Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp100001pxb; Thu, 2 Sep 2021 20:31:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/E0hQXh9WMUyEOnzh/rO+A4UA+UGHz6eSx0CQ2cPoGQ3mDAyO70eszoUheiykVB0DEkSm X-Received: by 2002:a6b:5819:: with SMTP id m25mr1349706iob.105.1630639860049; Thu, 02 Sep 2021 20:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630639860; cv=none; d=google.com; s=arc-20160816; b=QIq9AjQwdrotT6vt0wbsF/uyO0VtgPfUTXhrIejhqNEzMEYdz+0YlhB8LSOvbPT83z AMjzD+kaWhwTJ7dc3e5bwKotNgjgD5sTfJ4U2IMu7SyGTzzJHHoLg9pFyDWdYUfcesaJ 6zZzJmO1BQPrGvLfIFMt01BS5hTHazuw1hGESbcY1V6zgHtoklSsBzxJMgQm+UV6PIim UQnbX1F+EgOY+OTkKJ5wMmIGvwXX7TwWh8wR/ATgoJL7LhoqlJlCKz8ZXpcZ+YpYFUYU 7H4nvTl6ixx3YlbTqWQj0fCuzuKF8MUF1CsWuTSYKDNVukwvGR5gI8JJIlj9d24tSY5q JiKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:to :from:subject; bh=T2xFEN4qmDcf/tPZH2/nS9eIljgtD/e443H323JqIT0=; b=mLcJ2IQgN+PdHJh+LSnzN42CoOc42sczlnnjxcJ/xdNpGgsXMluEuxqKgc6TgUoWhF +L9jHNSwtua2IjLlce+UMH97CFoBMjIBHzd8xfnbe77caFcgY5AjCkmNd0wzOJi3cICm fw9JRFJlDtbQaS2ehxACkW1nKQHNvHutUCTV63/Z5dgv1yQdrYM7bMUdw52XvqEgIV0F Ggq7MMFpwcRM32M0PBUViBtueqCV0g8Oa8GVg73NV+UnDlLUBS1nkXaifTZRQ0VNIh6G vOGRFCrcbNlmay5ylRbtuRqhEYA4lhxrL2AYKx1oXvPdWhEfen9KIB+N+jzVqcNUY7fk T0zw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si3746612ios.58.2021.09.02.20.30.48; Thu, 02 Sep 2021 20:31:00 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344368AbhICC2V (ORCPT + 99 others); Thu, 2 Sep 2021 22:28:21 -0400 Received: from out30-45.freemail.mail.aliyun.com ([115.124.30.45]:41082 "EHLO out30-45.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233254AbhICC2U (ORCPT ); Thu, 2 Sep 2021 22:28:20 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=yun.wang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0Un3RzCT_1630636038; Received: from testdeMacBook-Pro.local(mailfrom:yun.wang@linux.alibaba.com fp:SMTPD_---0Un3RzCT_1630636038) by smtp.aliyun-inc.com(127.0.0.1); Fri, 03 Sep 2021 10:27:19 +0800 Subject: [PATCH] net: remove the unnecessary check in cipso_v4_doi_free From: =?UTF-8?B?546L6LSH?= To: Paul Moore , "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski , netdev@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org References: Message-ID: <53f6b3fe-dde3-c35a-5ee1-ff480936b356@linux.alibaba.com> Date: Fri, 3 Sep 2021 10:27:18 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- net/ipv4/cipso_ipv4.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index 7fbd0b5..099259f 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c @@ -465,16 +465,14 @@ void cipso_v4_doi_free(struct cipso_v4_doi *doi_def) 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); } -- 1.8.3.1