Skip to content

Commit

Permalink
net/tls: fix socket wmem accounting on fallback with netem
Browse files Browse the repository at this point in the history
netem runs skb_orphan_partial() which "disconnects" the skb
from normal TCP write memory accounting.  We should not adjust
sk->sk_wmem_alloc on the fallback path for such skbs.

Fixes: e8f6979 ("net/tls: Add generic NIC offload infrastructure")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed Jul 9, 2019
1 parent 5a4cea2 commit 5c4b460
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/tls/tls_device_fallback.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ static void complete_skb(struct sk_buff *nskb, struct sk_buff *skb, int headln)

update_chksum(nskb, headln);

/* sock_efree means skb must gone through skb_orphan_partial() */
if (nskb->destructor == sock_efree)
return;

delta = nskb->truesize - skb->truesize;
if (likely(delta < 0))
WARN_ON_ONCE(refcount_sub_and_test(-delta, &sk->sk_wmem_alloc));
Expand Down

0 comments on commit 5c4b460

Please sign in to comment.