aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2014-12-29 08:00:19 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2015-03-20 10:34:41 -0400
commitb642f7269bd40ae9abe9cff01581b2eb5e2c2287 (patch)
tree40f638e64883cb5224c1c2c0a6a3c34579c9f737 /fs/9p
parentad80492df56b4bd2d4da9990678d87b66af42f54 (diff)
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 <kirill.shutemov@linux.intel.com> Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p')
-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 8d29e1e03dfa..9612e5fc0ae2 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)
212 case P9_LOCK_BLOCKED: 212 case P9_LOCK_BLOCKED:
213 res = -EAGAIN; 213 res = -EAGAIN;
214 break; 214 break;
215 default:
216 WARN_ONCE(1, "unknown lock status code: %d\n", status);
217 /* fallthough */
215 case P9_LOCK_ERROR: 218 case P9_LOCK_ERROR:
216 case P9_LOCK_GRACE: 219 case P9_LOCK_GRACE:
217 res = -ENOLCK; 220 res = -ENOLCK;
218 break; 221 break;
219 default:
220 BUG();
221 } 222 }
222 223
223out_unlock: 224out_unlock: