[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20230114205850.176370-2-pchelkin@ispras.ru>
Date: Sat, 14 Jan 2023 23:58:49 +0300
From: Fedor Pchelkin <pchelkin@...ras.ru>
To: stable@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Fedor Pchelkin <pchelkin@...ras.ru>,
Steffen Klassert <steffen.klassert@...unet.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Sasha Levin <sashal@...nel.org>,
Nicolas Dichtel <nicolas.dichtel@...nd.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Alexey Khoroshilov <khoroshilov@...ras.ru>,
lvc-project@...uxtesting.org,
syzbot+3d9866419b4aa8f985d6@...kaller.appspotmail.com
Subject: [PATCH 5.10 1/1] xfrm: fix rcu lock in xfrm_notify_userpolicy()
From: Nicolas Dichtel <nicolas.dichtel@...nd.com>
commit 93ec1320b0170d7a207eda2d119c669b673401ed upstream.
As stated in the comment above xfrm_nlmsg_multicast(), rcu read lock must
be held before calling this function.
Reported-by: syzbot+3d9866419b4aa8f985d6@...kaller.appspotmail.com
Fixes: 9856c3a129dd ("xfrm: notify default policy on update")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@...nd.com>
Signed-off-by: Steffen Klassert <steffen.klassert@...unet.com>
Signed-off-by: Fedor Pchelkin <pchelkin@...ras.ru>
---
net/xfrm/xfrm_user.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index d9841f44487f..b5a517916895 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1920,6 +1920,7 @@ static int xfrm_notify_userpolicy(struct net *net)
int len = NLMSG_ALIGN(sizeof(*up));
struct nlmsghdr *nlh;
struct sk_buff *skb;
+ int err;
skb = nlmsg_new(len, GFP_ATOMIC);
if (skb == NULL)
@@ -1938,7 +1939,10 @@ static int xfrm_notify_userpolicy(struct net *net)
nlmsg_end(skb, nlh);
- return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_POLICY);
+ rcu_read_lock();
+ err = xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_POLICY);
+ rcu_read_unlock();
+ return err;
}
static bool xfrm_userpolicy_is_valid(__u8 policy)
--
2.34.1
Powered by blists - more mailing lists