Module Name: src Committed By: pooka Date: Thu Sep 24 15:36:59 UTC 2009
Modified Files: src/sys/dev/usb: ugen.c Log Message: ugen_get_cdesc() can return NULL. When this happens, return the karmic EINVAL error instead of crashing. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/sys/dev/usb/ugen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/usb/ugen.c diff -u src/sys/dev/usb/ugen.c:1.103 src/sys/dev/usb/ugen.c:1.104 --- src/sys/dev/usb/ugen.c:1.103 Wed Sep 23 19:07:19 2009 +++ src/sys/dev/usb/ugen.c Thu Sep 24 15:36:59 2009 @@ -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;