linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mtd_blkdevs: initialze new->rq in add_mtd_blktrans_dev
@ 2021-06-16  7:15 Christoph Hellwig
  2021-06-16  7:15 ` [PATCH 2/2] loop: fix order of cleaning up the queue and freeing the tagset Christoph Hellwig
  2021-06-16 12:54 ` [PATCH 1/2] mtd_blkdevs: initialze new->rq in add_mtd_blktrans_dev Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2021-06-16  7:15 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, bgoncalv, m.szyprowski

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(+)

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;
-- 
2.30.2


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

* [PATCH 2/2] loop: fix order of cleaning up the queue and freeing the tagset
  2021-06-16  7:15 [PATCH 1/2] mtd_blkdevs: initialze new->rq in add_mtd_blktrans_dev Christoph Hellwig
@ 2021-06-16  7:15 ` Christoph Hellwig
  2021-06-16 12:54 ` [PATCH 1/2] mtd_blkdevs: initialze new->rq in add_mtd_blktrans_dev Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2021-06-16  7:15 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, bgoncalv, m.szyprowski

We must release the queue before freeing the tagset.

Fixes: 1c99502fae35 ("loop: use blk_mq_alloc_disk and blk_cleanup_disk")
Reported-by: Bruno Goncalves <bgoncalv@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 9a48b3f9a15c..e0c4de392eab 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -2172,8 +2172,8 @@ static int loop_add(struct loop_device **l, int i)
 static void loop_remove(struct loop_device *lo)
 {
 	del_gendisk(lo->lo_disk);
-	blk_mq_free_tag_set(&lo->tag_set);
 	blk_cleanup_disk(lo->lo_disk);
+	blk_mq_free_tag_set(&lo->tag_set);
 	mutex_destroy(&lo->lo_mutex);
 	kfree(lo);
 }
-- 
2.30.2


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

* Re: [PATCH 1/2] mtd_blkdevs: initialze new->rq in add_mtd_blktrans_dev
  2021-06-16  7:15 [PATCH 1/2] mtd_blkdevs: initialze new->rq in add_mtd_blktrans_dev Christoph Hellwig
  2021-06-16  7:15 ` [PATCH 2/2] loop: fix order of cleaning up the queue and freeing the tagset Christoph Hellwig
@ 2021-06-16 12:54 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2021-06-16 12:54 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-block, bgoncalv, m.szyprowski

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.

-- 
Jens Axboe


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

end of thread, other threads:[~2021-06-16 12:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16  7:15 [PATCH 1/2] mtd_blkdevs: initialze new->rq in add_mtd_blktrans_dev Christoph Hellwig
2021-06-16  7:15 ` [PATCH 2/2] loop: fix order of cleaning up the queue and freeing the tagset Christoph Hellwig
2021-06-16 12:54 ` [PATCH 1/2] mtd_blkdevs: initialze new->rq in add_mtd_blktrans_dev Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).