summaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-19 13:06:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-19 13:06:06 -0400
commit5f4fc6d440d77a2cf74fe4ea56955674ac7e35e7 (patch)
tree87dedefb73acda80d945a84603c687002c0ce1d5 /net/ipv4
parent249be8511b269495bc95cb8bdfdd5840b2ba73c0 (diff)
parent8d650cdedaabb33e85e9b7c517c0c71fcecc1de9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix AF_XDP cq entry leak, from Ilya Maximets. 2) Fix handling of PHY power-down on RTL8411B, from Heiner Kallweit. 3) Add some new PCI IDs to iwlwifi, from Ihab Zhaika. 4) Fix handling of neigh timers wrt. entries added by userspace, from Lorenzo Bianconi. 5) Various cases of missing of_node_put(), from Nishka Dasgupta. 6) The new NET_ACT_CT needs to depend upon NF_NAT, from Yue Haibing. 7) Various RDS layer fixes, from Gerd Rausch. 8) Fix some more fallout from TCQ_F_CAN_BYPASS generalization, from Cong Wang. 9) Fix FIB source validation checks over loopback, also from Cong Wang. 10) Use promisc for unsupported number of filters, from Justin Chen. 11) Missing sibling route unlink on failure in ipv6, from Ido Schimmel. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (90 commits) tcp: fix tcp_set_congestion_control() use from bpf hook ag71xx: fix return value check in ag71xx_probe() ag71xx: fix error return code in ag71xx_probe() usb: qmi_wwan: add D-Link DWM-222 A2 device ID bnxt_en: Fix VNIC accounting when enabling aRFS on 57500 chips. net: dsa: sja1105: Fix missing unlock on error in sk_buff() gve: replace kfree with kvfree selftests/bpf: fix test_xdp_noinline on s390 selftests/bpf: fix "valid read map access into a read-only array 1" on s390 net/mlx5: Replace kfree with kvfree MAINTAINERS: update netsec driver ipv6: Unlink sibling route in case of failure liquidio: Replace vmalloc + memset with vzalloc udp: Fix typo in net/ipv4/udp.c net: bcmgenet: use promisc for unsupported filters ipv6: rt6_check should return NULL if 'from' is NULL tipc: initialize 'validated' field of received packets selftests: add a test case for rp_filter fib: relax source validation check for loopback packets mlxsw: spectrum: Do not process learned records with a dummy FID ...
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_frontend.c5
-rw-r--r--net/ipv4/tcp.c4
-rw-r--r--net/ipv4/tcp_cong.c6
-rw-r--r--net/ipv4/udp.c2
4 files changed, 12 insertions, 5 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 317339cd7f03..e8bc939b56dd 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -388,6 +388,11 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
388 fib_combine_itag(itag, &res); 388 fib_combine_itag(itag, &res);
389 389
390 dev_match = fib_info_nh_uses_dev(res.fi, dev); 390 dev_match = fib_info_nh_uses_dev(res.fi, dev);
391 /* This is not common, loopback packets retain skb_dst so normally they
392 * would not even hit this slow path.
393 */
394 dev_match = dev_match || (res.type == RTN_LOCAL &&
395 dev == net->loopback_dev);
391 if (dev_match) { 396 if (dev_match) {
392 ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_HOST; 397 ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_HOST;
393 return ret; 398 return ret;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 7846afacdf0b..776905899ac0 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2785,7 +2785,9 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
2785 name[val] = 0; 2785 name[val] = 0;
2786 2786
2787 lock_sock(sk); 2787 lock_sock(sk);
2788 err = tcp_set_congestion_control(sk, name, true, true); 2788 err = tcp_set_congestion_control(sk, name, true, true,
2789 ns_capable(sock_net(sk)->user_ns,
2790 CAP_NET_ADMIN));
2789 release_sock(sk); 2791 release_sock(sk);
2790 return err; 2792 return err;
2791 } 2793 }
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index e1862b64a90f..c445a81d144e 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -333,7 +333,8 @@ out:
333 * tcp_reinit_congestion_control (if the current congestion control was 333 * tcp_reinit_congestion_control (if the current congestion control was
334 * already initialized. 334 * already initialized.
335 */ 335 */
336int tcp_set_congestion_control(struct sock *sk, const char *name, bool load, bool reinit) 336int tcp_set_congestion_control(struct sock *sk, const char *name, bool load,
337 bool reinit, bool cap_net_admin)
337{ 338{
338 struct inet_connection_sock *icsk = inet_csk(sk); 339 struct inet_connection_sock *icsk = inet_csk(sk);
339 const struct tcp_congestion_ops *ca; 340 const struct tcp_congestion_ops *ca;
@@ -369,8 +370,7 @@ int tcp_set_congestion_control(struct sock *sk, const char *name, bool load, boo
369 } else { 370 } else {
370 err = -EBUSY; 371 err = -EBUSY;
371 } 372 }
372 } else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || 373 } else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || cap_net_admin)) {
373 ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN))) {
374 err = -EPERM; 374 err = -EPERM;
375 } else if (!try_module_get(ca->owner)) { 375 } else if (!try_module_get(ca->owner)) {
376 err = -EBUSY; 376 err = -EBUSY;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index c21862ba9c02..d88821c794fb 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2170,7 +2170,7 @@ start_lookup:
2170 2170
2171/* Initialize UDP checksum. If exited with zero value (success), 2171/* Initialize UDP checksum. If exited with zero value (success),
2172 * CHECKSUM_UNNECESSARY means, that no more checks are required. 2172 * CHECKSUM_UNNECESSARY means, that no more checks are required.
2173 * Otherwise, csum completion requires chacksumming packet body, 2173 * Otherwise, csum completion requires checksumming packet body,
2174 * including udp header and folding it to skb->csum. 2174 * including udp header and folding it to skb->csum.
2175 */ 2175 */
2176static inline int udp4_csum_init(struct sk_buff *skb, struct udphdr *uh, 2176static inline int udp4_csum_init(struct sk_buff *skb, struct udphdr *uh,