aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2012-10-16 05:39:07 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2012-11-07 04:41:37 -0500
commit3a238adefb8c5b8cb8cde0ce689d513306176ff4 (patch)
treece36637e3391d9437bc19773885aa0955941962a /fs/gfs2
parent73738a77f42c2d7f53fd61f73272c9dd6f520897 (diff)
GFS2: Require user to provide argument for FITRIM
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>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/rgrp.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 43d1a20bdbe4..b6bbf718d6c3 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1270,11 +1270,7 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
1270 if (!blk_queue_discard(q)) 1270 if (!blk_queue_discard(q))
1271 return -EOPNOTSUPP; 1271 return -EOPNOTSUPP;
1272 1272
1273 if (argp == NULL) { 1273 if (copy_from_user(&r, argp, sizeof(r)))
1274 r.start = 0;
1275 r.len = ULLONG_MAX;
1276 r.minlen = 0;
1277 } else if (copy_from_user(&r, argp, sizeof(r)))
1278 return -EFAULT; 1274 return -EFAULT;
1279 1275
1280 ret = gfs2_rindex_update(sdp); 1276 ret = gfs2_rindex_update(sdp);
@@ -1323,7 +1319,7 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
1323 1319
1324out: 1320out:
1325 r.len = trimmed << 9; 1321 r.len = trimmed << 9;
1326 if (argp && copy_to_user(argp, &r, sizeof(r))) 1322 if (copy_to_user(argp, &r, sizeof(r)))
1327 return -EFAULT; 1323 return -EFAULT;
1328 1324
1329 return ret; 1325 return ret;