[PATCH net v2] rps: Correct wrong skb_flow_limit check when enable RPS

2018-05-10 Thread gfree . wind
From: Gao Feng The skb flow limit is implemented for each CPU independently. In the current codes, the function skb_flow_limit gets the softnet_data by this_cpu_ptr. But the target cpu of enqueue_to_backlog would be not the current cpu when enable RPS. As the result, the skb_flow_limit checks the

[PATCH net] net: Correct wrong skb_flow_limit check when enable RPS

2018-05-10 Thread gfree . wind
From: Gao Feng The skb flow limit is implemented for each CPU independently. In the current codes, the function skb_flow_limit gets the softnet_data by this_cpu_ptr. But the target cpu of enqueue_to_backlog would be not the current cpu when enable RPS. As the result, the skb_flow_limit checks the

[PATCH net] net: Fix one possible memleak in ip_setup_cork

2018-04-15 Thread gfree . wind
From: Gao Feng It would allocate memory in this function when the cork->opt is NULL. But the memory isn't freed if failed in the latter rt check, and return error directly. It causes the memleak if its caller is ip_make_skb which also doesn't free the cork->opt when meet a error. Now move the rt

[PATCH net] net: Fix one possible memleak in ip_setup_cork

2018-04-15 Thread gfree . wind
From: Gao Feng It would allocate memory in this function when the cork->opt is NULL. But the memory isn't freed if failed in the latter rt check, and return error directly. It causes the memleak if its caller is ip_make_skb which also doesn't free the cork->opt when meet a error. Now move the rt

[PATCH net] macvlan: Fix one possible double free

2017-12-26 Thread gfree . wind
From: Gao Feng Because the macvlan_uninit would free the macvlan port, so there is one double free case in macvlan_common_newlink. When the macvlan port is just created, then register_netdevice or netdev_upper_dev_link failed and they would invoke macvlan_uninit. Then it would reach the macvlan_p

[PATCH net-next] ipvlan: Eliminate duplicated codes with existing function

2017-12-06 Thread gfree . wind
From: Gao Feng The recv flow of ipvlan l2 mode performs as same as l3 mode for non-multicast packet, so use the existing func ipvlan_handle_mode_l3 instead of these duplicated statements in non-multicast case. Signed-off-by: Gao Feng --- drivers/net/ipvlan/ipvlan_core.c | 13 ++--- 1 f

[PATCH net-next] ipvlan: Add new func ipvlan_is_valid_dev instead of duplicated codes

2017-12-01 Thread gfree . wind
From: Gao Feng There are multiple duplicated condition checks in the current codes, so I add the new func ipvlan_is_valid_dev instead of the duplicated codes to check if the netdev is real ipvlan dev. Signed-off-by: Gao Feng --- drivers/net/ipvlan/ipvlan_main.c | 33 +--

[PATCH net] ipvlan: Add the skb->mark as flow4's member to lookup route

2017-11-30 Thread gfree . wind
From: Gao Feng Current codes don't use skb->mark to assign flowi4_mark, it would make the policy route rule with fwmark doesn't work as expected. Signed-off-by: Gao Feng --- drivers/net/ipvlan/ipvlan_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ipvlan/ipvlan_core.c b/

[PATCH net 1/2] ipvlan: Fix insufficient skb linear check for arp

2017-11-22 Thread gfree . wind
From: Gao Feng In the function ipvlan_get_L3_hdr, current codes use pskb_may_pull to make sure the skb header has enough linear room for arp header. But it would access the arp payload in func ipvlan_addr_lookup. So it still may access the unepxected memory. Now use arp_hdr_len(port->dev) instea

[PATCH net 2/2] ipvlan: Fix insufficient skb linear check for ipv6 icmp

2017-11-22 Thread gfree . wind
From: Gao Feng In the function ipvlan_get_L3_hdr, current codes use pskb_may_pull to make sure the skb header has enough linear room for ipv6 header. But it would use the latter memory directly without linear check when it is icmp. So it still may access the unepxected memory in ipvlan_addr_looku

