Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp513690pxb; Fri, 3 Sep 2021 07:10:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCuoeWfUTC9y3JEgVExpUvqzK34rsMPaYqif1s6Kp4w/FzrsJ/34UF2wwbOIBbAR9bDZfI X-Received: by 2002:a05:6638:1905:: with SMTP id p5mr2761012jal.25.1630678238382; Fri, 03 Sep 2021 07:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630678238; cv=none; d=google.com; s=arc-20160816; b=SiPPLepr1RW4iZRz9xsKQ751Z6P/tTj4ESKie5UeIZAQCRTQEn05hk6ScGGDpLhofD aVPGxggABPwfo2qcjPI9CbqodbAohbPVZ6/3AUFo1L7u4Xo9M+5jD2YxVWXZQ1jiaohJ ub+NGpgLjXkTgbOzbIe0aaV9s4HSFaBSn3919ARo8SbtMKWPYsJLiuxah5cTAdyAy54K iud3BySF+LEKw6d3IfY0iQBQo6uB4tR0g1HrRjsG61CfIRER/au2x/R10nO2n5/KwpeV ghJV51HXuOba3vcID0edfkkx3GXGiUUDgwNlNAq7V1Oes3MWghzLsmCMtl4M4kGXcaCz a8Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=cdPH0RUrZjKAXah7cowHX5Y+IopONEnkhgKNCSY3VPw=; b=KbDA+fRBptfX3RO1pCmOFm9iNZNmbdScB3d4fL8PgI6v02c0PYOlSVjK616xUtpzqX 6QnSQPZpE6yQce4ITxmCdvTnnk9o9CxtxV4c6ufASueVuf1yEAlK4sicbdHhlD4hc6kG prLGcv1F0TClEGlr7c1RaODEvJl1VFcgkhm84w1ikOZvHKsGgVD4Jw30teQFn1EObg3s a/P/CQp2hN54r0i2dCiPV9Kwyc+zxVY205+L7Q7ocPONM4TqmxY59kcHc/xW49D7zP8A 6ZhWBM6Hws5cg4MqTWlZ1j2TF9PPyIcb3xyvBKWS0RtyyEnZkwERJGXEqj8GvgsibfuK aHdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=Vf1l0IL5; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si5533204jat.52.2021.09.03.07.10.25; Fri, 03 Sep 2021 07:10:38 -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=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=Vf1l0IL5; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238048AbhICOJP (ORCPT + 99 others); Fri, 3 Sep 2021 10:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234108AbhICOJO (ORCPT ); Fri, 3 Sep 2021 10:09:14 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B4B0C061575 for ; Fri, 3 Sep 2021 07:08:14 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id lc21so12343332ejc.7 for ; Fri, 03 Sep 2021 07:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=cdPH0RUrZjKAXah7cowHX5Y+IopONEnkhgKNCSY3VPw=; b=Vf1l0IL5pe3MFxiQdNRXIyLZxAIBZiZdFrcYZ+LpU2j6vhQiUbAlXd4yfIpm9/1SZV VY1GK9B71BNVjo49ax2WMFtEeTRLW8B8oo7rgRpy3VGigfjw3xO3lXqP0YJjrwOILgDD TTrxgbeKlQGdbXYvykcCoNHtka7KLU+8jYrpz/98gHHt6gw3WSvrC8vA0B6pF98ixq6o WuKf+ulUvi+z1mYpANjUZ/pK8/Nzdgoupppl11Vfug12v7Y3c3x3/HDYZrmK6uTqrZwr 1z/3orDN8UUCrN4wQY3fGV9CLl+hArzm6XKOrCAcExRm5aFg0kTGaQaLRQGUwcbo0GYO bdkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=cdPH0RUrZjKAXah7cowHX5Y+IopONEnkhgKNCSY3VPw=; b=mHstzMrQtNYPVx0NjUXQp6HFlebGu4yTi9o6zhKGUJLkBcV4kTPvAk6jafUJGEkMvB Atv6D9IKDgO8ZYN9x8G5s38cl1iQJIy4ot6hpFnAz1FQvDI1QGB1/Cq1CakShi33J5i+ vJihkGePS/yP6uFTNb2pXyIyhUcRE05HPymTFLrH9iXitHqIEFYTwYH0S1+SZke70qkQ sDUkCUq+YAubeXRQ94+VNk0eNC2ca9RZuebpqG8zeJvyULvQH+fcQIckOYnL8dGt77QO Rjv/4St6l+jdXD3i6GqCMDNM9AXDsLTOivclmQJ3AyTaqdfrcr+Yt1kg0wfQwOBmZv+q JEng== X-Gm-Message-State: AOAM530pPv0JLcWeyHSYfBx7u+LhSzP0gF6AaNTKETGwzn5SUlMv7SEu Xy61XsbFJCgc/xujR1d6t3aMVTBo8qQJWpkY+77G X-Received: by 2002:a17:906:6011:: with SMTP id o17mr4325477ejj.157.1630678092913; Fri, 03 Sep 2021 07:08:12 -0700 (PDT) MIME-Version: 1.0 References: <53f6b3fe-dde3-c35a-5ee1-ff480936b356@linux.alibaba.com> In-Reply-To: <53f6b3fe-dde3-c35a-5ee1-ff480936b356@linux.alibaba.com> From: Paul Moore Date: Fri, 3 Sep 2021 10:08:01 -0400 Message-ID: Subject: Re: [PATCH] net: remove the unnecessary check in cipso_v4_doi_free To: =?UTF-8?B?546L6LSH?= Cc: "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski , netdev@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 2, 2021 at 10:27 PM =E7=8E=8B=E8=B4=87 wrote: > > 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(-) Verified that the v2 patch is in net/master so removing the v1 patch as this does is the right thing to do. Thanks for sending this out. Acked-by: Paul Moore > 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 > --=20 paul moore www.paul-moore.com