Re: [PATCH net 1/3] flex_array: make FLEX_ARRAY_BASE_SIZE the same value of FLEX_ARRAY_PART_SIZE

2018-12-05 Thread Xin Long
On Thu, Dec 6, 2018 at 1:38 PM David Miller wrote: > > From: Xin Long > Date: Wed, 5 Dec 2018 14:49:40 +0800 > > > This patch is to separate the base data memory from struct flex_array and > > save it into a page. With this change, total_nr_elements of a flex_arra

[PATCH net 2/3] flex_array: support flex_array_resize

2018-12-04 Thread Xin Long
-by: Neil Horman Signed-off-by: Xin Long --- include/linux/flex_array.h | 11 + lib/flex_array.c | 58 ++ 2 files changed, 69 insertions(+) diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h index 29ad65f..19ff58d

[PATCH net 3/3] sctp: fa_resize sctp stream instead of redo fa_alloc

2018-12-04 Thread Xin Long
lex_array_clear() and flex_array_shrink() are called to free the unused memory before shrinking. Fixes: 5e32a431 ("sctp: introduce stream scheduler foundations") Reported-by: Ying Xu Reported-by: syzbot+e33a3a138267ca119...@syzkaller.appspotmail.com Suggested-by: Neil Horman

[PATCH net 1/3] flex_array: make FLEX_ARRAY_BASE_SIZE the same value of FLEX_ARRAY_PART_SIZE

2018-12-04 Thread Xin Long
in the next patch. Suggested-by: Neil Horman Signed-off-by: Xin Long --- include/linux/flex_array.h | 29 + lib/flex_array.c | 15 --- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/include/linux/flex_array.h b/include/linux

[PATCH net 0/3] net: add support for flex_array_resize in flex_array

2018-12-04 Thread Xin Long
memory so far. Xin Long (3): flex_array: make FLEX_ARRAY_BASE_SIZE the same value of FLEX_ARRAY_PART_SIZE flex_array: support flex_array_resize sctp: fa_resize sctp stream instead of redo fa_alloc include/linux/flex_array.h | 40 ++--- lib/flex_array.c | 73

Re: [PATCHv2 net] sctp: check and update stream->out_curr when allocating stream_out

2018-11-30 Thread Xin Long
On Sat, Dec 1, 2018 at 12:23 AM Neil Horman wrote: > > On Fri, Nov 30, 2018 at 10:48:10PM +0900, Xin Long wrote: > > On Fri, Nov 30, 2018 at 9:21 PM Neil Horman wrote: > > > > > > On Fri, Nov 30, 2018 at 03:22:39PM +0900, Xin Long wrote: > > > > On

[PATCH net] sctp: kfree_rcu asoc

2018-11-30 Thread Xin Long
new transport") Reported-by: syzbot+0b05d8aa7cb185107...@syzkaller.appspotmail.com Reported-by: syzbot+aad231d51b1923158...@syzkaller.appspotmail.com Suggested-by: Neil Horman Signed-off-by: Xin Long --- include/net/sctp/structs.h | 2 ++ net/sctp/associola.c | 2 +- 2 files changed

Re: [PATCHv2 net] sctp: hold transport before accessing its asoc in sctp_epaddr_lookup_transport

2018-11-30 Thread Xin Long
On Fri, Nov 30, 2018 at 11:27 PM Neil Horman wrote: > > On Fri, Nov 30, 2018 at 11:15:50PM +0900, Xin Long wrote: > > On Fri, Nov 30, 2018 at 10:33 PM Marcelo Ricardo Leitner > > wrote: > > > > > > On Fri, Nov 30, 2018 at 07:32:36AM -0500, Neil Horman wrote: &

Re: [PATCHv2 net] sctp: hold transport before accessing its asoc in sctp_epaddr_lookup_transport

2018-11-30 Thread Xin Long
On Fri, Nov 30, 2018 at 10:33 PM Marcelo Ricardo Leitner wrote: > > On Fri, Nov 30, 2018 at 07:32:36AM -0500, Neil Horman wrote: > > On Fri, Nov 30, 2018 at 02:04:16PM +0900, Xin Long wrote: > > > On Fri, Nov 30, 2018 at 5:52 AM Neil Horman wrote: > > > > >

Re: [PATCHv2 net] sctp: check and update stream->out_curr when allocating stream_out

2018-11-30 Thread Xin Long
On Fri, Nov 30, 2018 at 9:21 PM Neil Horman wrote: > > On Fri, Nov 30, 2018 at 03:22:39PM +0900, Xin Long wrote: > > On Thu, Nov 29, 2018 at 11:39 PM Neil Horman wrote: > > > > > > On Thu, Nov 29, 2018 at 02:42:56PM +0800, Xin Long wrote: > > > > Now whe

Re: [PATCHv2 net] sctp: check and update stream->out_curr when allocating stream_out

2018-11-29 Thread Xin Long
On Thu, Nov 29, 2018 at 11:39 PM Neil Horman wrote: > > On Thu, Nov 29, 2018 at 02:42:56PM +0800, Xin Long wrote: > > Now when using stream reconfig to add out streams, stream->out > > will get re-allocated, and all old streams' information will > > be copied to th

Re: [PATCHv2 net] sctp: hold transport before accessing its asoc in sctp_epaddr_lookup_transport

2018-11-29 Thread Xin Long
On Fri, Nov 30, 2018 at 5:52 AM Neil Horman wrote: > > On Thu, Nov 29, 2018 at 02:44:07PM +0800, Xin Long wrote: > > Without holding transport to dereference its asoc, a use after > > free panic can be caused in sctp_epaddr_lookup_transport. Note > > that a