[PATCH net 0/2] ipvlan: Fix insufficient skb linear check

2017-11-22 Thread gfree . wind
From: Gao Feng The current ipvlan codes use pskb_may_pull to get the skb linear header in func ipvlan_get_L3_hdr, but the size isn't enough for arp and ipv6 icmp. So it may access the unexpected momory in ipvlan_addr_lookup. Gao Feng (2): ipvlan: Fix insufficient skb linear check for arp ipv

[PATCH net-next] driver: ipvlan: Add new func ipvlan_is_valid_dev instead of duplicated codes

2017-11-15 Thread gfree . wind
From: Gao Feng There are multiple duplicated condition checks in the current codes, so I add the new func ipvlan_is_valid_dev instead of the duplicated codes to check if the netdev is real ipvlan dev. Signed-off-by: Gao Feng --- drivers/net/ipvlan/ipvlan_main.c | 33 +--

[PATCH net-next] ppp: Destroy the mutex when cleanup

2017-10-31 Thread gfree . wind
From: Gao Feng The mutex_destroy only makes sense when enable DEBUG_MUTEX. For the good readbility, it's better to invoke it in exit func when the init func invokes mutex_init. Signed-off-by: Gao Feng --- drivers/net/ppp/ppp_generic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers

[PATCH net-next v2] net: Remove useless function skb_header_release

2017-09-21 Thread gfree . wind
From: Gao Feng There is no one which would invokes the function skb_header_release. So just remove it now. Signed-off-by: Gao Feng --- v2: Correct some comments, per Joe v1: initial version drivers/net/usb/asix_common.c | 2 +- include/linux/skbuff.h | 19 --- ne

[PATCH net-next ] net: Remove useless function skb_header_release

2017-09-20 Thread gfree . wind
From: Gao Feng There is no one which would invokes the function skb_header_release. So just remove it now. Signed-off-by: Gao Feng --- include/linux/skbuff.h | 16 1 file changed, 16 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 72299ef..ce63

[PATCH net-next 1/1] sched: Use __qdisc_drop instead of kfree_skb in sch_prio and sch_qfq

