xfs
[Top] [All Lists]

Re: ls segfaults, kernel does NULL pointer dereference...

To: Clem Taylor <clemtaylor@xxxxxxxxx>
Subject: Re: ls segfaults, kernel does NULL pointer dereference...
From: Andi Kleen <ak@xxxxxxx>
Date: Fri, 13 Sep 2002 10:55:19 +0200
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: <3D817F8A.6020205@xxxxxxxxx>
References: <3D817F8A.6020205@xxxxxxxxx>
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.3.22.1i
On Fri, Sep 13, 2002 at 02:02:50AM -0400, Clem Taylor wrote:
> I came home to find my 1.1TB disk array in a sick state, a drive is
> failing...  When I do an ls on the volume, ls segfaults and the log shows
> that the kernel tried to dereference a NULL pointer.
> 
> I'm running 2.4.19-rc1-xfs on a dual Athlon with a 3ware 7xxx controller
> and 6 160G Maxtor drives. I repaired the drive (and ordered a new one) and 
> after reboot everything seems to be okay. It does seem a little strange 
> that XFS would fail this way....
> 


Looks like a bug in xfs_iget's error handling.  When a read error occurs
during getting the inode xfs_iget_core doesn't insert a vnode behaviour and 
later code which assumes that the behaviour is there fails.

This patch should fix it at least for this case. It may be safer to always
insert a behaviour even in the error case, but one would hope that all 
callers of xfs_iget handle errors properly.


--- linux/fs/xfs/xfs_iget.c-o   Tue Aug 27 21:00:43 2002
+++ linux/fs/xfs/xfs_iget.c     Fri Sep 13 10:53:58 2002
@@ -493,6 +493,10 @@
                                goto retry;
                        }
 
+                       if (is_bad_inode(inode)) { 
+                               iput(inode); 
+                               return EIO;
+                       } 
                        bdp = vn_bhv_lookup(VN_BHV_HEAD(vp), &xfs_vnodeops);
                        ip = XFS_BHVTOI(bdp);
                        if (lock_flags != 0) {


-Andi


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