Re: [PATCHv2 net] sctp: check and update stream->out_curr when allocating stream_out

2018-11-29 Thread Xin Long
On Thu, Nov 29, 2018 at 9:50 PM Neil Horman wrote: > > On Thu, Nov 29, 2018 at 02:42:56PM +0800, Xin Long wrote: > > Now when using stream reconfig to add out streams, stream->out > > will get re-allocated, and all old streams' information will > > be copied to th

[PATCHv2 net] sctp: hold transport before accessing its asoc in sctp_hash_transport

2018-11-28 Thread Xin Long
gelog. Fixes: cd2b70875058 ("sctp: check duplicate node before inserting a new transport") Reported-by: syzbot+0b05d8aa7cb185107...@syzkaller.appspotmail.com Signed-off-by: Xin Long --- net/sctp/input.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/

[PATCHv2 net] sctp: hold transport before accessing its asoc in sctp_epaddr_lookup_transport

2018-11-28 Thread Xin Long
the changelog. Fixes: 7fda702f9315 ("sctp: use new rhlist interface on sctp transport rhashtable") Reported-by: syzbot+aad231d51b1923158...@syzkaller.appspotmail.com Signed-off-by: Xin Long --- net/sctp/input.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a

[PATCHv2 net] sctp: check and update stream->out_curr when allocating stream_out

2018-11-28 Thread Xin Long
by: syzbot+e33a3a138267ca119...@syzkaller.appspotmail.com Signed-off-by: Xin Long --- net/sctp/stream.c | 20 1 file changed, 20 insertions(+) diff --git a/net/sctp/stream.c b/net/sctp/stream.c index 3892e76..30e7809 100644 --- a/net/sctp/stream.c +++ b/net/sctp/stream.c @@ -84,6 +

Re: [PATCH net] sctp: hold transport before accessing its asoc in sctp_hash_transport

2018-11-28 Thread Xin Long
On Thu, Nov 22, 2018 at 2:53 AM Marcelo Ricardo Leitner wrote: > > On Wed, Nov 21, 2018 at 03:47:33PM +0900, Xin Long wrote: > > On Wed, Nov 21, 2018 at 9:46 AM Marcelo Ricardo Leitner > > wrote: > > > > > > On Tue, Nov 20, 2018 at 07:52:48AM -0500, Neil

[PATCHv2 net] sctp: update frag_point when stream_interleave is set

2018-11-27 Thread Xin Long
eparately in sctp_process_init and sctp_association_init, per Marcelo's suggestion. Fixes: 2f5e3c9df693 ("sctp: introduce sctp_assoc_update_frag_point") Reported-by: Jakub Audykowicz Signed-off-by: Xin Long --- net/sctp/associola.c | 7 --- net/sctp/sm_make_chunk.c | 3 +++ 2 fil

Re: [PATCH net] sctp: check and update stream->out_curr when allocating stream_out

2018-11-27 Thread Xin Long
On Tue, Nov 27, 2018 at 7:30 PM Xin Long wrote: > > On Mon, Nov 26, 2018 at 10:59 PM Neil Horman wrote: > > > > On Mon, Nov 26, 2018 at 10:46:33PM +0900, Xin Long wrote: > > > On Mon, Nov 26, 2018 at 9:54 PM Neil Horman wrote: > > > > > > > >

Re: [PATCH net] sctp: check and update stream->out_curr when allocating stream_out

2018-11-27 Thread Xin Long
On Mon, Nov 26, 2018 at 10:59 PM Neil Horman wrote: > > On Mon, Nov 26, 2018 at 10:46:33PM +0900, Xin Long wrote: > > On Mon, Nov 26, 2018 at 9:54 PM Neil Horman wrote: > > > > > > On Mon, Nov 26, 2018 at 07:22:05PM +0800, Xin Long wrote: > > > > Now whe

Re: [PATCH net] sctp: check and update stream->out_curr when allocating stream_out

2018-11-26 Thread Xin Long
On Mon, Nov 26, 2018 at 9:54 PM Neil Horman wrote: > > On Mon, Nov 26, 2018 at 07:22:05PM +0800, Xin Long wrote: > > Now when using stream reconfig to add out streams, stream->out > > will get re-allocated, and all old streams' information will > > be copied to th

Re: [PATCH net] sctp: update frag_point when stream_interleave is set

2018-11-26 Thread Xin Long
On Mon, Nov 26, 2018 at 9:29 PM Marcelo Ricardo Leitner wrote: > > On Mon, Nov 26, 2018 at 05:02:11PM +0800, Xin Long wrote: > > sctp_assoc_update_frag_point() should be called whenever asoc->pathmtu > > changes, but we missed one place in sctp_association_init(). It would

Re: [PATCH net] sctp: increase sk_wmem_alloc when head->truesize is increased

2018-11-26 Thread Xin Long
On Mon, Nov 26, 2018 at 9:27 PM Neil Horman wrote: > > On Mon, Nov 26, 2018 at 02:52:44PM +0800, Xin Long wrote: > > I changed to count sk_wmem_alloc by skb truesize instead of 1 to > > fix the sk_wmem_alloc leak caused by later truesize's change in > > xfrm in Commit 02

[PATCH net] sctp: check and update stream->out_curr when allocating stream_out

2018-11-26 Thread Xin Long
ot;) Reported-by: Ying Xu Reported-by: syzbot+e33a3a138267ca119...@syzkaller.appspotmail.com Signed-off-by: Xin Long --- net/sctp/stream.c | 46 -- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/net/sctp/stream.c b/net/sctp/stream.c

