summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@gmx.com>2018-05-30 16:47:06 +0800
committerIlya Dryomov <idryomov@gmail.com>2018-06-04 20:46:01 +0200
commit8db0c7596f1258b28f32a38f2d5bbc0d63c104c9 (patch)
tree5849eca70bc449a8514d5eb6ad6aecf8547373a9
parentc36ed50de2ad1649ce0369a4a6fc2cc11b20dfb7 (diff)
downloadlinux-8db0c7596f1258b28f32a38f2d5bbc0d63c104c9.tar.bz2
ceph: strengthen rsize/wsize/readdir_max_bytes validation
The check (intval < PAGE_SIZE) will involve type cast, so even when specifying negative value to rsize/wsize/readdir_max_bytes, it will pass the validation check successfully. Signed-off-by: Chengguang Xu <cgxu519@gmx.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--fs/ceph/super.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index b4ff1392e333..cec1d3343742 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -259,12 +259,12 @@ static int parse_fsopt_token(char *c, void *private)
break;
/* misc */
case Opt_wsize:
- if (intval < PAGE_SIZE || intval > CEPH_MAX_WRITE_SIZE)
+ if (intval < (int)PAGE_SIZE || intval > CEPH_MAX_WRITE_SIZE)
return -EINVAL;
fsopt->wsize = ALIGN(intval, PAGE_SIZE);
break;
case Opt_rsize:
- if (intval < PAGE_SIZE || intval > CEPH_MAX_READ_SIZE)
+ if (intval < (int)PAGE_SIZE || intval > CEPH_MAX_READ_SIZE)
return -EINVAL;
fsopt->rsize = ALIGN(intval, PAGE_SIZE);
break;
@@ -289,7 +289,7 @@ static int parse_fsopt_token(char *c, void *private)
fsopt->max_readdir = intval;
break;
case Opt_readdir_max_bytes:
- if (intval < PAGE_SIZE && intval != 0)
+ if (intval < (int)PAGE_SIZE && intval != 0)
return -EINVAL;
fsopt->max_readdir_bytes = intval;
break;