linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Geyslan G. Bem" <geyslan@gmail.com>
To: kernel-br@googlegroups.com
Cc: "Geyslan G. Bem" <geyslan@gmail.com>, Ben Myers <bpm@sgi.com>,
	Alex Elder <elder@kernel.org>,
	xfs@oss.sgi.com (supporter:XFS FILESYSTEM),
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] xfs: fix possible NULL dereference
Date: Mon, 21 Oct 2013 15:32:46 -0300	[thread overview]
Message-ID: <1382380366-26540-1-git-send-email-geyslan@gmail.com> (raw)

This patch puts a 'break' in the true branch, avoiding the 'icptr->ic_next'
dereferencing.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 fs/xfs/xfs_log.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index a2dea108..8cdeb7e 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -3703,8 +3703,10 @@ xlog_verify_iclog(
 	spin_lock(&log->l_icloglock);
 	icptr = log->l_iclog;
 	for (i=0; i < log->l_iclog_bufs; i++) {
-		if (icptr == NULL)
+		if (!icptr) {
 			xfs_emerg(log->l_mp, "%s: invalid ptr", __func__);
+			break;
+		}
 		icptr = icptr->ic_next;
 	}
 	if (icptr != log->l_iclog)
-- 
1.8.4


             reply	other threads:[~2013-10-21 18:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-21 18:32 Geyslan G. Bem [this message]
     [not found] ` <5265956F.4010700@sandeen.net>
2013-10-21 22:44   ` [PATCH] xfs: fix possible NULL dereference Dave Chinner
2013-10-21 23:12     ` Eric Sandeen
2013-10-21 23:18       ` Ben Myers
2013-10-21 23:56         ` Dave Chinner
2013-10-22  0:00           ` Eric Sandeen
2013-10-22  0:17             ` Dave Chinner
2013-10-22 10:12               ` Geyslan Gregório Bem
2013-10-22 20:39                 ` Dave Chinner
2013-10-22 20:49                   ` Eric Sandeen
2013-10-22 21:03                     ` Dave Chinner
2013-10-22 21:19                       ` Eric Sandeen
2013-10-22 22:02                         ` Dave Chinner
2013-10-22 22:33                           ` Ben Myers
2013-10-25  9:15                           ` Dave Jones
2013-10-23 10:58                         ` Geyslan Gregório Bem
2013-10-23 20:34                           ` Ben Myers
2013-10-23 20:53                             ` Geyslan Gregório Bem
2013-10-30 20:08                             ` Eric Sandeen
2013-10-31 15:55                               ` Ben Myers
2013-10-31 16:15                                 ` Geyslan Gregório Bem

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1382380366-26540-1-git-send-email-geyslan@gmail.com \
    --to=geyslan@gmail.com \
    --cc=bpm@sgi.com \
    --cc=elder@kernel.org \
    --cc=kernel-br@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).