From: sashiko-bot@kernel.org
To: "Shuai Liu" <847807867@qq.com>, linux-mtd@lists.infradead.org
Cc: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
syzbot+c66e7044aa73c620d862@syzkaller.appspotmail.com
Subject: Re: [PATCH] mtd: blktrans: keep reclaim out of the ->release paths
Date: Tue, 17 Nov 2026 05:40:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-218218@kernel.org> (raw)
In-Reply-To: <tencent_B9AEB406CBA2FC785312AE8158D20489FB06@qq.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mtd: blktrans: missing Fixes trailer for reclaim deadlock in
release paths
--
commit 232393974881d584472bbb349c3d7552980a5ca0
Author: Shuai Liu <847807867@qq.com>
> mtd: blktrans: keep reclaim out of the ->release paths
>
> blktrans_release() invokes tr->release() while holding dev->lock, and
> translators can walk down into the flash driver from there:
> mtdblock_release() flushes its write cache via write_cached_data() ->
> erase_write() -> mtd_erase(), and concat_erase() allocates a struct
> erase_info with GFP_KERNEL. del_mtd_blktrans_dev() calls ->release()
> under the same lock on the device removal path.
>
> Reclaim from those allocations can recurse back into the same block
> queue and deadlock. lockdep reports the full cycle when a write to the
> concat device is flushed at last close:
>
> init/1 is trying to acquire lock:
> fs_reclaim, at: __kmalloc_cache_noprof
> but task is already holding lock:
> &mtdblk->cache_mutex, at: mtdblock_release
>
> Chain exists of:
> fs_reclaim --> &new->lock --> &mtdblk->cache_mutex
>
> the existing dependency chain (in reverse order) is:
> fs_reclaim -> q_usage_counter(io) -> elevator_lock
> -> set->srcu -> new->lock -> mtdblk->cache_mutex
>
> Call Trace:
> concat_erase
> mtd_erase
> erase_write
> write_cached_data
> mtdblock_release
> blktrans_release
> bdev_release
>
> The io path is already protected: mtd_queue_rq() disables reclaim
> across dispatch with memalloc_noio_save(), because translators may
> allocate while processing requests under dev->lock and the srcu read
> side. ->release() runs under the same locks, so give it the same
> treatment in blktrans_release() and del_mtd_blktrans_dev().
>
> Verified with mtdram + block2mtd + concat + mtdblock on QEMU
> (CONFIG_PROVE_LOCKING): writing through /dev/mtdblockN and closing
> the fd produces the warning above on the unpatched kernel and stays
> silent with this patch, with the readback still succeeding.
>
> Reported-by: syzbot+c66e7044aa73c620d862@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=c66e7044aa73c620d862
> Signed-off-by: Shuai Liu <847807867@qq.com>
[Severity: Low]
This fixes a reclaim recursion deadlock when ->release() is called under
the per-device mutex introduced by commit 048d87199566 ("mtd: blktrans:
Hotplug fixes"). Should the commit message include a Fixes tag for stable
backporting:
Fixes: 048d87199566 ("mtd: blktrans: Hotplug fixes")
--
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_B9AEB406CBA2FC785312AE8158D20489FB06@qq.com?part=1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2026-11-17 5:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 16:01 [syzbot] [mtd?] possible deadlock in blktrans_release syzbot
2026-11-16 16:01 ` syzbot
2026-11-17 5:28 ` [PATCH] mtd: blktrans: keep reclaim out of the ->release paths Shuai Liu
2026-11-17 5:28 ` Shuai Liu
2026-11-17 5:40 ` sashiko-bot [this message]
2026-11-17 6:08 ` [PATCH v2] " Shuai Liu
2026-11-17 6:08 ` Shuai Liu
2026-11-17 6:53 ` sashiko-bot
2026-11-17 8:40 ` Shuai Liu
2026-11-17 8:40 ` Shuai Liu
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=sashiko-outbox-218218@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=847807867@qq.com \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=sashiko-reviews@lists.linux.dev \
--cc=syzbot+c66e7044aa73c620d862@syzkaller.appspotmail.com \
--cc=vigneshr@ti.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.