From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36]) (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 84593370D4F for ; Fri, 12 Jun 2026 07:48:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.96.220.36 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781250496; cv=none; b=IunrlVTEDHAnteUB2XIX5tPcGmcm+BS1Gy06HwrIhmJbGxofYoBATyPF8bWFUSwgn1Wpmd6RY6XMzfgSKvvGP3OFzfCssEEsrsiWoLH8lcr6M3ywboF5BR74ddlcUx+RtPd0k9Ys5QdfuA0L6QCauNH2e7meI73BKXV0jwIUmLU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781250496; c=relaxed/simple; bh=8mDE0c1y7Un/Y0WmmamNTPkIMk+zvEDQUK/9TtVs92M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YXLvIcaF5pAzdkY2ZK1ys9uKCv/OCby9p4vq3R3On/StJpDll5VPmbqrrkB5wijurolxiSmTbDmoBU2dt/vzc0R3Lq2Nwfft1KGmkYtIJ6frWXDppvNCq1jTUDuUzHsPjtEkWnu4tVtmdAidfRiohoZz2qdF6PYsfcao9/ygHTI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b=AwcOX9yh; arc=none smtp.client-ip=62.96.220.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b="AwcOX9yh" Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id 5932220764; Fri, 12 Jun 2026 09:48:14 +0200 (CEST) X-Virus-Scanned: by secunet Received: from mx1.secunet.com ([127.0.0.1]) by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sQcK4_ctTxlW; Fri, 12 Jun 2026 09:48:13 +0200 (CEST) Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.secunet.com (Postfix) with ESMTPS id C9402206D2; Fri, 12 Jun 2026 09:48:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com C9402206D2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1781250493; bh=mutWTOTvOthvV9e/Q4zKFBCbXR0RKwZYlXNso7uCHB4=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=AwcOX9yhUEO6h/LHYdx1D0p8Y+M7PAth0lRQUE4LmsQqRAB+wZqnzvEk8i6R0vlj7 lOMgVMVa0Ouq8lqHg5QOg8NGiXQniMdkkyQIlCLT5XO96xLgHsURfesKW46LZdHcYA 0fp3GGOOnyvOrqF/h+5yLok34k67gkl7mfw9X/yN5qBc+hAYCpuxzwH9reASmpenwk VoSdc6O+9XSQfXmAkSgp8VnSWp4TdpxtzSHagQgWjQ22WbNesoWt9C3A/nf3w1bvhZ /FiM13cHdteVYq/IUHXqKCvbHZwMwq/wlX2b6FDVKvSuFcbNQcmWNLYpXk+Nx4b4X0 JIKB5NHvyr/Jw== Received: from secunet.com (10.182.7.193) by EXCH-01.secunet.de (10.32.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Fri, 12 Jun 2026 09:48:13 +0200 Received: (nullmailer pid 1768314 invoked by uid 1000); Fri, 12 Jun 2026 07:47:57 -0000 From: Steffen Klassert To: David Miller , Jakub Kicinski CC: Herbert Xu , Steffen Klassert , Subject: [PATCH 17/18] xfrm: restrict netlink attributes for XFRM_MSG_MIGRATE_STATE Date: Fri, 12 Jun 2026 09:46:33 +0200 Message-ID: <20260612074725.1760473-18-steffen.klassert@secunet.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260612074725.1760473-1-steffen.klassert@secunet.com> References: <20260612074725.1760473-1-steffen.klassert@secunet.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-02.secunet.de (10.32.0.172) To EXCH-01.secunet.de (10.32.0.171) From: Antony Antony Only accept XFRMA used in this method, reject the rest. Signed-off-by: Antony Antony Signed-off-by: Steffen Klassert --- net/xfrm/xfrm_user.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index b9fbb8d13c1a..e1010b5315e9 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -3788,6 +3788,30 @@ static int xfrm_reject_unused_attr(int type, struct nlattr **attrs, } } + if (type == XFRM_MSG_MIGRATE_STATE) { + int i; + + for (i = 0; i <= XFRMA_MAX; i++) { + if (!attrs[i]) + continue; + + switch (i) { + case XFRMA_MARK: + case XFRMA_ENCAP: + case XFRMA_OFFLOAD_DEV: + case XFRMA_SET_MARK: + case XFRMA_SET_MARK_MASK: + case XFRMA_MTIMER_THRESH: + case XFRMA_NAT_KEEPALIVE_INTERVAL: + break; + default: + NL_SET_ERR_MSG_ATTR(extack, attrs[i], + "Unsupported attribute in XFRM_MSG_MIGRATE_STATE"); + return -EINVAL; + } + } + } + return 0; } -- 2.43.0