diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-04-14 22:11:53 +0300 |
---|---|---|
committer | Mike Marshall <hubcap@omnibond.com> | 2017-04-26 14:33:01 -0400 |
commit | 907bfcd8d8a616ca794ba187f6bf1b0e12b3a8dd (patch) | |
tree | 482e24eb60a07687094903cf17af88645f3a2fca /fs/orangefs/orangefs-debugfs.c | |
parent | b5a9d61eebdd0016ccb383b25a5c3d04977a6549 (diff) | |
download | talos-op-linux-907bfcd8d8a616ca794ba187f6bf1b0e12b3a8dd.tar.gz talos-op-linux-907bfcd8d8a616ca794ba187f6bf1b0e12b3a8dd.zip |
orangefs: handle zero size write in debugfs
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>
Diffstat (limited to 'fs/orangefs/orangefs-debugfs.c')
-rw-r--r-- | fs/orangefs/orangefs-debugfs.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c index 791912da97d7..716ed337f166 100644 --- a/fs/orangefs/orangefs-debugfs.c +++ b/fs/orangefs/orangefs-debugfs.c @@ -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... |