From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, alex.aring@gmail.com,
jukka.rissanen@linux.intel.com,
Willem de Bruijn <willemb@google.com>
Subject: [PATCH net] ieee802154: lowpan_header_create check must check daddr
Date: Sun, 23 Dec 2018 12:52:18 -0500 [thread overview]
Message-ID: <20181223175218.165576-1-willemdebruijn.kernel@gmail.com> (raw)
From: Willem de Bruijn <willemb@google.com>
Packet sockets may call dev_header_parse with NULL daddr. Make
lowpan_header_ops.create fail.
Fixes: 87a93e4eceb4 ("ieee802154: change needed headroom/tailroom")
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
Re: function comment on packet socket address length: that is (now)
verified to be at least dev->addr_len.
It is customary to return -header_len on failure in .create(), but
not sure what that would be here, and any negative value is treated
the same by callers, so returning -EINVAL.
Is the return 0 on !ETH_P_IPV6 intentional, or should that also be
negative?
---
net/ieee802154/6lowpan/tx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ieee802154/6lowpan/tx.c b/net/ieee802154/6lowpan/tx.c
index ca53efa17be1..8bec827081cd 100644
--- a/net/ieee802154/6lowpan/tx.c
+++ b/net/ieee802154/6lowpan/tx.c
@@ -48,6 +48,9 @@ int lowpan_header_create(struct sk_buff *skb, struct net_device *ldev,
const struct ipv6hdr *hdr = ipv6_hdr(skb);
struct neighbour *n;
+ if (!daddr)
+ return -EINVAL;
+
/* TODO:
* if this package isn't ipv6 one, where should it be routed?
*/
--
2.20.1.415.g653613c723-goog
next reply other threads:[~2018-12-23 17:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-23 17:52 Willem de Bruijn [this message]
2018-12-23 20:45 ` [PATCH net] ieee802154: lowpan_header_create check must check daddr Alexander Aring
2018-12-23 20:53 ` Alexander Aring
2018-12-24 0:45 ` Willem de Bruijn
2018-12-24 15:21 ` Alexander Aring
2018-12-24 22:33 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181223175218.165576-1-willemdebruijn.kernel@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=alex.aring@gmail.com \
--cc=davem@davemloft.net \
--cc=jukka.rissanen@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox