All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: zyan@redhat.com
Cc: ceph-devel@vger.kernel.org
Subject: re: ceph: set i_head_snapc when getting CEPH_CAP_FILE_WR reference
Date: Wed, 15 Jun 2016 15:44:18 +0300	[thread overview]
Message-ID: <20160615124418.GA11243@mwanda> (raw)

Hello Yan, Zheng,

The patch 5dda377cf0a6: "ceph: set i_head_snapc when getting
CEPH_CAP_FILE_WR reference" from Apr 30, 2015, leads to the following
static checker warning:

	fs/ceph/snap.c:557 ceph_queue_cap_snap()
	error: potential NULL dereference 'old_snapc'.

fs/ceph/snap.c
   547          /* dirty page count moved from _head to this cap_snap;
   548             all subsequent writes page dirties occur _after_ this
   549             snapshot. */
   550          capsnap->dirty_pages = ci->i_wrbuffer_ref_head;
   551          ci->i_wrbuffer_ref_head = 0;
   552          capsnap->context = old_snapc;
   553          list_add_tail(&capsnap->ci_item, &ci->i_cap_snaps);
   554          old_snapc = NULL;
                ^^^^^^^^^^^^^^^^^
   555  
   556          if (used & CEPH_CAP_FILE_WR) {
   557                  dout("queue_cap_snap %p cap_snap %p snapc %p"
   558                       " seq %llu used WR, now pending\n", inode,
   559                       capsnap, old_snapc, old_snapc->seq);
                                                 ^^^^^^^^^^^^^^
This is a NULL deref.

   560                  capsnap->writing = 1;
   561          } else {
   562                  /* note mtime, size NOW. */
   563                  __ceph_finish_cap_snap(ci, capsnap);
   564          }
   565          capsnap = NULL;

regards,
dan carpenter

             reply	other threads:[~2016-06-15 12:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 12:44 Dan Carpenter [this message]
2016-06-15 12:54 ` ceph: set i_head_snapc when getting CEPH_CAP_FILE_WR reference Yan, Zheng

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=20160615124418.GA11243@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=zyan@redhat.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.