Skip to content

Commit 18d7817

Browse files
Ming Leiaxboe
authored andcommitted
blk-mq: check q->poll_stat in queue_poll_stat_show
Without checking q->poll_stat in queue_poll_stat_show(), kernel panic may be caused if q->poll_stat isn't allocated. Fixes: 48b5c1f ("block: only allocate poll_stats if there's a user of them") Signed-off-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 8a75189 commit 18d7817

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

block/blk-mq-debugfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ static int queue_poll_stat_show(void *data, struct seq_file *m)
3030
struct request_queue *q = data;
3131
int bucket;
3232

33+
if (!q->poll_stat)
34+
return 0;
35+
3336
for (bucket = 0; bucket < (BLK_MQ_POLL_STATS_BKTS / 2); bucket++) {
3437
seq_printf(m, "read (%d Bytes): ", 1 << (9 + bucket));
3538
print_stat(m, &q->poll_stat[2 * bucket]);

0 commit comments

Comments
 (0)