OSDN Git Service

ima: Use i_version only when filesystem supports it
authorSascha Hauer <s.hauer@pengutronix.de>
Mon, 11 Dec 2017 11:35:20 +0000 (06:35 -0500)
committerJeff Layton <jlayton@redhat.com>
Wed, 13 Dec 2017 12:23:02 +0000 (07:23 -0500)
commitac0bf025d2c0e88097f0ab247e7460053fef7e9d
tree62295db61ea3697a038a552d92d029d2a616f66d
parent50c4c4e268a2d7a3e58ebb698ac74da0de40ae36
ima: Use i_version only when filesystem supports it

i_version is only supported by a filesystem when the SB_I_VERSION
flag is set. This patch tests for the SB_I_VERSION flag before using
i_version. If we can't use i_version to detect a file change then we
must assume the file has changed in the last_writer path and remeasure
it.

On filesystems without i_version support IMA used to measure a file
only once and didn't detect any changes to a file. With this patch
IMA now works properly on these filesystems.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
security/integrity/ima/ima_main.c