提交 25a2fe55 编写于 作者: Y Yu Kuai 提交者: Zheng Zengkai

block: fix sleeping function called from invalid context in part_get_stat_info()

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I57S8D
CVE: NA

--------------------------------

part_get_stat_info() call mutex_lock() inside part_stat_lock(), which
is wrong because part_stat_lock() disables preempt.

Fix the problem by hold mutex first.
Signed-off-by: NYu Kuai <yukuai3@huawei.com>
Reviewed-by: NJason Yan <yanaijie@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 341c2453
...@@ -1311,12 +1311,12 @@ static void part_get_stat_info(struct hd_struct *hd, struct disk_stats *stat, ...@@ -1311,12 +1311,12 @@ static void part_get_stat_info(struct hd_struct *hd, struct disk_stats *stat,
struct request_queue *q = part_to_disk(hd)->queue; struct request_queue *q = part_to_disk(hd)->queue;
if (queue_is_mq(q)) { if (queue_is_mq(q)) {
part_stat_lock();
mutex_lock(&part_to_dev(hd)->mutex); mutex_lock(&part_to_dev(hd)->mutex);
part_stat_lock();
part_set_stat_time(hd); part_set_stat_time(hd);
*inflight = blk_mq_in_flight_with_stat(q, hd); *inflight = blk_mq_in_flight_with_stat(q, hd);
mutex_unlock(&part_to_dev(hd)->mutex);
part_stat_unlock(); part_stat_unlock();
mutex_unlock(&part_to_dev(hd)->mutex);
} else { } else {
*inflight = part_in_flight(hd); *inflight = part_in_flight(hd);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册