public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: fix merging data-less bios
@ 2025-11-11 14:06 Keith Busch
  2025-11-11 14:10 ` Christoph Hellwig
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Keith Busch @ 2025-11-11 14:06 UTC (permalink / raw)
  To: linux-block, axboe, hch; +Cc: yukuai, Keith Busch, Matthew Wilcox

From: Keith Busch <kbusch@kernel.org>

The data segment gaps the block layer tracks doesn't apply to bio's that
don't have data. Skip calculating this to fix a NULL pointer access.

Fixes: 2f6b2565d43cdb5 ("block: accumulate memory segment gaps per bio")
Reported-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 block/blk-merge.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/blk-merge.c b/block/blk-merge.c
index 3ca6fbf8b7870..d3115d7469df0 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -737,6 +737,9 @@ u8 bio_seg_gap(struct request_queue *q, struct bio *prev, struct bio *next,
 {
 	struct bio_vec pb, nb;
 
+	if (!bio_has_data(prev))
+		return 0;
+
 	gaps_bit = min_not_zero(gaps_bit, prev->bi_bvec_gap_bit);
 	gaps_bit = min_not_zero(gaps_bit, next->bi_bvec_gap_bit);
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] block: fix merging data-less bios
  2025-11-11 14:06 [PATCH] block: fix merging data-less bios Keith Busch
@ 2025-11-11 14:10 ` Christoph Hellwig
  2025-11-11 14:18 ` Yu Kuai
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2025-11-11 14:10 UTC (permalink / raw)
  To: Keith Busch; +Cc: linux-block, axboe, hch, yukuai, Keith Busch, Matthew Wilcox

On Tue, Nov 11, 2025 at 06:06:20AM -0800, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> The data segment gaps the block layer tracks doesn't apply to bio's that
> don't have data. Skip calculating this to fix a NULL pointer access.
> 
> Fixes: 2f6b2565d43cdb5 ("block: accumulate memory segment gaps per bio")
> Reported-by: Matthew Wilcox <willy@infradead.org>
> Signed-off-by: Keith Busch <kbusch@kernel.org>

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] block: fix merging data-less bios
  2025-11-11 14:06 [PATCH] block: fix merging data-less bios Keith Busch
  2025-11-11 14:10 ` Christoph Hellwig
@ 2025-11-11 14:18 ` Yu Kuai
  2025-11-11 15:36 ` Jens Axboe
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Yu Kuai @ 2025-11-11 14:18 UTC (permalink / raw)
  To: Keith Busch, linux-block, axboe, hch, yukuai; +Cc: Keith Busch, Matthew Wilcox

在 2025/11/11 22:06, Keith Busch 写道:

> The data segment gaps the block layer tracks doesn't apply to bio's that
> don't have data. Skip calculating this to fix a NULL pointer access.
>
> Fixes: 2f6b2565d43cdb5 ("block: accumulate memory segment gaps per bio")
> Reported-by: Matthew Wilcox<willy@infradead.org>
> Signed-off-by: Keith Busch<kbusch@kernel.org>
> ---
>   block/blk-merge.c | 3 +++
>   1 file changed, 3 insertions(+)

LGTM
Reviewed-by: Yu Kuai <yukuai@fnnas.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] block: fix merging data-less bios
  2025-11-11 14:06 [PATCH] block: fix merging data-less bios Keith Busch
  2025-11-11 14:10 ` Christoph Hellwig
  2025-11-11 14:18 ` Yu Kuai
@ 2025-11-11 15:36 ` Jens Axboe
  2025-11-11 15:45 ` Matthew Wilcox
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2025-11-11 15:36 UTC (permalink / raw)
  To: linux-block, hch, Keith Busch; +Cc: yukuai, Keith Busch, Matthew Wilcox


On Tue, 11 Nov 2025 06:06:20 -0800, Keith Busch wrote:
> The data segment gaps the block layer tracks doesn't apply to bio's that
> don't have data. Skip calculating this to fix a NULL pointer access.
> 
> 

Applied, thanks!

[1/1] block: fix merging data-less bios
      commit: fd9ecd005252b595fd02ff7fcc4056251027404d

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] block: fix merging data-less bios
  2025-11-11 14:06 [PATCH] block: fix merging data-less bios Keith Busch
                   ` (2 preceding siblings ...)
  2025-11-11 15:36 ` Jens Axboe
