The bio_alloc_clone() call in pkt_make_request_read() lacks NULL check, which could lead to NULL pointer dereference. Add NULL check and handle allocation failure by calling bio_io_error(). Signed-off-by: Ye Chey <yechey@xxxxxxxxxxx> --- drivers/block/pktcdvd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 65b96c083..68d1f43a7 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -2323,6 +2323,10 @@ static void pkt_make_request_read(struct pktcdvd_device *pd, struct bio *bio) { struct bio *cloned_bio = bio_alloc_clone(file_bdev(pd->bdev_file), bio, GFP_NOIO, &pkt_bio_set); + if (!cloned_bio) { + bio_io_error(bio); + return; + } struct packet_stacked_data *psd = mempool_alloc(&psd_pool, GFP_NOIO); psd->pd = pd; -- 2.44.0