summaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_file.c
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2014-12-29 15:00:18 +0200
committerDominique Martinet <dominique.martinet@cea.fr>2015-03-13 18:07:54 +0100
commit867e2feb014b1fb72129847cbc432e761fa18c5b (patch)
treef871f4fe87713b59ea49091d81a6f7df10cb9d13 /fs/9p/vfs_file.c
parent40ac1fe0ea51b94684107ed078bc18f0221676cc (diff)
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. [ 17.965643] ------------[ cut here ]------------ [ 17.965646] kernel BUG at /home/kas/git/public/linux-next/fs/9p/vfs_file.c:220! [ 17.965651] invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC [ 17.965657] Dumping ftrace buffer: [ 17.965690] (ftrace buffer empty) [ 17.965696] Modules linked in: [ 17.965699] CPU: 11 PID: 197 Comm: trinity-c22 Not tainted 3.19.0-rc1-next-20141226-00038-g0cd9dce957f9-dirty #379 [ 17.965700] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.7.5.1-0-g8936dbb-20141113_115728-nilsson.home.kraxel.org 04/01/2014 [ 17.965702] task: ffff880476e2bfc0 ti: ffff880476eac000 task.ti: ffff880476eac000 [ 17.965713] RIP: 0010:[<ffffffff8139cf98>] [<ffffffff8139cf98>] v9fs_file_do_lock+0x168/0x1b0 [ 17.965714] warning: process `trinity-c12' used the obsolete bdflush system call [ 17.965716] RSP: 0000:ffff880476eafea8 EFLAGS: 00010286 [ 17.965716] Fix your initscripts? [ 17.965718] RAX: 00000000000000ff RBX: 0000000000000006 RCX: 0000000000000001 [ 17.965720] RDX: ffff880476e2bfc0 RSI: 0000000000000000 RDI: ffffffff81e47c20 [ 17.965721] RBP: ffff880476eafef8 R08: 0000000000000035 R09: 0000000000000005 [ 17.965722] R10: 0000000000000000 R11: 0000000000000001 R12: ffff88047c081730 [ 17.965723] R13: ffff88047b920000 R14: ffff8800035de4c0 R15: 00007fd277f54690 [ 17.965724] FS: 00007fd277f54700(0000) GS:ffff880484600000(0000) knlGS:0000000000000000 [ 17.965725] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 17.965729] CR2: 00007fd277e4e044 CR3: 0000000476e6e000 CR4: 00000000001406e0 [ 17.965730] Stack: [ 17.965734] ffff8800035de4c0 0000000000000000 0000000000000000 0000000000000000 [ 17.965737] 00000000000000c5 ffff88047c708884 ffff88047b920000 ffff8800035de4c0 [ 17.965740] 0000000000000006 ffff88007ad68c98 ffff880476eaff38 ffffffff8139d0b6 [ 17.965742] Call Trace: [ 17.965749] [<ffffffff8139d0b6>] v9fs_file_flock_dotl+0xd6/0xf0 [ 17.965756] [<ffffffff81216133>] SyS_flock+0xf3/0x190 [ 17.965762] [<ffffffff818607a9>] ia32_do_call+0x13/0x13 [ 17.965812] Code: 41 5c 41 5d 41 5e 5d c3 0f 1f 00 c6 45 b8 02 e9 2a ff ff ff 0f 1f 80 00 00 00 00 c6 45 b8 01 e9 1a ff ff ff 0f 1f 80 00 00 00 00 <0f> 0b 66 0f 1f 44 00 00 0f b6 45 b7 3c 01 75 90 b8 f5 ff ff ff [ 17.965815] RIP [<ffffffff8139cf98>] v9fs_file_do_lock+0x168/0x1b0 [ 17.965816] RSP <ffff880476eafea8> [ 17.965824] ---[ end trace 1cfc767bf06625a1 ]--- Let's bypass the switch if p9_client_lock_dotl() fails. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Diffstat (limited to 'fs/9p/vfs_file.c')
-rw-r--r--fs/9p/vfs_file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index b40133796b8..8d29e1e03df 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