lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150420181707.GD4206@htj.duckdns.org>
Date:	Mon, 20 Apr 2015 14:17:07 -0400
From:	Tejun Heo <tj@...nel.org>
To:	Jan Kara <jack@...e.cz>
Cc:	axboe@...nel.dk, linux-kernel@...r.kernel.org, hch@...radead.org,
	hannes@...xchg.org, linux-fsdevel@...r.kernel.org,
	vgoyal@...hat.com, lizefan@...wei.com, cgroups@...r.kernel.org,
	linux-mm@...ck.org, mhocko@...e.cz, clm@...com,
	fengguang.wu@...el.com, david@...morbit.com, gthelen@...gle.com
Subject: Re: [PATCH 15/49] writeback: move backing_dev_info->wb_lock and
 ->worklist into bdi_writeback

Hello, Jan.

On Mon, Apr 20, 2015 at 05:32:24PM +0200, Jan Kara wrote:
> > @@ -454,9 +451,9 @@ EXPORT_SYMBOL(bdi_init);
> >  
> >  void bdi_destroy(struct backing_dev_info *bdi)
> >  {
> > -	bdi_wb_shutdown(bdi);
> > -
> > -	WARN_ON(!list_empty(&bdi->work_list));
> > +	/* make sure nobody finds us on the bdi_list anymore */
> > +	bdi_remove_from_list(bdi);
> > +	wb_shutdown(&bdi->wb);
> >  
> >  	if (bdi->dev) {
> >  		bdi_debug_unregister(bdi);
>   But if someone ends up calling bdi_destroy() on unregistered bdi,
> bdi_remove_from_list() will be corrupting memory, won't it? And if I

bdi_init() does INIT_LIST_HEAD() on it, so it should be fine, no?

> remember right there were some corner cases where this really happened.
> Previously we were careful and checked WB_registered. I guess we could
> check for !list_empty(&bdi->bdi_list) and also reinit bdi_list in
> bdi_remove_from_list() after synchronize_rcu_expedited().

But we can't call bdi_destroy() more than once no matter what.  We'd
be doing double frees.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