Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/dev



On Wed, Jul 27, 2016 at 01:09:44AM +0000, Paul Goyette wrote:
> Module Name:	src
> Committed By:	pgoyette
> Date:		Wed Jul 27 01:09:44 UTC 2016
> 
> Modified Files:
> 	src/sys/dev: md.c
> 
> Log Message:
> If we're going to check for a NULL pointer, do the check before we
> dereference it (to get the lock address).
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.76 -r1.77 src/sys/dev/md.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 

> Modified files:
> 
> Index: src/sys/dev/md.c
> diff -u src/sys/dev/md.c:1.76 src/sys/dev/md.c:1.77
> --- src/sys/dev/md.c:1.76	Mon Jan  4 16:24:52 2016
> +++ src/sys/dev/md.c	Wed Jul 27 01:09:44 2016
> @@ -1,4 +1,4 @@
> -/*	$NetBSD: md.c,v 1.76 2016/01/04 16:24:52 hannken Exp $	*/
> +/*	$NetBSD: md.c,v 1.77 2016/07/27 01:09:44 pgoyette Exp $	*/
>  
>  /*
>   * Copyright (c) 1995 Gordon W. Ross, Leo Weppelman.
> @@ -40,7 +40,7 @@
>   */
>  
>  #include <sys/cdefs.h>
> -__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.76 2016/01/04 16:24:52 hannken Exp $");
> +__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.77 2016/07/27 01:09:44 pgoyette Exp $");
>  
>  #ifdef _KERNEL_OPT
>  #include "opt_md.h"
> @@ -414,13 +414,13 @@ mdstrategy(struct buf *bp)
>  
>  	sc = device_lookup_private(&md_cd, MD_UNIT(bp->b_dev));
>  
> -	mutex_enter(&sc->sc_lock);
> -
>  	if (sc == NULL || sc->sc_type == MD_UNCONFIGURED) {
>  		bp->b_error = ENXIO;
>  		goto done;
>  	}
>  
> +	mutex_enter(&sc->sc_lock);
> +
>  	switch (sc->sc_type) {
>  #if MEMORY_DISK_SERVER
>  	case MD_UMEM_SERVER:
> 

goto done; will exit mutex not entered now, I think.



Home | Main Index | Thread Index | Old Index