From: Jia-Ju Bai <baijiaju1990@163.com>
To: viro@zeniv.linux.org.uk, dhowells@redhat.com
Cc: linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [BUG] fs/afs/flock: possible sleep-in-atomic bugs in afs_do_setlk
Date: Sat, 7 Oct 2017 18:11:01 +0800 [thread overview]
Message-ID: <8aff89e4-e880-7e97-8b29-37822f4d2e02@163.com> (raw)
According to fs/afs/flock.c, the kernel may sleep under a spinlock,
and the function call paths are:
afs_do_setlk (acquire the spinlock: inode->i_lock)
afs_vnode_fetch_status
schedule --> may sleep
afs_do_setlk (acquire the spinlock: inode->i_lock)
wait_event_interruptible --> may sleep
These bugs may be introduced by only considering "vnode->lock" but
ignoring "inode->i_lock".
A possible fix is to unlock "inode->i_lock" before calling
afs_vnode_fetch_status and wait_event_interruptible, and lock
"inode->i_lock" again after them.
These bugs are found by my static analysis tool and my code review.
Thanks,
Jia-Ju Bai
reply other threads:[~2017-10-07 10:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=8aff89e4-e880-7e97-8b29-37822f4d2e02@163.com \
--to=baijiaju1990@163.com \
--cc=dhowells@redhat.com \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®