Skip to content

Commit fbbd84a

Browse files
Dan Carpenterkuba-moo
authored andcommitted
chelsio/chtls: prevent potential integer overflow on 32bit
The "gl->tot_len" variable is controlled by the user. It comes from process_responses(). On 32bit systems, the "gl->tot_len + sizeof(struct cpl_pass_accept_req) + sizeof(struct rss_header)" addition could have an integer wrapping bug. Use size_add() to prevent this. Fixes: a089439 ("crypto: chtls - Register chtls with net tls") Cc: [email protected] Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c8eb0c3 commit fbbd84a

File tree

1 file changed

+3
-2
lines changed
  • drivers/net/ethernet/chelsio/inline_crypto/chtls

1 file changed

+3
-2
lines changed

drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,9 @@ static struct sk_buff *copy_gl_to_skb_pkt(const struct pkt_gl *gl,
346346
* driver. Once driver synthesizes cpl_pass_accept_req the skb will go
347347
* through the regular cpl_pass_accept_req processing in TOM.
348348
*/
349-
skb = alloc_skb(gl->tot_len + sizeof(struct cpl_pass_accept_req)
350-
- pktshift, GFP_ATOMIC);
349+
skb = alloc_skb(size_add(gl->tot_len,
350+
sizeof(struct cpl_pass_accept_req)) -
351+
pktshift, GFP_ATOMIC);
351352
if (unlikely(!skb))
352353
return NULL;
353354
__skb_put(skb, gl->tot_len + sizeof(struct cpl_pass_accept_req)

0 commit comments

Comments
 (0)