Source-Changes-HG archive

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

[src/trunk]: src/sys/dev ccd(4): Only pathbuf_destroy if pathbuf_copyin succe...



details:   https://anonhg.NetBSD.org/src/rev/eb512b7fc88f
branches:  trunk
changeset: 363444:eb512b7fc88f
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Mar 12 17:27:50 2022 +0000

description:
ccd(4): Only pathbuf_destroy if pathbuf_copyin succeeded.

Reported-by: syzbot+a46aadc788a80afc8742%syzkaller.appspotmail.com@localhost

diffstat:

 sys/dev/ccd.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 00015d1ca9c9 -r eb512b7fc88f sys/dev/ccd.c
--- a/sys/dev/ccd.c     Sat Mar 12 17:23:32 2022 +0000
+++ b/sys/dev/ccd.c     Sat Mar 12 17:27:50 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ccd.c,v 1.186 2022/02/11 23:20:09 riastradh Exp $      */
+/*     $NetBSD: ccd.c,v 1.187 2022/03/12 17:27:50 riastradh Exp $      */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.186 2022/02/11 23:20:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.187 2022/03/12 17:27:50 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1313,8 +1313,8 @@
                        error = pathbuf_copyin(cpp[i], &pb);
                        if (error == 0) {
                                error = vn_bdev_openpath(pb, &vpp[i], l);
+                               pathbuf_destroy(pb);
                        }
-                       pathbuf_destroy(pb);
                        if (error != 0) {
                                for (j = 0; j < lookedup; ++j)
                                        (void)vn_close(vpp[j], FREAD|FWRITE,



Home | Main Index | Thread Index | Old Index