* [PATCH net] sctp: increase sk_wmem_alloc when head->truesize is increased
@ 2018-11-26 6:52 ` Xin Long
0 siblings, 0 replies; 10+ messages in thread
From: Xin Long @ 2018-11-26 6:52 UTC (permalink / raw)
To: network dev, linux-sctp; +Cc: davem, Marcelo Ricardo Leitner, Neil Horman
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 02968ccf0125 ("sctp: count sk_wmem_alloc by skb
truesize in sctp_packet_transmit").
But I should have also increased sk_wmem_alloc when head->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 <lucien.xin@gmail.com>
---
net/sctp/output.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/sctp/output.c b/net/sctp/output.c
index b0e74a3..025f48e 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -410,6 +410,7 @@ static void sctp_packet_gso_append(struct sk_buff *head, struct sk_buff *skb)
head->truesize += skb->truesize;
head->data_len += skb->len;
head->len += skb->len;
+ refcount_add(skb->truesize, &head->sk->sk_wmem_alloc);
__skb_header_release(skb);
}
--
2.1.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net] sctp: increase sk_wmem_alloc when head->truesize is increased
@ 2018-11-26 6:52 ` Xin Long
0 siblings, 0 replies; 10+ messages in thread
From: Xin Long @ 2018-11-26 6:52 UTC (permalink / raw)
To: network dev, linux-sctp; +Cc: davem, Marcelo Ricardo Leitner, Neil Horman
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 02968ccf0125 ("sctp: count sk_wmem_alloc by skb
truesize in sctp_packet_transmit").
But I should have also increased sk_wmem_alloc when head->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 <lucien.xin@gmail.com>
---
net/sctp/output.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/sctp/output.c b/net/sctp/output.c
index b0e74a3..025f48e 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -410,6 +410,7 @@ static void sctp_packet_gso_append(struct sk_buff *head, struct sk_buff *skb)
head->truesize += skb->truesize;
head->data_len += skb->len;
head->len += skb->len;
+ refcount_add(skb->truesize, &head->sk->sk_wmem_alloc);
__skb_header_release(skb);
}
--
2.1.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: increase sk_wmem_alloc when head->truesize is increased
2018-11-26 6:52 ` Xin Long
@ 2018-11-26 12:04 ` Marcelo Ricardo Leitner
-1 siblings, 0 replies; 10+ messages in thread
From: Marcelo Ricardo Leitner @ 2018-11-26 12:04 UTC (permalink / raw)
To: Xin Long; +Cc: network dev, linux-sctp, davem, Neil Horman
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 02968ccf0125 ("sctp: count sk_wmem_alloc by skb
> truesize in sctp_packet_transmit").
>
> But I should have also increased sk_wmem_alloc when head->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 <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> ---
> net/sctp/output.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/sctp/output.c b/net/sctp/output.c
> index b0e74a3..025f48e 100644
> --- a/net/sctp/output.c
> +++ b/net/sctp/output.c
> @@ -410,6 +410,7 @@ static void sctp_packet_gso_append(struct sk_buff *head, struct sk_buff *skb)
> head->truesize += skb->truesize;
> head->data_len += skb->len;
> head->len += skb->len;
> + refcount_add(skb->truesize, &head->sk->sk_wmem_alloc);
>
> __skb_header_release(skb);
> }
> --
> 2.1.0
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: increase sk_wmem_alloc when head->truesize is increased
@ 2018-11-26 12:04 ` Marcelo Ricardo Leitner
0 siblings, 0 replies; 10+ messages in thread
From: Marcelo Ricardo Leitner @ 2018-11-26 12:04 UTC (permalink / raw)
To: Xin Long; +Cc: network dev, linux-sctp, davem, Neil Horman
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 02968ccf0125 ("sctp: count sk_wmem_alloc by skb
> truesize in sctp_packet_transmit").
>
> But I should have also increased sk_wmem_alloc when head->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 <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> ---
> net/sctp/output.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/sctp/output.c b/net/sctp/output.c
> index b0e74a3..025f48e 100644
> --- a/net/sctp/output.c
> +++ b/net/sctp/output.c
> @@ -410,6 +410,7 @@ static void sctp_packet_gso_append(struct sk_buff *head, struct sk_buff *skb)
> head->truesize += skb->truesize;
> head->data_len += skb->len;
> head->len += skb->len;
> + refcount_add(skb->truesize, &head->sk->sk_wmem_alloc);
>
> __skb_header_release(skb);
> }
> --
> 2.1.0
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: increase sk_wmem_alloc when head->truesize is increased
2018-11-26 6:52 ` Xin Long
@ 2018-11-26 12:26 ` Neil Horman
-1 siblings, 0 replies; 10+ messages in thread
From: Neil Horman @ 2018-11-26 12:26 UTC (permalink / raw)
To: Xin Long; +Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner
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 02968ccf0125 ("sctp: count sk_wmem_alloc by skb
> truesize in sctp_packet_transmit").
>
> But I should have also increased sk_wmem_alloc when head->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 <lucien.xin@gmail.com>
> ---
> net/sctp/output.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/sctp/output.c b/net/sctp/output.c
> index b0e74a3..025f48e 100644
> --- a/net/sctp/output.c
> +++ b/net/sctp/output.c
> @@ -410,6 +410,7 @@ static void sctp_packet_gso_append(struct sk_buff *head, struct sk_buff *skb)
> head->truesize += skb->truesize;
> head->data_len += skb->len;
> head->len += skb->len;
> + refcount_add(skb->truesize, &head->sk->sk_wmem_alloc);
>
> __skb_header_release(skb);
> }
This looks to me like you are now double counting every packet that passes
through sctp_packet_transmit, once in skb_set_owner_w and again in
sctp_packet_pack=>sctp_packet_gso_append
Neil
> --
> 2.1.0
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: increase sk_wmem_alloc when head->truesize is increased
@ 2018-11-26 12:26 ` Neil Horman
0 siblings, 0 replies; 10+ messages in thread
From: Neil Horman @ 2018-11-26 12:26 UTC (permalink / raw)
To: Xin Long; +Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner
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 02968ccf0125 ("sctp: count sk_wmem_alloc by skb
> truesize in sctp_packet_transmit").
>
> But I should have also increased sk_wmem_alloc when head->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 <lucien.xin@gmail.com>
> ---
> net/sctp/output.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/sctp/output.c b/net/sctp/output.c
> index b0e74a3..025f48e 100644
> --- a/net/sctp/output.c
> +++ b/net/sctp/output.c
> @@ -410,6 +410,7 @@ static void sctp_packet_gso_append(struct sk_buff *head, struct sk_buff *skb)
> head->truesize += skb->truesize;
> head->data_len += skb->len;
> head->len += skb->len;
> + refcount_add(skb->truesize, &head->sk->sk_wmem_alloc);
>
> __skb_header_release(skb);
> }
This looks to me like you are now double counting every packet that passes
through sctp_packet_transmit, once in skb_set_owner_w and again in
sctp_packet_pack=>sctp_packet_gso_append
Neil
> --
> 2.1.0
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: increase sk_wmem_alloc when head->truesize is increased
2018-11-26 12:26 ` Neil Horman
@ 2018-11-26 12:49 ` Xin Long
-1 siblings, 0 replies; 10+ messages in thread
From: Xin Long @ 2018-11-26 12:49 UTC (permalink / raw)
To: Neil Horman; +Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner
On Mon, Nov 26, 2018 at 9:27 PM Neil Horman <nhorman@tuxdriver.com> 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 02968ccf0125 ("sctp: count sk_wmem_alloc by skb
> > truesize in sctp_packet_transmit").
> >
> > But I should have also increased sk_wmem_alloc when head->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 <lucien.xin@gmail.com>
> > ---
> > net/sctp/output.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/net/sctp/output.c b/net/sctp/output.c
> > index b0e74a3..025f48e 100644
> > --- a/net/sctp/output.c
> > +++ b/net/sctp/output.c
> > @@ -410,6 +410,7 @@ static void sctp_packet_gso_append(struct sk_buff *head, struct sk_buff *skb)
> > head->truesize += skb->truesize;
> > head->data_len += skb->len;
> > head->len += skb->len;
> > + refcount_add(skb->truesize, &head->sk->sk_wmem_alloc);
> >
> > __skb_header_release(skb);
> > }
> This looks to me like you are now double counting every packet that passes
> through sctp_packet_transmit, once in skb_set_owner_w and again in
> sctp_packet_pack=>sctp_packet_gso_append
For gso packet, the skb(head) in sctp_packet_transmit/skb_set_owner_w
is the head_skb, the skbs here are the fragments.
For non-gso packet, it will never come here.
>
> Neil
>
> > --
> > 2.1.0
> >
> >
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: increase sk_wmem_alloc when head->truesize is increased
@ 2018-11-26 12:49 ` Xin Long
0 siblings, 0 replies; 10+ messages in thread
From: Xin Long @ 2018-11-26 12:49 UTC (permalink / raw)
To: Neil Horman; +Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner
On Mon, Nov 26, 2018 at 9:27 PM Neil Horman <nhorman@tuxdriver.com> 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 02968ccf0125 ("sctp: count sk_wmem_alloc by skb
> > truesize in sctp_packet_transmit").
> >
> > But I should have also increased sk_wmem_alloc when head->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 <lucien.xin@gmail.com>
> > ---
> > net/sctp/output.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/net/sctp/output.c b/net/sctp/output.c
> > index b0e74a3..025f48e 100644
> > --- a/net/sctp/output.c
> > +++ b/net/sctp/output.c
> > @@ -410,6 +410,7 @@ static void sctp_packet_gso_append(struct sk_buff *head, struct sk_buff *skb)
> > head->truesize += skb->truesize;
> > head->data_len += skb->len;
> > head->len += skb->len;
> > + refcount_add(skb->truesize, &head->sk->sk_wmem_alloc);
> >
> > __skb_header_release(skb);
> > }
> This looks to me like you are now double counting every packet that passes
> through sctp_packet_transmit, once in skb_set_owner_w and again in
> sctp_packet_pack=>sctp_packet_gso_append
For gso packet, the skb(head) in sctp_packet_transmit/skb_set_owner_w
is the head_skb, the skbs here are the fragments.
For non-gso packet, it will never come here.
>
> Neil
>
> > --
> > 2.1.0
> >
> >
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: increase sk_wmem_alloc when head->truesize is increased
2018-11-26 6:52 ` Xin Long
@ 2018-11-27 23:42 ` David Miller
-1 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2018-11-27 23:42 UTC (permalink / raw)
To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman
From: Xin Long <lucien.xin@gmail.com>
Date: Mon, 26 Nov 2018 14:52:44 +0800
> 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 02968ccf0125 ("sctp: count sk_wmem_alloc by skb
> truesize in sctp_packet_transmit").
>
> But I should have also increased sk_wmem_alloc when head->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 <lucien.xin@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: increase sk_wmem_alloc when head->truesize is increased
@ 2018-11-27 23:42 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2018-11-27 23:42 UTC (permalink / raw)
To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman
From: Xin Long <lucien.xin@gmail.com>
Date: Mon, 26 Nov 2018 14:52:44 +0800
> 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 02968ccf0125 ("sctp: count sk_wmem_alloc by skb
> truesize in sctp_packet_transmit").
>
> But I should have also increased sk_wmem_alloc when head->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 <lucien.xin@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-11-28 10:42 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-26 6:52 [PATCH net] sctp: increase sk_wmem_alloc when head->truesize is increased Xin Long
2018-11-26 6:52 ` Xin Long
2018-11-26 12:04 ` Marcelo Ricardo Leitner
2018-11-26 12:04 ` Marcelo Ricardo Leitner
2018-11-26 12:26 ` Neil Horman
2018-11-26 12:26 ` Neil Horman
2018-11-26 12:49 ` Xin Long
2018-11-26 12:49 ` Xin Long
2018-11-27 23:42 ` David Miller
2018-11-27 23:42 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.