[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4734E962.3010603@trash.net>
Date: Sat, 10 Nov 2007 00:12:34 +0100
From: Patrick McHardy <kaber@...sh.net>
To: "Luis R. Rodriguez" <mcgrof@...il.com>
CC: Joe Perches <joe@...ches.com>, netdev@...r.kernel.org,
linux-wireless@...r.kernel.org, Jeff Garzik <jeff@...zik.org>,
David Miller <davem@...emloft.net>
Subject: Re: [PATCH] Fix infinite loop on dev_mc_unsync()
Luis R. Rodriguez wrote:
> diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
> index 15241cf..2aea8e1 100644
> --- a/net/core/dev_mcast.c
> +++ b/net/core/dev_mcast.c
> @@ -160,14 +160,12 @@ EXPORT_SYMBOL(dev_mc_sync);
> */
> void dev_mc_unsync(struct net_device *to, struct net_device *from)
> {
> - struct dev_addr_list *da, *next;
> + struct dev_addr_list *da;
>
> netif_tx_lock_bh(from);
> netif_tx_lock_bh(to);
>
> - da = from->mc_list;
> - while (da != NULL) {
> - next = da->next;
> + for (da = from->mc_list; da; da = da->next) {
>
This may cause a use-after-free since __dev_addr_delete frees the address
when all references are gone.
> if (!da->da_synced)
> continue;
> __dev_addr_delete(&to->mc_list, &to->mc_count,
> @@ -175,7 +173,6 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from)
> da->da_synced = 0;
> __dev_addr_delete(&from->mc_list, &from->mc_count,
> da->da_addr, da->da_addrlen, 0);
> - da = next;
> }
>
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists