[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <369912bd-2ccf-4cb7-817a-a32ccbb3d83d@web.de>
Date: Sun, 26 May 2024 14:57:07 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Yu Kuai <yukuai3@...wei.com>, linux-block@...r.kernel.org,
kernel-janitors@...r.kernel.org, Bart Van Assche <bvanassche@....org>,
Chaitanya Kulkarni <kch@...dia.com>,
Chengming Zhou <zhouchengming@...edance.com>,
Damien Le Moal <dlemoal@...nel.org>, Hannes Reinecke <hare@...e.de>,
Jens Axboe <axboe@...nel.dk>, Johannes Thumshirn
<johannes.thumshirn@....com>, Yi Zhang <yi.zhang@...hat.com>,
Zhu Yanjun <yanjun.zhu@...ux.dev>
Cc: LKML <linux-kernel@...r.kernel.org>, Yang Erkun <yangerkun@...wei.com>,
Yi Zhang <yi.zhang@...wei.com>, Yu Kuai <yukuai1@...weicloud.com>
Subject: Re: [PATCH v2] null_blk: fix null-ptr-dereference while configuring
'power' and 'submit_queues'
…
> Fix this problem by resuing the global mutex to protect
> nullb_device_power_store() and nullb_update_nr_hw_queues() from configfs.
>
> Fixes: 45919fbfe1c4 ("null_blk: Enable modifying 'submit_queues' after an instance has been configured")
…
> +++ b/drivers/block/null_blk/main.c
> @@ -413,13 +413,25 @@ static int nullb_update_nr_hw_queues(struct nullb_device *dev,
> static int nullb_apply_submit_queues(struct nullb_device *dev,
> unsigned int submit_queues)
> {
> - return nullb_update_nr_hw_queues(dev, submit_queues, dev->poll_queues);
> + int ret;
> +
> + mutex_lock(&lock);
> + ret = nullb_update_nr_hw_queues(dev, submit_queues, dev->poll_queues);
> + mutex_unlock(&lock);
> +
> + return ret;
> }
…
How do you think about to increase the application of scope-based resource management here?
https://elixir.bootlin.com/linux/v6.9.1/source/include/linux/cleanup.h#L124
Will development interests grow for the usage of a statement like “guard(mutex)(&lock);”?
Regards,
Markus
Powered by blists - more mailing lists