From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Eric Van Hensbergen <ericvh@gmail.com>,
Ron Minnich <rminnich@sandia.gov>,
Latchesar Ionkov <lucho@ionkov.net>
Cc: v9fs-developer@lists.sourceforge.net,
linux-fsdevel@vger.kernel.org,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: [PATCH 1/2] 9p: fix error handling in v9fs_file_do_lock
Date: Mon, 29 Dec 2014 15:00:18 +0200 [thread overview]
Message-ID: <1419858019-116944-1-git-send-email-kirill.shutemov@linux.intel.com> (raw)
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>
---
fs/9p/vfs_file.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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
--
2.1.4
next reply other threads:[~2014-12-29 13:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-29 13:00 Kirill A. Shutemov [this message]
2014-12-29 13:00 ` [PATCH 2/2] 9p: do not crash on unknown lock status code Kirill A. Shutemov
2015-01-06 12:14 ` [V9fs-developer] " Dominique Martinet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1419858019-116944-1-git-send-email-kirill.shutemov@linux.intel.com \
--to=kirill.shutemov@linux.intel.com \
--cc=ericvh@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=lucho@ionkov.net \
--cc=rminnich@sandia.gov \
--cc=v9fs-developer@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).