Re: [PATCH] blk-cgroup: validate alloc/free function pairs at the start of blkcg_policy_register()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

在 2025/02/11 21:57, Michal Koutný 写道:
Hello Linxuan.

On Mon, Feb 10, 2025 at 11:18:27AM +0800, Chen Linxuan <chenlinxuan@xxxxxxxxxxxxx> wrote:
Move the validation check for cpd/pd_alloc_fn and cpd/pd_free_fn function
pairs to the start of blkcg_policy_register(). This ensures we immediately
return -EINVAL if the function pairs are not correctly provided, rather
than returning -ENOSPC after locking and unlocking mutexes unnecessarily.

Co-authored-by: Wen Tao <wentao@xxxxxxxxxxxxx>
Signed-off-by: Wen Tao <wentao@xxxxxxxxxxxxx>
Signed-off-by: Chen Linxuan <chenlinxuan@xxxxxxxxxxxxx>

If you consider those locks contention a problem (policy registrations
are "only" boot time, possibly module load time), then it's good to refer

Fixes: e84010732225c ("blkcg: add sanity check for blkcg policy operations")

This is super cold path, so I don't think it's a problem.

---
  block/blk-cgroup.c | 16 ++++++++--------
  1 file changed, 8 insertions(+), 8 deletions(-)

But it's correct,
Reviewed-by: Michal Koutný <mkoutny@xxxxxxxx>


Since we're here, can you also change the return value to -ENOMEM from
error path err_free_cpds?

Thanks,
Kuai





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux