linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the ipsec-next tree with the ipsec tree
@ 2019-04-26  1:41 Stephen Rothwell
  2019-05-01  3:01 ` Stephen Rothwell
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2019-04-26  1:41 UTC (permalink / raw)
  To: Steffen Klassert
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Florian Westphal

[-- Attachment #1: Type: text/plain, Size: 4467 bytes --]

Hi all,

Today's linux-next merge of the ipsec-next tree got a conflict in:

  net/ipv4/xfrm4_policy.c

between commit:

  8742dc86d0c7 ("xfrm4: Fix uninitialized memory read in _decode_session4")

from the ipsec tree and commit:

  c53ac41e3720 ("xfrm: remove decode_session indirection from afinfo_policy")

from the ipsec-next tree.

I fixed it up (the code changed by the former has been moved by the latter
- see below) and can carry the fix as necessary. This is now fixed as
far as linux-next is concerned, but any non trivial conflicts should be
mentioned to your upstream maintainer when your tree is submitted for
merging.  You may also want to consider cooperating with the maintainer
of the conflicting tree to minimise any particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Fri, 26 Apr 2019 11:37:41 +1000
Subject: [PATCH] xfrm4: fix up for moved _decode_session4

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 net/xfrm/xfrm_policy.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 410233c5681e..7a43ae6b2a44 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -3264,7 +3264,8 @@ static void
 decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
 {
 	const struct iphdr *iph = ip_hdr(skb);
-	u8 *xprth = skb_network_header(skb) + iph->ihl * 4;
+	int ihl = iph->ihl;
+	u8 *xprth = skb_network_header(skb) + ihl * 4;
 	struct flowi4 *fl4 = &fl->u.ip4;
 	int oif = 0;
 
@@ -3275,6 +3276,11 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
 	fl4->flowi4_mark = skb->mark;
 	fl4->flowi4_oif = reverse ? skb->skb_iif : oif;
 
+	fl4->flowi4_proto = iph->protocol;
+	fl4->daddr = reverse ? iph->saddr : iph->daddr;
+	fl4->saddr = reverse ? iph->daddr : iph->saddr;
+	fl4->flowi4_tos = iph->tos;
+
 	if (!ip_is_fragment(iph)) {
 		switch (iph->protocol) {
 		case IPPROTO_UDP:
@@ -3286,7 +3292,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
 			    pskb_may_pull(skb, xprth + 4 - skb->data)) {
 				__be16 *ports;
 
-				xprth = skb_network_header(skb) + iph->ihl * 4;
+				xprth = skb_network_header(skb) + ihl * 4;
 				ports = (__be16 *)xprth;
 
 				fl4->fl4_sport = ports[!!reverse];
@@ -3298,7 +3304,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
 			    pskb_may_pull(skb, xprth + 2 - skb->data)) {
 				u8 *icmp;
 
-				xprth = skb_network_header(skb) + iph->ihl * 4;
+				xprth = skb_network_header(skb) + ihl * 4;
 				icmp = xprth;
 
 				fl4->fl4_icmp_type = icmp[0];
@@ -3310,7 +3316,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
 			    pskb_may_pull(skb, xprth + 4 - skb->data)) {
 				__be32 *ehdr;
 
-				xprth = skb_network_header(skb) + iph->ihl * 4;
+				xprth = skb_network_header(skb) + ihl * 4;
 				ehdr = (__be32 *)xprth;
 
 				fl4->fl4_ipsec_spi = ehdr[0];
@@ -3321,7 +3327,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
 			    pskb_may_pull(skb, xprth + 8 - skb->data)) {
 				__be32 *ah_hdr;
 
-				xprth = skb_network_header(skb) + iph->ihl * 4;
+				xprth = skb_network_header(skb) + ihl * 4;
 				ah_hdr = (__be32 *)xprth;
 
 				fl4->fl4_ipsec_spi = ah_hdr[1];
@@ -3332,7 +3338,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
 			    pskb_may_pull(skb, xprth + 4 - skb->data)) {
 				__be16 *ipcomp_hdr;
 
-				xprth = skb_network_header(skb) + iph->ihl * 4;
+				xprth = skb_network_header(skb) + ihl * 4;
 				ipcomp_hdr = (__be16 *)xprth;
 
 				fl4->fl4_ipsec_spi = htonl(ntohs(ipcomp_hdr[1]));
@@ -3344,7 +3350,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
 				__be16 *greflags;
 				__be32 *gre_hdr;
 
-				xprth = skb_network_header(skb) + iph->ihl * 4;
+				xprth = skb_network_header(skb) + ihl * 4;
 				greflags = (__be16 *)xprth;
 				gre_hdr = (__be32 *)xprth;
 
@@ -3360,10 +3366,6 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
 			break;
 		}
 	}
-	fl4->flowi4_proto = iph->protocol;
-	fl4->daddr = reverse ? iph->saddr : iph->daddr;
-	fl4->saddr = reverse ? iph->daddr : iph->saddr;
-	fl4->flowi4_tos = iph->tos;
 }
 
 #if IS_ENABLED(CONFIG_IPV6)
-- 
2.20.1


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: linux-next: manual merge of the ipsec-next tree with the ipsec tree
  2019-04-26  1:41 linux-next: manual merge of the ipsec-next tree with the ipsec tree Stephen Rothwell
@ 2019-05-01  3:01 ` Stephen Rothwell
  2019-05-09  1:20   ` Stephen Rothwell
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2019-05-01  3:01 UTC (permalink / raw)
  To: David Miller, Networking
  Cc: Steffen Klassert, Linux Next Mailing List,
	Linux Kernel Mailing List, Florian Westphal

[-- Attachment #1: Type: text/plain, Size: 4389 bytes --]

Hi all,

On Fri, 26 Apr 2019 11:41:20 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Today's linux-next merge of the ipsec-next tree got a conflict in:
> 
>   net/ipv4/xfrm4_policy.c
> 
> between commit:
> 
>   8742dc86d0c7 ("xfrm4: Fix uninitialized memory read in _decode_session4")
> 
> from the ipsec tree and commit:
> 
>   c53ac41e3720 ("xfrm: remove decode_session indirection from afinfo_policy")
> 
> from the ipsec-next tree.
> 
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Fri, 26 Apr 2019 11:37:41 +1000
> Subject: [PATCH] xfrm4: fix up for moved _decode_session4
> 
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>  net/xfrm/xfrm_policy.c | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index 410233c5681e..7a43ae6b2a44 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -3264,7 +3264,8 @@ static void
>  decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
>  {
>  	const struct iphdr *iph = ip_hdr(skb);
> -	u8 *xprth = skb_network_header(skb) + iph->ihl * 4;
> +	int ihl = iph->ihl;
> +	u8 *xprth = skb_network_header(skb) + ihl * 4;
>  	struct flowi4 *fl4 = &fl->u.ip4;
>  	int oif = 0;
>  
> @@ -3275,6 +3276,11 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
>  	fl4->flowi4_mark = skb->mark;
>  	fl4->flowi4_oif = reverse ? skb->skb_iif : oif;
>  
> +	fl4->flowi4_proto = iph->protocol;
> +	fl4->daddr = reverse ? iph->saddr : iph->daddr;
> +	fl4->saddr = reverse ? iph->daddr : iph->saddr;
> +	fl4->flowi4_tos = iph->tos;
> +
>  	if (!ip_is_fragment(iph)) {
>  		switch (iph->protocol) {
>  		case IPPROTO_UDP:
> @@ -3286,7 +3292,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
>  			    pskb_may_pull(skb, xprth + 4 - skb->data)) {
>  				__be16 *ports;
>  
> -				xprth = skb_network_header(skb) + iph->ihl * 4;
> +				xprth = skb_network_header(skb) + ihl * 4;
>  				ports = (__be16 *)xprth;
>  
>  				fl4->fl4_sport = ports[!!reverse];
> @@ -3298,7 +3304,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
>  			    pskb_may_pull(skb, xprth + 2 - skb->data)) {
>  				u8 *icmp;
>  
> -				xprth = skb_network_header(skb) + iph->ihl * 4;
> +				xprth = skb_network_header(skb) + ihl * 4;
>  				icmp = xprth;
>  
>  				fl4->fl4_icmp_type = icmp[0];
> @@ -3310,7 +3316,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
>  			    pskb_may_pull(skb, xprth + 4 - skb->data)) {
>  				__be32 *ehdr;
>  
> -				xprth = skb_network_header(skb) + iph->ihl * 4;
> +				xprth = skb_network_header(skb) + ihl * 4;
>  				ehdr = (__be32 *)xprth;
>  
>  				fl4->fl4_ipsec_spi = ehdr[0];
> @@ -3321,7 +3327,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
>  			    pskb_may_pull(skb, xprth + 8 - skb->data)) {
>  				__be32 *ah_hdr;
>  
> -				xprth = skb_network_header(skb) + iph->ihl * 4;
> +				xprth = skb_network_header(skb) + ihl * 4;
>  				ah_hdr = (__be32 *)xprth;
>  
>  				fl4->fl4_ipsec_spi = ah_hdr[1];
> @@ -3332,7 +3338,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
>  			    pskb_may_pull(skb, xprth + 4 - skb->data)) {
>  				__be16 *ipcomp_hdr;
>  
> -				xprth = skb_network_header(skb) + iph->ihl * 4;
> +				xprth = skb_network_header(skb) + ihl * 4;
>  				ipcomp_hdr = (__be16 *)xprth;
>  
>  				fl4->fl4_ipsec_spi = htonl(ntohs(ipcomp_hdr[1]));
> @@ -3344,7 +3350,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
>  				__be16 *greflags;
>  				__be32 *gre_hdr;
>  
> -				xprth = skb_network_header(skb) + iph->ihl * 4;
> +				xprth = skb_network_header(skb) + ihl * 4;
>  				greflags = (__be16 *)xprth;
>  				gre_hdr = (__be32 *)xprth;
>  
> @@ -3360,10 +3366,6 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
>  			break;
>  		}
>  	}
> -	fl4->flowi4_proto = iph->protocol;
> -	fl4->daddr = reverse ? iph->saddr : iph->daddr;
> -	fl4->saddr = reverse ? iph->daddr : iph->saddr;
> -	fl4->flowi4_tos = iph->tos;
>  }
>  
>  #if IS_ENABLED(CONFIG_IPV6)

This is now a conflict between the net and net-next trees.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: linux-next: manual merge of the ipsec-next tree with the ipsec tree
  2019-05-01  3:01 ` Stephen Rothwell
