xfs
[Top] [All Lists]

Re: [patch] xfsprogs: repair pagefault due to missed out sanity NULL che

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [patch] xfsprogs: repair pagefault due to missed out sanity NULL check
From: Ajeet Yadav <ajeet.yadav.77@xxxxxxxxx>
Date: Tue, 1 Feb 2011 11:56:32 +0900
Cc: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=JLYid884GvnvcdlF1tYRj+akxtJo6l1TF/dxTap0RRI=; b=sA/kSBNQRZ5RrWthW8Bii8bSaQ+rNU78G1j5rHUYIC5TeZtIj+zSZD56lAgm9jW+gC 5drMbLT7txjxLN0QnDnnD5lWbT36WoE2a4PAUmbIuPvcBed6hM7kJGzS04WtEg703Svr gEeMJYgsHzZl0oh7Alh2MCvPb1wnpR99SSX6M=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=RcOjY3yBOr5c6MRdpQr6qeeo1UoCxTOA3vzRI1W4bRHEQxM9ghklbZKy4MoBdizHlB rFToFILPIX4istO9jQq17drbmcAqYD8NPH0KlVaf4vNEXZWCxbH/50Q+9mwftmuCg9xt SJuGuTagkBFEKhafoD+sbnG1BS3gI8fcaRT3M=
In-reply-to: <20110131041729.GJ21311@dastard>
References: <AANLkTiktigbHHHsYrxRBja6LxQ3N_gAq_KAoLNYGRB=r@xxxxxxxxxxxxxx> <20110131041729.GJ21311@dastard>
xfsprogs: repair pagefaults due to unhandled NULL check in da_read_buf()
 
xfs_repair does not correctly handle bplist[i] for error situations in
function da_read_buf(). If libxfs_readbuf() fails then bplist[i] = NULL,
but error handing code calls libxfs_putbuf(bdlist[i]) for all indexes of i
without first checking whether its NULL. This result in pagefault in
libpthread library during pthread_mutex_unlock().
This problem is identified when we remove the storage while xfs_repair
is running on it.
 
Signed-off-by: Ajeet Yadav <ajeet.yadav.77@xxxxxxxxx>
 
diff -Nurp xfsprogs/repair/dir2.c xfsprogs-dirty/repair/dir2.c
--- xfsprogs/repair/dir2.c      2010-07-16 13:07:09.000000000 +0900
+++ xfsprogs-dirty/repair/dir2.c        2011-01-28 18:49:21.000000000 +0900
@@ -110,9 +110,10 @@ da_read_buf(
                bplist[i] = libxfs_readbuf(mp->m_dev,
                                XFS_FSB_TO_DADDR(mp, bmp[i].startblock),
                                XFS_FSB_TO_BB(mp, bmp[i].blockcount), 0);
-               if (!bplist[i])
+               if (!bplist[i]){
+                       nex = i;
                        goto failed;
-
+               }
                pftrace("readbuf %p (%llu, %d)", bplist[i],
                        (long long)XFS_BUF_ADDR(bplist[i]),
                        XFS_BUF_COUNT(bplist[i]));
<Prev in Thread] Current Thread [Next in Thread>