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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y7+B40Mnnm7/rY+O@ZenIV>
Date:   Thu, 12 Jan 2023 03:43:31 +0000
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Peng Zhang <zhangpeng362@...wei.com>
Cc:     almaz.alexandrovich@...agon-software.com,
        kari.argillander@...il.com, akpm@...ux-foundation.org,
        ntfs3@...ts.linux.dev, linux-kernel@...r.kernel.org,
        sunnanyong@...wei.com, wangkefeng.wang@...wei.com,
        Dan Carpenter <error27@...il.com>
Subject: Re: [PATCH -next] fs/ntfs3: Fix potential NULL/IS_ERR bug in
 ntfs_lookup()

On Thu, Jan 12, 2023 at 01:32:48AM +0000, Peng Zhang wrote:
> From: ZhangPeng <zhangpeng362@...wei.com>
> 
> Dan Carpenter reported a Smatch static checker warning:
> 
> fs/ntfs3/namei.c:96 ntfs_lookup()
> error: potential NULL/IS_ERR bug 'inode'
> It will cause null-ptr-deref when dir_search_u() returns NULL if the
> file is not found.
> Fix this by replacing IS_ERR() with IS_ERR_OR_NULL() to add a check for
> NULL.

That's a bad approach - you are papering over bad calling conventions instead of
fixing them.

IS_ERR_OR_NULL is almost never the right tool.  Occasionally there are valid
cases for function possibly returning pointer/NULL/ERR_PTR(...); this is
almost certainly not one of those.

Incidentally, inodes with NULL ->i_op should never exist.  _Any_ place that
sets ->i_op to NULL is broken, plain and simple.  A new instance of struct
inode has ->i_op pointing to empty method table; it *is* initialized.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