From: Kirill A. Shutemov Date: Mon, 29 Dec 2014 13:00:19 +0000 (+0200) Subject: 9p: do not crash on unknown lock status code X-Git-Tag: v4.14-rc1~5545^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b642f7269bd40ae9abe9cff01581b2eb5e2c2287;p=platform%2Fkernel%2Flinux-rpi.git 9p: do not crash on unknown lock status code Current 9p implementation will crash whole system if sees unknown 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 Signed-off-by: Dominique Martinet Signed-off-by: Eric Van Hensbergen --- diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 8d29e1e..9612e5f 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 code: %d\n", status); + /* fallthough */ case P9_LOCK_ERROR: case P9_LOCK_GRACE: res = -ENOLCK; break; - default: - BUG(); } out_unlock: