From patchwork Tue Apr 12 07:17:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bader X-Patchwork-Id: 1616090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=lbcv9TQC; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KcxrX240Jz9sDX for ; Tue, 12 Apr 2022 17:17:46 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1neAmQ-0006dr-U5; Tue, 12 Apr 2022 07:17:38 +0000 Received: from smtp-relay-canonical-0.internal ([10.131.114.83] helo=smtp-relay-canonical-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1neAmO-0006dD-7w for kernel-team@lists.ubuntu.com; Tue, 12 Apr 2022 07:17:36 +0000 Received: from canonical.com (1.general.smb.uk.vpn [10.172.193.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id CC9CC3F60F for ; Tue, 12 Apr 2022 07:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1649747855; bh=PMS+4HHvxzyEIPrxXR1ALh+KlazUnieo0/h3KfPu1qo=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lbcv9TQCgeW/7gTFdYPHqDy00JEHsWCB5qTrygf4OXDTX5mBldqbTD82mOT1wkSAe jFmYN/GIjv/bivQe2wHNbT994mEvbOcJgAOJu/HtOPwJ5k5BGuh5OpIPTAcHtTokf5 Ce7528MNe9+x0uiTzYFWJqcvBy9lqkL9E36ZlnsY/9iWcTqADkcBQdrQ3IkiYIL0dh 9qMC0CsQ3daqv39NODyxtxeqJOtI39n9wGCjqtmknyxT5OlLPJ+TGLa961WYQgSb2H DdZ4wM6BqbeD216Amrkg9M0O4shbEiZZVXoDrcSYzpmWEYkH9ryLYSekzyhP9/CNFd t+TJR1HjDNx5A== From: Stefan Bader To: kernel-team@lists.ubuntu.com Subject: [SRU I/F PATCH 1/1] xfrm: fix the if_id check in changelink Date: Tue, 12 Apr 2022 09:17:34 +0200 Message-Id: <20220412071734.11252-2-stefan.bader@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220412071734.11252-1-stefan.bader@canonical.com> References: <20220412071734.11252-1-stefan.bader@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Antony Antony BugLink: https://bugs.launchpad.net/bugs/1968591 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 Signed-off-by: Antony Antony Signed-off-by: Steffen Klassert (cherry picked from commit 6d0d95a1c2b07270870e7be16575c513c29af3f1) Signed-off-by: Stefan Bader Acked-by: Kleber Sacilotto de Souza --- net/xfrm/xfrm_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c index 57448fc519fc..4e3c62d1ad9e 100644 --- a/net/xfrm/xfrm_interface.c +++ b/net/xfrm/xfrm_interface.c @@ -673,12 +673,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);