Source-Changes-HG archive

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

[src/bouyer-socketcan]: src/sys/netcan If a packet was sent using sendto, the...



details:   https://anonhg.NetBSD.org/src/rev/a7aefc167cf5
branches:  bouyer-socketcan
changeset: 820896:a7aefc167cf5
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu Apr 20 17:29:10 2017 +0000

description:
If a packet was sent using sendto, the socket pointed to by the tag may
be unbound. Check for this in canintr().
XXX possibly the socket can completely dissapear before we get here.
This needs to be revisited.

diffstat:

 sys/netcan/can.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 718d768f74c4 -r a7aefc167cf5 sys/netcan/can.c
--- a/sys/netcan/can.c  Thu Apr 20 13:00:52 2017 +0000
+++ b/sys/netcan/can.c  Thu Apr 20 17:29:10 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: can.c,v 1.1.2.11 2017/04/20 12:59:11 bouyer Exp $      */
+/*     $NetBSD: can.c,v 1.1.2.12 2017/04/20 17:29:10 bouyer Exp $      */
 
 /*-
  * Copyright (c) 2003, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: can.c,v 1.1.2.11 2017/04/20 12:59:11 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: can.c,v 1.1.2.12 2017/04/20 17:29:10 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -323,7 +323,8 @@
                        sender_canp = sotocanpcb(so);
                        m_tag_delete(m, sotag);
                        /* if the sender doesn't want loopback, don't do it */
-                       if (sender_canp->canp_flags & CANP_NO_LOOPBACK) {
+                       if (sender_canp &&
+                           (sender_canp->canp_flags & CANP_NO_LOOPBACK) != 0) {
                                m_freem(m);
                                continue;
                        }



Home | Main Index | Thread Index | Old Index