summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAntony Antony <antony.antony@secunet.com>2022-02-01 09:51:57 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-03-08 21:07:46 +0300
commit019b4b9d59774784a3c1f0439d28bfae8bd28061 (patch)
tree485bf759a53756f8f76fdd06e7e2d00afa4542c6 /net
parent49c24579cec41e32f13d57b337fd28fb208d4a5b (diff)
downloadlinux-019b4b9d59774784a3c1f0439d28bfae8bd28061.tar.xz
xfrm: fix the if_id check in changelink
commit 6d0d95a1c2b07270870e7be16575c513c29af3f1 upstream. if_id will be always 0, because it was not yet initialized. Fixes: 8dce43919566 ("xfrm: interface with if_id 0 should return error") Reported-by: Pavel Machek <pavel@denx.de> Signed-off-by: Antony Antony <antony.antony@secunet.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/xfrm/xfrm_interface.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
index 08343201513a..3932d3aaff27 100644
--- a/net/xfrm/xfrm_interface.c
+++ b/net/xfrm/xfrm_interface.c
@@ -695,12 +695,12 @@ static int xfrmi_changelink(struct net_device *dev, struct nlattr *tb[],
struct net *net = xi->net;
struct xfrm_if_parms p = {};
+ xfrmi_netlink_parms(data, &p);
if (!p.if_id) {
NL_SET_ERR_MSG(extack, "if_id must be non zero");
return -EINVAL;
}
- xfrmi_netlink_parms(data, &p);
xi = xfrmi_locate(net, &p);
if (!xi) {
xi = netdev_priv(dev);