Repository navigation
Commit 8d25879
cgroups: if you list_empty() a head then don't list_del() it
list_del() leaves poison in the prev and next pointers. The next
list_empty() will compare those poisons, and say the list isn't empty.
Any list operations that assume the node is on a list because of such a
check will be fooled into dereferencing poison. One needs to INIT the
node after the del, and fortunately there's already a wrapper for that -
list_del_init().
Some of the dels are followed by deallocations, so can be ignored, and one
can be merged with an add to make a move. Apart from that, I erred on the
side of caution in making nodes list_empty()-queriable.
Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Reviewed-by: Paul Menage <menage@google.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Kirill A. Shutemov <kirill@shutemov.name>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>1 parent edd4554 commit 8d25879
1 file changed
Lines changed: 6 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1813 | 1813 | | |
1814 | 1814 | | |
1815 | 1815 | | |
1816 | | - | |
1817 | | - | |
1818 | | - | |
1819 | | - | |
| 1816 | + | |
| 1817 | + | |
1820 | 1818 | | |
1821 | 1819 | | |
1822 | 1820 | | |
| |||
3655 | 3653 | | |
3656 | 3654 | | |
3657 | 3655 | | |
3658 | | - | |
| 3656 | + | |
3659 | 3657 | | |
3660 | 3658 | | |
3661 | 3659 | | |
3662 | 3660 | | |
3663 | | - | |
| 3661 | + | |
3664 | 3662 | | |
3665 | 3663 | | |
3666 | 3664 | | |
| |||
3879 | 3877 | | |
3880 | 3878 | | |
3881 | 3879 | | |
3882 | | - | |
| 3880 | + | |
3883 | 3881 | | |
3884 | 3882 | | |
3885 | 3883 | | |
| |||
4241 | 4239 | | |
4242 | 4240 | | |
4243 | 4241 | | |
4244 | | - | |
| 4242 | + | |
4245 | 4243 | | |
4246 | 4244 | | |
4247 | 4245 | | |
| |||
0 commit comments