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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 9 Apr 2015 09:15:30 +0000
From:	Dexuan Cui <decui@...rosoft.com>
To:	Greg KH <gregkh@...uxfoundation.org>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"driverdev-devel@...uxdriverproject.org" 
	<driverdev-devel@...uxdriverproject.org>,
	"olaf@...fle.de" <olaf@...fle.de>,
	"apw@...onical.com" <apw@...onical.com>,
	"jasowang@...hat.com" <jasowang@...hat.com>,
	KY Srinivasan <kys@...rosoft.com>,
	"vkuznets@...hat.com" <vkuznets@...hat.com>,
	"dan.carpenter@...cle.com" <dan.carpenter@...cle.com>,
	Haiyang Zhang <haiyangz@...rosoft.com>
Subject: RE: [PATCH] hv: vmbus_free_channels(): remove the redundant
 free_channel()

> -----Original Message-----
> From: Greg KH [mailto:gregkh@...uxfoundation.org]
> Sent: Thursday, April 9, 2015 17:07
> To: Dexuan Cui
> Cc: linux-kernel@...r.kernel.org; driverdev-devel@...uxdriverproject.org;
> olaf@...fle.de; apw@...onical.com; jasowang@...hat.com; KY Srinivasan;
> vkuznets@...hat.com; dan.carpenter@...cle.com; Haiyang Zhang
> Subject: Re: [PATCH] hv: vmbus_free_channels(): remove the redundant
> free_channel()
> 
> On Wed, Apr 08, 2015 at 11:13:47PM -0700, Dexuan Cui wrote:
> > free_channel() has been invoked in
> > vmbus_remove() -> hv_process_channel_removal(), or vmbus_remove() ->
> > ... -> vmbus_close_internal() -> hv_process_channel_removal().
> >
> > We also change to use list_for_each_entry_safe(), because the entry
> > is removed in hv_process_channel_removal().
> >
> > Thank Dan Carpenter for finding the issue!
> >
> > Signed-off-by: Dexuan Cui <decui@...rosoft.com>
> > Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> > Cc: K. Y. Srinivasan <kys@...rosoft.com>
> > Cc: Vitaly Kuznetsov <vkuznets@...hat.com>
> > ---
> >  drivers/hv/channel_mgmt.c | 11 ++++++++---
> >  1 file changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
> > index 0eeb1b3..865a3af 100644
> > --- a/drivers/hv/channel_mgmt.c
> > +++ b/drivers/hv/channel_mgmt.c
> > @@ -212,11 +212,16 @@ void hv_process_channel_removal(struct
> vmbus_channel *channel, u32 relid)
> >
> >  void vmbus_free_channels(void)
> >  {
> > -	struct vmbus_channel *channel;
> > +	struct vmbus_channel *channel, *tmp;
> > +
> > +	list_for_each_entry_safe(channel, tmp, &vmbus_connection.chn_list,
> > +		listentry) {
> 
> Horrid indentation, never put continuations on a 1 tab stop location,
> you can't read this properly, right?
> 
> > +		/* if we don't set rescind to true, vmbus_close_internal()
> > +		 * won't invoke hv_process_channel_removal().
> > +		 */
> > +		channel->rescind = true;
> 
> You are changing the logic here, right?  Why do you now need the _safe()
> call if you aren't freeing anything?
> 
> confused,
> 
> greg k-h

Hi Greg,
vmbus_device_unregister() invokes device_unregister() -> vmbus_remove() ->
hv_process_channel_removal() -- in this function, we remove the entry from
the list:
list_del(&channel->listentry)
and we run free_channel(channel).

Thanks,
-- Dexuan
--
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