From: Eric Biggers <ebiggers@kernel.org>
To: Laveesh Bansal <laveeshb@laveeshbansal.com>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
"Theodore Y. Ts'o" <tytso@mit.edu>,
Jaegeuk Kim <jaegeuk@kernel.org>,
syzbot+20d60aafd9a0d1f2a380@syzkaller.appspotmail.com,
linux-block@vger.kernel.org, linux-fscrypt@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] blk-crypto: use a NOIO scope while holding profile->lock
Date: Tue, 24 Nov 2026 17:44:54 -0800 [thread overview]
Message-ID: <20261125014454.GA2461@sol> (raw)
In-Reply-To: <20261123181408.62972-1-laveeshb@laveeshbansal.com>
On Mon, Nov 23, 2026 at 10:14:08AM -0800, Laveesh Bansal wrote:
> setkey allocates with GFP_KERNEL (Adiantum)
We should just fix that one:
https://lore.kernel.org/linux-crypto/20261125013553.94480-1-ebiggers@kernel.org/
We should still proceed with this patch, but there is really no need for
the crypto code to allocate memory in random places. I've been working
on getting rid of cases like this.
> Fixes: 488f6682c832 ("block: blk-crypto-fallback for Inline Encryption")
> Cc: stable@vger.kernel.org # v7.3+
The v7.3+ should not be there.
> @@ -53,11 +54,14 @@ static inline void blk_crypto_hw_enter(struct blk_crypto_profile *profile)
> if (profile->dev)
> pm_runtime_get_sync(profile->dev);
> down_write(&profile->lock);
> + /* Reclaim evicts keys under this lock; don't recurse into the fs. */
> + profile->memflags = memalloc_noio_save();
> }
"don't recurse into the fs" describes memalloc_nofs_save(), but the code
actually uses memalloc_noio_save(). The code is right, so a better
comment might be:
/* Avoid recursing into I/O or fs reclaim while holding profile->lock */
> static inline void blk_crypto_hw_exit(struct blk_crypto_profile *profile)
> __releases(&profile->lock)
> {
> + memalloc_noio_restore(profile->memflags);
Storing the flags in blk_crypto_profile isn't necessary. It should just
be a stack variable, returned by blk_crypto_hw_enter() and consumed by
blk_crypto_hw_exit().
- Eric
prev parent reply other threads:[~2026-11-25 1:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 18:14 [PATCH v2] blk-crypto: use a NOIO scope while holding profile->lock Laveesh Bansal
2026-11-25 1:44 ` Eric Biggers [this message]
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=20261125014454.GA2461@sol \
--to=ebiggers@kernel.org \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=jaegeuk@kernel.org \
--cc=laveeshb@laveeshbansal.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fscrypt@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+20d60aafd9a0d1f2a380@syzkaller.appspotmail.com \
--cc=tytso@mit.edu \
/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