aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/permission.c
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2014-10-06 16:32:52 -0400
committerZiyan <jaraidaniel@gmail.com>2016-03-11 01:10:40 +0100
commit0fa1cc273037d7cf8260d2827e863760fc2d2b55 (patch)
tree2b4aa87bd61dd6aec8bc960929f22debcf56e8e8 /security/keys/permission.c
parent7cdec5e77edf1c29251c076a75daa31051ffc86b (diff)
downloadkernel_samsung_tuna-0fa1cc273037d7cf8260d2827e863760fc2d2b55.zip
kernel_samsung_tuna-0fa1cc273037d7cf8260d2827e863760fc2d2b55.tar.gz
kernel_samsung_tuna-0fa1cc273037d7cf8260d2827e863760fc2d2b55.tar.bz2
selinux: fix inode security list corruption
commit 923190d32de4428afbea5e5773be86bea60a9925 upstream. sb_finish_set_opts() can race with inode_free_security() when initializing inode security structures for inodes created prior to initial policy load or by the filesystem during ->mount(). This appears to have always been a possible race, but commit 3dc91d4 ("SELinux: Fix possible NULL pointer dereference in selinux_inode_permission()") made it more evident by immediately reusing the unioned list/rcu element of the inode security structure for call_rcu() upon an inode_free_security(). But the underlying issue was already present before that commit as a possible use-after-free of isec. Shivnandan Kumar reported the list corruption and proposed a patch to split the list and rcu elements out of the union as separate fields of the inode_security_struct so that setting the rcu element would not affect the list element. However, this would merely hide the issue and not truly fix the code. This patch instead moves up the deletion of the list entry prior to dropping the sbsec->isec_lock initially. Then, if the inode is dropped subsequently, there will be no further references to the isec. Change-Id: Iac9264851e98933deabedaa9c4ead434669a07a8 Reported-by: Shivnandan Kumar <shivnandan.k@samsung.com> Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: Paul Moore <pmoore@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'security/keys/permission.c')
0 files changed, 0 insertions, 0 deletions