From e8782e2fbcb5c1c8823a733a985a2896a1450334 Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Fri, 4 Jul 2014 20:28:44 +0200 Subject: 9p: kerneldoc warning fixes options argument was removed from v9fs_session_info in commit 4b53e4b50077 ("9p: remove unnecessary v9fses->options which duplicates the mount string") iov and nr_segs were removed from v9fs_direct_IO in commit d8d3d94b80aa ("pass iov_iter to ->direct_IO()") Cc: Eric Van Hensbergen Cc: Ron Minnich Cc: Latchesar Ionkov Cc: v9fs-developer@lists.sourceforge.net Signed-off-by: Fabian Frederick Signed-off-by: Dominique Martinet Signed-off-by: Eric Van Hensbergen --- fs/9p/v9fs.h | 1 - fs/9p/vfs_addr.c | 2 -- 2 files changed, 3 deletions(-) (limited to 'fs/9p') diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index 099c7712631c..fb9ffcb43277 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h @@ -78,7 +78,6 @@ enum p9_cache_modes { * @cache: cache mode of type &p9_cache_modes * @cachetag: the tag of the cache associated with this session * @fscache: session cookie associated with FS-Cache - * @options: copy of options string given by user * @uname: string user name to mount hierarchy as * @aname: mount specifier for remote hierarchy * @maxdata: maximum data to be sent/recvd per protocol message diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index eb14e055ea83..3672b16feac6 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -243,9 +243,7 @@ static int v9fs_launder_page(struct page *page) * v9fs_direct_IO - 9P address space operation for direct I/O * @rw: direction (read or write) * @iocb: target I/O control block - * @iov: array of vectors that define I/O buffer * @pos: offset in file to begin the operation - * @nr_segs: size of iovec array * * The presence of v9fs_direct_IO() in the address space ops vector * allowes open() O_DIRECT flags which would have failed otherwise. -- cgit v1.2.3 From ad80492df56b4bd2d4da9990678d87b66af42f54 Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov" Date: Mon, 29 Dec 2014 15:00:18 +0200 Subject: 9p: fix error handling in v9fs_file_do_lock p9_client_lock_dotl() doesn't set status if p9_client_rpc() fails. It can lead to 'default:' case in switch below and kernel crashes. Let's bypass the switch if p9_client_lock_dotl() fails. Signed-off-by: Kirill A. Shutemov Signed-off-by: Dominique Martinet Signed-off-by: Eric Van Hensbergen --- fs/9p/vfs_file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/9p') diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index b40133796b87..8d29e1e03dfa 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -194,7 +194,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) for (;;) { res = p9_client_lock_dotl(fid, &flock, &status); if (res < 0) - break; + goto out_unlock; if (status != P9_LOCK_BLOCKED) break; @@ -220,6 +220,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) BUG(); } +out_unlock: /* * incase server returned error for lock request, revert * it locally -- cgit v1.2.3 From b642f7269bd40ae9abe9cff01581b2eb5e2c2287 Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov" Date: Mon, 29 Dec 2014 15:00:19 +0200 Subject: 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 --- fs/9p/vfs_file.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'fs/9p') 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) 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: -- cgit v1.2.3 From 5c4086b8de6989f10ae814f5746604fc44a02a21 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 9 Jan 2015 12:56:07 +0100 Subject: fs/9p: Initialize status in v9fs_file_do_lock. If p9_client_lock_dotl returns an error, status is possibly never filled but will be used in the following switch. Initializing it to P9_LOCK_ERROR makes sur we will return an error and cleanup (and not hit the default case). Signed-off-by: Dominique Martinet Signed-off-by: Eric Van Hensbergen --- fs/9p/vfs_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/9p') diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 9612e5fc0ae2..bdb103f73e34 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -149,7 +149,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) { struct p9_flock flock; struct p9_fid *fid; - uint8_t status; + uint8_t status = P9_LOCK_ERROR; int res = 0; unsigned char fl_type; -- cgit v1.2.3