public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: aoe: fix page fault in freedev()
@ 2022-03-10 11:53 Valentin Kleibel
  2022-03-10 12:03 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 10+ messages in thread
From: Valentin Kleibel @ 2022-03-10 11:53 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman; +Cc: Jens Axboe, Justin Sanders, linux-block

There is a bug in the aoe driver module where every forcible removal of 
an aoe device (eg. "rmmod aoe" with aoe devices available or "aoe-flush 
ex.x") leads to a page fault.
The code in freedev() calls blk_mq_free_tag_set() before running 
blk_cleanup_queue() which leads to this issue 
(drivers/block/aoe/aoedev.c L281ff).
This issue was fixed upstream in commit 6560ec9 (aoe: use 
blk_mq_alloc_disk and blk_cleanup_disk) with the introduction and use of 
the function blk_cleanup_disk().

This patch applies to kernels 5.4 and 5.10.

The function calls are reordered to match the behavior of 
blk_cleanup_disk() to mitigate this issue.

Fixes: 3582dd2 (aoe: convert aoeblk to blk-mq)
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215647
Signed-off-by: Valentin Kleibel <valentin@vrvis.at>
---
  drivers/block/aoe/aoedev.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
index e2ea2356da06..08c98ea724ea 100644
--- a/drivers/block/aoe/aoedev.c
+++ b/drivers/block/aoe/aoedev.c
@@ -277,9 +277,9 @@ freedev(struct aoedev *d)
         if (d->gd) {
                 aoedisk_rm_debugfs(d);
                 del_gendisk(d->gd);
+               blk_cleanup_queue(d->blkq);
                 put_disk(d->gd);
                 blk_mq_free_tag_set(&d->tag_set);
-               blk_cleanup_queue(d->blkq);
         }
         t = d->targets;
         e = t + d->ntargets;

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

end of thread, other threads:[~2022-04-11 14:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-10 11:53 [PATCH] block: aoe: fix page fault in freedev() Valentin Kleibel
2022-03-10 12:03 ` Greg Kroah-Hartman
2022-03-10 12:24   ` Valentin Kleibel
2022-03-10 12:26     ` Greg Kroah-Hartman
2022-03-10 12:55       ` Valentin Kleibel
2022-03-14 11:12         ` Greg Kroah-Hartman
2022-03-31  9:58           ` [PATCH v2 0/2] " Valentin Kleibel
2022-03-31 10:00             ` [PATCH v2 1/2] block: add blk_alloc_disk and blk_cleanup_disk APIs Valentin Kleibel
2022-04-11 14:43               ` Greg Kroah-Hartman
2022-03-31 10:01             ` [PATCH v2 2/2] aoe: use blk_mq_alloc_disk and blk_cleanup_disk Valentin Kleibel

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