diff mbox series

Revert "net: fix NULL pointer reference in cipso_v4_doi_free"

Message ID 7f239a0e-7a09-3dc0-43ce-27c19c7a309d@linux.alibaba.com (mailing list archive)
State New, archived
Headers show
Series Revert "net: fix NULL pointer reference in cipso_v4_doi_free" | expand

Commit Message

王贇 Sept. 1, 2021, 2:18 a.m. UTC
This reverts commit 733c99ee8be9a1410287cdbb943887365e83b2d6.

Since commit e842cb60e8ac ("net: fix NULL pointer reference in
cipso_v4_doi_free") also applied to fix the root cause, we can
just revert the old version now.

Suggested-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Michael Wang <yun.wang@linux.alibaba.com>
---
 net/ipv4/cipso_ipv4.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

Comments

王贇 Sept. 1, 2021, 2:21 a.m. UTC | #1
Hi Paul, it confused me since it's the first time I face
such situation, but I just realized what you're asking is
actually this revert, correct?

Regards,
Michael Wang

On 2021/9/1 上午10:18, 王贇 wrote:
> This reverts commit 733c99ee8be9a1410287cdbb943887365e83b2d6.
> 
> Since commit e842cb60e8ac ("net: fix NULL pointer reference in
> cipso_v4_doi_free") also applied to fix the root cause, we can
> just revert the old version now.
> 
> Suggested-by: Paul Moore <paul@paul-moore.com>
> Signed-off-by: Michael Wang <yun.wang@linux.alibaba.com>
> ---
>  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);
>  }
>
Paul Moore Sept. 1, 2021, 9:05 p.m. UTC | #2
On Tue, Aug 31, 2021 at 10:21 PM 王贇 <yun.wang@linux.alibaba.com> wrote:
>
> Hi Paul, it confused me since it's the first time I face
> such situation, but I just realized what you're asking is
> actually this revert, correct?

I believe DaveM already answered your question in the other thread,
but if you are still unsure about the patch let me know.
王贇 Sept. 2, 2021, 2:37 a.m. UTC | #3
On 2021/9/2 上午5:05, Paul Moore wrote:
> On Tue, Aug 31, 2021 at 10:21 PM 王贇 <yun.wang@linux.alibaba.com> wrote:
>>
>> Hi Paul, it confused me since it's the first time I face
>> such situation, but I just realized what you're asking is
>> actually this revert, correct?
> 
> I believe DaveM already answered your question in the other thread,
> but if you are still unsure about the patch let me know.

I do failed to get the point :-(

As I checked the:
  https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git

both v1 and v2 are there with the same description and both code modification
are applied.

We want revert v1 but not in a revert patch style, then do you suggest
send a normal patch to do the code revert?

Regards,
Michael Wang

>
Paul Moore Sept. 3, 2021, 2:15 a.m. UTC | #4
On Wed, Sep 1, 2021 at 10:37 PM 王贇 <yun.wang@linux.alibaba.com> wrote:
> On 2021/9/2 上午5:05, Paul Moore wrote:
> > On Tue, Aug 31, 2021 at 10:21 PM 王贇 <yun.wang@linux.alibaba.com> wrote:
> >>
> >> Hi Paul, it confused me since it's the first time I face
> >> such situation, but I just realized what you're asking is
> >> actually this revert, correct?
> >
> > I believe DaveM already answered your question in the other thread,
> > but if you are still unsure about the patch let me know.
>
> I do failed to get the point :-(
>
> As I checked the:
>   https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
>
> both v1 and v2 are there with the same description and both code modification
> are applied.
>
> We want revert v1 but not in a revert patch style, then do you suggest
> send a normal patch to do the code revert?

It sounds like DaveM wants you to create a normal (not a revert) patch
that removes the v1 changes while leaving the v2 changes intact.  In
the patch description you can mention that v1 was merged as a mistake
and that v2 is the correct fix (provide commit IDs for each in your
commit description using the usual 12-char hash snippet followed by
the subject in parens-and-quotes).
王贇 Sept. 3, 2021, 2:31 a.m. UTC | #5
On 2021/9/3 上午10:15, Paul Moore wrote:
[snip]
>> both v1 and v2 are there with the same description and both code modification
>> are applied.
>>
>> We want revert v1 but not in a revert patch style, then do you suggest
>> send a normal patch to do the code revert?
> 
> It sounds like DaveM wants you to create a normal (not a revert) patch
> that removes the v1 changes while leaving the v2 changes intact.  In
> the patch description you can mention that v1 was merged as a mistake
> and that v2 is the correct fix (provide commit IDs for each in your
> commit description using the usual 12-char hash snippet followed by
> the subject in parens-and-quotes).

Thanks for the kindly explain, I've sent:
  [PATCH] net: remove the unnecessary check in cipso_v4_doi_free

Which actually revert the v1 and mentioned v2 fixed the root casue,
Would you please take a look see if that is helpful?

Regards,
Michael Wang

>
Paul Moore Sept. 3, 2021, 2:08 p.m. UTC | #6
On Thu, Sep 2, 2021 at 10:31 PM 王贇 <yun.wang@linux.alibaba.com> wrote:
> On 2021/9/3 上午10:15, Paul Moore wrote:
> [snip]
> >> both v1 and v2 are there with the same description and both code modification
> >> are applied.
> >>
> >> We want revert v1 but not in a revert patch style, then do you suggest
> >> send a normal patch to do the code revert?
> >
> > It sounds like DaveM wants you to create a normal (not a revert) patch
> > that removes the v1 changes while leaving the v2 changes intact.  In
> > the patch description you can mention that v1 was merged as a mistake
> > and that v2 is the correct fix (provide commit IDs for each in your
> > commit description using the usual 12-char hash snippet followed by
> > the subject in parens-and-quotes).
>
> Thanks for the kindly explain, I've sent:
>   [PATCH] net: remove the unnecessary check in cipso_v4_doi_free
>
> Which actually revert the v1 and mentioned v2 fixed the root casue,
> Would you please take a look see if that is helpful?

That looks correct to me, acked.  Thanks.
diff mbox series

Patch

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);
 }