All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: lufq.fnst@cn.fujitsu.com
Cc: linux-btrfs@vger.kernel.org
Subject: re: btrfs: fix check_shared for fiemap ioctl
Date: Tue, 7 Jun 2016 20:18:48 +0300	[thread overview]
Message-ID: <20160607171848.GA29093@mwanda> (raw)

Hello Lu Fengqi,

The patch ac8332f0c3ac: "btrfs: fix check_shared for fiemap ioctl"
from Jun 1, 2016, leads to the following static checker warning:

	fs/btrfs/backref.c:277 ref_tree_add()
	error: dereferencing freed memory 'node'

fs/btrfs/backref.c
   271          origin_count = node->ref_mod;
   272          node->ref_mod += count;
   273  
   274          if (!node->ref_mod)
   275                  ref_tree_remove(ref_tree, node);
                                                  ^^^^
Freed here.

   276  
   277          if (node->ref_mod > 0)
                    ^^^^^^^^^^^^^
Use after free.

   278                  ref_tree->unique_refs += origin_count > 0 ? 0 : 1;
   279          else if (node->ref_mod <= 0)
   280                  ref_tree->unique_refs += origin_count > 0 ? -1 : 0;
   281  
   282          return 0;

regards,
dan carpenter

             reply	other threads:[~2016-06-07 17:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 17:18 Dan Carpenter [this message]
2016-06-08  1:10 ` btrfs: fix check_shared for fiemap ioctl Lu Fengqi

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=20160607171848.GA29093@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lufq.fnst@cn.fujitsu.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.