summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2009-08-09 20:10:09 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2009-08-09 20:10:09 +0000
commita7c3409c62f87e1b1f48342c5ca71020b8fe76ac (patch)
tree7d554670fce72709ec38119b2ed99b7ecf9ffb90 /sys/dev
parent402fffbb11a6b188778cb92fe058a62543b1642e (diff)
Check if the command buffer has been allocated before we free it. Fixes
a possible page fault trap while device detach.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/udl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/usb/udl.c b/sys/dev/usb/udl.c
index 35ee1fdab99..487416baece 100644
--- a/sys/dev/usb/udl.c
+++ b/sys/dev/usb/udl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udl.c,v 1.21 2009/08/02 10:38:34 miod Exp $ */
+/* $OpenBSD: udl.c,v 1.22 2009/08/09 20:10:08 mglocker Exp $ */
/*
* Copyright (c) 2009 Marcus Glocker <mglocker@openbsd.org>
@@ -872,7 +872,10 @@ udl_cmd_free_buf(struct udl_softc *sc)
{
struct udl_cmd_buf *cb = &sc->sc_cmd_buf;
- free(cb->buf, M_DEVBUF);
+ if (cb->buf != NULL) {
+ free(cb->buf, M_DEVBUF);
+ cb->buf = NULL;
+ }
cb->off = 0;
}