[PATCH net] sctp: update frag_point when stream_interleave is set

2018-11-26 Thread Xin Long
is also called in sctp_association_init(). We're doing this also because frag_point is affected by datachunk's type, namely stream_interleave_0/1. Fixes: 2f5e3c9df693 ("sctp: introduce sctp_assoc_update_frag_point") Reported-by: Jakub Audykowicz Signed-off-by: Xin Long --- net/sctp/stream_interleave.c

[PATCH net] sctp: increase sk_wmem_alloc when head->truesize is increased

2018-11-25 Thread Xin Long
->truesize is increased in sctp_packet_gso_append() as xfrm does. Otherwise, sctp gso packet will cause sk_wmem_alloc underflow. Fixes: 02968ccf0125 ("sctp: count sk_wmem_alloc by skb truesize in sctp_packet_transmit") Signed-off-by: Xin Long --- net/sctp/output.c | 1 + 1 file change

Re: [PATCH net] sctp: hold transport before accessing its asoc in sctp_hash_transport

2018-11-20 Thread Xin Long
On Wed, Nov 21, 2018 at 9:46 AM Marcelo Ricardo Leitner wrote: > > On Tue, Nov 20, 2018 at 07:52:48AM -0500, Neil Horman wrote: > > On Tue, Nov 20, 2018 at 07:09:16PM +0800, Xin Long wrote: > > > In sctp_hash_transport, it dereferences a transport's asoc only under > &g

[PATCH net] sctp: hold transport before accessing its asoc in sctp_epaddr_lookup_transport

2018-11-20 Thread Xin Long
asoc in sctp_transport_get_next") is needed to hold the transport before accessing its asoc in sctp_epaddr_lookup_transport. Fixes: 7fda702f9315 ("sctp: use new rhlist interface on sctp transport rhashtable") Reported-by: syzbot+aad231d51b1923158...@syzkaller.appspotmail.com Signed-off-by

[PATCH net] sctp: hold transport before accessing its asoc in sctp_hash_transport

2018-11-20 Thread Xin Long
asoc in sctp_transport_get_next") is needed to hold the transport before accessing its asoc in sctp_hash_transport. Fixes: cd2b70875058 ("sctp: check duplicate node before inserting a new transport") Reported-by: syzbot+0b05d8aa7cb185107...@syzkaller.appspotmail.com Signed-off-by: Xin Long ---

Re: KASAN: use-after-free Read in __lock_sock

2018-11-19 Thread Xin Long
On Sat, Nov 17, 2018 at 4:18 PM syzbot wrote: > > Hello, > > syzbot found the following crash on: > > HEAD commit:ccda4af0f4b9 Linux 4.20-rc2 > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=156cd53340 > kernel config:

Re: KASAN: use-after-free Read in sctp_epaddr_lookup_transport

2018-11-19 Thread Xin Long
port+0xacb/0xb20 > net/sctp/input.c:971 > Read of size 8 at addr 8881cde426b0 by task syz-executor3/18110 > The same fix is needed in sctp_epaddr_lookup_transport() as: commit bab1be79a5169ac748d8292b20c86d874022d7ba Author: Xin Long Date: Mon Aug 27 18:38:31

Re: KASAN: use-after-free Read in sctp_hash_transport

2018-11-19 Thread Xin Long
ad8_noabort+0x14/0x20 mm/kasan/report.c:433 > sctp_hash_transport+0x803/0x810 net/sctp/input.c:958 Caused by: commit cd2b708750582e327789d8fb07c6eb5f79f7759f Author: Xin Long Date: Fri Feb 17 16:35:24 2017 +0800 sctp: check duplicate node before inserting a new transport A same fix is

Re: [PATCH net] sctp: always set frag_point on pmtu change

2018-11-18 Thread Xin Long
On Mon, Nov 19, 2018 at 5:49 AM Jakub Audykowicz wrote: > > Calling send on a connected SCTP socket results in kernel panic if > spp_pathmtu was configured manually before an association is established > and it was not reconfigured to another value once the association is > established. > > Steps

[PATCH net] sctp: not increase stream's incnt before sending addstrm_in request

2018-11-18 Thread Xin Long
d7 ("sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Request Parameter") Reported-by: Jianwen Ji Signed-off-by: Xin Long --- net/sctp/stream.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/sctp/stream.c b/net/sctp/stream.c index ffb940d..3892e76 100644 ---

[PATCH net] Revert "sctp: remove sctp_transport_pmtu_check"

2018-11-18 Thread Xin Long
This reverts commit 22d7be267eaa8114dcc28d66c1c347f667d7878a. The dst's mtu in transport can be updated by a non sctp place like in xfrm where the MTU information didn't get synced between asoc, transport and dst, so it is still needed to do the pmtu check in sctp_packet_config. ---

[PATCHv3 net-next 1/4] sctp: define subscribe in sctp_sock as __u16

2018-11-18 Thread Xin Long
, and thus it will not be removed. This patch only changes the internal storage of the flags. Signed-off-by: Xin Long --- include/net/sctp/structs.h | 2 +- include/net/sctp/ulpevent.h | 39 --- include/uapi/linux/sctp.h| 6 +- net/sctp/chunk.c

[PATCHv3 net-next 3/4] sctp: rename enum sctp_event to sctp_event_type

2018-11-18 Thread Xin Long
sctp_event is a structure name defined in RFC for sockopt SCTP_EVENT. To avoid the conflict, rename it. Signed-off-by: Xin Long --- include/net/sctp/constants.h | 2 +- include/net/sctp/sm.h| 4 ++-- net/sctp/primitive.c | 2 +- net/sctp/sm_sideeffect.c | 12

