[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2f93789c-e931-452a-9b42-43c3254b626f@linux.alibaba.com>
Date: Fri, 15 Mar 2024 11:22:53 +0800
From: Philo Lu <lulie@...ux.alibaba.com>
To: zhangzhengming <zhang.zhengming@....com>
Cc: akpm@...ux-foundation.org, alibuda@...ux.alibaba.com,
dust.li@...ux.alibaba.com, gregkh@...uxfoundation.org,
guwen@...ux.alibaba.com, hengqi@...ux.alibaba.com, kunyu@...china.com,
linux-kernel@...r.kernel.org, nabijaczleweli@...ijaczleweli.xyz,
xuanzhuo@...ux.alibaba.com, zhao_lei1@...erun.com, zhou.kete@....com
Subject: Re: [PATCH] relay: avoid relay_open_buf inproperly fails in
buffer-only mode
On 2024/3/15 10:39, zhangzhengming wrote:
>> diff --git a/kernel/relay.c b/kernel/relay.c
>> index a8e90e98bf2c..0d8b8325530a 100644
>> --- a/kernel/relay.c
>> +++ b/kernel/relay.c
>> @@ -391,12 +391,13 @@ static struct rchan_buf *relay_open_buf(struct rchan *chan, unsigned int cpu)
>> goto free_buf;
>> relay_set_buf_dentry(buf, dentry);
>> } else {
>> - /* Only retrieve global info, nothing more, nothing less */
>> + /* In buffer-only mode, relay_open_buf is called with
>> + * filename=NULL, but create_buf_file is still needed to
>> + * retrieve is_global info. So dentry should be NULL here.
>> + */
>> dentry = chan->cb->create_buf_file(NULL, NULL,
>> S_IRUSR, buf,
>> &chan->is_global);
>> - if (IS_ERR_OR_NULL(dentry))
>> - goto free_buf;
>> }
>>
>> buf->cpu = cpu;
> I suggest replacing IS_ERR_OR_NULL with IS_ERR instead of removing it due to the possibility of create_buf_file callback returning an error.
>
This would be fine. AFAICT the return value here is un-important. So
reverting to `WARN_ON(dentry)` maybe another choice.
Powered by blists - more mailing lists