提交 e07037c5 编写于 作者: D Dan Carpenter 提交者: Yang Yingliang

iocost: don't nest spin_lock_irq in ioc_weight_write()

mainline inclusion
from mainline-5.4-rc6
commit 41591a51f00d2dc7bb9dc6e9bedf56c5cf6f2392
category: feature
bugzilla: 38688
CVE: NA

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

This code causes a static analysis warning:

    block/blk-iocost.c:2113 ioc_weight_write() error: double lock 'irq'

We disable IRQs in blkg_conf_prep() and re-enable them in
blkg_conf_finish().  IRQ disable/enable should not be nested because
that means the IRQs will be enabled at the first unlock instead of the
second one.

Fixes: 7caa47151ab2 ("blkcg: implement blk-iocost")
Acked-by: NTejun Heo <tj@kernel.org>
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NYu Kuai <yukuai3@huawei.com>
Reviewed-by: NHou Tao <houtao1@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 9f427cd7
...@@ -2111,10 +2111,10 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf, ...@@ -2111,10 +2111,10 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf,
goto einval; goto einval;
} }
spin_lock_irq(&iocg->ioc->lock); spin_lock(&iocg->ioc->lock);
iocg->cfg_weight = v; iocg->cfg_weight = v;
weight_updated(iocg); weight_updated(iocg);
spin_unlock_irq(&iocg->ioc->lock); spin_unlock(&iocg->ioc->lock);
blkg_conf_finish(&ctx); blkg_conf_finish(&ctx);
return nbytes; return nbytes;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册