linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blk-mq: check q->poll_stat in queue_poll_stat_show
@ 2021-12-02  9:07 Ming Lei
  2021-12-02 15:21 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Ming Lei @ 2021-12-02  9:07 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Ming Lei

Without checking q->poll_stat in queue_poll_stat_show(), kernel panic
may be caused if q->poll_stat isn't allocated.

Fixes: 48b5c1fbcd8c ("block: only allocate poll_stats if there's a user of them")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-mq-debugfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 7f27dca3a45e..3a790eb4995c 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -30,6 +30,9 @@ static int queue_poll_stat_show(void *data, struct seq_file *m)
 	struct request_queue *q = data;
 	int bucket;
 
+	if (!q->poll_stat)
+		return 0;
+
 	for (bucket = 0; bucket < (BLK_MQ_POLL_STATS_BKTS / 2); bucket++) {
 		seq_printf(m, "read  (%d Bytes): ", 1 << (9 + bucket));
 		print_stat(m, &q->poll_stat[2 * bucket]);
-- 
2.31.1


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

* Re: [PATCH] blk-mq: check q->poll_stat in queue_poll_stat_show
  2021-12-02  9:07 [PATCH] blk-mq: check q->poll_stat in queue_poll_stat_show Ming Lei
@ 2021-12-02 15:21 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-12-02 15:21 UTC (permalink / raw)
  To: Ming Lei; +Cc: linux-block

On Thu, 2 Dec 2021 17:07:16 +0800, Ming Lei wrote:
> Without checking q->poll_stat in queue_poll_stat_show(), kernel panic
> may be caused if q->poll_stat isn't allocated.
> 
> 

Applied, thanks!

[1/1] blk-mq: check q->poll_stat in queue_poll_stat_show
      commit: 18d78171c061889a9a43152f60d6a27a10fc7656

Best regards,
-- 
Jens Axboe



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

end of thread, other threads:[~2021-12-02 15:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02  9:07 [PATCH] blk-mq: check q->poll_stat in queue_poll_stat_show Ming Lei
2021-12-02 15:21 ` 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).