From: linmiaohe <linmiaohe@huawei.com>
To: Satya Tangirala <satyat@google.com>, Eric Biggers <ebiggers@kernel.org>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
Jens Axboe <axboe@kernel.dk>,
"dm-devel@redhat.com" <dm-devel@redhat.com>
Subject: Re: [PATCH] block: make bio_crypt_clone() return an error code
Date: Wed, 2 Sep 2020 06:34:16 +0000 [thread overview]
Message-ID: <b90bb41c7755452eb6f3fb3116ff9d6d@huawei.com> (raw)
Satya Tangirala <satyat@google.com> wrote:
>On Tue, Sep 01, 2020 at 10:15:11PM -0700, Eric Biggers wrote:
>> From: Eric Biggers <ebiggers@google.com>
>>
>> Callers of bio_clone_fast() may use a gfp_mask that excludes
>> GFP_DIRECT_RECLAIM. For example, map_request() uses GFP_ATOMIC.
>>
>> If this were to happen, the mempool_alloc() in __bio_crypt_clone() can
>> fail, causing a NULL dereference.
>The call to blk_crypto_rq_bio_prep() from blk_rq_prep_clone() could also fail for the same reason. So we may need to make blk_crypto_rq_bio_prep() also return a bool and handle the errors in the callers (the only other caller is I think blk_mq_bio_to_request(), which explicitly calls the function with GFP_NOIO, so maybe we could explicitly document the fact that blk_mq_bio_to_request will return true when called with a gfp_mask th
at includes GFP_DIRECT_RECLAIM, and ignore the return value in blk_mq_bio_to_request()). (And maybe we should document the same for bio_crypt_set_ctx and bio_crypt_clone?)
Agreed.
Except for above suggestions, the patch looks good for me, many thanks.
>>
>> In reality map_request() currently never has to clone an encryption
next reply other threads:[~2020-09-02 6:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-02 6:34 linmiaohe [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-09-02 5:15 [PATCH] block: make bio_crypt_clone() return an error code Eric Biggers
2020-09-02 6:25 ` Satya Tangirala
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=b90bb41c7755452eb6f3fb3116ff9d6d@huawei.com \
--to=linmiaohe@huawei.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@redhat.com \
--cc=ebiggers@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=satyat@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).