mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
netfilter: fix regression in looped (broad|multi)cast's MAC handling
[ Upstream commitebb966d3bd
] In commit5648b5e116
("netfilter: nfnetlink_queue: fix OOB when mac header was cleared"), the test for non-empty MAC header introduced in commit2c38de4c1f
("netfilter: fix looped (broad|multi)cast's MAC handling") has been replaced with a test for a set MAC header. This breaks the case when the MAC header has been reset (using skb_reset_mac_header), as is the case with looped-back multicast packets. As a result, the packets ending up in NFQUEUE get a bogus hwaddr interpreted from the first bytes of the IP header. This patch adds a test for a non-empty MAC header in addition to the test for a set MAC header. The same two tests are also implemented in nfnetlink_log.c, where the initial code of commit2c38de4c1f
("netfilter: fix looped (broad|multi)cast's MAC handling") has not been touched, but where supposedly the same situation may happen. Fixes:5648b5e116
("netfilter: nfnetlink_queue: fix OOB when mac header was cleared") Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr> Reviewed-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
d53456492b
commit
a44aa23f78
2 changed files with 4 additions and 2 deletions
|
@ -510,7 +510,8 @@ __build_packet_message(struct nfnl_log_net *log,
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (indev && skb->dev &&
|
if (indev && skb->dev &&
|
||||||
skb->mac_header != skb->network_header) {
|
skb_mac_header_was_set(skb) &&
|
||||||
|
skb_mac_header_len(skb) != 0) {
|
||||||
struct nfulnl_msg_packet_hw phw;
|
struct nfulnl_msg_packet_hw phw;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
|
|
@ -543,7 +543,8 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (indev && entskb->dev &&
|
if (indev && entskb->dev &&
|
||||||
skb_mac_header_was_set(entskb)) {
|
skb_mac_header_was_set(entskb) &&
|
||||||
|
skb_mac_header_len(entskb) != 0) {
|
||||||
struct nfqnl_msg_packet_hw phw;
|
struct nfqnl_msg_packet_hw phw;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue