* re: ceph: set i_head_snapc when getting CEPH_CAP_FILE_WR reference
@ 2016-06-15 12:44 Dan Carpenter
2016-06-15 12:54 ` Yan, Zheng
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-06-15 12:44 UTC (permalink / raw)
To: zyan; +Cc: ceph-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: ceph: set i_head_snapc when getting CEPH_CAP_FILE_WR reference
2016-06-15 12:44 ceph: set i_head_snapc when getting CEPH_CAP_FILE_WR reference Dan Carpenter
@ 2016-06-15 12:54 ` Yan, Zheng
0 siblings, 0 replies; 2+ messages in thread
From: Yan, Zheng @ 2016-06-15 12:54 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Zheng Yan, ceph-devel
On Wed, Jun 15, 2016 at 8:44 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 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;
Fixed by https://github.com/ceph/ceph-client/commit/c17197fca778207cc24d434106b5b5b2f2a17c16
Thanks
Yan, Zheng
>
> regards,
> dan carpenter
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-15 12:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-15 12:44 ceph: set i_head_snapc when getting CEPH_CAP_FILE_WR reference Dan Carpenter
2016-06-15 12:54 ` Yan, Zheng
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.