Smack: fix d_instantiate logic for sockfs and pipefs 52/104252/2
authorRafal Krypa <r.krypa@samsung.com>
Tue, 13 Dec 2016 01:44:53 +0000 (10:44 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 19 Dec 2016 06:14:09 +0000 (22:14 -0800)
commitef86ba27a5f3443c27e200199fa1bbbb9c4d6c10
tree2d656503e8d0c2988308780c3151c30ecf67d1c5
parent11e91b6133b6ed0606599d3e2ddb2b44818db49c
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: Id83469a5b29958ec7c2cdbafbbaa014276126351
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
Signed-off-by: jooseong lee <jooseong.lee@samsung.com>
security/smack/smack_lsm.c