]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
orangefs: handle zero size write in debugfs
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 14 Apr 2017 19:11:53 +0000 (22:11 +0300)
committerMike Marshall <hubcap@omnibond.com>
Wed, 26 Apr 2017 18:33:01 +0000 (14:33 -0400)
If we write zero bytes to this debugfs file, then it will cause an
underflow when we do copy_from_user(buf, ubuf, count - 1).  Debugfs can
normally only be written to by root so the impact of this is low.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
fs/orangefs/orangefs-debugfs.c

index 791912da97d7487d99c618ce8ac6f5fbe3cd11fb..716ed337f1663ddfaf0729c5d8275b0366308f19 100644 (file)
@@ -440,6 +440,9 @@ static ssize_t orangefs_debug_write(struct file *file,
                "orangefs_debug_write: %pD\n",
                file);
 
+       if (count == 0)
+               return 0;
+
        /*
         * Thwart users who try to jamb a ridiculous number
         * of bytes into the debug file...