From: Jens Axboe <axboe@fb.com>
To: Tejun Heo <tj@kernel.org>, Dmitry Vyukov <dvyukov@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
xiakaixu@huawei.com, Vlastimil Babka <vbabka@suse.cz>,
Joe Perches <joe@perches.com>,
Mel Gorman <mgorman@techsingularity.net>,
Michal Hocko <mhocko@suse.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
syzkaller <syzkaller@googlegroups.com>
Subject: Re: [PATCH] block: fix double-free in the failure path of cgwb_bdi_init()
Date: Wed, 8 Feb 2017 13:52:52 -0700 [thread overview]
Message-ID: <66bc2094-3f13-91da-41c2-78fa1e8a81e8@fb.com> (raw)
In-Reply-To: <20170208201907.GC25826@htj.duckdns.org>
On 02/08/2017 01:19 PM, Tejun Heo wrote:
> When !CONFIG_CGROUP_WRITEBACK, bdi has single bdi_writeback_congested
> at bdi->wb_congested. cgwb_bdi_init() allocates it with kzalloc() and
> doesn't do further initialization. This usually works fine as the
> reference count gets bumped to 1 by wb_init() and the put from
> wb_exit() releases it.
>
> However, when wb_init() fails, it puts the wb base ref automatically
> freeing the wb and the explicit kfree() in cgwb_bdi_init() error path
> ends up trying to free the same pointer the second time causing a
> double-free.
>
> Fix it by explicitly initilizing the refcnt to 1 and putting the base
> ref from cgwb_bdi_destroy().
Queued up for 4.11.
--
Jens Axboe
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2017-02-08 20:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 9:55 mm: double-free in cgwb_bdi_init Dmitry Vyukov
2017-02-08 20:19 ` [PATCH] block: fix double-free in the failure path of cgwb_bdi_init() Tejun Heo
2017-02-08 20:52 ` Jens Axboe [this message]
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=66bc2094-3f13-91da-41c2-78fa1e8a81e8@fb.com \
--to=axboe@fb.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@google.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=syzkaller@googlegroups.com \
--cc=tj@kernel.org \
--cc=vbabka@suse.cz \
--cc=xiakaixu@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox