From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B996FC433EF for ; Mon, 7 Mar 2022 10:23:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233281AbiCGKXp (ORCPT ); Mon, 7 Mar 2022 05:23:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242208AbiCGKVn (ORCPT ); Mon, 7 Mar 2022 05:21:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C09CF91AE7; Mon, 7 Mar 2022 01:59:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3B57360BBC; Mon, 7 Mar 2022 09:53:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42C8DC340F5; Mon, 7 Mar 2022 09:53:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646646836; bh=K6eS3JaZPT0Wb2NjGA557EzkMGcgAGrutANdqmeykiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nTyq7f0s0n8UNkrgxp02nI4wH3jTUAdeJX1SCo/EsIQsdQb1lUXBb1XuL5o7jS4JE eK2F0eqQ6EQHVK8k0EYY13uPiNMdx1hWDnp19xKIlmguINGk0a8uY+cKL8EDoI9hK3 CSPk8v5ndAbfs5LdRULSDakI0NtVtVzAsdLHgCdo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , Antony Antony , Steffen Klassert Subject: [PATCH 5.16 069/186] xfrm: fix the if_id check in changelink Date: Mon, 7 Mar 2022 10:18:27 +0100 Message-Id: <20220307091656.021340087@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091654.092878898@linuxfoundation.org> References: <20220307091654.092878898@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Antony Antony 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 Signed-off-by: Antony Antony Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman --- net/xfrm/xfrm_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/xfrm/xfrm_interface.c +++ b/net/xfrm/xfrm_interface.c @@ -673,12 +673,12 @@ static int xfrmi_changelink(struct net_d 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);