NetBSD-Bugs archive

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

kern/51616: double unlock in ufs_extattr



>Number:         51616
>Category:       kern
>Synopsis:       double unlock in ufs_extattr
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 09 04:40:00 +0000 2016
>Originator:     David A. Holland
>Release:        NetBSD 7.99.40 (20161022)
>Organization:
>Environment:
System: n/a
Architecture: all
Machine: all
>Description:

ufs_extattr_rm has special-case logic to avoid double-locking an
attribute backing vnode when working on an attribute *for* the backing
vnode; but this logic is missing for the corresponding unlock, leading
to a double unlock and panic.

>How-To-Repeat:

code reading.

>Fix:

I would appreciate if one of the people who has been prodding this
code could eyeball this patch, just in case I'm missing something.


Index: ufs/ufs_extattr.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ufs/ufs_extattr.c,v
retrieving revision 1.47
diff -u -p -r1.47 ufs_extattr.c
--- ufs/ufs_extattr.c	7 Jul 2016 06:55:44 -0000	1.47
+++ ufs/ufs_extattr.c	9 Nov 2016 04:33:30 -0000
@@ -1589,7 +1589,8 @@ ufs_extattr_rm(struct vnode *vp, int att
 		error = ENXIO;
 
  vopunlock_exit:
-	VOP_UNLOCK(attribute->uele_backing_vnode);
+	if (attribute->uele_backing_vnode != vp)
+		VOP_UNLOCK(attribute->uele_backing_vnode);
 
 	return (error);
 }
Index: lfs/ulfs_extattr.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/lfs/ulfs_extattr.c,v
retrieving revision 1.13
diff -u -p -r1.13 ulfs_extattr.c
--- lfs/ulfs_extattr.c	7 Jul 2016 06:55:44 -0000	1.13
+++ lfs/ulfs_extattr.c	9 Nov 2016 04:33:30 -0000
@@ -1589,7 +1589,8 @@ ulfs_extattr_rm(struct vnode *vp, int at
 		error = ENXIO;
 
  vopunlock_exit:
-	VOP_UNLOCK(attribute->uele_backing_vnode);
+	if (attribute->uele_backing_vnode != vp)
+		VOP_UNLOCK(attribute->uele_backing_vnode);
 
 	return (error);
 }



Home | Main Index | Thread Index | Old Index