From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07E2C3F1ADA; Wed, 20 May 2026 16:59:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779296362; cv=none; b=BN7MXhFekbFkxcwgo2E4Dixju9Dfcnh4g+lMHtlgpGjcOiSC9jn0Ilw4KCy5DgkLVh9PdXhX8ufqP3jXnPSsWz85KFhNm+8WcrXCf0eAhOfsbyTvMU32cQWmn9kyufg/kChrHCJ1fiMVxFsrIJrQwwDQhlmJ7twaXBv7B/RtFU4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779296362; c=relaxed/simple; bh=5m6LzCHm1sVHsfke0OM1L0XhLa3HcUVtEBl9KueYdsQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BPewwvmn5NrfPTHhNyFC+gy4jxmOwoJhoDcsTEpqTwgoaxZ/fPrjW938lHn2l2np5rL3tJpEmTIZdFUpFoPpnAfwcWfiN//wrekQI5oNdll70oZBkfCPaESy+XAtykaMdpJr9BnSIIH5zZmI7WJirekjWF9AWw1sC47e4jH0U/g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=m4SK9gkx; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="m4SK9gkx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 655371F000E9; Wed, 20 May 2026 16:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779296360; bh=C8jdT0vOGbH8EPU44jd/llQY1G60dFRA2ULVlo6qKTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=m4SK9gkxt2Ftc0LqwIDSd9RWlg6dwYdi16fI3zMB0vBc8g2XJFe4k6IbWDFdhKFLL b/PX6Gvik05LWwLB6sTDv/o2gZc2bJB3f8KTRgwmtbPF+gUgVLIDOsh6mxhohqCCoN TnL9rz5uX6Gf+MjMpliUXPX8hD1GFKQ4Fvo2GxNg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dudu Lu , Vadim Fedorenko , Eric Dumazet , Paolo Abeni , Sasha Levin Subject: [PATCH 7.0 0769/1146] macvlan: fix macvlan_get_size() not reserving space for IFLA_MACVLAN_BC_CUTOFF Date: Wed, 20 May 2026 18:16:59 +0200 Message-ID: <20260520162205.618853580@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162148.390695140@linuxfoundation.org> References: <20260520162148.390695140@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dudu Lu [ Upstream commit fa92a77b0ed4d5f11a71665a232ac5a54a4b055d ] macvlan_get_size() does not account for IFLA_MACVLAN_BC_CUTOFF, but macvlan_fill_info() conditionally includes it when port->bc_cutoff != 1. This causes nla_put_s32() to fail with -EMSGSIZE when the netlink skb runs out of space, triggering a WARN_ON in rtnetlink and preventing the interface from being dumped. The bug can be reproduced with: ip link add macvlan0 link eth0 type macvlan mode bridge ip link set macvlan0 type macvlan bc_cutoff 0 ip -d link show macvlan0 # fails with -EMSGSIZE The bc_cutoff feature was added in commit 954d1fa1ac93 ("macvlan: Add netlink attribute for broadcast cutoff"), which added the nla_put_s32() call in macvlan_fill_info() but missed adding the corresponding nla_total_size(4) in macvlan_get_size(). A follow-up commit 55cef78c244d ("macvlan: add forgotten nla_policy for IFLA_MACVLAN_BC_CUTOFF") fixed the missing nla_policy entry but still did not fix the size calculation. Fixes: 954d1fa1ac93 ("macvlan: Add netlink attribute for broadcast cutoff") Signed-off-by: Dudu Lu Reviewed-by: Vadim Fedorenko Reviewed-by: Eric Dumazet Link: https://patch.msgid.link/20260413085349.73977-1-phx0fer@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/macvlan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 1bbb3868f51d2..3073d67d0dffc 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -1682,6 +1682,7 @@ static size_t macvlan_get_size(const struct net_device *dev) + macvlan_get_size_mac(vlan) /* IFLA_MACVLAN_MACADDR */ + nla_total_size(4) /* IFLA_MACVLAN_BC_QUEUE_LEN */ + nla_total_size(4) /* IFLA_MACVLAN_BC_QUEUE_LEN_USED */ + + nla_total_size(4) /* IFLA_MACVLAN_BC_CUTOFF */ ); } -- 2.53.0