Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb upgt(4): Make upgt_free_cmd match upgt_alloc_cmd.



details:   https://anonhg.NetBSD.org/src/rev/b0df4d56c370
branches:  trunk
changeset: 368243:b0df4d56c370
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Jul 01 01:07:32 2022 +0000

description:
upgt(4): Make upgt_free_cmd match upgt_alloc_cmd.

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

diffstat:

 sys/dev/usb/if_upgt.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (37 lines):

diff -r 9e422d68785b -r b0df4d56c370 sys/dev/usb/if_upgt.c
--- a/sys/dev/usb/if_upgt.c     Fri Jul 01 01:06:51 2022 +0000
+++ b/sys/dev/usb/if_upgt.c     Fri Jul 01 01:07:32 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_upgt.c,v 1.32 2021/08/21 11:55:25 andvar Exp $      */
+/*     $NetBSD: if_upgt.c,v 1.33 2022/07/01 01:07:32 riastradh Exp $   */
 /*     $OpenBSD: if_upgt.c,v 1.49 2010/04/20 22:05:43 tedu Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_upgt.c,v 1.32 2021/08/21 11:55:25 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_upgt.c,v 1.33 2022/07/01 01:07:32 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2374,13 +2374,14 @@
 {
        struct upgt_data *data_cmd = &sc->cmd_data;
 
-       if (data_cmd->xfer != NULL) {
-               usbd_destroy_xfer(data_cmd->xfer);
-               data_cmd->xfer = NULL;
-       }
+       if (data_cmd->xfer == NULL)
+               return;
 
        mutex_destroy(&sc->sc_mtx);
        cv_destroy(&sc->sc_cv);
+
+       usbd_destroy_xfer(data_cmd->xfer);
+       data_cmd->xfer = NULL;
 }
 
 static int



Home | Main Index | Thread Index | Old Index