@ 2019-05-09  1:20   ` Stephen Rothwell
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2019-05-09  1:20 UTC (permalink / raw)
  To: David Miller, Networking
  Cc: Steffen Klassert, Linux Next Mailing List,
	Linux Kernel Mailing List, Florian Westphal

[-- Attachment #1: Type: text/plain, Size: 4799 bytes --]

Hi Dave,

On Wed, 1 May 2019 13:01:57 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> On Fri, 26 Apr 2019 11:41:20 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > Today's linux-next merge of the ipsec-next tree got a conflict in:
> > 
> >   net/ipv4/xfrm4_policy.c
> > 
> > between commit:
> > 
> >   8742dc86d0c7 ("xfrm4: Fix uninitialized memory read in _decode_session4")
> > 
> > from the ipsec tree and commit:
> > 
> >   c53ac41e3720 ("xfrm: remove decode_session indirection from afinfo_policy")
> > 
> > from the ipsec-next tree.
> > 
> > From: Stephen Rothwell <sfr@canb.auug.org.au>
> > Date: Fri, 26 Apr 2019 11:37:41 +1000
> > Subject: [PATCH] xfrm4: fix up for moved _decode_session4
> > 
> > Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > ---
> >  net/xfrm/xfrm_policy.c | 24 +++++++++++++-----------
> >  1 file changed, 13 insertions(+), 11 deletions(-)
> > 
> > diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> > index 410233c5681e..7a43ae6b2a44 100644
> > --- a/net/xfrm/xfrm_policy.c
> > +++ b/net/xfrm/xfrm_policy.c
> > @@ -3264,7 +3264,8 @@ static void
> >  decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
> >  {
> >  	const struct iphdr *iph = ip_hdr(skb);
> > -	u8 *xprth = skb_network_header(skb) + iph->ihl * 4;
> > +	int ihl = iph->ihl;
> > +	u8 *xprth = skb_network_header(skb) + ihl * 4;
> >  	struct flowi4 *fl4 = &fl->u.ip4;
> >  	int oif = 0;
> >  
> > @@ -3275,6 +3276,11 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
> >  	fl4->flowi4_mark = skb->mark;
> >  	fl4->flowi4_oif = reverse ? skb->skb_iif : oif;
> >  
> > +	fl4->flowi4_proto = iph->protocol;
> > +	fl4->daddr = reverse ? iph->saddr : iph->daddr;
> > +	fl4->saddr = reverse ? iph->daddr : iph->saddr;
> > +	fl4->flowi4_tos = iph->tos;
> > +
> >  	if (!ip_is_fragment(iph)) {
> >  		switch (iph->protocol) {
> >  		case IPPROTO_UDP:
> > @@ -3286,7 +3292,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
> >  			    pskb_may_pull(skb, xprth + 4 - skb->data)) {
> >  				__be16 *ports;
> >  
> > -				xprth = skb_network_header(skb) + iph->ihl * 4;
> > +				xprth = skb_network_header(skb) + ihl * 4;
> >  				ports = (__be16 *)xprth;
> >  
> >  				fl4->fl4_sport = ports[!!reverse];
> > @@ -3298,7 +3304,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
> >  			    pskb_may_pull(skb, xprth + 2 - skb->data)) {
> >  				u8 *icmp;
> >  
> > -				xprth = skb_network_header(skb) + iph->ihl * 4;
> > +				xprth = skb_network_header(skb) + ihl * 4;
> >  				icmp = xprth;
> >  
> >  				fl4->fl4_icmp_type = icmp[0];
> > @@ -3310,7 +3316,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
> >  			    pskb_may_pull(skb, xprth + 4 - skb->data)) {
> >  				__be32 *ehdr;
> >  
> > -				xprth = skb_network_header(skb) + iph->ihl * 4;
> > +				xprth = skb_network_header(skb) + ihl * 4;
> >  				ehdr = (__be32 *)xprth;
> >  
> >  				fl4->fl4_ipsec_spi = ehdr[0];
> > @@ -3321,7 +3327,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
> >  			    pskb_may_pull(skb, xprth + 8 - skb->data)) {
> >  				__be32 *ah_hdr;
> >  
> > -				xprth = skb_network_header(skb) + iph->ihl * 4;
> > +				xprth = skb_network_header(skb) + ihl * 4;
> >  				ah_hdr = (__be32 *)xprth;
> >  
> >  				fl4->fl4_ipsec_spi = ah_hdr[1];
> > @@ -3332,7 +3338,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
> >  			    pskb_may_pull(skb, xprth + 4 - skb->data)) {
> >  				__be16 *ipcomp_hdr;
> >  
> > -				xprth = skb_network_header(skb) + iph->ihl * 4;
> > +				xprth = skb_network_header(skb) + ihl * 4;
> >  				ipcomp_hdr = (__be16 *)xprth;
> >  
> >  				fl4->fl4_ipsec_spi = htonl(ntohs(ipcomp_hdr[1]));
> > @@ -3344,7 +3350,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
> >  				__be16 *greflags;
> >  				__be32 *gre_hdr;
> >  
> > -				xprth = skb_network_header(skb) + iph->ihl * 4;
> > +				xprth = skb_network_header(skb) + ihl * 4;
> >  				greflags = (__be16 *)xprth;
> >  				gre_hdr = (__be32 *)xprth;
> >  
> > @@ -3360,10 +3366,6 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
> >  			break;
> >  		}
> >  	}
> > -	fl4->flowi4_proto = iph->protocol;
> > -	fl4->daddr = reverse ? iph->saddr : iph->daddr;
> > -	fl4->saddr = reverse ? iph->daddr : iph->saddr;
> > -	fl4->flowi4_tos = iph->tos;
> >  }
> >  
> >  #if IS_ENABLED(CONFIG_IPV6)  
> 
> This is now a conflict between the net and net-next trees.

It looks like this fixup has been missed in Linus' merge of the
net-next tree ...

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-09  1:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-26  1:41 linux-next: manual merge of the ipsec-next tree with the ipsec tree Stephen Rothwell
2019-05-01  3:01 ` Stephen Rothwell
2019-05-09  1:20   ` Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).