[PATCHv3 net-next 4/4] sctp: add sockopt SCTP_EVENT

2018-11-18 Thread Xin Long
This patch adds sockopt SCTP_EVENT described in rfc6525#section-6.2. With this sockopt users can subscribe to an event from a specified asoc. Signed-off-by: Xin Long --- include/uapi/linux/sctp.h | 7 net/sctp/socket.c | 88 +++ 2 files

[PATCHv3 net-next 0/4] sctp: add subscribe per asoc and sockopt SCTP_EVENT

2018-11-18 Thread Xin Long
sable the event." As for the old SCTP_EVENTS Option with struct sctp_event_subscribe, it's being DEPRECATED. v1->v2: - fix some key word in changelog that triggerred the filters at vger.kernel.org. v2->v3: - fix an array out of bounds noticed by Neil in patch 1/4. Xin Long (4)

[PATCHv3 net-next 2/4] sctp: add subscribe per asoc

2018-11-18 Thread Xin Long
The member subscribe should be per asoc, so that sockopt SCTP_EVENT in the next patch can subscribe a event from one asoc only. Signed-off-by: Xin Long --- include/net/sctp/structs.h | 2 ++ net/sctp/associola.c | 2 ++ net/sctp/chunk.c | 6 ++ net/sctp/socket.c

[PATCHv2 net] sctp: not allow to set asoc prsctp_enable by sockopt

2018-11-17 Thread Xin Long
xes: 28aa4c26fce2 ("sctp: add SCTP_PR_SUPPORTED on sctp sockopt") Reported-by: Ying Xu Signed-off-by: Xin Long --- net/sctp/socket.c | 26 +- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 739f3e5..bf618d1 100644 -

[PATCH net] sctp: count sk_wmem_alloc by skb truesize in sctp_packet_transmit

2018-11-17 Thread Xin Long
ued to count for writable space since Commit cd305c74b0f8 ("sctp: use sk_wmem_queued to check for writable space"), it's ok to fix it by counting sk_wmem_alloc by skb truesize in sctp_packet_transmit. Fixes: cac2661c53f3 ("esp4: Avoid skb_cow_data whenever possible") Reported-b

Re: [PATCH net] sctp: not allow to set asoc prsctp_enable by sockopt

2018-11-17 Thread Xin Long
:36PM -0200, Marcelo Ricardo Leitner wrote: > > > > On Thu, Nov 15, 2018 at 04:43:10PM -0500, Neil Horman wrote: > > > > > On Thu, Nov 15, 2018 at 03:22:21PM -0200, Marcelo Ricardo Leitner > > > wrote: > > > > > > On Thu, Nov 15, 2018 at 07:14:28

Re: [PATCH net] sctp: not allow to set asoc prsctp_enable by sockopt

2018-11-15 Thread Xin Long
On Fri, Nov 16, 2018 at 2:22 AM Marcelo Ricardo Leitner wrote: > > On Thu, Nov 15, 2018 at 07:14:28PM +0800, Xin Long wrote: > > As rfc7496#section4.5 says about SCTP_PR_SUPPORTED: > > > >This socket option allows the enabling or disabling of the > >

[PATCH net] sctp: not allow to set asoc prsctp_enable by sockopt

2018-11-15 Thread Xin Long
) Reported-by: Ying Xu Signed-off-by: Xin Long --- net/sctp/socket.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 739f3e5..e9b8232 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -3940,7 +3940,6 @@

Re: [PATCH net] ipv6: fix a dst leak when removing its exception

2018-11-14 Thread Xin Long
On Thu, Nov 15, 2018 at 3:33 PM David Ahern wrote: > > On 11/14/18 11:03 AM, David Ahern wrote: > > On 11/13/18 8:48 AM, Xin Long wrote: > >> These is no need to hold dst before calling rt6_remove_exception_rt(). > >> The call to dst_hold_safe() in ip6_lin

Re: [PATCHv2 net-next 1/4] sctp: define subscribe in sctp_sock as __u16

