xfs: fix NULL pointer dereference in xfs_filestream_lookup_ag()
authorEric Sandeen <sandeen@sandeen.net>
Wed, 25 Mar 2015 03:54:25 +0000 (14:54 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 25 Mar 2015 03:54:25 +0000 (14:54 +1100)
If xfs_filestream_get_parent() fails, we have a null pip,
goto out, and attempt to IRELE(NULL).  This causes a null
pointer dereference and BUG().

Fix this by directly returning NULLAGNUMBER in this case.

Reported-by: Adrien Nader <adrien@notk.org>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_filestream.c

index a2e86e8..8f9f854 100644 (file)
@@ -322,7 +322,7 @@ xfs_filestream_lookup_ag(
 
        pip = xfs_filestream_get_parent(ip);
        if (!pip)
-               goto out;
+               return NULLAGNUMBER;
 
        mru = xfs_mru_cache_lookup(mp->m_filestream, pip->i_ino);
        if (mru) {