From: Yu Kuai yukuai3@huawei.com
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: Yu Kuai yukuai3@huawei.com Reviewed-by: Jason Yan yanaijie@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- block/genhd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/genhd.c b/block/genhd.c index cc114dd0265b..fcd6210417bc 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -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;
if (queue_is_mq(q)) { - part_stat_lock(); mutex_lock(&part_to_dev(hd)->mutex); + part_stat_lock(); part_set_stat_time(hd); *inflight = blk_mq_in_flight_with_stat(q, hd); - mutex_unlock(&part_to_dev(hd)->mutex); part_stat_unlock(); + mutex_unlock(&part_to_dev(hd)->mutex); } else { *inflight = part_in_flight(hd); }