Skip to contentSkip to conversation

pull request (net-next): ipsec-next 2018-12-20

PATCH New Steffen Klassert 2 participants 4 messages Dec 20, 2018

Subsystems (3)
lore
Share & tools
lore

Steffen Klassert

author maintainer
#0 lore raw

Two last patches for this release cycle:

1) Remove an unused variable in xfrm_policy_lookup_bytype(). From YueHaibing.

2) Fix possible infinite loop in __xfrm6_tunnel_alloc_spi(). Also from YueHaibing.

Please pull or let me know if there are problems.

Thanks!

The following changes since commit 33f18c96afdf4da20014f834874e2820ee880cde:

net: ethernet: don't set phylib state CHANGELINK in drivers (2018-12-18 22:07:20 -0800)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git master

for you to fetch changes up to fa89a4593b927b3f59c3b69379f31d3b22272e4e:

xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi (2018-12-19 12:33:17 +0100)

----------------------------------------------------------------
YueHaibing (2):
xfrm: policy: remove set but not used variable 'priority'
xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi

 net/ipv6/xfrm6_tunnel.c | 3 +++
 net/xfrm/xfrm_policy.c  | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)
author maintainer
#1 lore raw

PATCH 1/2 xfrm: policy: remove set but not used variable 'priority'

From: YueHaibing <[email protected]>

Fixes gcc '-Wunused-but-set-variable' warning:

net/xfrm/xfrm_policy.c: In function 'xfrm_policy_lookup_bytype':
net/xfrm/xfrm_policy.c:2079:6: warning:
variable 'priority' set but not used [-Wunused-but-set-variable]

It not used since commit 6be3b0db6db8 ("xfrm: policy: add inexact policy search tree infrastructure")

---
 net/xfrm/xfrm_policy.c | 3 ---
 1 file changed, 3 deletions(-)
net/xfrm/xfrm_policy.c +0 -3
index be04091eb7db..537b7eec623c 100644
@@ -2076,7 +2076,6 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
 	struct xfrm_policy *pol, *ret;
 	struct hlist_head *chain;
 	unsigned int sequence;
-	u32 priority;
 	int err;
 
 	daddr = xfrm_flowi_daddr(fl, family);
@@ -2091,7 +2090,6 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
 		chain = policy_hash_direct(net, daddr, saddr, family, dir);
 	} while (read_seqcount_retry(&xfrm_policy_hash_generation, sequence));
 
-	priority = ~0U;
 	ret = NULL;
 	hlist_for_each_entry_rcu(pol, chain, bydst) {
 		err = xfrm_policy_match(pol, fl, type, family, dir, if_id);
@@ -2104,7 +2102,6 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
 			}
 		} else {
 			ret = pol;
-			priority = ret->priority;
 			break;
 		}
 	}
Signature · 1 line
2.17.1
author maintainer
#2 lore raw

PATCH 2/2 xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi

In reply to Steffen Klassert

From: YueHaibing <[email protected]>

gcc warn this:

net/ipv6/xfrm6_tunnel.c:143 __xfrm6_tunnel_alloc_spi() warn:
always true condition '(spi <= 4294967295) => (0-u32max <= u32max)'

'spi' is u32, which always not greater than XFRM6_TUNNEL_SPI_MAX because of wrap around. So the second forloop will never reach.

---
 net/ipv6/xfrm6_tunnel.c | 3 +++
 1 file changed, 3 insertions(+)
net/ipv6/xfrm6_tunnel.c +3 -0
index 4a46df8441c9..f5b4febeaa25 100644
@@ -144,6 +144,9 @@ static u32 __xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr)
 		index = __xfrm6_tunnel_spi_check(net, spi);
 		if (index >= 0)
 			goto alloc_spi;
+
+		if (spi == XFRM6_TUNNEL_SPI_MAX)
+			break;
 	}
 	for (spi = XFRM6_TUNNEL_SPI_MIN; spi < xfrm6_tn->spi; spi++) {
 		index = __xfrm6_tunnel_spi_check(net, spi);
Signature · 1 line
2.17.1
maintainer
#3 lore raw
In reply to Steffen Klassert

From: Steffen Klassert <[email protected]>
Date: Thu, 20 Dec 2018 09:20:47 +0100

Quoted 9 lines

Two last patches for this release cycle:

1) Remove an unused variable in xfrm_policy_lookup_bytype(). From YueHaibing.

2) Fix possible infinite loop in __xfrm6_tunnel_alloc_spi(). Also from YueHaibing.

Please pull or let me know if there are problems.

Pulled, thanks!