[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5271672C.7070101@sandeen.net>
Date: Wed, 30 Oct 2013 15:08:12 -0500
From: Eric Sandeen <sandeen@...deen.net>
To: Ben Myers <bpm@....com>,
Geyslan Gregório Bem <geyslan@...il.com>
CC: Alex Elder <elder@...nel.org>,
open list <linux-kernel@...r.kernel.org>,
XFS FILESYSTEM <xfs@....sgi.com>
Subject: Re: [PATCH] xfs: fix possible NULL dereference
On 10/23/13 3:34 PM, Ben Myers wrote:
> 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@...il.com>
> Signed-off-by: Ben Myers <bpm@....com>
Reviewed-by: Eric Sandeen <sandeen@...hat.com>
> ---
> 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);
>
> _______________________________________________
> xfs mailing list
> xfs@....sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists