Module Name:    src
Committed By:   bouyer
Date:           Thu Apr 20 17:29:10 UTC 2017

Modified Files:
        src/sys/netcan [bouyer-socketcan]: can.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/netcan/can.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/netcan/can.c
diff -u src/sys/netcan/can.c:1.1.2.11 src/sys/netcan/can.c:1.1.2.12
--- src/sys/netcan/can.c:1.1.2.11	Thu Apr 20 12:59:11 2017
+++ src/sys/netcan/can.c	Thu Apr 20 17:29:10 2017
@@ -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 @@ canintr(void)
 			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;
 			}

Reply via email to