public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.12 stable] pktcdvd: Handle bio_split() failure
@ 2025-09-30  6:48 Haotian Zhang
  2025-09-30  7:34 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Haotian Zhang @ 2025-09-30  6:48 UTC (permalink / raw)
  To: stable; +Cc: gregkh, sashal, linux-block, axboe, vulab

The error return from bio_split() is not checked before
being passed to bio_chain(), leading to a kernel panic
from an invalid pointer dereference.

Add a check with IS_ERR() to handle the allocation failure
and prevent the crash.

This patch fixes a bug in the pktcdvd driver, which was removed
from the mainline kernel but still exists in stable branches.

Fixes: 4b83e99ee7092 ("Revert "pktcdvd: remove driver."")
Cc: stable@vger.kernel.org
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
 drivers/block/pktcdvd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 65b96c083b3c..c0999c3d167a 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2466,6 +2466,8 @@ static void pkt_submit_bio(struct bio *bio)
 			split = bio_split(bio, last_zone -
 					  bio->bi_iter.bi_sector,
 					  GFP_NOIO, &pkt_bio_set);
+			if (IS_ERR(split))
+				goto end_io;
 			bio_chain(split, bio);
 		} else {
 			split = bio;
-- 
2.25.1


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

end of thread, other threads:[~2025-09-30  7:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-30  6:48 [PATCH 6.12 stable] pktcdvd: Handle bio_split() failure Haotian Zhang
2025-09-30  7:34 ` Greg KH

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