Skip to content

Commit e46e06f

Browse files
AnnYugawaPaolo Abeni
authored andcommitted
tipc: check return value of pskb_trim()
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>
1 parent 5c85f70 commit e46e06f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

net/tipc/crypto.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1960,7 +1960,8 @@ static void tipc_crypto_rcv_complete(struct net *net, struct tipc_aead *aead,
19601960

19611961
skb_reset_network_header(*skb);
19621962
skb_pull(*skb, tipc_ehdr_size(ehdr));
1963-
pskb_trim(*skb, (*skb)->len - aead->authsize);
1963+
if (pskb_trim(*skb, (*skb)->len - aead->authsize))
1964+
goto free_skb;
19641965

19651966
/* Validate TIPCv2 message */
19661967
if (unlikely(!tipc_msg_validate(skb))) {

0 commit comments

Comments
 (0)