Re: fs: NULL deref in atime_needs_update

From: Al Viro
Date: Mon Feb 22 2016 - 12:23:20 EST


On Mon, Feb 22, 2016 at 12:20:30PM +0100, Dmitry Vyukov wrote:

> I've reproduced the second report (the one originating in openat) with
> this patch and the WARNING did _not_ fire:

Lovely... Could you dump your inode.o on anonftp somewhere? Or post
the disassembled atime_needs_update, for that matter - shouldn't be
all that long... .config (and gcc version) you are using would also be nice.

On the face of it, NULL inode is a plausible source of that one, but
it's _very_ odd. It would have to be NULL ->link_inode, and since the
warning hadn't triggered, there was a successful should_follow_link(),
with NULL inode argument.

Could you slap WARN_ON(!inode) in pick_link()? Or even
WARN_ON(IS_ERR_OR_NULL(inode)), for that matter...