diff mbox series

[1/2] mtd_blkdevs: initialze new->rq in add_mtd_blktrans_dev

Message ID 20210616071547.1156283-1-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/2] mtd_blkdevs: initialze new->rq in add_mtd_blktrans_dev | expand

Commit Message

Christoph Hellwig June 16, 2021, 7:15 a.m. UTC
Various places expect the request_queue in ->rq.  Initialize it to
avoid NULL pointer derefences.

Fixes: 6966bb921def ("mtd_blkdevs: use blk_mq_alloc_disk")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/mtd/mtd_blkdevs.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jens Axboe June 16, 2021, 12:54 p.m. UTC | #1
On 6/16/21 1:15 AM, Christoph Hellwig wrote:
> Various places expect the request_queue in ->rq.  Initialize it to
> avoid NULL pointer derefences.

Applied 1-2, thanks.
diff mbox series

Patch

diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 5dc4c966ea73..6ce4bc57f919 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -382,6 +382,7 @@  int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
 	}
 
 	new->disk = gd;
+	new->rq = new->disk->queue;
 	gd->private_data = new;
 	gd->major = tr->major;
 	gd->first_minor = (new->devnum) << tr->part_bits;