Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb ugen_get_cdesc() can return NULL. When this hap...



details:   https://anonhg.NetBSD.org/src/rev/580ec865bafd
branches:  trunk
changeset: 747612:580ec865bafd
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Sep 24 15:36:59 2009 +0000

description:
ugen_get_cdesc() can return NULL.  When this happens, return the
karmic EINVAL error instead of crashing.

diffstat:

 sys/dev/usb/ugen.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r ecfae9fcfad5 -r 580ec865bafd sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c        Thu Sep 24 14:53:36 2009 +0000
+++ b/sys/dev/usb/ugen.c        Thu Sep 24 15:36:59 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ugen.c,v 1.103 2009/09/23 19:07:19 plunky Exp $        */
+/*     $NetBSD: ugen.c,v 1.104 2009/09/24 15:36:59 pooka Exp $ */
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.103 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.104 2009/09/24 15:36:59 pooka Exp $");
 
 #include "opt_ugen_bulk_ra_wb.h"
 #include "opt_compat_netbsd.h"
@@ -1736,6 +1736,8 @@
                int error;
 
                cdesc = ugen_get_cdesc(sc, fd->ufd_config_index, &len);
+               if (cdesc == NULL)
+                       return (EINVAL);
                if (len > fd->ufd_size)
                        len = fd->ufd_size;
                iov.iov_base = (void *)fd->ufd_data;



Home | Main Index | Thread Index | Old Index