@ 2025-11-11 15:45 ` Matthew Wilcox
  2025-11-11 16:00 ` Chaitanya Kulkarni
  2025-11-11 16:26 ` Venkat
  5 siblings, 0 replies; 7+ messages in thread
From: Matthew Wilcox @ 2025-11-11 15:45 UTC (permalink / raw)
  To: Keith Busch; +Cc: linux-block, axboe, hch, yukuai, Keith Busch

On Tue, Nov 11, 2025 at 06:06:20AM -0800, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> The data segment gaps the block layer tracks doesn't apply to bio's that
> don't have data. Skip calculating this to fix a NULL pointer access.
> 
> Fixes: 2f6b2565d43cdb5 ("block: accumulate memory segment gaps per bio")
> Reported-by: Matthew Wilcox <willy@infradead.org>
> Signed-off-by: Keith Busch <kbusch@kernel.org>

Thanks for the quick fix!

Tested-by: Matthew Wilcox (Oracle) <willy@infradead.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] block: fix merging data-less bios
  2025-11-11 14:06 [PATCH] block: fix merging data-less bios Keith Busch
                   ` (3 preceding siblings ...)
  2025-11-11 15:45 ` Matthew Wilcox
@ 2025-11-11 16:00 ` Chaitanya Kulkarni
  2025-11-11 16:26 ` Venkat
  5 siblings, 0 replies; 7+ messages in thread
From: Chaitanya Kulkarni @ 2025-11-11 16:00 UTC (permalink / raw)
  To: Keith Busch, linux-block@vger.kernel.org, axboe@kernel.dk,
	hch@lst.de
  Cc: yukuai@fnnas.com, Keith Busch, Matthew Wilcox

On 11/11/25 06:06, Keith Busch wrote:
> From: Keith Busch<kbusch@kernel.org>
>
> The data segment gaps the block layer tracks doesn't apply to bio's that
> don't have data. Skip calculating this to fix a NULL pointer access.
>
> Fixes: 2f6b2565d43cdb5 ("block: accumulate memory segment gaps per bio")
> Reported-by: Matthew Wilcox<willy@infradead.org>
> Signed-off-by: Keith Busch<kbusch@kernel.org>
> ---


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] block: fix merging data-less bios
  2025-11-11 14:06 [PATCH] block: fix merging data-less bios Keith Busch
                   ` (4 preceding siblings ...)
  2025-11-11 16:00 ` Chaitanya Kulkarni
@ 2025-11-11 16:26 ` Venkat
  5 siblings, 0 replies; 7+ messages in thread
From: Venkat @ 2025-11-11 16:26 UTC (permalink / raw)
  To: Keith Busch; +Cc: linux-block, axboe, hch, yukuai, Keith Busch, Matthew Wilcox



> On 11 Nov 2025, at 7:36 PM, Keith Busch <kbusch@meta.com> wrote:
> 
> From: Keith Busch <kbusch@kernel.org>
> 
> The data segment gaps the block layer tracks doesn't apply to bio's that
> don't have data. Skip calculating this to fix a NULL pointer access.
> 
> Fixes: 2f6b2565d43cdb5 ("block: accumulate memory segment gaps per bio")
> Reported-by: Matthew Wilcox <willy@infradead.org>
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---

Thanks for pointing to this fix. Tested this on IBM Power9 server and it fixes reported issue.

Please add below tag.

Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>

Regards,
Venkat.
> block/blk-merge.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/block/blk-merge.c b/block/blk-merge.c
> index 3ca6fbf8b7870..d3115d7469df0 100644
> --- a/block/blk-merge.c
> +++ b/block/blk-merge.c
> @@ -737,6 +737,9 @@ u8 bio_seg_gap(struct request_queue *q, struct bio *prev, struct bio *next,
> {
> struct bio_vec pb, nb;
> 
> + if (!bio_has_data(prev))
> + return 0;
> +
> gaps_bit = min_not_zero(gaps_bit, prev->bi_bvec_gap_bit);
> gaps_bit = min_not_zero(gaps_bit, next->bi_bvec_gap_bit);
> 
> -- 
> 2.47.3
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-11-11 16:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-11 14:06 [PATCH] block: fix merging data-less bios Keith Busch
2025-11-11 14:10 ` Christoph Hellwig
2025-11-11 14:18 ` Yu Kuai
2025-11-11 15:36 ` Jens Axboe
2025-11-11 15:45 ` Matthew Wilcox
2025-11-11 16:00 ` Chaitanya Kulkarni
2025-11-11 16:26 ` Venkat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox