forked from luck/tmp_suning_uos_patched
net/tls: avoid NULL pointer deref on nskb->sk in fallback
update_chksum() accesses nskb->sk before it has been set
by complete_skb(), move the init up.
Fixes: e8f6979981
("net/tls: Add generic NIC offload infrastructure")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
15d55bae4e
commit
2dcb003314
|
@ -201,13 +201,14 @@ static void complete_skb(struct sk_buff *nskb, struct sk_buff *skb, int headln)
|
||||||
|
|
||||||
skb_put(nskb, skb->len);
|
skb_put(nskb, skb->len);
|
||||||
memcpy(nskb->data, skb->data, headln);
|
memcpy(nskb->data, skb->data, headln);
|
||||||
update_chksum(nskb, headln);
|
|
||||||
|
|
||||||
nskb->destructor = skb->destructor;
|
nskb->destructor = skb->destructor;
|
||||||
nskb->sk = sk;
|
nskb->sk = sk;
|
||||||
skb->destructor = NULL;
|
skb->destructor = NULL;
|
||||||
skb->sk = NULL;
|
skb->sk = NULL;
|
||||||
|
|
||||||
|
update_chksum(nskb, headln);
|
||||||
|
|
||||||
delta = nskb->truesize - skb->truesize;
|
delta = nskb->truesize - skb->truesize;
|
||||||
if (likely(delta < 0))
|
if (likely(delta < 0))
|
||||||
WARN_ON_ONCE(refcount_sub_and_test(-delta, &sk->sk_wmem_alloc));
|
WARN_ON_ONCE(refcount_sub_and_test(-delta, &sk->sk_wmem_alloc));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user