Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/dev/usb Pull up following revision(s) (requested by m...



details:   https://anonhg.NetBSD.org/src/rev/4e1623da6d79
branches:  netbsd-9
changeset: 466589:4e1623da6d79
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Dec 29 11:13:48 2019 +0000

description:
Pull up following revision(s) (requested by mlelstv in ticket #590):

        sys/dev/usb/uvideo.c: revision 1.50
        sys/dev/usb/uvideo.c: revision 1.51
        sys/dev/usb/uvideo.c: revision 1.52

Avoid kmem_alloc(0,..), which hits an assertion.

PR kern/53734: Prevent kernel panic during Wide Vision FHD Camera detection
Check if size is zero, too.

PR kern/53734
we want to check that the allocation is going to be zero, not whether
some pointer is NULL (oops).

Should be the right version this time!

diffstat:

 sys/dev/usb/uvideo.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r bab9085954b0 -r 4e1623da6d79 sys/dev/usb/uvideo.c
--- a/sys/dev/usb/uvideo.c      Sun Dec 29 09:42:40 2019 +0000
+++ b/sys/dev/usb/uvideo.c      Sun Dec 29 11:13:48 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvideo.c,v 1.47 2019/05/05 03:17:54 mrg Exp $  */
+/*     $NetBSD: uvideo.c,v 1.47.2.1 2019/12/29 11:13:48 martin Exp $   */
 
 /*
  * Copyright (c) 2008 Patrick Mahoney
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.47 2019/05/05 03:17:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.47.2.1 2019/12/29 11:13:48 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -989,6 +989,9 @@
 uvideo_unit_alloc_controls(struct uvideo_unit *vu, uint8_t size,
                           const uint8_t *controls)
 {
+       if (size == 0)
+               return USBD_INVAL;
+
        vu->vu_controls = kmem_alloc(sizeof(*vu->vu_controls) * size, KM_SLEEP);
        vu->vu_control_size = size;
        memcpy(vu->vu_controls, controls, size);



Home | Main Index | Thread Index | Old Index