summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2014-12-29 15:00:19 +0200
committerDominique Martinet <dominique.martinet@cea.fr>2015-03-13 18:08:02 +0100
commitbded7e047719747b318140e9d8c0cd2da5230bcf (patch)
tree5edb0bf5685de97cee9e5a6195f768ab0eb1eef6
parent867e2feb014b1fb72129847cbc432e761fa18c5b (diff)
9p: do not crash on unknown lock status code
Current 9p implementation will crash whole system if sees unkown lock status code. It's trivial target for DOS: 9p server can produce such code easily. Let's fallback more gracefully: warning in dmesg + -ENOLCK. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
-rw-r--r--fs/9p/vfs_file.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 8d29e1e03df..0db033e698e 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -212,12 +212,13 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
case P9_LOCK_BLOCKED:
res = -EAGAIN;
break;
+ default:
+ WARN_ONCE(1, "unknown lock status clode: %d\n", status);
+ /* fallthough */
case P9_LOCK_ERROR:
case P9_LOCK_GRACE:
res = -ENOLCK;
break;
- default:
- BUG();
}
out_unlock: