]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
GFS2: Require user to provide argument for FITRIM
authorLukas Czerner <lczerner@redhat.com>
Tue, 16 Oct 2012 09:39:07 +0000 (11:39 +0200)
committerSteven Whitehouse <swhiteho@redhat.com>
Wed, 7 Nov 2012 09:41:37 +0000 (09:41 +0000)
When the fstrim_range argument is not provided by user in FITRIM ioctl
we should just return EFAULT and not promoting bad behaviour by filling
the structure in kernel. Let the user deal with it.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/rgrp.c

index 43d1a20bdbe4a8e9756ee578da0e020e5c8270a1..b6bbf718d6c390438ad04f6ecd6ed81773296a2b 100644 (file)
@@ -1270,11 +1270,7 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
        if (!blk_queue_discard(q))
                return -EOPNOTSUPP;
 
-       if (argp == NULL) {
-               r.start = 0;
-               r.len = ULLONG_MAX;
-               r.minlen = 0;
-       } else if (copy_from_user(&r, argp, sizeof(r)))
+       if (copy_from_user(&r, argp, sizeof(r)))
                return -EFAULT;
 
        ret = gfs2_rindex_update(sdp);
@@ -1323,7 +1319,7 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
 
 out:
        r.len = trimmed << 9;
-       if (argp && copy_to_user(argp, &r, sizeof(r)))
+       if (copy_to_user(argp, &r, sizeof(r)))
                return -EFAULT;
 
        return ret;