From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH] cifs: cope with negative dentries in cifs_get_root Date: Tue, 9 Aug 2011 07:38:00 +0100 Message-ID: <20110809063800.GE2203@ZenIV.linux.org.uk> References: <1312549360-4317-1-git-send-email-jlayton@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jeff Layton , smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Pavel Shilovsky Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: On Tue, Aug 09, 2011 at 09:41:33AM +0400, Pavel Shilovsky wrote: > > ? ? ? ? ? ? ? ?mutex_unlock(&dir->i_mutex); > > ? ? ? ? ? ? ? ?dput(dentry); > > ? ? ? ? ? ? ? ?dentry = child; > > + ? ? ? ? ? ? ? if (!dentry->d_inode) { > > dentry can be NULL here (returned from lookup_one_len) and it can > cause a null pointer dereference. Not NULL, ERR_PTR(...). IOW, we need to check IS_ERR(dentry) to protect that check of dentry->d_inode.