From d425320ac818abcf874bcaaba40a48546201f9aa Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Fri, 16 Dec 2016 12:41:56 -0800 Subject: [PATCH] Fix fchange in zpl_ioctl_setflags The fchange in zpl_ioctl_setflags was for detecting flag change. However it was incorrect and would always fail to detect a flag change from set to unset, causing users without CAP_LINUX_IMMUTABLE to be able to unset flags. Signed-off-by: Chunwei Chen --- module/zfs/zpl_file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c index b22ec046e3..a853754b1c 100644 --- a/module/zfs/zpl_file.c +++ b/module/zfs/zpl_file.c @@ -736,8 +736,7 @@ zpl_ioctl_getflags(struct file *filp, void __user *arg) * is outside of our jurisdiction. */ -#define fchange(f0, f1, b0, b1) ((((f0) & (b0)) == (b0)) != \ - (((b1) & (f1)) == (f1))) +#define fchange(f0, f1, b0, b1) (!((f0) & (b0)) != !((f1) & (b1))) static int zpl_ioctl_setflags(struct file *filp, void __user *arg)