Skip to content

Commit

Permalink
tipc: check return value of pskb_trim()
Browse files Browse the repository at this point in the history
goto free_skb if an unexpected result is returned by pskb_tirm()
in tipc_crypto_rcv_complete().

Fixes: fc1b6d6 ("tipc: introduce TIPC encryption & authentication")
Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
Reviewed-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
Link: https://lore.kernel.org/r/20230725064810.5820-1-ruc_gongyuanjun@163.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Yuanjun Gong authored and Paolo Abeni committed Jul 27, 2023
1 parent 5c85f70 commit e46e06f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/tipc/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,8 @@ static void tipc_crypto_rcv_complete(struct net *net, struct tipc_aead *aead,

skb_reset_network_header(*skb);
skb_pull(*skb, tipc_ehdr_size(ehdr));
pskb_trim(*skb, (*skb)->len - aead->authsize);
if (pskb_trim(*skb, (*skb)->len - aead->authsize))
goto free_skb;

/* Validate TIPCv2 message */
if (unlikely(!tipc_msg_validate(skb))) {
Expand Down

0 comments on commit e46e06f

Please sign in to comment.