Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jan 2002 10:48:32 -0800
From:      Alfred Perlstein <alfred@freebsd.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        current@freebsd.org
Subject:   Re: lock reversal in fdalloc()
Message-ID:  <20020131104831.E18604@elvis.mu.org>
In-Reply-To: <20020201043751.O5590-100000@gamplex.bde.org>; from bde@zeta.org.au on Fri, Feb 01, 2002 at 04:43:39AM %2B1100
References:  <20020201043751.O5590-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
* Bruce Evans <bde@zeta.org.au> [020131 09:42] wrote:
> Jan 31 18:27:29 gamplex kernel: lock order reversal
> Jan 31 18:27:29 gamplex kernel: 1st 0xc26ea034 filedesc structure @ ./@/kern/kern_descrip.c:925
> Jan 31 18:27:29 gamplex kernel: 2nd 0xc031eca0 Giant @ ./@/kern/kern_descrip.c:959
> 
> %%%
> Index: kern_descrip.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/kern/kern_descrip.c,v
> retrieving revision 1.122
> diff -u -2 -r1.122 kern_descrip.c
> --- kern_descrip.c	29 Jan 2002 22:54:19 -0000	1.122
> +++ kern_descrip.c	31 Jan 2002 07:32:43 -0000
> @@ -957,7 +967,9 @@
>  		fdexpand++;
>  		if (oldofile != NULL) {
> +			FILEDESC_UNLOCK(fdp);
>  			mtx_lock(&Giant);
>  			FREE(oldofile, M_FILEDESC);
>  			mtx_unlock(&Giant);
> +			FILEDESC_LOCK(fdp);
>  		}
>  	}
> %%%
> 
> I'm not sure that releasing the lock here is safe, but other parts of
> fdalloc() do this.

I don't think this is safe at a glance, I think it's only safe right
before return'ing from the function.  I'll look at it later tonight.

-Alfred

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020131104831.E18604>