Re: [PATCH] fs: jffs2: fix possible sleep-in-atomic-context bugs
From: Al Viro
Date: Thu Dec 26 2019 - 17:50:12 EST
On Tue, Dec 17, 2019 at 09:51:43PM +0800, Jia-Ju Bai wrote:
> The filesystem may sleep while holding a spinlock.
> The function call path (from bottom to top) in Linux 4.19 is:
>
> fs/jffs2/malloc.c, 188:
> kmem_cache_alloc(GFP_KERNEL) in jffs2_alloc_refblock
> fs/jffs2/malloc.c, 221:
> jffs2_alloc_refblock in jffs2_prealloc_raw_node_refs
... gets called only if jeb->last_node is NULL. I've no idea
whether it is possible on those call chains and analysis is
certainly needed before applying that kind of patches.
It might very well be real, and certainly worth asking jffs2
folks to look into. But this kind of "defensive" fixes
is no good without understanding of the situation in the
code being (hopefully) fixed.
It's a good catch; even if there is a reason why we never
hit the blocking allocation in there, that reason should be
spelled out in the code. It isn't, and that can easily
grow into a bug even if it hasn't done so already.