[tipc-discussion] [PATCH net] tipc: fix a possible memleak in tipc_buf_append

2024-04-30 Thread Xin Long
__skb_linearize() doesn't free the skb when it fails, so move '*buf = NULL' after __skb_linearize(), so that the skb can be freed on the err path. Fixes: b7df21cf1b79 ("tipc: skb_linearize the head skb when reassembling msgs") Reported-by: Paolo Abeni Signed-off-by: Xin Long --- net/

[tipc-discussion] [PATCH net-next] tipc: rename the module name diag to tipc_diag

2024-02-02 Thread Xin Long
It is not appropriate for TIPC to use "diag" as its diag module name while the other protocols are using "$(protoname)_diag" like tcp_diag, udp_diag and sctp_diag etc. So this patch is to rename diag.ko to tipc_diag.ko in tipc's Makefile. Signed-off-by: Xin Long --- n

[tipc-discussion] [PATCH net-next] tipc: replace open-code bearer rcu_dereference access in bearer.c

2023-06-05 Thread Xin Long
Replace these open-code bearer rcu_dereference access with bearer_get(), like other places in bearer.c. While at it, also use tipc_net() instead of net_generic(net, tipc_net_id) to get "tn" in bearer.c. Signed-off-by: Xin Long --- net/tipc/bearer.c | 14 ++ 1 file

[tipc-discussion] [PATCH net-next] tipc: delete tipc_mtu_bad from tipc_udp_enable

2023-05-29 Thread Xin Long
nged to a too small mtu after the UDP bearer is created even with tipc_mtu_bad() check in tipc_udp_enable(). Note that NETDEV_CHANGEMTU event processing in tipc_l2_device_event() doesn't really work for UDP bearer. So this patch deletes the unnecessary tipc_mtu_bad from tipc_udp_enable. Signed-of

[tipc-discussion] [PATCHv3 net 3/3] tipc: check the bearer min mtu properly when setting it by netlink

2023-05-14 Thread Xin Long
used to check media min mtu in __tipc_nl_media_set(), as m->mtu currently is only used by the IPv4 UDP bearer as its default mtu value. Fixes: 682cd3cf946b ("tipc: confgiure and apply UDP bearer MTU on running links") Signed-off-by: Xin Long Acked-by: Jon Maloy --- net/tipc/bearer.

[tipc-discussion] [PATCHv3 net 0/3] tipc: fix the mtu update in link mtu negotiation

2023-05-14 Thread Xin Long
the crash with this helper. While at it, the 3rd patch fixes the udp bearer mtu update by netlink with this helper. Xin Long (3): tipc: add tipc_bearer_min_mtu to calculate min mtu tipc: do not update mtu if msg_max is too small in mtu negotiation tipc: check the bearer min mtu properly when

[tipc-discussion] [PATCHv3 net 2/3] tipc: do not update mtu if msg_max is too small in mtu negotiation

2023-05-14 Thread Xin Long
("tipc: simplify link mtu negotiation") Reported-by: Shuang Li Signed-off-by: Xin Long Acked-by: Jon Maloy --- v2: - do the msg_max check against the min MTU early, as Tung suggested. v3: - move the change history under ---, as Tung suggested. --- net/tipc/link.c | 9 ++--- 1

[tipc-discussion] [PATCHv3 net 1/3] tipc: add tipc_bearer_min_mtu to calculate min mtu

2023-05-14 Thread Xin Long
-off-by: Xin Long Acked-by: Jon Maloy --- v2: - use bearer_get() to avoid the open code. v3: - move the change history under ---, as Tung suggested. --- net/tipc/bearer.c| 13 + net/tipc/bearer.h| 3 +++ net/tipc/udp_media.c | 5 +++-- 3 files changed, 19 insertions(+), 2

Re: [tipc-discussion] [PATCHv2 net 1/3] tipc: add tipc_bearer_min_mtu to calculate min mtu

2023-05-03 Thread Xin Long
t it after "---". See the comment in Patch 2/3. > > > >Signed-off-by: Xin Long > >--- > > net/tipc/bearer.c| 13 + > > net/tipc/bearer.h| 3 +++ > > net/tipc/udp_media.c | 5 +++-- > > 3 files changed, 19 insertions(+), 2 deletion

Re: [tipc-discussion] [PATCHv2 net 2/3] tipc: do not update mtu if msg_max is too small in mtu negotiation

2023-05-03 Thread Xin Long
changes, see the comment from davem: https://lore.kernel.org/netdev/20160415.172858.253625178036493951.da...@davemloft.net/ unless there are some new rules I missed. Thanks. > > > >Fixes: ed193ece2649 ("tipc: simplify link mtu negotiation") > >Reported-by: Shuan

[tipc-discussion] [PATCHv2 net 1/3] tipc: add tipc_bearer_min_mtu to calculate min mtu

2023-05-02 Thread Xin Long
;v2: - use bearer_get() to avoid the open code. Signed-off-by: Xin Long --- net/tipc/bearer.c| 13 + net/tipc/bearer.h| 3 +++ net/tipc/udp_media.c | 5 +++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 35cac7733

[tipc-discussion] [PATCHv2 net 2/3] tipc: do not update mtu if msg_max is too small in mtu negotiation

2023-05-02 Thread Xin Long
e msg_max check against the min MTU early, as Tung suggested. Fixes: ed193ece2649 ("tipc: simplify link mtu negotiation") Reported-by: Shuang Li Signed-off-by: Xin Long --- net/tipc/link.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/tipc/link.c b/ne

