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>
This commit is contained in:
parent
45671a9eb6
commit
1cf3fa7934
@ -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 *);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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 *);
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user