xfs
[Top] [All Lists]

[PATCH] xfs: don't release NULL pip in xfs_filestream_lookup_ag()

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfs: don't release NULL pip in xfs_filestream_lookup_ag()
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Tue, 03 Mar 2015 14:14:57 -0600
Cc: Adrien Nader <adrien@xxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
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 testing for pip before trying to release it.

Reported-by: Adrien Nader <adrien@xxxxxxxx>
Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---

diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c
index a2e86e8..fb09a63 100644
--- a/fs/xfs/xfs_filestream.c
+++ b/fs/xfs/xfs_filestream.c
@@ -348,7 +348,8 @@ xfs_filestream_lookup_ag(
        if (xfs_filestream_pick_ag(pip, startag, &ag, 0, 0))
                ag = NULLAGNUMBER;
 out:
-       IRELE(pip);
+       if (pip)
+               IRELE(pip);
        return ag;
 }
 

<Prev in Thread] Current Thread [Next in Thread>