2017-09-03 Thread gfree . wind
From: Gao Feng The commit 520ac30f4551 ("net_sched: drop packets after root qdisc lock is released) made a big change of tc for performance. There are two points left in sch_prio and sch_qfq which are not changed with that commit. Now enhance them now with __qdisc_drop. Signed-off-by: Gao Feng

[PATCH net-next v2] sched: sfq: drop packets after root qdisc lock is released

2017-08-26 Thread gfree . wind
From: Gao Feng The commit 520ac30f4551 ("net_sched: drop packets after root qdisc lock is released) made a big change of tc for performance. But there are some points which are not changed in SFQ enqueue operation. 1. Fail to find the SFQ hash slot; 2. When the queue is full; Now use qdisc_drop

[PATCH net-next RESEND] sched: sfq: drop packets after root qdisc lock is released

2017-08-25 Thread gfree . wind
From: Gao Feng The commit 520ac30f4551 ("net_sched: drop packets after root qdisc lock is released) made a big change of tc for performance. But there are some points which are not changed in SFQ enqueue operation. 1. Fail to find the SFQ hash slot; 2. When the queue is full; Now use qdisc_drop

[PATCH net-next] net: sched: Add the invalid handle check in qdisc_class_find

2017-08-18 Thread gfree . wind
From: Gao Feng Add the invalid handle "0" check to avoid unnecessary search, because the qdisc uses the skb->priority as the handle value to look up, and it is "0" usually. Signed-off-by: Gao Feng --- include/net/sch_generic.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/net/

[PATCH net-next 1/1] driver: pptp: Remove unnecessary statements in pptp_sock_destruct

2017-08-09 Thread gfree . wind
From: Gao Feng In the commit ddab82821fa6 ("ppp: Fix a scheduling-while-atomic bug in del_chan"), I moved the synchronize_rcu() from del_chan() to pptp_release after del_chan() to avoid one scheduling-while-atomic bug. Actually the del_chan() and pppox_unbind_sock are unneccessary in the pptp_so

[PATCH net] ppp: Fix a scheduling-while-atomic bug in del_chan

2017-07-31 Thread gfree . wind
From: Gao Feng The PPTP set the pptp_sock_destruct as the sock's sk_destruct, it would trigger this bug when __sk_free is invoked in atomic context, because of the call path pptp_sock_destruct->del_chan->synchronize_rcu. Now move the synchronize_rcu to pptp_release from del_chan. This is the onl

[PATCH] ppp: Fix false xmit recursion detect with two ppp devices

2017-07-17 Thread gfree . wind
From: Gao Feng The global percpu variable ppp_xmit_recursion is used to detect the ppp xmit recursion to avoid the deadlock, which is caused by one CPU tries to lock the xmit lock twice. But it would report false recursion when one CPU wants to send the skb from two different PPP devices, like on

[PATCH net v2] net: sched: Fix one possible panic when no destroy callback

2017-06-27 Thread gfree . wind
From: Gao Feng When qdisc fail to init, qdisc_create would invoke the destroy callback to cleanup. But there is no check if the callback exists really. So it would cause the panic if there is no real destroy callback like the qdisc codel, fq, and so on. Take codel as an example following: When a

[net PATCH] net: sched: Fix one possible panic when no destroy callback

2017-06-26 Thread gfree . wind
From: Gao Feng When qdisc fail to init, qdisc_create would invoke the destroy callback to cleanup. But there is no check if the callback exists really. So it would cause the panic if there is no real destroy callback like these qdisc codel, pfifo, pfifo_fast, and so on. Now add one the check for

[PATCH net] net: 8021q: Fix one possible panic caused by BUG_ON in free_netdev

2017-06-16 Thread gfree . wind
From: Gao Feng The register_vlan_device would invoke free_netdev directly, when register_vlan_dev failed. It would trigger the BUG_ON in free_netdev if the dev was already registered. In this case, the netdev would be freed in netdev_run_todo later. So add one condition check now. Only when dev

[PATCH net-next] ppp: remove unnecessary bh disable in xmit path

2017-06-01 Thread gfree . wind
From: Gao Feng Since the commit 55454a565836 ("ppp: avoid dealock on recursive xmit"), the PPP xmit path is protected by wrapper functions which disable the bh already. So it is unnecessary to disable the bh again in the real xmit path. Signed-off-by: Gao Feng --- drivers/net/ppp/ppp_generic.c

[PATCH net-next] net: rps: Add the rfs_needed check when record flow hash

2017-05-24 Thread gfree . wind
From: Gao Feng There are two spots which invoke the sock_rps_record_flow_hash, one is sock_rps_record_flow which has already checked rfs_needed. But the other is tun_flow_update which doesn't check if the rfs is enabled. Now rename the original function sock_rps_record_flow_hash to _sock_rps_rec

[PATCH net-next] net: rfs: Don't reset RFS entries when nothing changed

2017-05-22 Thread gfree . wind
From: Gao Feng When the new RFS table size specified by sysctl equals the old one, there is nothing changed actually. So it is unnecessary to reset the RFS table entris. Signed-off-by: Gao Feng --- net/core/sysctl_net_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --gi

[PATCH net v2] driver: vrf: Fix one possible use-after-free issue

2017-05-09 Thread gfree . wind
From: Gao Feng The current codes only deal with the case that the skb is dropped, it may meet one use-after-free issue when NF_HOOK returns 0 that means the skb is stolen by one netfilter rule or hook. When one netfilter rule or hook stoles the skb and return NF_STOLEN, it means the skb is taken

[PATCH net] driver: vrf: Fix one possible use-after-free issue

2017-05-09 Thread gfree . wind
From: Gao Feng The current codes only deal with the case that the skb is dropped, it may meet one use-after-free issue when NF_HOOK returns 0 that means the skb is stolen by one netfilter rule or hook. When one netfilter rule or hook stoles the skb and return NF_STOLEN, it means the skb is taken

[PATCH net v4 12/12] net: batman-adv: Fix one possbile memleak when fail to register_netdevice

2017-05-02 Thread gfree . wind
From: Gao Feng The batman-adv allocates some resources in its ndo_init func, and free them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because the destructor would not be invoked to free the resources. Now crea

[PATCH net v4 11/12] net: vlan: Fix one possbile memleak when fail to register_netdevice

2017-05-02 Thread gfree . wind
From: Gao Feng The vlan driver allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handle

[PATCH net v4 10/12] net: sit: Fix one possbile memleak when fail to register_netdevice

2017-05-02 Thread gfree . wind
From: Gao Feng The ipip6 allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handler of r

[PATCH net v4 09/12] net: ip_tunnel: Fix one possbile memleak when fail to register_netdevice

2017-05-02 Thread gfree . wind
From: Gao Feng The ip_tunnel allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handler

[PATCH net v4 08/12] net: ip6_vti: Fix one possbile memleak when fail to register_netdevice

2017-05-02 Thread gfree . wind
From: Gao Feng The ip6_vti allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handler of

[PATCH net v4 07/12] ip6_tunnel: Fix one possbile memleak when fail to register_netdevice

2017-05-02 Thread gfree . wind
From: Gao Feng The ip6_tunnel allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handler

[PATCH net v4 03/12] driver: loopback: Fix one possbile memleak when fail to register_netdevice

2017-05-01 Thread gfree . wind
From: Gao Feng The loopback driver allocates some resources in its ndo_init func, and free them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because the destructor would not be invoked to free the resources. Now

[PATCH net v4 05/12] driver: veth: Fix one possbile memleak when fail to register_netdevice

2017-05-01 Thread gfree . wind
From: Gao Feng The veth driver allocates some resources in its ndo_init func, and free them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because the destructor would not be invoked to free the resources. Now cre

[PATCH net v4 04/12] driver: team: Fix one possbile memleak when fail to register_netdevice

2017-05-01 Thread gfree . wind
From: Gao Feng The team driver allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handle

[PATCH net v4 02/12] driver: ifb: Fix one possbile memleak when fail to register_netdevice

2017-05-01 Thread gfree . wind
From: Gao Feng The ifb driver allocates some resources in its ndo_init func, and free them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because the destructor would not be invoked to free the resources. Now crea

[PATCH net v4 06/12] net: ip6_gre: Fix one possbile memleak when fail to register_netdevice

2017-05-01 Thread gfree . wind
From: Gao Feng The ip6_gre allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handler of

[PATCH net v4 00/12] Fix possbile memleaks when fail to register_netdevice

2017-05-01 Thread gfree . wind
From: Gao Feng These following drivers allocate kinds of resources in its ndo_init func, free some of them or all in the destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in th

[PATCH net v4 01/12] driver: dummy: Fix one possbile memleak when fail to register_netdevice

2017-05-01 Thread gfree . wind
From: Gao Feng The dummy driver allocates dev->dstats and priv->vfinfo in its ndo_init func dummy_dev_init, free the dev->dstats in the ndo_uninit and free the priv->vfinfo in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init call

[PATCH net v3] net: vlan: Fix one possbile memleak when fail to register_netdevice

2017-04-28 Thread gfree . wind
From: Gao Feng The vlan driver allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handle

[PATCH net v3] net: ip_tunnel: Fix one possbile memleak when fail to register_netdevice

2017-04-28 Thread gfree . wind
From: Gao Feng The ip_tunnel allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handler

[PATCH net v3] net: sit: Fix one possbile memleak when fail to register_netdevice

2017-04-28 Thread gfree . wind
From: Gao Feng The ipip6 allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handler of r

[PATCH net v3] net: ip6_vti: Fix one possbile memleak when fail to register_netdevice

2017-04-28 Thread gfree . wind
From: Gao Feng The ip6_vti allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handler of

[PATCH net v3] net: ip6_tunnel: Fix one possbile memleak when fail to register_netdevice

2017-04-28 Thread gfree . wind
From: Gao Feng The ip6_tunnel allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handler

[PATCH net v3] net: ip6_gre: Fix one possbile memleak when fail to register_netdevice

2017-04-28 Thread gfree . wind
From: Gao Feng The ip6_gre allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handler of

[PATCH net v3] driver: veth: Fix one possbile memleak when fail to register_netdevice

2017-04-28 Thread gfree . wind
From: Gao Feng The veth driver allocates some resources in its ndo_init func, and free them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because the destructor would not be invoked to free the resources. Now cre

[PATCH net v3] driver: team: Fix one possbile memleak when fail to register_netdevice

2017-04-28 Thread gfree . wind
From: Gao Feng The team driver allocates some resources in its ndo_init func, and free some of them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because only the ndo_uninit callback is invoked in the error handle

[PATCH net v3] driver: loopback: Fix one possbile memleak when fail to register_netdevice

2017-04-28 Thread gfree . wind
From: Gao Feng The loopback driver allocates some resources in its ndo_init func, and free them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because the destructor would not be invoked to free the resources. Now

[PATCH net v3] driver: ifb: Fix one possbile memleak when fail to register_netdevice

2017-04-28 Thread gfree . wind
From: Gao Feng The ifb driver allocates some resources in its ndo_init func, and free them in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init callback. Because the destructor would not be invoked to free the resources. Now crea

[PATCH net v3] driver: dummy: Fix one possbile memleak when fail to register_netdevice

2017-04-28 Thread gfree . wind
From: Gao Feng The dummy driver allocates dev->dstats and priv->vfinfo in its ndo_init func dummy_dev_init, free the dev->dstats in the ndo_uninit and free the priv->vfinfo in its destructor func. Then there is one memleak that some errors happen after register_netdevice invokes the ndo_init call

[PATCH net v2] net: dev: Fix possible memleaks when fail to register_netdevice

2017-04-27 Thread gfree . wind
From: Gao Feng These drivers allocate kinds of resources in init routine, and free some resources in the destructor of net_device. It may cause memleak when some errors happen after register_netdevice invokes the init callback. Because only the uninit callback is invoked in the error handler of r

[PATCH] net: fib: Decrease one unnecessary rt cache flush in fib_disable_ip

2017-04-26 Thread gfree . wind
From: Gao Feng The func fib_flush already flushes the rt cache if necessary, so it is not necessary to invoke rt_cache_flush again in fib_disable_ip. Signed-off-by: Gao Feng --- net/ipv4/fib_frontend.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/fib_frontend.

[PATCH net] net: batman-adv: Fix possible memleaks when fail to register_netdevice

2017-04-25 Thread gfree . wind
From: Gao Feng Because the func batadv_softif_init_late allocate some resources and it would be invoked in register_netdevice. So we need to invoke the func batadv_softif_free instead of free_netdev to cleanup when fail to register_netdevice. Signed-off-by: Gao Feng --- net/batman-adv/soft-int

[PATCH net] driver/net: Fix possible memleaks when fail to register_netdevice

2017-04-25 Thread gfree . wind
From: Gao Feng These drivers allocate kinds of resources in init routine, and free some resources in the destructor of net_device. It may cause memleak when some errors happen after register_netdevice invokes the init callback. Because only the uninit callback is invoked in the error handler of r

[PATCH net-next v3 1/1] net: ipv4: Refine the ipv4_default_advmss

2017-04-11 Thread gfree . wind
From: Gao Feng 1. Don't get the metric RTAX_ADVMSS of dst. There are two reasons. 1) Its caller dst_metric_advmss has already invoke dst_metric_advmss before invoke default_advmss. 2) The ipv4_default_advmss is used to get the default mss, it should not try to get the metric like ip6_default_advm

[PATCH net-next v2 1/1] net: ipv4: Refine the ipv4_default_advmss

2017-04-11 Thread gfree . wind
From: Gao Feng 1. Don't get the metric RTAX_ADVMSS of dst. There are two reasons. 1) Its caller dst_metric_advmss has already invoke dst_metric_advmss before invoke default_advmss. 2) The ipv4_default_advmss is used to get the default mss, it should not try to get the metric like ip6_default_advm

[PATCH net-next 1/1] net: ipv4: Refine the ipv4_default_advmss

2017-04-11 Thread gfree . wind
From: Gao Feng 1. Don't get the metric RTAX_ADVMSS of dst. There are two reasons. 1) Its caller dst_metric_advmss has already invoke dst_metric_advmss before invoke default_advmss. 2) The ipv4_default_advmss is used to get the default mss, it should not try to get the metric like ip6_default_advm

[PATCH net 1/1] net: tcp: Increase TCPABORTONLINGER when send RST by linger2 in keepalive timer

2017-04-09 Thread gfree . wind
From: Gao Feng It should increase TCPABORTONLINGER counter when send RST caused by linger2 in keepalive timer. Signed-off-by: Gao Feng --- net/ipv4/tcp_timer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index b2ab411..5c01f21 100644 --- a/

[PATCH net v2 1/1] net: tcp: Increase TCP_MIB_OUTRSTS even though fail to alloc skb

2017-04-06 Thread gfree . wind
From: Gao Feng Because TCP_MIB_OUTRSTS is an important count, so always increase it whatever send it successfully or not. Now move the increment of TCP_MIB_OUTRSTS to the top of tcp_send_active_reset to make sure it is increased always even though fail to alloc skb. Signed-off-by: Gao Feng ---

[PATCH net 1/1] net: tcp: Don't increase the TCP_MIB_OUTRSTS when fail to transmit RST

2017-04-06 Thread gfree . wind
From: Gao Feng When fail to transmit RST, don't increase TCP_MIB_OUTRSTS in func tcp_send_active_reset like the case that it only increases LINUX_MIB_TCPABORTFAILED when fail to alloc skb. Signed-off-by: Gao Feng --- net/ipv4/tcp_output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(

[PATCH net-next v2 1/1] net: tcp: Define the TCP_MAX_WSCALE instead of literal number 14

2017-04-04 Thread gfree . wind
From: Gao Feng Define one new macro TCP_MAX_WSCALE instead of literal number '14', and use U16_MAX instead of 65535 as the max value of TCP window. There is another minor change, use rounddown(space, mss) instead of (space / mss) * mss; Signed-off-by: Gao Feng --- v2: Correct the literal 14 in

[PATCH net-next 1/1] net: tcp: Define the TCP_MAX_WSCALE instead of literal number 14

2017-03-31 Thread gfree . wind
From: Gao Feng Define one new macro TCP_MAX_WSCALE instead of literal number '14', and use U16_MAX instead of 65535 as the max value of TCP window. There is another minor change, use rounddown(space, mss) instead of (space / mss) * mss; Signed-off-by: Gao Feng --- include/net/tcp.h | 3 +++

[PATCH net 1/1] proc/sysctl: Fix the int overflow for jiffies conversion

2017-03-29 Thread gfree . wind
From: Gao Feng The function do_proc_dointvec_jiffies_conv uses LONG_MX/HZ as the max value to avoid overflow. But actually the *valp is int type, so it still causes overflow. For example, echo 2147483647 > ./sys/net/ipv4/tcp_keepalive_time Then, cat ./sys/net/ipv4/tcp_keepalive_time The output i

[PATCH nf-next 1/1] net: tcp: Refine the __tcp_select_window

2017-03-29 Thread gfree . wind
From: Gao Feng 1. Move the "window = tp->rcv_wnd;" into the condition block without tp->rx_opt.rcv_wscale. Because it is unnecessary when enable wscale; 2. Use the macro ALIGN instead of two statements. The two statements are used to make window align to 1< --- net/ipv4/tcp_output.c | 8 +++

[PATCH net-next 1/1] tcp: sysctl: Fix a race to avoid unexpected 0 window from space

2017-03-23 Thread gfree . wind
From: Gao Feng Because sysctl_tcp_adv_win_scale could be changed any time, so there is one race in tcp_win_from_space. For example, 1.sysctl_tcp_adv_win_scale<=0 (sysctl_tcp_adv_win_scale is negative now) 2.space>>(-sysctl_tcp_adv_win_scale) (sysctl_tcp_adv_win_scale is postive now) As a result,