From: Julia Lawall Date: Mon, 9 Jul 2012 07:27:14 +0000 (+0200) Subject: UBIFS: remove invalid reference to list iterator variable X-Git-Tag: v3.6-rc1~150^2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7074e5eb233343e4bad8c0a3f9e73167cf85a159;p=pandora-kernel.git UBIFS: remove invalid reference to list iterator variable If list_for_each_entry, etc complete a traversal of the list, the iterator variable ends up pointing to an address at an offset from the list head, and not a meaningful structure. Thus this value should not be used after the end of the iterator. Replace a field access from orphan by NULL in two places. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier c; expression E; iterator name list_for_each_entry; statement S; @@ list_for_each_entry(c,...) { ... when != break; when forall when strict } ... ( c = E | *c ) // Artem: fortunately, this did not cause any issues because we iterate the orphan list using the elements count, so we never dereferenced the corrupted pointer. This is why I do not send this patch to -stable. But otherwise - well spotted! Signed-off-by: Julia Lawall Signed-off-by: Artem Bityutskiy --- Reading git-diff-tree failed