[tipc-discussion] [PATCHv2 net 3/3] tipc: check the bearer min mtu properly when setting it by netlink

2023-05-02 Thread Xin Long
used to check media min mtu in __tipc_nl_media_set(), as m->mtu currently is only used by the IPv4 UDP bearer as its default mtu value. Fixes: 682cd3cf946b ("tipc: confgiure and apply UDP bearer MTU on running links") Signed-off-by: Xin Long --- net/tipc/bearer.c | 4 ++-- 1 fi

[tipc-discussion] [PATCHv2 net 0/3] tipc: fix the mtu update in link mtu negotiation

2023-05-02 Thread Xin Long
the crash with this helper. While at it, the 3rd patch fixes the udp bearer mtu update by netlink with this helper. Xin Long (3): tipc: add tipc_bearer_min_mtu to calculate min mtu tipc: do not update mtu if msg_max is too small in mtu negotiation tipc: check the bearer min mtu properly when

Re: [tipc-discussion] [PATCH net 1/2] tipc: add tipc_bearer_min_mtu to calculate min mtu

2023-05-01 Thread Xin Long
On Mon, May 1, 2023 at 11:35 AM Xin Long wrote: > On Mon, May 1, 2023 at 1:21 AM Tung Quang Nguyen > wrote: >> >@@ -760,6 +760,7 @@ static int tipc_udp_enable(struct net *net, struct >> >tipc_bearer *b, >> > else >> >

Re: [tipc-discussion] [PATCH net 2/2] tipc: do not update mtu if msg_max is too small

2023-05-01 Thread Xin Long
On Mon, May 1, 2023 at 1:22 AM Tung Quang Nguyen < tung.q.ngu...@dektech.com.au> wrote: > > > >-Original Message- > >From: Xin Long > >Sent: Sunday, April 30, 2023 5:41 AM > >To: network dev ; > tipc-discussion@lists.sourceforge.net > >C

Re: [tipc-discussion] [PATCH net 1/2] tipc: add tipc_bearer_min_mtu to calculate min mtu

2023-05-01 Thread Xin Long
On Mon, May 1, 2023 at 1:21 AM Tung Quang Nguyen < tung.q.ngu...@dektech.com.au> wrote: > > > >-Original Message- > >From: Xin Long > >Sent: Sunday, April 30, 2023 5:41 AM > >To: network dev ; > tipc-discussion@lists.sourceforge.net > >Cc

[tipc-discussion] [PATCH net 2/2] tipc: do not update mtu if msg_max is too small

2023-04-29 Thread Xin Long
("tipc: simplify link mtu negotiation") Reported-by: Shuang Li Signed-off-by: Xin Long --- net/tipc/link.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/tipc/link.c b/net/tipc/link.c index b3ce24823f50..a9e46c58b28a 100644 --- a/net/tipc/link.c +++ b

[tipc-discussion] [PATCH net 1/2] tipc: add tipc_bearer_min_mtu to calculate min mtu

2023-04-29 Thread Xin Long
-off-by: Xin Long --- net/tipc/bearer.c| 13 + net/tipc/bearer.h| 3 +++ net/tipc/udp_media.c | 5 +++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 35cac7733fd3..c5d2e8c45f88 100644 --- a/net/tipc/bearer.c +++ b

[tipc-discussion] [PATCH net 0/2] tipc: fix the mtu update in link mtu negotiation

2023-04-29 Thread Xin Long
the crash with this function. Xin Long (2): tipc: add tipc_bearer_min_mtu to calculate min mtu tipc: do not update mtu if msg_max is too small net/tipc/bearer.c| 13 + net/tipc/bearer.h| 3 +++ net/tipc/link.c | 7 --- net/tipc/udp_media.c | 5 +++-- 4 files

[tipc-discussion] [PATCH net] tipc: re-fetch skb cb after tipc_msg_validate

2022-11-25 Thread Xin Long
it by re-fetching the skb cb from the new allocated skb after calling tipc_msg_validate(). Fixes: fc1b6d6de220 ("tipc: introduce TIPC encryption & authentication") Reported-by: Shuang Li Signed-off-by: Xin Long --- net/tipc/crypto.c | 3 +++ 1 file changed, 3 insertions(+) diff --

[tipc-discussion] [PATCH net 1/2] tipc: set con sock in tipc_conn_alloc

2022-11-18 Thread Xin Long
ver and flag CF_CONNECTED setting under s->idr_lock, as they should all be set before tipc_conn_alloc() is called. Fixes: c5fa7b3cf3cb ("tipc: introduce new TIPC server infrastructure") Reported-by: Wei Chen Signed-off-by: Xin Long --- net/tipc/topsrv.c | 11 +-- 1 file

[tipc-discussion] [PATCH net 0/2] tipc: fix two race issues in tipc_conn_alloc

2022-11-18 Thread Xin Long
The race exists beteen tipc_topsrv_accept() and tipc_conn_close(), one is allocating the con while the other is freeing it and there is no proper lock protecting it. Therefore, a null-pointer-defer and a use-after-free may be triggered, see details on each patch. Xin Long (2): tipc: set con

[tipc-discussion] [PATCH net 2/2] tipc: add an extra conn_get in tipc_conn_alloc

2022-11-18 Thread Xin Long
conn_rcv_sub() returns 0 or -1 only, we don't need to check for "> 0". Fixes: c5fa7b3cf3cb ("tipc: introduce new TIPC server infrastructure") Signed-off-by: Xin Long --- net/tipc/topsrv.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/tipc

[tipc-discussion] [PATCH net] tipc: fix the msg->req tlv len check in tipc_nl_compat_name_table_dump_header

2022-11-04 Thread Xin Long
238680ce20...@syzkaller.appspotmail.com Fixes: 974cb0e3e7c9 ("tipc: fix uninit-value in tipc_nl_compat_name_table_dump") Signed-off-by: Xin Long --- net/tipc/netlink_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.

Re: [tipc-discussion] BUG: unable to handle kernel NULL pointer dereference in tipc_crypto_key_distr

2022-11-04 Thread Xin Long
On Sun, Oct 30, 2022 at 6:32 AM Wei Chen wrote: > > Dear Linux Developer, > > Recently when using our tool to fuzz kernel, the following crash was > triggered: > > HEAD commit: 64570fbc14f8 Linux 5.15-rc5 > git tree: upstream > compiler: gcc 8.0.1 > console output: >

Re: [tipc-discussion] BUG: unable to handle kernel NULL pointer dereference in tipc_conn_close

2022-10-31 Thread Xin Long
On Sun, Oct 30, 2022 at 6:20 AM Wei Chen wrote: > > Dear Linux Developer, > > Recently when using our tool to fuzz kernel, the following crash was > triggered: > > HEAD commit: 64570fbc14f8 Linux 5.15-rc5 > git tree: upstream > compiler: gcc 8.0.1 > console output: >

[tipc-discussion] [PATCH net] tipc: fix a null-ptr-deref in tipc_topsrv_accept

2022-10-18 Thread Xin Long
orted-by: syzbot+c5ce866a8d30f4be0...@syzkaller.appspotmail.com Signed-off-by: Xin Long --- net/tipc/topsrv.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c index 14fd05fd6107..d92ec92f0b71 100644 --- a/net/tipc/topsrv.c +++ b/net/tipc/topsrv.c

[tipc-discussion] [PATCH net] tipc: move bc link creation back to tipc_node_create

2022-06-24 Thread Xin Long
k creation should also be called before it's rehashed, as we don't create it for preliminary nodes. Fixes: 4cbf8ac2fe5a ("tipc: enable creating a "preliminary" node") Reported-by: Shuang Li Signed-off-by: Xin Long Acked-by: Jon Maloy --- net/tipc/node.c | 41 +++

Re: [tipc-discussion] [PATCH net-next] tipc: remove inputq from tipc_bc_base

2022-06-07 Thread Xin Long
On Mon, Jun 6, 2022 at 11:20 PM Tung Quang Nguyen wrote: > > > -Original Message- > > From: Xin Long > > Sent: Tuesday, June 7, 2022 12:57 AM > > To: tipc-discussion@lists.sourceforge.net > > Subject: Re: [tipc-discussion] [PATCH net-next] tipc: rem

Re: [tipc-discussion] [PATCH net-next] tipc: remove inputq from tipc_bc_base

2022-06-06 Thread Xin Long
fix Jon's email address. On Mon, Jun 6, 2022 at 1:52 PM Xin Long wrote: > > After Commit 2af5ae372a4b ("tipc: clean up unused code and structures"), > there is no place really using tn->bcbase->inputq. This patch is to > delete this member from struct tipc_bc_base.

Re: [tipc-discussion] [PATCH net] tipc: move bc link creation back to tipc_node_create

2022-06-06 Thread Xin Long
fix Jon's email address. On Mon, Jun 6, 2022 at 11:24 AM Xin Long wrote: > > Shuang Li reported a NULL pointer dereference crash: > > [] BUG: kernel NULL pointer dereference, address: 0068 > [] RIP: 0010:tipc_link_is_up+0x5/0x10 [tipc] &g

[tipc-discussion] [PATCH net-next] tipc: remove inputq from tipc_bc_base

2022-06-06 Thread Xin Long
After Commit 2af5ae372a4b ("tipc: clean up unused code and structures"), there is no place really using tn->bcbase->inputq. This patch is to delete this member from struct tipc_bc_base. Signed-off-by: Xin Long --- net/tipc/bcast.c | 22 +- 1 file changed, 1

[tipc-discussion] [PATCH net] tipc: move bc link creation back to tipc_node_create

2022-06-06 Thread Xin Long
k creation should also be called before it's rehashed, as we don't create it for preliminary nodes. Fixes: 4cbf8ac2fe5a ("tipc: enable creating a "preliminary" node") Reported-by: Shuang Li Signed-off-by: Xin Long --- net/tipc/node.c | 41 ++---

[tipc-discussion] [PATCH net-next] tipc: add lxc_xmit switch for the transmission between netns

2022-03-07 Thread Xin Long
switch for lxc_xmit, so that users can use TIPC between netns as before by setting it to 0. Note that it only affects the new created nodes. Signed-off-by: Xin Long --- net/tipc/node.c | 4 +++- net/tipc/node.h | 2 ++ net/tipc/sysctl.c | 9 + 3 files changed, 14 insertions(+), 1

[tipc-discussion] [PATCH net-next] tipc: discard MSG_CRYPTO msgs when key_exchange_enabled is not set

2021-12-10 Thread Xin Long
When key_exchange is disabled, there is no reason to accept MSG_CRYPTO msgs if it doesn't send MSG_CRYPTO msgs. Signed-off-by: Xin Long Acked-by: Jon Maloy --- net/tipc/link.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/tipc/link.c b/net/tipc/link.c index

[tipc-discussion] [PATCH net-next] tipc: discard MSG_CRYPTO msgs when key_exchange_enabled is not set

2021-11-24 Thread Xin Long
When key_exchange is disabled, there is no reason to accept MSG_CRYPTO msgs if it doesn't send MSG_CRYPTO msgs. Signed-off-by: Xin Long --- net/tipc/link.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/tipc/link.c b/net/tipc/link.c index 09ae8448f394..8d9e09f48f4c

[tipc-discussion] [PATCH net-next] tipc: delete the unlikely branch in tipc_aead_encrypt

2021-11-24 Thread Xin Long
as the pages in skbs are not writable, see more on commit 3cf4375a0904 ("tipc: do not write skb_shinfo frags when doing decrytion"). Signed-off-by: Xin Long Acked-by: Jon Maloy --- net/tipc/crypto.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/net/ti

[tipc-discussion] [PATCH net-next] tipc: delete the unlikely branch in tipc_aead_encrypt

2021-11-21 Thread Xin Long
as the pages in skbs are not writable, see more on commit 3cf4375a0904 ("tipc: do not write skb_shinfo frags when doing decrytion"). Signed-off-by: Xin Long --- net/tipc/crypto.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/net/tipc/crypto.c b/net/t

[tipc-discussion] [PATCH net] tipc: only accept encrypted MSG_CRYPTO msgs

2021-11-15 Thread Xin Long
") Acked-by: Ying Xue Acked-by: Jon Maloy Signed-off-by: Xin Long --- net/tipc/link.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/tipc/link.c b/net/tipc/link.c index 1b7a487c8841..09ae8448f394 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -12

Re: [tipc-discussion] [PATCH net] tipc: only accept encrypted MSG_CRYPTO msgs

2021-11-14 Thread Xin Long
the MSG_CRYPTO type") > > ///jon > > > > > On 11/14/21 08:09, Xue, Ying wrote: > > Thanks Xin! The patch looks good to me. > > > > Acked-by: Ying Xue > > > > -Original Message- > > From: Xin Long > > Sent: Saturday, November 13,

[tipc-discussion] [PATCH net] tipc: only accept encrypted MSG_CRYPTO msgs

2021-11-12 Thread Xin Long
is to do that by checking TIPC_SKB_CB(skb)->decrypted and discard it if this packet never got decrypted. Fixes: 1ef6f7c9390f ("tipc: add automatic session key exchange") Signed-off-by: Xin Long --- net/tipc/link.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --g

[tipc-discussion] shouldn't unencrypted packets be discarded if any key is set on local node?

2021-11-10 Thread Xin Long
Hi Everyone, Currently in tcp_rcv(), it seems that both unencrypted and encrypted packets can be processed even when key/master_key is set. After the key is set, which means all packets going out will be encrypted, to respond to the unencrypted packets with encrypted packets doesn't seem normal,

Re: [tipc-discussion] [PATCH net-next 8/8] tipc: add hardware gso

2021-09-22 Thread Xin Long
On Fri, Sep 10, 2021 at 8:08 AM Jon Maloy wrote: > > > > On 06/07/2021 14:22, Xin Long wrote: > > Since there's no enough bit in netdev_features_t for > > NETIF_F_GSO_TIPC_BIT, and tipc is using the simliar > > code as sctp, this patch will reuse SKB_GSO_SCTP and >

[tipc-discussion] [PATCH net] tipc: call tipc_wait_for_connect only when dlen is not 0

2021-08-15 Thread Xin Long
t for SYN+") Reported-by: Shuang Li Signed-off-by: Xin Long Acked-by: Jon Maloy --- net/tipc/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 75b99b7eda22..8754bd885169 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -

[tipc-discussion] [PATCH net] tipc: call tipc_wait_for_connect only when dlen is not 0

2021-08-03 Thread Xin Long
t for SYN+") Reported-by: Shuang Li Signed-off-by: Xin Long --- net/tipc/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 75b99b7eda22..8754bd885169 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1518,7 +1518,7

[tipc-discussion] [PATCH net] tipc: do not write skb_shinfo frags when doing decrytion

2021-07-23 Thread Xin Long
("tipc: introduce TIPC encryption & authentication") Reported-by: Shuang Li Signed-off-by: Xin Long Acked-by: Jon Maloy --- net/tipc/crypto.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c index e5c43d4d5a75

[tipc-discussion] [PATCH net] tipc: do not write skb_shinfo frags when doing decrytion

2021-07-23 Thread Xin Long
("tipc: introduce TIPC encryption & authentication") Reported-by: Shuang Li Signed-off-by: Xin Long --- net/tipc/crypto.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c index e5c43d4d5a75..c9391d38de85 100644

[tipc-discussion] [PATCH net-next] tipc: fix an use-after-free issue in tipc_recvmsg

2021-07-23 Thread Xin Long
") Reported-by: syzbot+e6741b97d5552f97c...@syzkaller.appspotmail.com Signed-off-by: Xin Long Acked-by: Jon Maloy --- net/tipc/socket.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 9b0b311c7ec1..b0dd183a4dbc 100644 --- a/n

[tipc-discussion] [PATCH net-next] tipc: fix an use-after-free issue in tipc_recvmsg

2021-07-23 Thread Xin Long
") Reported-by: syzbot+e6741b97d5552f97c...@syzkaller.appspotmail.com Signed-off-by: Xin Long --- net/tipc/socket.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 9b0b311c7ec1..b0dd183a4dbc 100644 --- a/net/tipc/socket.

Re: [tipc-discussion] FW: [syzbot] KASAN: use-after-free Read in tipc_recvmsg

2021-07-22 Thread Xin Long
On Thu, Jul 22, 2021 at 9:55 PM Hoang Huu Le wrote: > > Hi Xin, > > I think the issue caused by your patch: > > f4919ff59c282 ("tipc: keep the skb in rcv queue until the whole data is read) > > 1976 if (!skb_cb->bytes_read) > 1977 tsk_advance_rx_queue(sk); <-- skb

[tipc-discussion] [PATCH net] tipc: fix implicit-connect for SYN+

2021-07-22 Thread Xin Long
-connect more implicit. Fixes: b97bf3fd8f6a ("[TIPC] Initial merge") Signed-off-by: Xin Long Acked-by: Jon Maloy --- net/tipc/socket.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 34a97ea36cc8..eb

[tipc-discussion] [PATCH net-next] tipc: keep the skb in rcv queue until the whole data is read

2021-07-16 Thread Xin Long
old user applications. Signed-off-by: Xin Long Acked-by: Jon Maloy --- net/tipc/socket.c | 36 +++- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 34a97ea36cc8..9b0b311c7ec1 100644 --- a/net/tipc/socket.c

[tipc-discussion] [PATCH net] tipc: fix implicit-connect for SYN+

2021-07-10 Thread Xin Long
-connect more implicit. Fixes: b97bf3fd8f6a ("[TIPC] Initial merge") Signed-off-by: Xin Long --- net/tipc/socket.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 34a97ea36cc8..ebd300c26a44 100644 ---

[tipc-discussion] [PATCH net-next 7/8] tipc: add software gso

2021-07-06 Thread Xin Long
to each skb in the head_skb's frag_list and send them one by one. This supports with both eth media and udp media. Signed-off-by: Xin Long --- net/tipc/bearer.c| 23 +-- net/tipc/msg.h | 1 + net/tipc/offload.c | 41 + net

[tipc-discussion] [PATCH net-next 8/8] tipc: add hardware gso

2021-07-06 Thread Xin Long
Since there's no enough bit in netdev_features_t for NETIF_F_GSO_TIPC_BIT, and tipc is using the simliar code as sctp, this patch will reuse SKB_GSO_SCTP and NETIF_F_GSO_SCTP_BIT for tipc. Signed-off-by: Xin Long --- include/linux/skbuff.h | 2 -- net/tipc/node.c| 15

[tipc-discussion] [PATCH net-next 6/8] tipc: add offload base

2021-07-06 Thread Xin Long
This is the base code for tipc gso, and tipc_gso_segment() will only be called after gso packets are built in the next patch. Signed-off-by: Xin Long --- include/linux/skbuff.h | 2 ++ net/tipc/Makefile | 2 +- net/tipc/core.c| 3 +++ net/tipc/msg.h | 2 ++ net/tipc

[tipc-discussion] [PATCH net-next 5/8] tipc: add probe recv and state transition

2021-07-06 Thread Xin Long
This patch is to receive and process the probe ack by checking msg_max_pkt() == l->pl.probe_size then does state transition in tipc_link_pl_recv(). For the details, see: https://lwn.net/Articles/860385/ Signed-off-by: Xin Long --- net/tipc/link.c |

[tipc-discussion] [PATCH net-next 3/8] tipc: build probe and its reply in tipc_link_build_proto_msg

2021-07-06 Thread Xin Long
This patch is to adjust the code in tipc_link_build_proto_msg() to make it able to build probe packet with a specific size for sender, and probe reply packet with mtu set. Note that to send the probe packet, the df flag has to be set. Signed-off-by: Xin Long --- net/tipc/link.c | 38

[tipc-discussion] [PATCH net-next 2/8] tipc: add the constants and variables for plpmtud

2021-07-06 Thread Xin Long
' and 'raise' are used for two timers' counting: PROBE_TIMER and PMTU_RAISE_TIMER. 'probe_high' is used for finding the optimal value for pmtu. Signed-off-by: Xin Long --- net/tipc/link.c | 13 + net/tipc/link.h | 20 2 files changed, 33 insertions(+) diff --git

[tipc-discussion] [PATCH net-next 0/8] tipc: add PLPMTUD probe and GSO offload

2021-07-06 Thread Xin Long
This patchset is to implement PLPMTUD and GSO for TIPC, Patch 1-5 are for PLPMTUD while 6-8 are for GSO. It gets some ideas from SCTP as their similarities like both are reliable datagram packets and possible to run over IP(v6)/UDP. But also it does some adjustments for TIPC. Xin Long (8

[tipc-discussion] [PATCH net-next 4/8] tipc: add probe send and state transition

2021-07-06 Thread Xin Long
pl.count will make a timer that 'timeout' every after '10 * node timer interval', where it does state transition in tipc_link_pl_send() and sends probe in tipc_link_build_proto_msg(). For the details, see: https://lwn.net/Articles/860385/ Signed-off-by: Xin Long --- net/tipc/link.c | 48

[tipc-discussion] [PATCH net-next 1/8] tipc: set the mtu for bearer properly for udp media

2021-07-06 Thread Xin Long
Instead of using 14000 for ipv4/udp mtu, and 1280 for ipv6/udp mtu, this patch to set mtu according to the lower device's mtu at the beginning. The pmtu will be determined by the PLPMTUD probe in the following patches. Signed-off-by: Xin Long --- include/uapi/linux/tipc_config.h | 6 -- net

[tipc-discussion] [PATCHv2 net-next] tipc: keep the skb in rcv queue until the whole data is read

2021-06-30 Thread Xin Long
old user applications. v1->v2: - To enable this only when the flags with MSG_EOR is passed into recvmsg() to fix the compatibility isssue as Erin noticed. Signed-off-by: Xin Long --- net/tipc/socket.c | 36 +++- 1 file changed, 27 insertions(+), 9 deleti

[tipc-discussion] [PATCH net-next] Documentation: add more details in tipc.rst

2021-06-30 Thread Xin Long
kernel-doc for TIPC is too simple, we need to add more information for it. This patch is to extend the abstract, and add the Features and Links items. Signed-off-by: Xin Long Acked-by: Jon Maloy --- Documentation/networking/tipc.rst | 121 +- 1 file changed, 118

Re: [tipc-discussion] [PATCH net-next] tipc: keep the skb in rcv queue until the whole data is read

2021-06-30 Thread Xin Long
On Wed, Jun 30, 2021 at 10:33 AM Jon Maloy wrote: > > > On 29/06/2021 17:41, Xin Long wrote: > > On Tue, Jun 29, 2021 at 3:57 PM Jon Maloy wrote: > >> > [...] > > Yes, Jon, I mean the opposite. > > > > when MSG_EOR is set, we will go with wh

Re: [tipc-discussion] [PATCH net-next] tipc: keep the skb in rcv queue until the whole data is read

2021-06-29 Thread Xin Long
On Tue, Jun 29, 2021 at 3:57 PM Jon Maloy wrote: > > > On 28/06/2021 15:16, Xin Long wrote: > > On Mon, Jun 28, 2021 at 3:03 PM Xin Long wrote: > >> On Sun, Jun 27, 2021 at 3:44 PM Erin Shepherd wrote: > >>> Xin Long writes: > >>> > >>&g

Re: [tipc-discussion] [PATCH net-next] tipc: keep the skb in rcv queue until the whole data is read

2021-06-28 Thread Xin Long
On Mon, Jun 28, 2021 at 3:03 PM Xin Long wrote: > > On Sun, Jun 27, 2021 at 3:44 PM Erin Shepherd wrote: > > > > Xin Long writes: > > > > > Currently, when userspace reads a datagram with a buffer that is > > > smaller than this datagram, the data will

Re: [tipc-discussion] [PATCH net-next] tipc: keep the skb in rcv queue until the whole data is read

2021-06-28 Thread Xin Long
On Sun, Jun 27, 2021 at 3:44 PM Erin Shepherd wrote: > > Xin Long writes: > > > Currently, when userspace reads a datagram with a buffer that is > > smaller than this datagram, the data will be truncated and only > > part of it can be received by users. It doesn't seem

[tipc-discussion] [PATCH net-next] tipc: keep the skb in rcv queue until the whole data is read

2021-06-25 Thread Xin Long
. This patch to fix it by keeping the skb in rcv queue until the whole data is read by users. Only the last msg of the datagram will be marked with MSG_EOR, just as TCP/SCTP does. Signed-off-by: Xin Long --- net/tipc/socket.c | 30 +- 1 file changed, 21 insertions(+), 9

[tipc-discussion] [PATCH net] Documentation: add more details in tipc.rst

2021-06-11 Thread Xin Long
kernel-doc for TIPC is too simple, we need to add more information for it. This patch is to extend the abstract, and add the Features and Links items. Signed-off-by: Xin Long --- Documentation/networking/tipc.rst | 121 +- 1 file changed, 118 insertions(+), 3

Re: [tipc-discussion] DGRAM/STREAM Crossover on Debian?

2021-06-02 Thread Xin Long
On Wed, May 26, 2021 at 11:38 AM Duzan, Gary D via tipc-discussion wrote: > >I'm in the process of enhancing a TIPC DGRAM-based RPC-ish service to > include TIPC STREAM transport for larger messages. To simplify configuration, > I have the server process(es) bind() the same type/range for

[tipc-discussion] [PATCH net] tipc: simplify the finalize work queue

2021-05-17 Thread Xin Long
pc_net_work". Note that it's safe to get net from tn->bcl as bcl is always released after the finalize work queue is done. Signed-off-by: Xin Long Acked-by: Jon Maloy --- net/tipc/core.c | 4 ++-- net/tipc/core.h | 8 +--- net/tipc/discover.c | 4 ++-- net/tipc/link.c |

[tipc-discussion] [PATCH net] tipc: wait and exit until all work queues are done

2021-05-16 Thread Xin Long
in tipc_net to track the numbers of work queues in schedule, and wait and exit until all work queues are done in tipc_exit_net(). Fixes: d0f91938bede ("tipc: add ip/udp media type") Reported-by: Shuang Li Signed-off-by: Xin Long Acked-by: Jon Maloy --- net/tipc/core.c | 2 ++ net/t

Re: [tipc-discussion] [net] Revert "net:tipc: Fix a double free in tipc_sk_mcast_rcv"

2021-05-15 Thread Xin Long
On Fri, May 14, 2021 at 7:18 PM Jon Maloy wrote: > > > > On 5/14/21 6:10 PM, patchwork-bot+netdev...@kernel.org wrote: > > Hello: > > > > This patch was applied to netdev/net.git (refs/heads/master): > > > > On Fri, 14 May 2021 08:23:03 +0700 you wrote: > >> This reverts commit

[tipc-discussion] [PATCH net] tipc: simplify the finalize work queue

2021-05-14 Thread Xin Long
pc_net_work". Note that it's safe to get net from tn->bcl as bcl is always released after the finalize work queue is done. Signed-off-by: Xin Long --- net/tipc/core.c | 4 ++-- net/tipc/core.h | 8 +--- net/tipc/discover.c | 4 ++-- net/tipc/link.c | 5 +

[tipc-discussion] [PATCH net] tipc: wait and exit until all work queues are done

2021-05-14 Thread Xin Long
in tipc_net to track the numbers of work queues in schedule, and wait and exit until all work queues are done in tipc_exit_net(). Reported-by: Shuang Li Signed-off-by: Xin Long --- net/tipc/core.c | 2 ++ net/tipc/core.h | 2 ++ net/tipc/udp_media.c | 2 ++ 3 files changed, 6 insertions

Re: [tipc-discussion] [PATCH net] tipc: fix a race in tipc_sk_mcast_rcv

2021-05-14 Thread Xin Long
On Thu, May 13, 2021 at 5:15 PM Jon Maloy wrote: > > > > On 4/28/21 3:30 PM, Xin Long wrote: > > After commit cb1b728096f5 ("tipc: eliminate race condition at multicast > > reception"), when processing the multicast reception, the packets are > > fir

[tipc-discussion] [PATCH net] tipc: skb_linearize the head skb when reassembling msgs

2021-05-07 Thread Xin Long
calling skb_unshare(), as __skb_linearize() will avoid skb_copy(). Also, we can not just drop the frag_list either as the early time. Fixes: 45c8b7b175ce ("tipc: allow non-linear first fragment buffer") Reported-by: Li Shuang Signed-off-by: Xin Long --- net/tipc/msg.c | 9 ++--- 1 file

[tipc-discussion] [PATCHv2 net] tipc: fix a race in tipc_sk_mcast_rcv

2021-04-29 Thread Xin Long
ents from tipc_sk_mcast_rcv() as Tung noticed. Fixes: cb1b728096f5 ("tipc: eliminate race condition at multicast reception") Fixes: 6bf24dc0cc0c ("net:tipc: Fix a double free in tipc_sk_mcast_rcv") Reported-by: Li Shuang Signed-off-by: Xin Long --- net/tipc/msg.h| 1

[tipc-discussion] [PATCH net] tipc: fix a race in tipc_sk_mcast_rcv

2021-04-28 Thread Xin Long
ception") Fixes: 6bf24dc0cc0c ("net:tipc: Fix a double free in tipc_sk_mcast_rcv") Reported-by: Li Shuang Signed-off-by: Xin Long --- net/tipc/node.c | 9 - net/tipc/socket.c | 16 +++- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/net/tipc/node.c b

Re: [tipc-discussion] [net-next v2 0/3] tipc: some small cleanups

2021-04-14 Thread Xin Long
ame_table.h | 4 +- > net/tipc/socket.c | 149 +++--- > 3 files changed, 74 insertions(+), 85 deletions(-) > > -- > 2.29.2 > > > > ___ > tipc-discussion mailing list > tipc-discussion@lists.sourceforge.net &g

[tipc-discussion] [PATCH net] tipc: increment the tmp aead refcnt before attaching it

2021-04-05 Thread Xin Long
by that in the other thread. This patch is to fix it by incrementing the tmp's refcnt before attaching it instead of calling tipc_aead_get() after attaching it. Fixes: fc1b6d6de220 ("tipc: introduce TIPC encryption & authentication") Reported-by: Li Shuang Signed-off-by: Xin Long --- net/tip

Re: [tipc-discussion] [net-next v2 00/16] tipc: cleanups and simplifications

2021-03-15 Thread Xin Long
+++--- > net/tipc/subscr.c | 84 + > net/tipc/subscr.h | 12 +- > 10 files changed, 573 insertions(+), 525 deletions(-) > > > > _______ > tipc-discussion mailing list > tipc-discussion@lists.sourcef

Re: [tipc-discussion] [net-next 00/16] tipc: cleanups and simplifications

2021-02-24 Thread Xin Long
Hi Jon, Sorry for so late to check this patchset, I just came back from Chinese New Year holidays. Overall I like the idea to use one or two new structures to make the parameters passing between functions more clear and readable. Meanwhile I think if the parameters of some function are already

Re: [tipc-discussion] [net-next 14/16] tipc: simplify api between binding table and topology server

2021-02-24 Thread Xin Long
On Wed, Dec 9, 2020 at 2:51 AM wrote: > > From: Jon Maloy > > The function tipc_report_overlap() is called from the binding table > with numerous parameters taken from an instance of struct publication. > A closer look reveals that it always is safe to send along a pointer > to the instance

Re: [tipc-discussion] [net-next 13/16] tipc: simplify signature of tipc_find_service()

2021-02-24 Thread Xin Long
On Wed, Dec 9, 2020 at 2:51 AM wrote: > > From: Jon Maloy > > We reduce the signature of tipc_find_service() and > tipc_create_service(). The reason for doing this might not > be obvious, but we plan to let struct tipc_uaddr contain > information that is relevant for these functions in a later >

Re: [tipc-discussion] [net-next 05/16] tipc: simplify call signatures for publication creation

2021-02-24 Thread Xin Long
On Wed, Dec 9, 2020 at 2:51 AM wrote: > > From: Jon Maloy > > We simplify the call signatures for tipc_nametbl_insert_publ() and > tipc_publ_create() so that fewer parameters are passed around. > > Signed-off-by: Jon Maloy > --- > net/tipc/name_distr.c | 23 >

Re: [tipc-discussion] [net-next 08/16] tipc: refactor tipc_sendmsg() and tipc_lookup_anycast()

2021-02-24 Thread Xin Long
On Wed, Dec 9, 2020 at 2:51 AM wrote: > > From: Jon Maloy > > We simplify the signature if function tipc_nametbl_lookup_anycast(), > using address structures instead of dicrete integers. > > This also makes it possible to make some improvements to the functions > __tipc_sendmsg() in socket.c and

Re: [tipc-discussion] [net-next 06/16] tipc: simplify signature of tipc_nametbl_withdraw() functions

2021-02-24 Thread Xin Long
On Wed, Dec 9, 2020 at 2:51 AM wrote: > > From: Jon Maloy > > Following the priniciples of the preceding commits, we reduce > the number of parameters passed along in tipc_sk_withdraw(), > tipc_nametbl_withdraw() and associated functions. > > Signed-off-by: Jon Maloy > --- >

Re: [tipc-discussion] [net-next 04/16] tipc: simplify signature of tipc_namtbl_publish()

2021-02-24 Thread Xin Long
On Wed, Dec 9, 2020 at 2:51 AM wrote: > > From: Jon Maloy > > Using the new address structure tipc_uaddr, we simplify the signature > of function tipc_sk_publish() and tipc_namtbl_publish() so that fewer > parameters need to be passed around. > > Signed-off-by: Jon Maloy > --- >

Re: [tipc-discussion] [net-next 02/16] tipc: move creation of publication item one level up in call chain

2021-02-24 Thread Xin Long
On Wed, Dec 9, 2020 at 2:51 AM wrote: > > From: Jon Maloy > > We instantiante struct publication in tipc_nametbl_insert_publ() > instead of as currently in tipc_service_insert_publ(). This has the > advantage that we can pass a pointer to the publication struct to > the next call levels, instead

Re: [tipc-discussion] [net v3 1/1] tipc: fix memory leak caused by tipc_buf_append()

2020-10-27 Thread Xin Long
are() returns NULL. > > Fixes: ed42989eab57 ("tipc: fix the skb_unshare() in tipc_buf_append()") > Acked-by: Jon Maloy > Reported-by: Thang Hoang Ngo > Signed-off-by: Tung Nguyen Reviewed-by: Xin Long > --- > net/tipc/msg.c | 5 ++--- > 1 file changed, 2 insertio

Re: [tipc-discussion] [net v1 1/1] tipc: fix memory leak caused by tipc_buf_append()

2020-10-26 Thread Xin Long
patch. Sorry, I realized it was a false one after double-checking. > > Thanks. > Tung Nguyen > > -Original Message- > From: Xin Long > Sent: Monday, October 26, 2020 4:10 PM > To: Tung Quang Nguyen > Cc: tipc-discussion@lists.sourceforge.net; Jon Maloy ; >

Re: [tipc-discussion] [net v1 1/1] tipc: fix memory leak caused by tipc_buf_append()

2020-10-26 Thread Xin Long
On Fri, Oct 23, 2020 at 4:20 PM Tung Nguyen wrote: > > Commit ed42989eab57 ("fix the skb_unshare() in tipc_buf_append()") > replaced skb_unshare() with skb_copy() to not reduce the data reference > counter of the original skb intentionally. This is not the correct > way to handle the cloned skb

Re: [tipc-discussion] KASAN: use-after-free Read in tipc_mcast_xmit (2)

2020-10-03 Thread Xin Long
ada44d90 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1400746790 > > The issue was bisected to: > > commit ff48b6222e65ebdba5a403ef1deba6214e749193 > Author: Xin Long > Date: Sun Sep 13 11:37:31 2020 + > > tipc: use skb_unshare() instead in tipc_b

[tipc-discussion] [PATCH net] tipc: use skb_unshare() instead in tipc_buf_append()

2020-09-13 Thread Xin Long
skb for the cloned frag and it'll be safe to change its frag_list. The similar things were also done in sctp_make_reassembled_event(), which is using skb_copy(). Reported-by: Shuang Li Fixes: 37e22164a8a3 ("tipc: rename and move message reassembly function") Signed-off-by: Xin Long ---

[tipc-discussion] [PATCH net] tipc: call rcu_read_lock() in tipc_aead_encrypt_done()

2020-08-20 Thread Xin Long
e TIPC encryption & authentication") Reported-by: syzbot+47bbc6b678d317ccc...@syzkaller.appspotmail.com Signed-off-by: Xin Long --- net/tipc/crypto.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c index 001bcb0..c38baba 100644 --- a/net/tipc/crypto.c +++ b/ne

Re: [tipc-discussion] WARNING: suspicious RCU usage in tipc_l2_send_msg

2020-08-19 Thread Xin Long
On Sat, Jun 27, 2020 at 1:25 AM syzbot wrote: > > Hello, > > syzbot found the following crash on: > > HEAD commit:b835a71e usbnet: smsc95xx: Fix use-after-free after removal > git tree: net > console output: https://syzkaller.appspot.com/x/log.txt?x=1095a51d10 > kernel config:

Re: [tipc-discussion] [PATCH net] tipc: not enable tipc when ipv6 works as a module

2020-08-18 Thread Xin Long
On Tue, Aug 18, 2020 at 6:20 AM Cong Wang wrote: > > On Mon, Aug 17, 2020 at 2:39 PM David Miller wrote: > > > > From: Cong Wang > > Date: Mon, 17 Aug 2020 13:59:46 -0700 > > > > > Is this a new Kconfig feature? ipv6_stub was introduced for > > > VXLAN, at that time I don't remember we have

  1   2   >