Re: [PATCH 5.17 000/772] 5.17.14-rc1 review

From: Pavel Machek
Date: Sat Jun 18 2022 - 06:49:36 EST


Hi!
> > >
> > > This is the start of the stable review cycle for the 5.17.14 release.
> > > There are 772 patches in this series, all will be posted as a response
> > > to this one. If anyone has any issues with these being applied, please
> > > let me know.
> > >
> > > Responses should be made by Thu, 09 Jun 2022 16:48:02 +0000.
> > > Anything received after that time might be too late.
> > >
> > > The whole patch series can be found in one patch at:
> > > https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.17.14-rc1.gz
> > > or in the git tree and branch at:
> > > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.17.y
> > > and the diffstat can be found below.
> > >
...
> > We will bisect and let you know more details about this reported problem.
>
> The bisect script pointed me to this commit and reverted and tested and
> confirmed.

Can you add some printks into that? Because I'm pretty sure this patch
does not break anything. (It should not fix much, either.)

> commit 1883088ed4a0d5cc9cea500ca4e89a354ab32c11
> Author: Jia-Ju Bai <baijiaju1990@xxxxxxxxx>

> md: bcache: check the return value of kzalloc() in detached_dev_do_request()
>
> commit 40f567bbb3b0639d2ec7d1c6ad4b1b018f80cf19 upstream.
>
> The function kzalloc() in detached_dev_do_request() can fail, so its
> return value should be checked.
>
> Fixes: bc082a55d25c ("bcache: fix inaccurate io state for detached
...

> +++ b/drivers/md/bcache/request.c
> @@ -1107,6 +1107,12 @@ static void detached_dev_do_request(struct
> bcache_device *d, struct bio *bio,
> * which would call closure_get(&dc->disk.cl)
> */
> ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
> + if (!ddip) {
> + bio->bi_status = BLK_STS_RESOURCE;
> + bio->bi_end_io(bio);
> + return;
> + }
> +
> ddip->d = d;
> /* Count on the bcache device */
> ddip->orig_bdev = orig_bdev;
>

So... for patch to make any difference, memory allocation has to fail
and ddip has to be NULL.

Before the patch, it would oops in "ddip->d = d;". With the patch, you
do some kind of error handling. Even if it is buggy, it should not do
more harm than immediate oops.

Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: PGP signature