Re: [PATCH] net: Fix some comments

2020-09-06 Thread linmiaohe
Jakub Kicinski wrote: >On Sat, 5 Sep 2020 05:14:48 -0400 Miaohe Lin wrote: >> Since commit 8d7017fd621d ("blackhole_netdev: use blackhole_netdev to >> invalidate dst entries"), we use blackhole_netdev to invalidate dst >> entries instead of loopback device anymore. Also fix broken NETIF_F_HW_CSU

Re: [PATCH] net: ipv4: remove unused arg exact_dif in compute_score

2020-08-30 Thread linmiaohe
David Ahern wrote: >On 8/29/20 3:01 AM, Miaohe Lin wrote: >> @@ -277,15 +277,13 @@ static struct sock *inet_lhash2_lookup(struct net *net, >> const __be32 daddr, const unsigned short hnum, >> const int dif, const int sdif) >> { >> -boo

Re: [PATCH] net: Avoid strcmp current->comm with warncomm when warned >= 5

2020-08-18 Thread linmiaohe
David Miller wrote: >From: Miaohe Lin >Date: Tue, 18 Aug 2020 07:41:32 -0400 > >> @@ -417,7 +417,7 @@ static void sock_warn_obsolete_bsdism(const char >> *name) { >> static int warned; >> static char warncomm[TASK_COMM_LEN]; >> -if (strcmp(warncomm, current->comm) && warned < 5) {

Re: [PATCH] net: Relax the npages test against MAX_SKB_FRAGS

2020-08-18 Thread linmiaohe
Eric Dumazet wrote: >On Tue, Aug 18, 2020 at 4:58 AM Miaohe Lin wrote: >> >> The npages test against MAX_SKB_FRAGS can be relaxed if we succeed to >> allocate high order pages as the note in comment said. >> > > >We do not want this change. > >This interface is used by datagram providers, we do

Re: [PATCH] net: handle the return value of pskb_carve_frag_list() correctly

2020-08-17 Thread linmiaohe
David Miller wrote: >> David Miller wrote: + /* split line is in frag list */ + if (k == 0 && pskb_carve_frag_list(skb, shinfo, off - pos, gfp_mask)) { + /* skb_frag_unref() is not needed here as shinfo->nr_frags = 0. */ + if (skb_has_frag_list(skb))

Re: [PATCH] net: handle the return value of pskb_carve_frag_list() correctly

2020-08-16 Thread linmiaohe
David Miller wrote: >> +/* split line is in frag list */ >> +if (k == 0 && pskb_carve_frag_list(skb, shinfo, off - pos, gfp_mask)) { >> +/* skb_frag_unref() is not needed here as shinfo->nr_frags = 0. >> */ >> +if (skb_has_frag_list(skb)) >> +kf

Re: [PATCH] net: add missing skb_uarg refcount increment in pskb_carve_inside_header()

2020-08-15 Thread linmiaohe
Willem de Bruijn wrote: >On Fri, Aug 14, 2020 at 9:20 AM linmiaohe wrote: >> >> Willem de Bruijn wrote: >> >On Thu, Aug 13, 2020 at 2:16 PM Miaohe Lin wrote: >> >> >> >> If the skb is zcopied, we should increase the skb_uarg refcount

Re: [PATCH] net: correct zerocopy refcnt with newly allocated UDP or RAW uarg

2020-08-15 Thread linmiaohe
Willem de Bruijn wrote: >On Fri, Aug 14, 2020 at 10:17 AM linmiaohe wrote: >> > >I don't think that can happen. > >The question is when this branch is false > >next = (u32)atomic_read(&sk->sk_zckey); >if ((u32)(uarg->i

Re: [PATCH] bpf: Convert to use the preferred fallthrough macro

2020-08-15 Thread linmiaohe
Yonghong Song wrote: >On 8/14/20 2:16 AM, Miaohe Lin wrote: >> Convert the uses of fallthrough comments to fallthrough macro. >> >> Signed-off-by: Miaohe Lin > >This is not a bug fix but rather an enhancement so not sure whether this >should push to bpf tree or wait until bpf-next. > >It may be

Re: [PATCH] bpf: Convert to use the preferred fallthrough macro

2020-08-15 Thread linmiaohe
Andrii Nakryiko wrote: On Fri, Aug 14, 2020 at 2:58 AM Miaohe Lin wrote: >> >> Convert the uses of fallthrough comments to fallthrough macro. >> @@ -1794,7 +1794,7 @@ static bool cg_sockopt_is_valid_access(int off, int >> size, >> return prog->expected_attach_type == >>

Re: [PATCH] net: correct zerocopy refcnt with newly allocated UDP or RAW uarg

2020-08-14 Thread linmiaohe
Willem de Bruijn wrote: >On Thu, Aug 13, 2020 at 1:59 PM Miaohe Lin wrote: >> >> The var extra_uref is introduced to pass the initial reference taken >> in sock_zerocopy_alloc to the first generated skb. But now we may fail >> to pass the initial reference with newly allocated UDP or RAW uarg

Re: [PATCH] net: add missing skb_uarg refcount increment in pskb_carve_inside_header()

2020-08-14 Thread linmiaohe
Willem de Bruijn wrote: >On Thu, Aug 13, 2020 at 2:16 PM Miaohe Lin wrote: >> >> If the skb is zcopied, we should increase the skb_uarg refcount before >> we involve skb_release_data(). See pskb_expand_head() as a reference. > >Did you manage to observe a bug through this datapath in practice? >

Re: [PATCH] net: Fix potential memory leak in proto_register()

2020-08-12 Thread linmiaohe
Hi all: David Miller wrote: >From: Cong Wang >Date: Tue, 11 Aug 2020 16:02:51 -0700 > >>> @@ -3406,6 +3406,16 @@ static void sock_inuse_add(struct net *net, >>> int val) } #endif >>> >>> +static void tw_prot_cleanup(struct timewait_sock_ops *twsk_prot) { >>> + if (!twsk_prot) >>> +

Re: [PATCH] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()

2020-08-11 Thread linmiaohe
Eric Dumazet wrote: > On 8/10/20 5:28 AM, Miaohe Lin wrote: >> The skb_shared_info part of the data is assigned in the following >> loop. It is meaningless to do a memcpy here. >> > >Reminder : net-next is CLOSED. > Thanks for your remind. I would wait for it open. >This is not correct. We sti

Re: [PATCH] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()

2020-08-11 Thread linmiaohe
Florian Westphal wrote: >Miaohe Lin wrote: >> The skb_shared_info part of the data is assigned in the following loop. > >Where? > It's at the below for (i = 0; i < nfrags; i++) loop. But I missed something as Eric Dumazet pointed out. Sorry about it.

[PATCH] net: Convert to use the fallthrough macro

2020-08-08 Thread linmiaohe
From: Miaohe Lin Convert the uses of fallthrough comments to fallthrough macro. Signed-off-by: Miaohe Lin --- net/socket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/socket.c b/net/socket.c index c61f036d24f5..f4d5998bdcba 100644 --- a/net/socket.c +++ b/net/

Re: [PATCH 3/5] net: Set fput_needed iff FDPUT_FPUT is set

2020-08-07 Thread linmiaohe
Al Viro wrote: >On Thu, Aug 06, 2020 at 12:59:16PM +0100, Al Viro wrote: >> On Thu, Aug 06, 2020 at 07:53:16PM +0800, linmiaohe wrote: >> > From: Miaohe Lin >> > >> > We should fput() file iff FDPUT_FPUT is set. So we should set >> > fput_neede

Re: [PATCH] net: Fix potential out of bound write in skb_try_coalesce()

2020-08-06 Thread linmiaohe
Eric Dumazet wrote: >On Tue, Aug 4, 2020 at 4:46 AM linmiaohe wrote: >> >> From: Miaohe Lin >> >> The head_frag of skb would occupy one extra skb_frag_t. Take it into >> account or out of bound write to skb frags may happen. >> > >Please share a

[PATCH 5/5] net: Use helper function ip_is_fragment()

2020-08-06 Thread linmiaohe
From: Miaohe Lin Use helper function ip_is_fragment() to check ip fragment. Signed-off-by: Miaohe Lin --- net/core/skbuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 8a0c39e4ab0a..fa823405829c 100644 --- a/net/core/skbuff.c

[PATCH 3/5] net: Set fput_needed iff FDPUT_FPUT is set

2020-08-06 Thread linmiaohe
From: Miaohe Lin We should fput() file iff FDPUT_FPUT is set. So we should set fput_needed accordingly. Fixes: 00e188ef6a7e ("sockfd_lookup_light(): switch to fdget^W^Waway from fget_light") Signed-off-by: Miaohe Lin --- net/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH 2/5] net: Use helper function fdput()

2020-08-06 Thread linmiaohe
From: Miaohe Lin Use helper function fdput() to fput() the file iff FDPUT_FPUT is set. Signed-off-by: Miaohe Lin --- net/socket.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/socket.c b/net/socket.c index 976426d03f09..6aff5aeb6728 100644 --- a/net/socket.c +++

[PATCH 4/5] net: Remove meaningless jump label out_fs

2020-08-06 Thread linmiaohe
From: Miaohe Lin The out_fs jump label has nothing to do but goto out. Signed-off-by: Miaohe Lin --- net/socket.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/socket.c b/net/socket.c index ee9c9dac4728..e1a1195ce69e 100644 --- a/net/socket.c +++ b/net/socket.c @@ -

[PATCH] net: Fix potential out of bound write in skb_try_coalesce()

2020-08-04 Thread linmiaohe
From: Miaohe Lin The head_frag of skb would occupy one extra skb_frag_t. Take it into account or out of bound write to skb frags may happen. Signed-off-by: Miaohe Lin --- net/core/skbuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c

Re: [PATCH] mac80211: use eth_zero_addr() to clear mac address

2020-08-04 Thread linmiaohe
> David Miller wrote: >>From: linmiaohe >>Date: Sat, 1 Aug 2020 17:12:38 +0800 >> >> From: Miaohe Lin >> >> Use eth_zero_addr() to clear mac address instead of memset(). >> >> Signed-off-by: Miaohe Lin > >If you're going to mak

[PATCH] net: Pass NULL to skb_network_protocol() when we don't care about vlan depth

2020-08-01 Thread linmiaohe
From: Miaohe Lin When we don't care about vlan depth, we could pass NULL instead of the address of a unused local variable to skb_network_protocol() as a param. Signed-off-by: Miaohe Lin --- net/core/skbuff.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/core/skbuff

[PATCH] net: Use __skb_pagelen() directly in skb_cow_data()

2020-08-01 Thread linmiaohe
From: Miaohe Lin In fact, skb_pagelen() - skb_headlen() is equal to __skb_pagelen(), use it directly to avoid unnecessary skb_headlen() call. Also fix the CHECK note of checkpatch.pl: Comparison to NULL could be written "!__pskb_pull_tail" Signed-off-by: Miaohe Lin --- net/core/skbuff.c |

[PATCH] nl80211: use eth_zero_addr() to clear mac address

2020-08-01 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address instead of memset(). Signed-off-by: Miaohe Lin --- net/wireless/nl80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7fbca0854265..c88f9d09cb25 100644 ---

[PATCH] net: qed: use eth_zero_addr() to clear mac address

2020-08-01 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address instead of memset(). Signed-off-by: Miaohe Lin --- drivers/net/ethernet/qlogic/qed/qed_sriov.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/etherne

[PATCH] net: qede: use eth_zero_addr() to clear mac address

2020-08-01 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address instead of memset(). Signed-off-by: Miaohe Lin --- drivers/net/ethernet/qlogic/qede/qede_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet

[PATCH] mac80211: use eth_zero_addr() to clear mac address

2020-08-01 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address instead of memset(). Signed-off-by: Miaohe Lin --- net/mac80211/trace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index 1b4709694d2a..50ab5b9d8eab 100644 --- a/net/

[PATCH] net: Pass NULL to skb_network_protocol() when we don't care about vlan depth

2020-07-30 Thread linmiaohe
From: Miaohe Lin When we don't care about vlan depth, we could pass NULL instead of the address of a unused local variable to skb_network_protocol() as a param. Signed-off-by: Miaohe Lin --- net/core/dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/core/dev.c b/n

[PATCH] net/ncsi: use eth_zero_addr() to clear mac address

2020-07-23 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address insetad of memset(). Signed-off-by: Miaohe Lin --- net/ncsi/ncsi-rsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c index a94bb59793f0..5b1f4ec66dd9 100644 --- a/net/ncsi/

[PATCH] cxgb4: use eth_zero_addr() to clear mac address

2020-07-23 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address insetad of memset(). Signed-off-by: Miaohe Lin --- drivers/net/ethernet/chelsio/cxgb4/smt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/smt.c b/drivers/net/ethernet/chelsio/cxg

[PATCH] net: udp: Fix wrong clean up for IS_UDPLITE macro

2020-07-21 Thread linmiaohe
From: Miaohe Lin We can't use IS_UDPLITE to replace udp_sk->pcflag when UDPLITE_RECV_CC is checked. Fixes: b2bf1e2659b1 ("[UDP]: Clean up for IS_UDPLITE macro") Signed-off-by: Miaohe Lin --- net/ipv4/udp.c | 2 +- net/ipv6/udp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --

[PATCH] igb: use eth_zero_addr() to clear mac address

2020-07-20 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address insetad of memset(). Signed-off-by: Miaohe Lin --- drivers/net/ethernet/intel/igb/igb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel

[PATCH] ixgbe: use eth_zero_addr() to clear mac address

2020-07-20 Thread linmiaohe
From: Miaohe Lin Use eth_zero_addr() to clear mac address insetad of memset(). Signed-off-by: Miaohe Lin --- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet

[PATCH] net: ipv4: Fix wrong type conversion from hint to rt in ip_route_use_hint()

2020-06-27 Thread linmiaohe
From: Miaohe Lin We can't cast sk_buff to rtable by (struct rtable *)hint. Use skb_rtable(). Fixes: 02b24941619f ("ipv4: use dst hint for ipv4 list receive") Signed-off-by: Miaohe Lin --- net/ipv4/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/route.c b/n

Re: [PATCH v3] net: netfilter: Fix rpfilter dropping vrf packets by mistake

2019-05-13 Thread linmiaohe
On 2019/5/13 17:42, Pablo Neira Ayuso wrote: > On Thu, Apr 25, 2019 at 09:43:53PM +0800, linmiaohe wrote: >> From: Miaohe Lin >> >> When firewalld is enabled with ipv4/ipv6 rpfilter, vrf >> ipv4/ipv6 packets will be dropped because in device is >> vrf but out

Re: [PATCH net] net: vrf: fix remove vrf module error when there's no reference

2019-03-03 Thread linmiaohe
On 2019/3/3 4:15, David Ahern wrote: > On 3/2/19 5:31 AM, linmiaohe wrote: >> From: Miaohe Lin >> >> If we insmod vrf.ko, there is no way to remove it because of lack of >> module_exit. >> I think we may need it. >> >> Signed-off-by: Miaohe Lin &g

[PATCH net] net: vrf: fix remove vrf module error when there's no reference

2019-03-02 Thread linmiaohe
From: Miaohe Lin If we insmod vrf.ko, there is no way to remove it because of lack of module_exit. I think we may need it. Signed-off-by: Miaohe Lin --- drivers/net/vrf.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index 7c1430ed0244..0e93