LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] crypto: chtls - use after free in chtls_pt_recvmsg()
@ 2018-06-01 7:59 Dan Carpenter
2018-06-15 15:13 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-06-01 7:59 UTC (permalink / raw)
To: Harsh Jain, Atul Gupta
Cc: Herbert Xu, David S. Miller, Atul Gupta, Michael Werner,
linux-crypto, linux-kernel, kernel-janitors
We call chtls_free_skb() but then we dereference it on the next lines.
Also "skb" can't be NULL, we just dereferenced it on the line before.
I have moved the free down a couple lines to fix this issue.
Fixes: 17a7d24aa89d ("crypto: chtls - generic handling of data and hdr")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/crypto/chelsio/chtls/chtls_io.c b/drivers/crypto/chelsio/chtls/chtls_io.c
index 51fc6821cbbf..708e232e3cdf 100644
--- a/drivers/crypto/chelsio/chtls/chtls_io.c
+++ b/drivers/crypto/chelsio/chtls/chtls_io.c
@@ -1548,15 +1548,14 @@ static int chtls_pt_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
tp->urg_data = 0;
if ((avail + offset) >= skb->len) {
- if (likely(skb))
- chtls_free_skb(sk, skb);
- buffers_freed++;
if (ULP_SKB_CB(skb)->flags & ULPCB_FLAG_TLS_HDR) {
tp->copied_seq += skb->len;
hws->rcvpld = skb->hdr_len;
} else {
tp->copied_seq += hws->rcvpld;
}
+ chtls_free_skb(sk, skb);
+ buffers_freed++;
hws->copied_seq = 0;
if (copied >= target &&
!skb_peek(&sk->sk_receive_queue))
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: chtls - use after free in chtls_pt_recvmsg()
2018-06-01 7:59 [PATCH] crypto: chtls - use after free in chtls_pt_recvmsg() Dan Carpenter
@ 2018-06-15 15:13 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2018-06-15 15:13 UTC (permalink / raw)
To: Dan Carpenter
Cc: Harsh Jain, Atul Gupta, David S. Miller, Michael Werner,
linux-crypto, linux-kernel, kernel-janitors
On Fri, Jun 01, 2018 at 10:59:25AM +0300, Dan Carpenter wrote:
> We call chtls_free_skb() but then we dereference it on the next lines.
> Also "skb" can't be NULL, we just dereferenced it on the line before.
>
> I have moved the free down a couple lines to fix this issue.
>
> Fixes: 17a7d24aa89d ("crypto: chtls - generic handling of data and hdr")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-15 15:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-01 7:59 [PATCH] crypto: chtls - use after free in chtls_pt_recvmsg() Dan Carpenter
2018-06-15 15:13 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).