net/tls: fix socket wmem accounting on fallback with netem
authorJakub Kicinski <jakub.kicinski@netronome.com>
Tue, 9 Jul 2019 02:53:18 +0000 (19:53 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 9 Jul 2019 03:21:10 +0000 (20:21 -0700)
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: e8f69799810c ("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>
net/tls/tls_device_fallback.c

index 1d2d804ac633f66fb323ca17940191a2fd45b06c..9070d68a92a4bf8a8efa0ff12bdc85cd66b71b51 100644 (file)
@@ -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));