Re: [PATCH v4] block: bio-integrity: Fix null-ptr-deref in bio_integrity_map_user()

From: Jens Axboe

Date: Thu May 07 2026 - 03:51:30 EST


> diff --git a/block/bio-integrity.c b/block/bio-integrity.c
> index e54c6e06e1cb..766cc2d1d51c 100644
> --- a/block/bio-integrity.c
> +++ b/block/bio-integrity.c
> @@ -403,6 +403,23 @@ int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter)
> if (unlikely(ret < 0))
> goto free_bvec;
>
> + /* Handle partial pinning. This can happen when pin_user_pages_fast()
> + * returns fewer pages than requested
> + */

Please follow the multi-line comment style used in the code around you.

> + if (user_backed_iter(iter) && unlikely(ret != bytes)) {
> + if (0 < ret) {

And never do this, it's so much worse to read than if (ret > 0)

--
Jens Axboe