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 3DAD22D7393; Thu, 30 Jul 2026 14:53:14 +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=1785423195; cv=none; b=pg90kJeJf1CrthQ6KpYngt7fsEskPZsbl3vNBrUqpmX5AROsKjYoacWi0nFrs8tHAQt7s57PrHzDXtI8Cm04Z/IS1UYw0dUjT2tqgEeo0jhqmKLhYtz7IWlCwB+TjKktVn4BNXxrL2ObwfcoNe/uTpu+6iZviz0kaOBUwHxF7cE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785423195; c=relaxed/simple; bh=AP3+XpzRs7Kzgj42Am8dkHxkDQWXARgyonQF6ve+I64=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=coQjRpyvN7tPf3iDTPejli/osSvNVOzg/gM+V/kBxjdz4HO7Cri9KKzWn2BysYZ1/KoaM2rtF2+1q62qsQl1UQDZGygJN7AvvK8Lnlb6u950KQf3pR25okk0YcqP9CPT1ZAf7I+CyNxjHdzCl2FN+3kncUqwGPWhM405Efi8IK4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0ES4tnkk; 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="0ES4tnkk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E7701F000E9; Thu, 30 Jul 2026 14:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785423193; bh=VPs2p5ilDsBphDLzkgMEQz+nsDPuR4WlFeWJMdiyDyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=0ES4tnkkJKo65lUmbJ/5yk2/SklF12zfIH8sousv979TRRfOOgpgSG87P11DDW/oR gWp/AfAklZJ7m4yEtWBTQZVSym7usHBkxTIGy4WuATsuGxm/1HQIx06jcHtAreCH5V RlJ3inZyE/8k0vOP5GrQRoYUzuER26Y5bk3jnJLQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Doruk Tan Ozturk , Fernando Fernandez Mancera , Jakub Kicinski Subject: [PATCH 7.1 654/744] vxlan: require CAP_NET_ADMIN in the device netns for changelink Date: Thu, 30 Jul 2026 16:15:27 +0200 Message-ID: <20260730141458.170063620@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141444.267951807@linuxfoundation.org> References: <20260730141444.267951807@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Doruk Tan Ozturk commit 3a61bd9637f3d929aa846e4eb3d98b48c26fcb0e upstream. A tunnel changelink() operates on at most two netns, dev_net(dev) and the sticky underlay netns vxlan->net. They differ once the device is created in or moved to a netns other than the one the request runs in. The rtnl changelink path checks CAP_NET_ADMIN only against dev_net(dev), so a caller privileged there but not in vxlan->net can rewrite a vxlan device whose underlay lives in vxlan->net. vxlan_changelink() validates and applies the new configuration against vxlan->net (vxlan_config_validate(vxlan->net, ...)) and can reopen the underlay socket in that netns, so the same reasoning as the tunnel changelink series applies here. Gate vxlan_changelink() with rtnl_dev_link_net_capable(), at the top of the op before any attribute is parsed, matching ipgre_changelink() and the rest of the "require CAP_NET_ADMIN in the device netns for changelink" series. Found by 0sec automated security-research tooling (https://0sec.ai). Fixes: 8bcdc4f3a20b ("vxlan: add changelink support") Cc: stable@vger.kernel.org Signed-off-by: Doruk Tan Ozturk Reviewed-by: Fernando Fernandez Mancera Link: https://patch.msgid.link/20260716203500.70573-2-doruk@0sec.ai Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/vxlan/vxlan_core.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -4422,6 +4422,9 @@ static int vxlan_changelink(struct net_d struct vxlan_rdst *dst; int err; + if (!rtnl_dev_link_net_capable(dev, vxlan->net)) + return -EPERM; + dst = &vxlan->default_dst; err = vxlan_nl2conf(tb, data, dev, &conf, true, extack); if (err)