xfs
[Top] [All Lists]

[PATCH] xfs: fix possible NULL dereference

To: kernel-br@xxxxxxxxxxxxxxxx
Subject: [PATCH] xfs: fix possible NULL dereference
From: "Geyslan G. Bem" <geyslan@xxxxxxxxx>
Date: Mon, 21 Oct 2013 15:32:46 -0300
Cc: "Geyslan G. Bem" <geyslan@xxxxxxxxx>, Ben Myers <bpm@xxxxxxx>, Alex Elder <elder@xxxxxxxxxx>, xfs@xxxxxxxxxxx (supporter:XFS FILESYSTEM), linux-kernel@xxxxxxxxxxxxxxx (open list)
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=jSQceWtNzIn8H9Ep0jUtU05llQGXQmjTKYf72dpJbuE=; b=uyEv0HBohHyd9/EVRE54Q8bnhsvG756dilFaNKuk3GyYbRCnvyD6Aoc/OvET7vMZfz SYFm7ZqLnqeD+t1uySxmDvaCgTR+6enIBKrHeU+3zLZmBsVqg6CKgSjNbY7T/vP0A8Sc L2SWYYO1OAgwwgrXDBpdCo3fDQ3b94cedbXhCQKwwQT/wxjYycT22txtQd4NtLDyH0wg clyMTF/IK1cFC02iYMrBYqfKNF/8YV0pjTgkg8oYLYRTXOs13EFZ4PwbbuyNdPDa1kpx op8j8PLqWFIHkkM+h4cLqtiEKwgPD0Zsr82d5qMKd9mr3fpfqLrMP4mfyaR/af0x4yiv YaeQ==
This patch puts a 'break' in the true branch, avoiding the 'icptr->ic_next'
dereferencing.

Signed-off-by: Geyslan G. Bem <geyslan@xxxxxxxxx>
---
 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

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