svn commit: r263690 - head/sys/kern

John-Mark Gurney jmg at funkthat.com
Mon Mar 24 18:59:51 UTC 2014


Maksim Yevmenkin wrote this message on Mon, Mar 24, 2014 at 18:13 +0000:
> Author: emax
> Date: Mon Mar 24 18:13:41 2014
> New Revision: 263690
> URL: http://svnweb.freebsd.org/changeset/base/263690
> 
> Log:
>   change defaule permissions on /dev/devstat. while i'm here remove
>   D_NEEDGIANT flag

I know that the following change is part of the remove D_NEEDGIANT, but
I'm puzzled how this code either worked before, or continues to work..

It looks like pagelist was suppose to be protected by devstat_mutex,
but previously wasn't and that this is fixing that bug, is this
correct?

> @@ -482,13 +481,16 @@ devstat_mmap(struct cdev *dev, vm_ooffse
>  
>  	if (nprot != VM_PROT_READ)
>  		return (-1);
> +	mtx_lock(&devstat_mutex);
>  	TAILQ_FOREACH(spp, &pagelist, list) {
>  		if (offset == 0) {
>  			*paddr = vtophys(spp->stat);
> +			mtx_unlock(&devstat_mutex);
>  			return (0);
>  		}
>  		offset -= PAGE_SIZE;
>  	}
> +	mtx_unlock(&devstat_mutex);
>  	return (-1);
>  }
>  

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."


More information about the svn-src-head mailing list