All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: Guoqing Jiang <gqjiang@suse.com>
Cc: linux-raid <linux-raid@vger.kernel.org>,
	Goldwyn Rodrigues <rgoldwyn@suse.com>, NeilBrown <neilb@suse.de>
Subject: use after free bug in b98043a2f8e7bb5b1918e2e02778f822f9dd4d3a
Date: Fri, 04 Mar 2016 16:19:16 -0500	[thread overview]
Message-ID: <wrfjy49yym97.fsf@redhat.com> (raw)

Hi,

I was looking at ExamineBitmap() and noticed that your patch below,
seems to introduce a use after free bug.

commit b98043a2f8e7bb5b1918e2e02778f822f9dd4d3a
Author: Guoqing Jiang <gqjiang@suse.com>
Date:   Wed Jun 10 13:42:07 2015 +0800

    Show all bitmaps while examining bitmap
    
    This adds capability of exmining bitmaps corresponding to all
    nodes/slots on the device.
    
    Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
    Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
    Signed-off-by: NeilBrown <neilb@suse.de>

Line 284 does a close(fd), but further down the code your patch
introduces:

+       } else {
+               printf("   Cluster nodes : %d\n", sb->nodes);
+               printf("    Cluster name : %64s\n", sb->cluster_name);
+               for (i = 0; i < (int)sb->nodes; i++) {
+                       if (i) {
+                               free(info);
+                               info = bitmap_fd_read(fd, brief);
+                               sb = &info->sb;
+                       }

It's not totally obvious to me here what the intention is for clustered
md here. Are you intending to use the same fd as was used at the top of
ExamineBitmap() or is it meant to open a new fd based on each clustered
entry?

In either case, the code as it is right now is certainly not going to
work :(

Cheers,
Jes

             reply	other threads:[~2016-03-04 21:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04 21:19 Jes Sorensen [this message]
2016-03-07 16:33 ` use after free bug in b98043a2f8e7bb5b1918e2e02778f822f9dd4d3a Guoqing Jiang

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=wrfjy49yym97.fsf@redhat.com \
    --to=jes.sorensen@redhat.com \
    --cc=gqjiang@suse.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=rgoldwyn@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.