summaryrefslogtreecommitdiff
path: root/net/sctp
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2018-11-26 09:52:44 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-13 10:52:00 +0300
commit52cc7ea79741bcd91d5eb093ac6b351a56307493 (patch)
treedc02c37cd097f77172f16d06f4fa12f145ecb005 /net/sctp
parenta2b7010f76ea67963a098095318a9552297478e6 (diff)
downloadlinux-52cc7ea79741bcd91d5eb093ac6b351a56307493.tar.xz
sctp: increase sk_wmem_alloc when head->truesize is increased
[ Upstream commit 0d32f17717e65e76cbdb248374dd162acdfe2fff ] 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> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/output.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/sctp/output.c b/net/sctp/output.c
index b0e74a3e77ec..025f48e14a91 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);
}