diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-07-04 12:42:31 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-07-04 12:42:31 +0000 |
commit | 704492537f64a08df6c276938b4102e9e47edb8b (patch) | |
tree | b774ff9edec99be8f4741b018869c5c2f57f0ee7 /sys | |
parent | 103f70c7a5df37a37daa355f32f4f8c8fbe8aaec (diff) |
Do not try to unlock the fdplock() in an error path if it isn't held.
Found the hardway by mlarkin@, ok bluhm@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/diskmap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/diskmap.c b/sys/dev/diskmap.c index 2c9ecfdfb62..d13763d5d78 100644 --- a/sys/dev/diskmap.c +++ b/sys/dev/diskmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diskmap.c,v 1.21 2018/07/03 05:50:46 mpi Exp $ */ +/* $OpenBSD: diskmap.c,v 1.22 2018/07/04 12:42:30 mpi Exp $ */ /* * Copyright (c) 2009, 2010 Joel Sing <jsing@openbsd.org> @@ -86,7 +86,7 @@ diskmapioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) NDINIT(&ndp, 0, 0, UIO_SYSSPACE, devname, p); ndp.ni_pledge = PLEDGE_RPATH; if ((error = vn_open(&ndp, fp0->f_flag, 0)) != 0) - goto bad; + goto invalid; vp = ndp.ni_vp; VOP_UNLOCK(vp); @@ -138,10 +138,10 @@ bad: if (vp) vrele(vp); +invalid: if (fp0) FRELE(fp0, p); -invalid: free(devname, M_DEVBUF, PATH_MAX); return (error); |