fuse: use READ_ONCE on congestion_threshold and max_background
authorKirill Tkhai <ktkhai@virtuozzo.com>
Mon, 27 Aug 2018 15:29:29 +0000 (18:29 +0300)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 28 Sep 2018 14:43:22 +0000 (16:43 +0200)
Since they are of unsigned int type, it's allowed to read them
unlocked during reporting to userspace. Let's underline this fact
with READ_ONCE() macroses.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/control.c

index 0b694655d988073d1bf33f5e2c2859260ac6be00..acc35819aae64b5c98de795ca1827a05a69c7a0e 100644 (file)
@@ -107,7 +107,7 @@ static ssize_t fuse_conn_max_background_read(struct file *file,
        if (!fc)
                return 0;
 
-       val = fc->max_background;
+       val = READ_ONCE(fc->max_background);
        fuse_conn_put(fc);
 
        return fuse_conn_limit_read(file, buf, len, ppos, val);
@@ -144,7 +144,7 @@ static ssize_t fuse_conn_congestion_threshold_read(struct file *file,
        if (!fc)
                return 0;
 
-       val = fc->congestion_threshold;
+       val = READ_ONCE(fc->congestion_threshold);
        fuse_conn_put(fc);
 
        return fuse_conn_limit_read(file, buf, len, ppos, val);