Re: [PATCH] proc: fix dereference of ERR_PTR

From: Al Viro
Date: Wed Apr 06 2016 - 12:13:49 EST


On Wed, Apr 06, 2016 at 11:07:45AM +0100, Sudip Mukherjee wrote:
> On the unlikely event of a bad name, d_hash_and_lookup() can return the
> error value in ERR_PTR(). And we were only checking the return value of
> d_hash_and_lookup() to be NULL. In case it is not NULL and has some
> error then d_inode() will try to dereference it later.

s/unlikely/impossible/ - procfs doesn't _have_ ->d_hash. NAK; at most
add a
/* no ->d_hash() rejects on procfs */
comment as we have next to another call site in procfs.