Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2353568pxb; Mon, 20 Sep 2021 19:52:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzuL1Kj6rZMDRW28KcXDAhhRiOABvDM7EotHlrEHU6U5rDXNpR9ijiu++MimSDfZvyjxp/ X-Received: by 2002:a50:cd8e:: with SMTP id p14mr32566971edi.39.1632192722559; Mon, 20 Sep 2021 19:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192722; cv=none; d=google.com; s=arc-20160816; b=Ao/CXJnYOrV9wdK+Zq52gKpxDbVZfrFqOABe6gOqRVb3jupOFPI3IB/7k7ciLjicmf 9ODTcNk0Ib39kUe/9xSj884r+B0KbxJ+G7Tu1Oqk+JGWTu9lfCJSgEvnSy3kkgQzX4Bx motw9EHTaVKb2VjRBkZAKDrhyMtkwxuQR7/G7BB11dOGhomOU9/xyrD0jg12nGj66v9H Vq2cdlWYO2OcVCNGbHxUympqA2N5xbv009CfPWelgAROBKo0sHzyMjgx8SW5i1WROQ2k Hdhl6f9tb5G5zm8CjaHzpjUOZMIAIsrbmXRlWhKH1/svxlKeTowkNK6K0Ve1wC5KJ+ej +SPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3pGN5GJnWrNt1hfLBljPGmukxdn7GZnpKFyUviaTFF0=; b=oMwoeuFfnAUrdt2LDzLZMgM07sFbnaLQYyPV/Oi+wtb7cYP/ZGC0snC7lBOJIXV+P8 lmZNwV/rBHgDif52YXS60xEBMHzi26kW2OhW4pazlGvsCmlcBgWOFDqmLo9Q1qoh/Pk7 tg8hsi2Fn+7K0CEGDf73hPmZOzirQ+k6ONIQVvGvCSWRgrbK7uWcM5dWMVD5UjhBSJ9g 9FQ+wKU3NbZb163MJ0vUAVvl+bqMMaCgfBnaUgkxl9a6FNaWDRHPf7nurqlQjKg4nFvm VhTjEEC4lW0ghxlhsNFX4LXbb94gpXbXtEPB0Hud4qDEo0kGk6DSaU/WqCZTi48Fa1O3 Bs2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xpUFz+CL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i21si19362032ejo.253.2021.09.20.19.51.38; Mon, 20 Sep 2021 19:52:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xpUFz+CL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353673AbhITSmG (ORCPT + 99 others); Mon, 20 Sep 2021 14:42:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:53122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381637AbhITSjB (ORCPT ); Mon, 20 Sep 2021 14:39:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E8DE463327; Mon, 20 Sep 2021 17:30:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159018; bh=XZ3OOusOdLmmB63r+AVWl5u+lWawr9Lg7iJ70qgnZRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xpUFz+CL37M4b8RVL9XDFxVmCUsOwEwqiuUg2wo0w/bbIS/xdIicQpKZhhgjAoDhg 3VW9plE+nFiYd9zuAR+vcy9VPhxzIR8tboFBx5KKy9cjowbaX4u/TIxhlcnK0lqOW0 NsKcAgBBqySRxahXe2VD8FVm/NF+4bthz96Hz2ko= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Moore , Michael Wang , "David S. Miller" Subject: [PATCH 5.14 039/168] net: remove the unnecessary check in cipso_v4_doi_free Date: Mon, 20 Sep 2021 18:42:57 +0200 Message-Id: <20210920163922.937928633@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@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: linux-kernel@vger.kernel.org From: 王贇 commit 9756e44fd4d283ebcc94df353642f322428b73de upstream. The commit 733c99ee8be9 ("net: fix NULL pointer reference in cipso_v4_doi_free") was merged by a mistake, this patch try to cleanup the mess. And we already have the commit e842cb60e8ac ("net: fix NULL pointer reference in cipso_v4_doi_free") which fixed the root cause of the issue mentioned in it's description. Suggested-by: Paul Moore Signed-off-by: Michael Wang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/cipso_ipv4.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c @@ -465,16 +465,14 @@ void cipso_v4_doi_free(struct cipso_v4_d if (!doi_def) return; - if (doi_def->map.std) { - switch (doi_def->type) { - case CIPSO_V4_MAP_TRANS: - kfree(doi_def->map.std->lvl.cipso); - kfree(doi_def->map.std->lvl.local); - kfree(doi_def->map.std->cat.cipso); - kfree(doi_def->map.std->cat.local); - kfree(doi_def->map.std); - break; - } + switch (doi_def->type) { + case CIPSO_V4_MAP_TRANS: + kfree(doi_def->map.std->lvl.cipso); + kfree(doi_def->map.std->lvl.local); + kfree(doi_def->map.std->cat.cipso); + kfree(doi_def->map.std->cat.local); + kfree(doi_def->map.std); + break; } kfree(doi_def); }