Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Oct 2004 17:43:01 -0400 (EDT)
From:      Robert Watson <rwatson@freebsd.org>
To:        gnn@freebsd.org
Cc:        freebsd-net@freebsd.org
Subject:   Re: Locking fixes to IPv6 scope6.c
Message-ID:  <Pine.NEB.3.96L.1041021171458.10079V-100000@fledge.watson.org>
In-Reply-To: <m2is9b9fva.wl@minion.local.neville-neil.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 16 Oct 2004 gnn@freebsd.org wrote:

> @@ -71,12 +71,14 @@
>  scope6_ifattach(ifp)
>  	struct ifnet *ifp;
>  {
> -	int s = splnet();
> +
>  	struct scope6_id *sid;
>  
>  	sid = (struct scope6_id *)malloc(sizeof(*sid), M_IFADDR, M_WAITOK);
>  	bzero(sid, sizeof(*sid));
>  
> +	IFNET_WLOCK();
> +
>  	/*
>  	 * XXX: IPV6_ADDR_SCOPE_xxx macros are not standard.
>  	 * Should we rather hardcode here?

I notice that the comments indicate that you acquire the ifnet list lock
to prevent the ifnet from going away; however, the caller passes in an
ifnet pointer.  Shouldn't it be the responsibility of the caller to make
sure the ifnet doesn't go away, or it could go away before you could
aquire the lock?  I.e., either by virtue of the ifnet life cycle, or by
virtue of the caller locking the list and these functions asserting it?

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert@fledge.watson.org      Principal Research Scientist, McAfee Research



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1041021171458.10079V-100000>