summaryrefslogtreecommitdiffstats
path: root/fs/ncpfs
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-11-20 15:56:56 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-20 16:17:32 -0800
commit1491e30ed1a741009d1d38f9285f7a29e6c05c78 (patch)
tree6a1282ea4dd9ae029ce8cb79092e89fca4dcc2ec /fs/ncpfs
parent5cf6a51e6062afe7cc507f32f1e5f7e6497ae844 (diff)
downloadlinux-1491e30ed1a741009d1d38f9285f7a29e6c05c78.tar.gz
linux-1491e30ed1a741009d1d38f9285f7a29e6c05c78.tar.bz2
linux-1491e30ed1a741009d1d38f9285f7a29e6c05c78.zip
ncpfs: don't allow negative timeouts
This code causes a static checker warning because it's a user controlled variable where we cap the upper bound but not the lower bound. Let's return an -EINVAL for negative timeouts. [akpm@linux-foundation.org: remove unneeded `else'] Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Jan Kara <jack@suse.com> Cc: Petr Vandrovec <petr@vandrovec.name> Cc: David Howells <dhowells@redhat.com> Cc: Jan Kara <jack@suse.cz> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ncpfs')
-rw-r--r--fs/ncpfs/ioctl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index 79b113048eac..0a3f9b594602 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -525,6 +525,8 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
switch (rqdata.cmd) {
case NCP_LOCK_EX:
case NCP_LOCK_SH:
+ if (rqdata.timeout < 0)
+ return -EINVAL;
if (rqdata.timeout == 0)
rqdata.timeout = NCP_LOCK_DEFAULT_TIMEOUT;
else if (rqdata.timeout > NCP_LOCK_MAX_TIMEOUT)