]> git.karo-electronics.de Git - karo-tx-linux.git/commit
lib/list_sort: do not pass bad pointers to cmp callback
authorDon Mullis <don.mullis@gmail.com>
Thu, 30 Sep 2010 22:15:32 +0000 (15:15 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 29 Oct 2010 04:51:09 +0000 (21:51 -0700)
commita7b048db83992dba877da7b85d8b1236324f9763
treec3c0499d7925462e2efb4dfdfdb689df951e4d9c
parent51793adc68ef938da175436919ab0db1c379eb18
lib/list_sort: do not pass bad pointers to cmp callback

commit f015ac3edd84ad72f88e08a4d83c56c360aae404 upstream.

If the original list is a POT in length, the first callback from line 73
will pass a==b both pointing to the original list_head.  This is dangerous
because the 'list_sort()' user can use 'container_of()' and accesses the
"containing" object, which does not necessary exist for the list head.  So
the user can access RAM which does not belong to him.  If this is a write
access, we can end up with memory corruption.

Signed-off-by: Don Mullis <don.mullis@gmail.com>
Tested-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
lib/list_sort.c