From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay.sgi.com (relay3.corp.sgi.com [198.149.34.15]) by oss.sgi.com (Postfix) with ESMTP id 711F67F37 for ; Wed, 23 Oct 2013 15:34:39 -0500 (CDT) Date: Wed, 23 Oct 2013 15:34:35 -0500 From: Ben Myers Subject: Re: [PATCH] xfs: fix possible NULL dereference Message-ID: <20131023203435.GR1935@sgi.com> References: <20131021231849.GL10553@sgi.com> <20131021235601.GG4446@dastard> <5265C03B.50701@sandeen.net> <20131022001732.GI4446@dastard> <20131022203946.GB2797@dastard> <5266E4BD.8030601@sandeen.net> <20131022210300.GC2797@dastard> <5266EBF0.901@sandeen.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com To: Geyslan =?iso-8859-1?Q?Greg=F3rio?= Bem Cc: Alex Elder , Eric Sandeen , open list , XFS FILESYSTEM Hey Geyslan, On Wed, Oct 23, 2013 at 08:58:51AM -0200, Geyslan Greg=F3rio Bem wrote: > - Regarding the "possible new patch" subject, I humbly pass the ball to y= ou. > = > Thank you for the attention. Thank you for the patch. I would really prefer to commit this showing authorship from you, rather than a Reported-by. Can I mark you down? Regards, Ben --- xfs: fix possible NULL dereference in xlog_verify_iclog In xlog_verify_iclog a debug check of the incore log buffers prints an error if icptr is null and then goes on to dereference the pointer regardless. Convert this to an assert so that the intention is clear. This was reported by Coverty. Reported-by: Geyslan G. Bem Signed-off-by: Ben Myers --- fs/xfs/xfs_log.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) Index: b/fs/xfs/xfs_log.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- a/fs/xfs/xfs_log.c 2013-10-23 14:52:47.875216875 -0500 +++ b/fs/xfs/xfs_log.c 2013-10-23 14:53:53.775245830 -0500 @@ -3714,11 +3714,9 @@ xlog_verify_iclog( /* check validity of iclog pointers */ spin_lock(&log->l_icloglock); icptr =3D log->l_iclog; - for (i=3D0; i < log->l_iclog_bufs; i++) { - if (icptr =3D=3D NULL) - xfs_emerg(log->l_mp, "%s: invalid ptr", __func__); - icptr =3D icptr->ic_next; - } + for (i=3D0; i < log->l_iclog_bufs; i++, icptr =3D icptr->ic_next) + ASSERT(icptr); + if (icptr !=3D log->l_iclog) xfs_emerg(log->l_mp, "%s: corrupt iclog ring", __func__); spin_unlock(&log->l_icloglock); _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs