lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220126215937.GA31158@duo.ucw.cz>
Date:   Wed, 26 Jan 2022 22:59:37 +0100
From:   Pavel Machek <pavel@...x.de>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Antony Antony <antony.antony@...unet.com>,
        Eyal Birger <eyal.birger@...il.com>,
        Steffen Klassert <steffen.klassert@...unet.com>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 5.10 173/563] xfrm: interface with if_id 0 should return
 error

Hi!

> [ Upstream commit 8dce43919566f06e865f7e8949f5c10d8c2493f5 ]
> 
> xfrm interface if_id = 0 would cause xfrm policy lookup errors since
> Commit 9f8550e4bd9d.
> 
> Now explicitly fail to create an xfrm interface when if_id = 0

This will break changelink completely, AFAICT.

> @@ -672,7 +677,12 @@ static int xfrmi_changelink(struct net_device *dev, struct nlattr *tb[],
>  {
>  	struct xfrm_if *xi = netdev_priv(dev);
>  	struct net *net = xi->net;
> -	struct xfrm_if_parms p;
> +	struct xfrm_if_parms 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_id will be always 0, because it was not yet initialized.

Best regards,
									Pavel

Signed-off-by: Pavel Machek <pavel@...x.de>

diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
index 57448fc519fc..eb028b835f70 100644
--- a/net/xfrm/xfrm_interface.c
+++ b/net/xfrm/xfrm_interface.c
@@ -673,12 +673,11 @@ 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);


-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