summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2004-06-25 21:11:14 +0000
committerjulian <julian@FreeBSD.org>2004-06-25 21:11:14 +0000
commitcf606d5f29ba03ae7d84a2c5e7458dbfb7db2d36 (patch)
tree64aaf07e387c6e0f8cc1eae22b2a1376c18d7014 /sys/netgraph
parent2cf7db632c6326199a2eec3a4d6b3ee8f4acac92 (diff)
downloadFreeBSD-src-cf606d5f29ba03ae7d84a2c5e7458dbfb7db2d36.zip
FreeBSD-src-cf606d5f29ba03ae7d84a2c5e7458dbfb7db2d36.tar.gz
Make the frameworkl responsible for not passing the nodes a NULL mbuf pointer.
this allows the nodes to not test for this.. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru>
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/ng_UI.c4
-rw-r--r--sys/netgraph/ng_base.c7
-rw-r--r--sys/netgraph/ng_eiface.c5
-rw-r--r--sys/netgraph/ng_iface.c2
-rw-r--r--sys/netgraph/ng_rfc1490.c4
-rw-r--r--sys/netgraph/ng_sppp.c2
6 files changed, 11 insertions, 13 deletions
diff --git a/sys/netgraph/ng_UI.c b/sys/netgraph/ng_UI.c
index f1e16d7..085804f 100644
--- a/sys/netgraph/ng_UI.c
+++ b/sys/netgraph/ng_UI.c
@@ -178,8 +178,8 @@ ng_UI_rcvdata(hook_p hook, item_p item)
if (hook == priv->downlink) {
u_char *start, *ptr;
- if (!m || (m->m_len < MAX_ENCAPS_HDR
- && !(m = m_pullup(m, MAX_ENCAPS_HDR))))
+ if (m->m_len < MAX_ENCAPS_HDR
+ && !(m = m_pullup(m, MAX_ENCAPS_HDR)))
ERROUT(ENOBUFS);
ptr = start = mtod(m, u_char *);
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
index f50f5f2..0616176 100644
--- a/sys/netgraph/ng_base.c
+++ b/sys/netgraph/ng_base.c
@@ -2139,6 +2139,13 @@ ng_snd_item(item_p item, int queue)
* the node is derivable from the hook.
* References are held on both by the item.
*/
+
+ /* Protect nodes from sending NULL pointers
+ * to each other
+ */
+ if (m == NULL)
+ return (EINVAL);
+
CHECK_DATA_MBUF(NGI_M(item));
if (hook == NULL) {
NG_FREE_ITEM(item);
diff --git a/sys/netgraph/ng_eiface.c b/sys/netgraph/ng_eiface.c
index 5df3457..aad1365 100644
--- a/sys/netgraph/ng_eiface.c
+++ b/sys/netgraph/ng_eiface.c
@@ -587,11 +587,6 @@ ng_eiface_rcvdata(hook_p hook, item_p item)
/* Meta-data ends its life here... */
NG_FREE_ITEM(item);
- if (m == NULL)
- {
- printf("ng_eiface: mbuf is null.\n");
- return (EINVAL);
- }
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
NG_FREE_M(m);
return (ENETDOWN);
diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c
index 078c235..c25477a 100644
--- a/sys/netgraph/ng_iface.c
+++ b/sys/netgraph/ng_iface.c
@@ -746,8 +746,6 @@ ng_iface_rcvdata(hook_p hook, item_p item)
/* Sanity checks */
KASSERT(iffam != NULL, ("%s: iffam", __func__));
M_ASSERTPKTHDR(m);
- if (m == NULL)
- return (EINVAL);
if ((ifp->if_flags & IFF_UP) == 0) {
NG_FREE_M(m);
return (ENETDOWN);
diff --git a/sys/netgraph/ng_rfc1490.c b/sys/netgraph/ng_rfc1490.c
index 451828d..ab6b415 100644
--- a/sys/netgraph/ng_rfc1490.c
+++ b/sys/netgraph/ng_rfc1490.c
@@ -316,8 +316,8 @@ ng_rfc1490_rcvdata(hook_p hook, item_p item)
const u_char *start;
const u_char *ptr;
- if (!m || (m->m_len < MAX_ENCAPS_HDR
- && !(m = m_pullup(m, MAX_ENCAPS_HDR))))
+ if (m->m_len < MAX_ENCAPS_HDR
+ && !(m = m_pullup(m, MAX_ENCAPS_HDR)))
ERROUT(ENOBUFS);
ptr = start = mtod(m, const u_char *);
diff --git a/sys/netgraph/ng_sppp.c b/sys/netgraph/ng_sppp.c
index 8461f8b..3f3c97f 100644
--- a/sys/netgraph/ng_sppp.c
+++ b/sys/netgraph/ng_sppp.c
@@ -382,8 +382,6 @@ ng_sppp_rcvdata (hook_p hook, item_p item)
NG_FREE_ITEM (item);
/* Sanity checks */
KASSERT (m->m_flags & M_PKTHDR, ("%s: not pkthdr", __func__));
- if (m == NULL)
- return (EINVAL);
if ((pp->pp_if.if_flags & IFF_UP) == 0) {
NG_FREE_M (m);
return (ENETDOWN);
OpenPOWER on IntegriCloud