xfs
[Top] [All Lists]

Re: [PATCH] xfs: fix possible NULL dereference

To: Ben Myers <bpm@xxxxxxx>
Subject: Re: [PATCH] xfs: fix possible NULL dereference
From: Geyslan Gregório Bem <geyslan@xxxxxxxxx>
Date: Wed, 23 Oct 2013 18:53:09 -0200
Cc: Eric Sandeen <sandeen@xxxxxxxxxxx>, Alex Elder <elder@xxxxxxxxxx>, open list <linux-kernel@xxxxxxxxxxxxxxx>, XFS FILESYSTEM <xfs@xxxxxxxxxxx>, kernel-br <kernel-br@xxxxxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=DiaYyXOBscJtEO4LUkhgWLS6WwU3Eh4tO/uz4H/SkYs=; b=pBkEJ2fNTJ0yupajsrCw7iiCSkvPxRhAs/n0b736ubdWiYaZCmX0C/NQypCXpbRPid w+c9fqVZm1xHsw175mkYGxbYot1gLGxCOhTVywd3lNk1f9iXaOn6Jy1qcyyDGfX14ZKI 1jv36GDDJB2eMYUAVEB/qMakaEF3zBtLrtuUhgb4kkJ7I0kS7A421XHyc0tqpJ40OaH4 EvO6OAVfoduSe1ul9e7vVcaRi+xV0ucdQIuQR+TopXrXMM7YXRrTnD+Ii1VP+YnnL5fx trPzYt98iKVah3XLLinu+BSomgw6vGEG3XHysJ7IeqSoCWEgW9WKF+PZmifpx75DDl/P +2gQ==
In-reply-to: <20131023203435.GR1935@xxxxxxx>
References: <20131021231849.GL10553@xxxxxxx> <20131021235601.GG4446@dastard> <5265C03B.50701@xxxxxxxxxxx> <20131022001732.GI4446@dastard> <CAGG-pUTh-PJJ4Nzo0r-f3VDPMc81U2z_NMX+Wcex3KzGs=U8cA@xxxxxxxxxxxxxx> <20131022203946.GB2797@dastard> <5266E4BD.8030601@xxxxxxxxxxx> <20131022210300.GC2797@dastard> <5266EBF0.901@xxxxxxxxxxx> <CAGG-pUTtYomspBXn=RE7YFU=vu6rWZ1fU7CBO45Mmodj8DZFiQ@xxxxxxxxxxxxxx> <20131023203435.GR1935@xxxxxxx>
2013/10/23 Ben Myers <bpm@xxxxxxx>:
> Hey Geyslan,
>
> On Wed, Oct 23, 2013 at 08:58:51AM -0200, Geyslan Gregório Bem wrote:
>> - Regarding the "possible new patch" subject, I humbly pass the ball to you.
>>
>> 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
>
Thank you, Ben. Sure, you can mark me.

> ---
>
> 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 <geyslan@xxxxxxxxx>
> Signed-off-by: Ben Myers <bpm@xxxxxxx>
> ---
>  fs/xfs/xfs_log.c |    8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> Index: b/fs/xfs/xfs_log.c
> ===================================================================
> --- 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 = log->l_iclog;
> -       for (i=0; i < log->l_iclog_bufs; i++) {
> -               if (icptr == NULL)
> -                       xfs_emerg(log->l_mp, "%s: invalid ptr", __func__);
> -               icptr = icptr->ic_next;
> -       }
> +       for (i=0; i < log->l_iclog_bufs; i++, icptr = icptr->ic_next)
> +               ASSERT(icptr);
> +
>         if (icptr != log->l_iclog)
>                 xfs_emerg(log->l_mp, "%s: corrupt iclog ring", __func__);
>         spin_unlock(&log->l_icloglock);
>

-- 
Regards,

Geyslan G. Bem
hackingbits.com

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