Smack: fix d_instantiate logic for sockfs and pipefs 50/104250/1
authorjooseong lee <jooseong.lee@samsung.com>
Tue, 13 Dec 2016 01:12:48 +0000 (10:12 +0900)
committerjooseong lee <jooseong.lee@samsung.com>
Tue, 13 Dec 2016 01:46:08 +0000 (10:46 +0900)
commit3ed68f5eb0dd1fc6e25aee2c64ad3630b62c997d
tree316c91bbd168cf0cb2095a1a8223a308f95a3cd9
parent2dfe6f4cef72e486b40a390e56b241c8c5f5dcae
Smack: fix d_instantiate logic for sockfs and pipefs

Since 4b936885a (v2.6.32) all inodes on sockfs and pipefs are disconnected.
It caused filesystem specific code in smack_d_instantiate to be skipped,
because all inodes on those pseudo filesystems were treated as root inodes.
As a result all sockfs inodes had the Smack label set to floor.

In most cases access checks for sockets use socket_smack data so the inode
label is not important. But there are special cases that were broken.
One example would be calling fcntl with F_SETOWN command on a socket fd.

Now smack_d_instantiate expects all pipefs and sockfs inodes to be
disconnected and has the logic in appropriate place.

Change-Id: I06e1977d30afe39f6758ea18245046d413fa46a4
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
[jooseong.lee: Backported from mainline]
Signed-off-by: jooseong lee <jooseong.lee@samsung.com>
security/smack/smack_lsm.c