2018-11-14 Thread Xin Long
On Wed, Nov 14, 2018 at 2:16 AM Neil Horman wrote: > > On Tue, Nov 13, 2018 at 02:24:53PM +0800, Xin Long wrote: > > > > /* Default Peer Address Parameters. These defaults can > >* be modified via SCTP_PEER_ADDR_PARAMS > > @@ -

[PATCH net] ipv6: fix a dst leak when removing its exception

2018-11-13 Thread Xin Long
/ipv6: separate handling of FIB entries from dst based routes") Fixes: 23fb93a4d3f1 ("net/ipv6: Cleanup exception and cache route handling") Reported-by: Li Shuang Signed-off-by: Xin Long --- net/ipv6/route.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git

Re: [PATCH net-next 0/4] sctp: add subscribe per asoc and sockopt SCTP_EVENT

2018-11-12 Thread Xin Long
On Tue, Nov 13, 2018 at 1:26 AM Xin Long wrote: > > This patchset mainly adds the Event Subscription sockopt described in > rfc6525#section-6.2: > > Subscribing to events as described in [RFC6458] uses a setsockopt() > call with the SCTP_EVENT socket option. This option tak

[PATCHv2 net-next 2/4] sctp: add subscribe per asoc

2018-11-12 Thread Xin Long
The member subscribe should be per asoc, so that sockopt SCTP_EVENT in the next patch can subscribe a event from one asoc only. Signed-off-by: Xin Long --- include/net/sctp/structs.h | 2 ++ net/sctp/associola.c | 2 ++ net/sctp/chunk.c | 6 ++ net/sctp/socket.c

[PATCHv2 net-next 4/4] sctp: add sockopt SCTP_EVENT

2018-11-12 Thread Xin Long
This patch adds sockopt SCTP_EVENT described in rfc6525#section-6.2. With this sockopt users can subscribe to an event from a specified asoc. Signed-off-by: Xin Long --- include/uapi/linux/sctp.h | 7 net/sctp/socket.c | 89 +++ 2 files

[PATCHv2 net-next 1/4] sctp: define subscribe in sctp_sock as __u16

2018-11-12 Thread Xin Long
, and thus it will not be removed. This patch only changes the internal storage of the flags. Signed-off-by: Xin Long --- include/net/sctp/structs.h | 2 +- include/net/sctp/ulpevent.h | 39 --- include/uapi/linux/sctp.h| 6 +- net/sctp/chunk.c

[PATCHv2 net-next 3/4] sctp: rename enum sctp_event to sctp_event_type

2018-11-12 Thread Xin Long
sctp_event is a structure name defined in RFC for sockopt SCTP_EVENT. To avoid the conflict, rename it. Signed-off-by: Xin Long --- include/net/sctp/constants.h | 2 +- include/net/sctp/sm.h| 4 ++-- net/sctp/primitive.c | 2 +- net/sctp/sm_sideeffect.c | 12

[PATCHv2 net-next 0/4] sctp: add subscribe per asoc and sockopt SCTP_EVENT

2018-11-12 Thread Xin Long
sable the event." As for the old SCTP_EVENTS Option with struct sctp_event_subscribe, it's being DEPRECATED. Xin Long (4): sctp: define subscribe in sctp_sock as __u16 sctp: add subscribe per asoc sctp: rename enum sctp_event to sctp_event_type sctp: add sockopt SCTP_EVENT includ

[PATCH net] l2tp: fix a sock refcnt leak in l2tp_tunnel_register

2018-11-12 Thread Xin Long
: f6cd651b056f ("l2tp: fix race in duplicate tunnel detection") Reported-by: Jianlin Shi Signed-off-by: Xin Long --- net/l2tp/l2tp_core.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 82cdf90..26f1d43 100644 ---

[PATCH net-next 3/4] sctp: rename enum sctp_event to sctp_event_type

2018-11-12 Thread Xin Long
sctp_event is a structure name defined in RFC for sockopt SCTP_EVENT. To avoid the conflict, rename it. Signed-off-by: Xin Long --- include/net/sctp/constants.h | 2 +- include/net/sctp/sm.h| 4 ++-- net/sctp/primitive.c | 2 +- net/sctp/sm_sideeffect.c | 12

[PATCH net-next 4/4] sctp: add sockopt SCTP_EVENT

2018-11-12 Thread Xin Long
This patch adds sockopt SCTP_EVENT described in rfc6525#section-6.2. With this sockopt users can subscribe to an event from a specified asoc. Signed-off-by: Xin Long --- include/uapi/linux/sctp.h | 7 net/sctp/socket.c | 89 +++ 2 files

[PATCH net-next 0/4] sctp: add subscribe per asoc and sockopt SCTP_EVENT

2018-11-12 Thread Xin Long
the event. As for the old SCTP_EVENTS Option with struct sctp_event_subscribe, it's being DEPRECATED. Xin Long (4): sctp: define subscribe in sctp_sock as __u16 sctp: add subscribe per asoc sctp: rename enum sctp_event to sctp_event_type sctp: add sockopt SCTP_EVENT include/net/sctp

[PATCHv2 net-next 2/3] sctp: add sock_reuseport for the sock in __sctp_hash_endpoint

2018-11-12 Thread Xin Long
are not matched at all. It will work until sk_reuseport support is added in sctp_get_port_local() in the next patch. v1->v2: - use 'laddr->valid && laddr2->valid' check instead as Marcelo pointed in sctp_bind_addrs_check(). Acked-by: Neil Horman Signed-off-by: Xin Long --- includ

[PATCHv2 net-next 3/3] sctp: process sk_reuseport in sctp_get_port_local

2018-11-12 Thread Xin Long
When socks' sk_reuseport is set, the same port and address are allowed to be bound into these socks who have the same uid. Note that the difference from sk_reuse is that it allows multiple socks to listen on the same port and address. Acked-by: Neil Horman Signed-off-by: Xin Long --- include

[PATCHv2 net-next 1/3] sctp: do reuseport_select_sock in __sctp_rcv_lookup_endpoint

2018-11-12 Thread Xin Long
ted in __sctp_rcv_lookup_endpoint(). Acked-by: Neil Horman Signed-off-by: Xin Long --- net/sctp/input.c | 69 +--- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/net/sctp/input.c b/net/sctp/input.c index 7ab08a5..00f995e 100

[PATCHv2 net-next 0/3] sctp: add support for sk_reuseport

2018-11-12 Thread Xin Long
:6400 172.16.5.1:1234 Xin Long (3): sctp: do reuseport_select_sock in __sctp_rcv_lookup_endpoint sctp: add sock_reuseport for the sock in __sctp_hash_endpoint sctp: process sk_reuseport in sctp_get_port_local include/net/sctp/sctp.h| 2 +- include/net/sctp/structs.h | 6

Re: [PATCH net-next 2/3] sctp: add sock_reuseport for the sock in __sctp_hash_endpoint

2018-11-12 Thread Xin Long
On Mon, Oct 22, 2018 at 11:15 PM Marcelo Ricardo Leitner wrote: > > On Sun, Oct 21, 2018 at 12:43:37PM +0800, Xin Long wrote: > > This is a part of sk_reuseport support for sctp. It defines a helper > > sctp_bind_addrs_check() to check if the bind_addrs in two socks are > &

Re: [PATCH net-next 1/3] sctp: do reuseport_select_sock in __sctp_rcv_lookup_endpoint

2018-11-12 Thread Xin Long
On Mon, Oct 22, 2018 at 11:18 PM Marcelo Ricardo Leitner wrote: > > On Sun, Oct 21, 2018 at 12:43:36PM +0800, Xin Long wrote: > > This is a part of sk_reuseport support for sctp, and it selects a > > sock by the hashkey of lport, paddr and dport by default. It will > >

[PATCH net] sctp: define SCTP_SS_DEFAULT for Stream schedulers

2018-11-03 Thread Xin Long
According to rfc8260#section-4.3.2, SCTP_SS_DEFAULT is required to defined as SCTP_SS_FCFS or SCTP_SS_RR. SCTP_SS_FCFS is used for SCTP_SS_DEFAULT's value in this patch. Fixes: 5e32a431 ("sctp: introduce stream scheduler foundations") Reported-by: Jianwen Ji Signed-off-by

[PATCH net] sctp: fix strchange_flags name for Stream Change Event

2018-11-03 Thread Xin Long
tream change event notification") Reported-by: Jianwen Ji Signed-off-by: Xin Long --- include/uapi/linux/sctp.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h index 34dd3d4..680ecc3 100644 --- a/include/uapi/linux/sctp.h +++ b/in

[PATCH net] sctp: check policy more carefully when getting pr status

2018-10-29 Thread Xin Long
. Fixes: 0ac1077e3a54 ("sctp: get pr_assoc and pr_stream all status with SCTP_PR_SCTP_ALL") Reported-by: syzbot+5da0d0a72a9e7d791...@syzkaller.appspotmail.com Suggested-by: Marcelo Ricardo Leitner Signed-off-by: Xin Long --- net/sctp/socket.c | 8 +--- 1 file changed, 5 insert

[PATCH net] sctp: clear the transport of some out_chunk_list chunks in sctp_assoc_rm_peer

2018-10-29 Thread Xin Long
of these chunks in out_chunk_list when removing a transport in sctp_assoc_rm_peer(). Reported-by: syzbot+56a40ceee5fb35932...@syzkaller.appspotmail.com Signed-off-by: Xin Long --- net/sctp/associola.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/sctp/associola.c b/net

Re: [PATCH net-next 0/3] sctp: add support for sk_reuseport

2018-10-21 Thread Xin Long
On Sun, Oct 21, 2018 at 1:43 PM Xin Long wrote: > > sctp sk_reuseport allows multiple socks to listen on the same port and > addresses, as long as these socks have the same uid. This works pretty > much as TCP/UDP does, the only difference is that sctp is multi-homing > and all

[PATCH net-next 3/3] sctp: process sk_reuseport in sctp_get_port_local

2018-10-20 Thread Xin Long
When socks' sk_reuseport is set, the same port and address are allowed to be bound into these socks who have the same uid. Note that the difference from sk_reuse is that it allows multiple socks to listen on the same port and address. Signed-off-by: Xin Long --- include/net/sctp/structs.h | 4

[PATCH net-next 0/3] sctp: add support for sk_reuseport

2018-10-20 Thread Xin Long
:6400 172.16.5.1:1234 Xin Long (3): sctp: do reuseport_select_sock in __sctp_rcv_lookup_endpoint sctp: add sock_reuseport for the sock in __sctp_hash_endpoint sctp: process sk_reuseport in sctp_get_port_local include/net/sctp/sctp.h| 2 +- include/net/sctp/structs.h | 6

[PATCH net-next 1/3] sctp: do reuseport_select_sock in __sctp_rcv_lookup_endpoint

2018-10-20 Thread Xin Long
This is a part of sk_reuseport support for sctp, and it selects a sock by the hashkey of lport, paddr and dport by default. It will work until sk_reuseport support is added in sctp_get_port_local() in the next patch. Signed-off-by: Xin Long --- net/sctp/input.c | 69

[PATCH net-next 2/3] sctp: add sock_reuseport for the sock in __sctp_hash_endpoint

2018-10-20 Thread Xin Long
are not matched at all. It will work until sk_reuseport support is added in sctp_get_port_local() in the next patch. Signed-off-by: Xin Long --- include/net/sctp/sctp.h| 2 +- include/net/sctp/structs.h | 2 ++ net/core/sock_reuseport.c | 1 + net/sctp/bind_addr.c | 28

[PATCH net] sctp: fix the data size calculation in sctp_data_size

2018-10-17 Thread Xin Long
sctp data size should be calculated by subtracting data chunk header's length from chunk_hdr->length, not just data header. Fixes: 668c9beb9020 ("sctp: implement assign_number for sctp_stream_interleave") Signed-off-by: Xin Long --- include/net/sctp/sm.h | 2 +- 1 file changed

[PATCH net-next 2/2] sctp: use sk_wmem_queued to check for writable space

2018-10-16 Thread Xin Long
s not increased for the skb allocked for sending, also as TCP does. SOCK_SNDBUF_LOCK check is also removed here as it's for tx buf auto tuning which I will add in another patch. Signed-off-by: Xin Long --- net/sctp/socket.c | 38 +- 1 file changed, 9 in

[PATCH net-next 1/2] sctp: count both sk and asoc sndbuf with skb truesize and sctp_chunk size

2018-10-16 Thread Xin Long
hen sndbuf_policy is not set. To make this right and also keep consistent between asoc sndbuf_used, sk sk_wmem_alloc and sk_wmem_queued, use skb->truesize + sizeof(sctp_chunk) for them. Signed-off-by: Xin Long --- include/net/sctp/constants.h | 5 - net/sctp/outqueue.c | 8 ++-- ne

[PATCH net-next 0/2] sctp: fix sk_wmem_queued and use it to check for writable space

2018-10-16 Thread Xin Long
sctp doesn't count and use asoc sndbuf_used, sk sk_wmem_alloc and sk_wmem_queued properly, which also causes some problem. This patchset is to improve it. Xin Long (2): sctp: count both sk and asoc sndbuf with skb truesize and sctp_chunk size sctp: use sk_wmem_queued to check

[PATCH net] sctp: not free the new asoc when sctp_wait_for_connect returns err

2018-10-16 Thread Xin Long
is. When users see this error, they will know the packet hasn't been sent. And it also makes sense to not free asoc because waiting connect fails, like the second call for sctp_wait_for_connect in sctp_sendmsg_to_asoc. Fixes: 668c9beb9020 ("sctp: implement assign_number for sctp_stream_interleave&q

[PATCH net] sctp: get pr_assoc and pr_stream all status with SCTP_PR_SCTP_ALL instead

2018-10-16 Thread Xin Long
sockopt") Fixes: d229d48d183f ("sctp: add SCTP_PR_STREAM_STATUS sockopt for prsctp") Reported-by: Ying Xu Signed-off-by: Xin Long --- include/uapi/linux/sctp.h | 1 + net/sctp/socket.c | 8 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/ua

[PATCH net] sctp: use the pmtu from the icmp packet to update transport pathmtu

2018-10-15 Thread Xin Long
nfo needs to be atomic_t. Signed-off-by: Xin Long --- include/net/sctp/structs.h | 2 ++ net/sctp/associola.c | 3 ++- net/sctp/input.c | 1 + net/sctp/output.c | 6 ++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/net/sctp/structs.h b/include/net/sctp/

Re: [PATCH net 0/2] geneve, vxlan: Don't set exceptions if skb->len < mtu

2018-10-15 Thread Xin Long
set exceptions if skb->len < mtu > > drivers/net/geneve.c | 14 +++--- > drivers/net/vxlan.c | 12 ++-- > include/net/dst.h| 10 ++ > 3 files changed, 15 insertions(+), 21 deletions(-) > > -- > 2.19.1 > Series Reviewed-by: Xin Long

Re: [PATCH net 2/2] geneve, vxlan: Don't set exceptions if skb->len < mtu

2018-10-15 Thread Xin Long
On Sat, Oct 13, 2018 at 6:54 AM Stefano Brivio wrote: > > We shouldn't abuse exceptions: if the destination MTU is already higher > than what we're transmitting, no exception should be created. makes sense, shouldn't ip(6) tunnels also do this? > > Fixes: 52a589d51f10 ("geneve: update skb dst

Re: [PATCH net] sctp: update dst pmtu with the correct daddr

2018-09-21 Thread Xin Long
On Fri, Sep 21, 2018 at 2:31 AM David Miller wrote: > > From: Xin Long > Date: Thu, 20 Sep 2018 17:27:28 +0800 > > > When processing pmtu update from an icmp packet, it calls .update_pmtu > > with sk instead of skb in sctp_transport_update_pmtu. > > &

[PATCH net] sctp: update dst pmtu with the correct daddr

2018-09-20 Thread Xin Long
tion. Fixes: 4895c771c7f0 ("ipv4: Add FIB nexthop exceptions.") Reported-by: ian.per...@dialogic.com Signed-off-by: Xin Long --- net/sctp/transport.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/net/sctp/transport.c b/net/sctp/transport.c index 12cac85..03

[PATCHv2 net] ipv6: use rt6_info members when dst is set in rt6_fill_node

2018-09-11 Thread Xin Long
dump a route entry without fibmatch set. v1->v2: - not use rt6i_prefsrc. - also fix the gw dump issue. Fixes: 93531c674315 ("net/ipv6: separate handling of FIB entries from dst based routes") Reported-by: Jianlin Shi Signed-off-by: Xin Long

Re: [PATCH net] ipv6: use rt6_info members when dst is set in rt6_fill_node

2018-09-10 Thread Xin Long
On Tue, Sep 11, 2018 at 12:13 AM David Ahern wrote: > > On 9/9/18 12:29 AM, Xin Long wrote: > >>> diff --git a/net/ipv6/route.c b/net/ipv6/route.c > >>> index 18e00ce..e554922 100644 > >>> --- a/net/ipv6/route.c > >>> +++ b/net/ipv6/route.c

Re: [PATCH net] ipv6: use rt6_info members when dst is set in rt6_fill_node

2018-09-09 Thread Xin Long
On Sun, Sep 9, 2018 at 9:45 AM David Ahern wrote: > > On 9/8/18 3:24 AM, Xin Long wrote: > > In inet6_rtm_getroute, since Commit 93531c674315 ("net/ipv6: separate > > handling of FIB entries from dst based routes"), it has used rt->from > > to dump rout

[PATCH net] ipv6: use rt6_info members when dst is set in rt6_fill_node

2018-09-08 Thread Xin Long
he gw/nh dump in another patch. Fixes: 93531c674315 ("net/ipv6: separate handling of FIB entries from dst based routes") Reported-by: Jianlin Shi Signed-off-by: Xin Long --- net/ipv6/route.c | 39 ++- 1 file changed, 26 insertions(+), 13 deletions(-)

[PATCH net 2/2] sctp: not traverse asoc trans list if non-ipv6 trans exists for ipv6_flowlabel

2018-09-03 Thread Xin Long
label and spp_dscp for sctp_paddrparams") Signed-off-by: Xin Long --- net/sctp/socket.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index a0ccfa4..f73e9d3 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -2658,10 +2658,12

[PATCH net 0/2] sctp: two fixes for spp_ipv6_flowlabel and spp_dscp sockopts

2018-09-03 Thread Xin Long
This patchset fixes two problems in sctp_apply_peer_addr_params() when setting spp_ipv6_flowlabel or spp_dscp. Xin Long (2): sctp: fix invalid reference to the index variable of the iterator sctp: not traverse asoc trans list if non-ipv6 trans exists for ipv6_flowlabel net/sctp/socket.c

[PATCH net 1/2] sctp: fix invalid reference to the index variable of the iterator

2018-09-03 Thread Xin Long
is actually an invalid reference. So fix it by using a new index variable to traverse transport_addr_list for both SPP_DSCP and SPP_IPV6_FLOWLABEL flags process. Fixes: 0b0dce7a36fb ("sctp: add spp_ipv6_flowlabel and spp_dscp for sctp_paddrparams") Reported-by: Julia Lawall Signed-off-by

Re: [PATCH net] sctp: hold transport before accessing its asoc in sctp_transport_get_next

2018-08-31 Thread Xin Long
On Wed, Aug 29, 2018 at 7:36 PM Neil Horman wrote: > > On Wed, Aug 29, 2018 at 12:08:40AM +0800, Xin Long wrote: > > On Mon, Aug 27, 2018 at 9:08 PM Neil Horman wrote: > > > > > > On Mon, Aug 27, 2018 at 06:38:31PM +0800, Xin Long wrote: > > > > As M

Re: [PATCH net] sctp: hold transport before accessing its asoc in sctp_transport_get_next

2018-08-28 Thread Xin Long
On Mon, Aug 27, 2018 at 9:08 PM Neil Horman wrote: > > On Mon, Aug 27, 2018 at 06:38:31PM +0800, Xin Long wrote: > > As Marcelo noticed, in sctp_transport_get_next, it is iterating over > > transports but then also accessing the association directly, without > > che

Re: [PATCH net 0/3] ipv6: fix error path of inet6_init()

2018-08-28 Thread Xin Long
p ordering for pingv6 registration > net: rtnl: return early from rtnl_unregister_all when protocol isn't > registered > > net/core/rtnetlink.c | 4 > net/ipv6/af_inet6.c | 10 +- > 2 files changed, 9 insertions(+), 5 deletions(-) > > -- > 2.18.0 > > Series Reviewed-by: Xin Long

[PATCH net] erspan: set erspan_ver to 1 by default when adding an erspan dev

2018-08-27 Thread Xin Long
erspan version.") Reported-by: Jianlin Shi Signed-off-by: Xin Long --- net/ipv4/ip_gre.c | 3 +++ net/ipv6/ip6_gre.c | 1 + 2 files changed, 4 insertions(+) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 51a5d06..ae714ae 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c

[PATCH net] sctp: remove useless start_fail from sctp_ht_iter in proc

2018-08-27 Thread Xin Long
After changing rhashtable_walk_start to return void, start_fail would never be set other value than 0, and the checking for start_fail is pointless, so remove it. Fixes: 97a6ec4ac021 ("rhashtable: Change rhashtable_walk_start to return void") Signed-off-by: Xin Long --- net/sctp/

[PATCH net] sctp: hold transport before accessing its asoc in sctp_transport_get_next

2018-08-27 Thread Xin Long
. With that, sctp_transport_hold calls can be removed in the later places. Fixes: 626d16f50f39 ("sctp: export some apis or variables for sctp_diag and reuse some for proc") Reported-by: syzbot+fe62a0c9aa6a85c6d...@syzkaller.appspotmail.com Signed-off-by: Xin Long --- net/sctp/proc.c | 4 net/sct

[PATCH net] ip6_tunnel: use the right value for ipv4 min mtu check in ip6_tnl_xmit

2018-08-05 Thread Xin Long
for the ipv4 min mtu check in ip6_tnl_xmit. While at it, change to use max() instead of if statement. Fixes: c9fefa08190f ("ip6_tunnel: get the min mtu properly in ip6_tnl_xmit") Reported-by: Sabrina Dubroca Signed-off-by: Xin Long --- net/ipv6/ip6_tunnel.c | 8 ++-- 1 file changed, 2

[PATCHv4 net-next 1/2] route: add support for directed broadcast forwarding

2018-07-27 Thread Xin Long
necessary to implement it in the route rx path. Note that route cache needs to be flushed when bc_forwarding is changed. Signed-off-by: Xin Long --- include/linux/inetdevice.h | 1 + include/uapi/linux/ip.h | 1 + include/uapi/linux/netconf.h | 1 + net/ipv4/devinet.c | 11

[PATCHv4 net-next 2/2] selftests: add a selftest for directed broadcast forwarding

2018-07-27 Thread Xin Long
As Ido's suggestion, this patch is to add a selftest for directed broadcast forwarding with vrf. It does the assertion by checking the src IP of the echo-reply packet in ping_test_from. Signed-off-by: Xin Long --- .../selftests/net/forwarding/router_broadcast.sh | 233 + 1

  1   2   3   4   5   6   7   8   9   10   >