From: Daniel Hodges <git@danielhodges.dev>
To: sd@queasysnail.net, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Daniel Hodges <git@danielhodges.dev>,
syzbot+0e665e4b99cb925286a0@syzkaller.appspotmail.com
Subject: [PATCH] macsec: skip PACKET_LOOPBACK frames in macsec_handle_frame()
Date: Mon, 9 Feb 2026 11:28:51 -0500 [thread overview]
Message-ID: <20260209162851.11800-1-git@danielhodges.dev> (raw)
macsec_handle_frame() assumes all incoming frames have a valid Ethernet
header at skb_mac_header(skb) and reads hdr->eth.h_proto to determine
whether to process the frame as MACsec. However, loopback packets are
delivered with pkt_type PACKET_LOOPBACK and carry only a
protocol-specific header (e.g. 7-byte phonethdr), not a full Ethernet
header. Reading 14 bytes of ethhdr from such a short header results in a
slab-out-of-bounds / uninit-value access.
Fix this by returning RX_HANDLER_PASS early for PACKET_LOOPBACK frames,
consistent with how macvlan_handle_frame() handles this case.
Reported-by: syzbot+0e665e4b99cb925286a0@syzkaller.appspotmail.com
Fixes: c09440f7dcb3 ("macsec: introduce IEEE 802.1AE driver")
Signed-off-by: Daniel Hodges <git@danielhodges.dev>
---
drivers/net/macsec.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 0206b84284ab..edcc51f82327 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -1103,6 +1103,13 @@ static rx_handler_result_t macsec_handle_frame(struct sk_buff **pskb)
bool pulled_sci;
int ret;
+ /* Loopback packets (e.g. from phonet) don't have L2 headers, so
+ * attempting to interpret the mac header as Ethernet would read
+ * uninitialized memory. Let them pass through unmodified.
+ */
+ if (unlikely(skb->pkt_type == PACKET_LOOPBACK))
+ return RX_HANDLER_PASS;
+
if (skb_headroom(skb) < ETH_HLEN)
goto drop_direct;
--
2.52.0
next reply other threads:[~2026-02-09 16:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-09 16:28 Daniel Hodges [this message]
2026-02-09 17:35 ` [PATCH] macsec: skip PACKET_LOOPBACK frames in macsec_handle_frame() Eric Dumazet
2026-02-10 2:02 ` Daniel Hodges
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=20260209162851.11800-1-git@danielhodges.dev \
--to=git@danielhodges.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sd@queasysnail.net \
--cc=syzbot+0e665e4b99cb925286a0@syzkaller.appspotmail.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