Thread (6 messages) flat view 6 messages, 4 authors, 6d ago

Re: [syzbot] [net?] WARNING in rtmsg_ifinfo_build_skb

From: Hangbin Liu <hidden>
Date: 2026-08-19 08:06:26
Also in: lkml

Hi Sabrina,

Wish you all well.

On Sat, Aug 15, 2026 at 01:14:01AM +0200, Sabrina Dubroca wrote:
quoted
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index ee0e2eb7dbc61c1affe4b0203337f2fdaeaa031c..0844f551d3be696bad72a8322fa4ea1bf9ccf105
100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -4402,7 +4402,7 @@ static int macsec_fill_info(struct sk_buff *skb,
                csid = secy->xpn ? MACSEC_CIPHER_ID_GCM_AES_XPN_256 :
MACSEC_CIPHER_ID_GCM_AES_256;
                break;
        default:
-               goto nla_put_failure;
+               return 0;
        }
It's not possible to create a macsec device with a key length other
than those 2, but it's true that returning -EMSGSIZE in this case is
not correct (-EINVAL + DEBUG_NET_WARN_ON_ONCE I guess).

The real problem is that we register the netdev before private data
has been fully initialized (macsec_newlink calls register_netdevice,
then macsec_add_dev), so we end up reaching fill_info before key_len
has been set.

So I think we should run macsec_add_dev before registering (and maybe
move those allocs to ndo_init), and possibly macsec_changelink_common
too. Setting the sci was intentionally done late, so this bit should
stay where it is.
IIRC, we talked about this issue some time ago, but I forgot to fix it.

Sorry, I also have to leave it to you to fix it. But feel free to tell me
if you are too busy.

Best Regards
Hangbin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help