Re: [PATCH net] net: vlan: fix vlan name truncation
From: Paolo Abeni
Date: Thu Sep 10 2026 - 07:02:21 EST
On 9/4/26 11:00 PM, Janis Edvarts Lacis wrote:
> register_vlan_device() from net/8021q/vlan.c sets name based on a field
> name_type from struct vlan_net. If name_type is VLAN_NAME_TYPE_RAW_PLUS_VID
> or VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD, register_vlan_device() sets vlan
> device's name to the actual net_device's name and adds vid at the end of
> this name separated by a dot.
>
> Network interface's name is limited to at most 16 characters, including NUL.
> Therefore, if the real_dev->name is long enough, then adding the vid
> at the end of this name can lead to the result exceeding 16 bytes which
> leads to a truncated name for the vlan device created in register_vlan_device().
>
> This patch fixes the issue by returning -ENAMETOOLONG from
> register_vlan_device() if the newly created name does not fit in 16
> bytes.
I'm sorry, but I don't think we can accept this patch: this change an
user-space visible behavior: even if a strange one, existing applications
and/or setups may relay on it and they will be broken by this change.
/P