[Devel] [PATCH vz7 vz7.29.6-mfuse] fuse: ioctl(FUSE_DEV_IOC_SETAFF): add cpu_possible check

Maxim Patlasov mpatlasov at virtuozzo.com
Wed Mar 29 14:06:28 PDT 2017


It's not enough to check that arg < num_online_cpus() because
cpu mask may be not contiguous. Thanks to AK for pointing out.

https://jira.sw.ru/browse/PSBM-60210

Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 fs/fuse/dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 8dd5154..216093d 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -2273,7 +2273,7 @@ static long fuse_dev_ioctl(struct file *file, unsigned int cmd,
 			}
 		}
 	} else if (cmd == FUSE_DEV_IOC_SETAFF) {
-		if (arg >= num_online_cpus()) {
+		if (arg >= NR_CPUS || !cpu_possible(arg)) {
 			err = -EINVAL;
 		} else {
 			struct fuse_dev *fud = fuse_get_dev(file);



More information about the Devel mailing list