[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <66bc2094-3f13-91da-41c2-78fa1e8a81e8@fb.com>
Date: Wed, 8 Feb 2017 13:52:52 -0700
From: Jens Axboe <axboe@...com>
To: Tejun Heo <tj@...nel.org>, Dmitry Vyukov <dvyukov@...gle.com>
CC: Andrew Morton <akpm@...ux-foundation.org>, <xiakaixu@...wei.com>,
Vlastimil Babka <vbabka@...e.cz>,
Joe Perches <joe@...ches.com>,
Mel Gorman <mgorman@...hsingularity.net>,
Michal Hocko <mhocko@...e.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
syzkaller <syzkaller@...glegroups.com>
Subject: Re: [PATCH] block: fix double-free in the failure path of
cgwb_bdi_init()
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
Powered by blists - more mailing lists