[<prev] [next>] [day] [month] [year] [list]
Message-ID: <48808863-2c1e-34bf-5968-8bb88052b556@gmail.com>
Date: Mon, 13 Aug 2018 11:32:39 +0800
From: Jia-Ju Bai <baijiaju1990@...il.com>
To: dhowells@...hat.com
Cc: linux-afs@...ts.infradead.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [BUG] fs: jffs2: possible sleep-in-atomic-context bugs in jffs2_iget
The kernel may sleep with holding a spinlock.
The function call paths (from bottom to top) in Linux-4.16 are:
[FUNC] schedule
fs/inode.c, 1916: schedule in __wait_on_freeing_inode
fs/inode.c, 826: __wait_on_freeing_inode in find_inode_fast
fs/inode.c, 1107: find_inode_fast in iget_locked
fs/jffs2/fs.c, 263: iget_locked in jffs2_iget
fs/jffs2/fs.c, 665: jffs2_iget in jffs2_gc_fetch_inode
fs/jffs2/wbuf.c, 505: jffs2_gc_fetch_inode in jffs2_wbuf_recover
fs/jffs2/wbuf.c, 462: spin_lock in jffs2_wbuf_recover
[FUNC] mutex_lock_nested
fs/jffs2/fs.c, 273: mutex_lock_nested in jffs2_iget
fs/jffs2/fs.c, 665: jffs2_iget in jffs2_gc_fetch_inode
fs/jffs2/wbuf.c, 505: jffs2_gc_fetch_inode in jffs2_wbuf_recover
fs/jffs2/wbuf.c, 462: spin_lock in jffs2_wbuf_recover
I do not find a good way to fix, so I only report.
Maybe the spinlock should be released before calling jffs2_iget(), and
then be acquired again.
This is found by my static analysis tool (DSAC).
Thanks,
Jia-Ju Bai
Powered by blists - more mailing lists