Skip to content

Commit

Permalink
orangefs: handle zero size write in debugfs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Mike Marshall committed Apr 26, 2017
1 parent b5a9d61 commit 907bfcd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/orangefs/orangefs-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down

0 comments on commit 907bfcd

Please sign in to comment.