Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934062AbbDIJIJ (ORCPT ); Thu, 9 Apr 2015 05:08:09 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:38356 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755005AbbDIJHK (ORCPT ); Thu, 9 Apr 2015 05:07:10 -0400 Date: Thu, 9 Apr 2015 11:07:06 +0200 From: Greg KH To: Dexuan Cui Cc: linux-kernel@vger.kernel.org, driverdev-devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com, kys@microsoft.com, vkuznets@redhat.com, dan.carpenter@oracle.com, haiyangz@microsoft.com Subject: Re: [PATCH] hv: vmbus_free_channels(): remove the redundant free_channel() Message-ID: <20150409090706.GA28274@kroah.com> References: <1428560027-31918-1-git-send-email-decui@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1428560027-31918-1-git-send-email-decui@microsoft.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1822 Lines: 51 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 > Reported-by: Dan Carpenter > Cc: K. Y. Srinivasan > Cc: Vitaly Kuznetsov > --- > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/