[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHC9VhSR8ETPaNVv6506z-wji9KCbRkrgzw0bC9uNtK7nSgzbQ@mail.gmail.com>
Date: Fri, 3 Sep 2021 10:08:01 -0400
From: Paul Moore <paul@...l-moore.com>
To: 王贇 <yun.wang@...ux.alibaba.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
David Ahern <dsahern@...nel.org>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: remove the unnecessary check in cipso_v4_doi_free
On Thu, Sep 2, 2021 at 10:27 PM 王贇 <yun.wang@...ux.alibaba.com> 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 <paul@...l-moore.com>
> Signed-off-by: Michael Wang <yun.wang@...ux.alibaba.com>
> ---
> 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 <paul@...l-moore.com>
> 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
>
--
paul moore
www.paul-moore.com
Powered by blists - more mailing lists