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 (requested by mart...



details:   https://anonhg.NetBSD.org/src/rev/3f42abdfc14f
branches:  netbsd-9
changeset: 963938:3f42abdfc14f
user:      jdc <jdc%NetBSD.org@localhost>
date:      Thu Jun 11 11:03:22 2020 +0000

description:
Pull up following revision (requested by martin in ticket #958):

        src/sys/dev/usb/if_run.c: revision 1.41

Better bounds checking for oversized packets, to avoid kernel memory
corruption. Pointed out by Ilja Van Sprundel.

diffstat:

 sys/dev/usb/if_run.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 9bceba651f1d -r 3f42abdfc14f sys/dev/usb/if_run.c
--- a/sys/dev/usb/if_run.c      Thu Jun 11 11:01:20 2020 +0000
+++ b/sys/dev/usb/if_run.c      Thu Jun 11 11:03:22 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_run.c,v 1.32 2019/01/22 06:47:20 skrll Exp $        */
+/*     $NetBSD: if_run.c,v 1.32.4.1 2020/06/11 11:03:22 jdc Exp $      */
 /*     $OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $ */
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.32 2019/01/22 06:47:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.32.4.1 2020/06/11 11:03:22 jdc Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2255,7 +2255,8 @@
                return;
        }
        if (len > MHLEN) {
-               MCLGET(m, M_DONTWAIT);
+               if (__predict_true(len <= MCLBYTES))
+                       MCLGET(m, M_DONTWAIT);
                if (__predict_false(!(m->m_flags & M_EXT))) {
                        ifp->if_ierrors++;
                        m_freem(m);



Home | Main Index | Thread Index | Old Index