lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2bb05623-9438-3b68-6ac8-4294f9676ff6@kernel.org>
Date:   Sat, 27 May 2023 09:01:41 +0800
From:   Chao Yu <chao@...nel.org>
To:     Jaegeuk Kim <jaegeuk@...nel.org>, Wu Bo <bo.wu@...o.com>
Cc:     linux-f2fs-devel@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org, wubo.oduw@...il.com
Subject: Re: [PATCH 1/1] f2fs: fix args passed to trace_f2fs_lookup_end

On 2023/5/27 1:21, Jaegeuk Kim wrote:
> On 05/24, Wu Bo wrote:
>> The NULL return of 'd_splice_alias' dosen't mean error.
>>
>> Signed-off-by: Wu Bo <bo.wu@...o.com>
>> ---
>>   fs/f2fs/namei.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
>> index 77a71276ecb1..e5a3e39ce90c 100644
>> --- a/fs/f2fs/namei.c
>> +++ b/fs/f2fs/namei.c
>> @@ -577,7 +577,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
>>   #endif
>>   	new = c(inode, dentry);
>>   	err = PTR_ERR_OR_ZERO(new);
>> -	trace_f2fs_lookup_end(dir, dentry, ino, !new ? -ENOENT : err);
>> +	trace_f2fs_lookup_end(dir, new ? new : dentry, ino, err);
> 
> Shouldn't give an error pointer to the dentry field.
> 
> How about just giving the err?
> 
> -       err = PTR_ERR_OR_ZERO(new);
> -       trace_f2fs_lookup_end(dir, dentry, ino, !new ? -ENOENT : err);
> +       trace_f2fs_lookup_end(dir, dentry, ino, PTR_ERR_OR_ZERO(new));

static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
{
	if (IS_ERR(ptr))
		return PTR_ERR(ptr);
	else
		return 0;
}

For below two cases, PTR_ERR_OR_ZERO(new) will return zero:
a) f2fs_lookup found existed dentry
b) f2fs_lookup didn't find existed dentry (-ENOENT case)

So in below commit, I passed -ENOENT to tracepoint for case b), so we can
distinguish result of f2fs_lookup in tracepoint, actually, -ENOENT is expected
value when we create a new file/directory.

Commit 84597b1f9b05 ("f2fs: fix wrong value of tracepoint parameter")

> 
> 
>>   	return new;
>>   out_iput:
>>   	iput(inode);
>> -- 
>> 2.35.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