SELinux: properly handle empty tty_files list
authorEric Paris <eparis@redhat.com>
Fri, 31 Oct 2008 21:40:00 +0000 (17:40 -0400)
committerJames Morris <jmorris@namei.org>
Fri, 31 Oct 2008 22:38:48 +0000 (09:38 +1100)
commit37dd0bd04a3240d2922786d501e2f12cec858fbf
treed4fa5a124a95d33bf22276429a82822ec8d4810a
parent721d5dfe7e516954c501d5e9d0dfab379cf4241a
SELinux: properly handle empty tty_files list

SELinux has wrongly (since 2004) had an incorrect test for an empty
tty->tty_files list.  With an empty list selinux would be pointing to part
of the tty struct itself and would then proceed to dereference that value
and again dereference that result.  An F10 change to plymouth on a ppc64
system is actually currently triggering this bug.  This patch uses
list_empty() to handle empty lists rather than looking at a meaningless
location.

[note, this fixes the oops reported in
https://bugzilla.redhat.com/show_bug.cgi?id=469079]

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
security/selinux/hooks.c