[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241023105345.1376856-5-steffen.klassert@secunet.com>
Date: Wed, 23 Oct 2024 12:53:45 +0200
From: Steffen Klassert <steffen.klassert@...unet.com>
To: Tobias Brunner <tobias@...ongswan.org>, Antony Antony
<antony.antony@...unet.com>, Daniel Xu <dxu@...uu.xyz>, Paul Wouters
<paul@...ats.ca>, Simon Horman <horms@...nel.org>, Sabrina Dubroca
<sd@...asysnail.net>
CC: Steffen Klassert <steffen.klassert@...unet.com>, <netdev@...r.kernel.org>,
<devel@...ux-ipsec.org>
Subject: [PATCH v3 ipsec-next 4/4] xfrm: Restrict percpu SA attribute to specific netlink message types
Reject the usage of XFRMA_SA_PCPU in xfrm netlink messages when
it's not applicable.
Signed-off-by: Steffen Klassert <steffen.klassert@...unet.com>
---
net/xfrm/xfrm_user.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index a9d071c93836..7bf7c870b851 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -3276,6 +3276,20 @@ static int xfrm_reject_unused_attr(int type, struct nlattr **attrs,
}
}
+ if (attrs[XFRMA_SA_PCPU]) {
+ switch (type) {
+ case XFRM_MSG_NEWSA:
+ case XFRM_MSG_UPDSA:
+ case XFRM_MSG_ALLOCSPI:
+ case XFRM_MSG_ACQUIRE:
+
+ break;
+ default:
+ NL_SET_ERR_MSG(extack, "Invalid attribute SA_PCPU");
+ return -EINVAL;
+ }
+ }
+
return 0;
}
--
2.34.1
Powered by blists - more mailing lists