From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wang Chen Subject: Re: v3 [PATCH net-next 4/7] ipv6: Check return of dev_set_allmulti Date: Mon, 07 Jul 2008 22:45:52 +0800 Message-ID: <48722C20.10801@cn.fujitsu.com> References: <48718014.4030009@cn.fujitsu.com> <4871814A.2070707@cn.fujitsu.com> <4871FBFC.2050408@trash.net> <48721780.9060103@cn.fujitsu.com> <48721984.8060202@trash.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: "David S. Miller" , NETDEV , YOSHIFUJI Hideaki To: Patrick McHardy Return-path: Received: from cn.fujitsu.com ([222.73.24.84]:57669 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1750804AbYGGOuq (ORCPT ); Mon, 7 Jul 2008 10:50:46 -0400 In-Reply-To: <48721984.8060202@trash.net> Sender: netdev-owner@vger.kernel.org List-ID: Patrick McHardy said the following on 2008-7-7 21:26: > Wang Chen wrote: >> Patrick McHardy said the following on 2008-7-7 19:20: >>>> @@ -627,13 +633,14 @@ static int mif6_add(struct mif6ctl *vifc, int >>>> mrtsock) >>>> if (!dev) >>>> return -EADDRNOTAVAIL; >>>> dev_put(dev); >>>> + err = dev_set_allmulti(dev, 1); >>>> + if (err) >>>> + return err; >>> The use of dev after putting it looks wrong, but thats already >>> present before your patch. So ACK for your patch, but we need >>> a fix on top. >>> >> >> Wait a moment :) >> --- >> case 0: >> dev = dev_get_by_index(&init_net, vifc->mif6c_pifi); >> if (!dev) >> return -EADDRNOTAVAIL; >> dev_put(dev); >> --- >> dev_get_by_index() holds the dev, so I think dev_put() just for hold/put >> balance. > > Sure, but its used after dropping the reference again. If so, my patch wrong. Because, > dev = ip6mr_reg_vif(); > if (!dev) > return -ENOBUFS; here, needs dev_hold(dev) also. so, I think I should fix it in this patch too, not a fix on top. How do you think, Patrick? > + err = dev_set_allmulti(dev, 1); > + if (err) { > + unregister_netdevice(dev); > + return err; > + } > break;