[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230717185710.93256-1-kuniyu@amazon.com>
Date: Mon, 17 Jul 2023 11:57:10 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <ruc_gongyuanjun@....com>
CC: <jmaloy@...hat.com>, <netdev@...r.kernel.org>, <ying.xue@...driver.com>,
<kuniyu@...zon.com>
Subject: Re: [PATCH 1/1] net:tipc: check return value of pskb_trim()
From: Yuanjun Gong <ruc_gongyuanjun@....com>
Date: Mon, 17 Jul 2023 22:50:49 +0800
> goto free_skb if an unexpected result is returned by pskb_tirm()
> in tipc_crypto_rcv_complete().
>
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@....com>
> ---
> net/tipc/crypto.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c
> index 577fa5af33ec..1b86cea261a5 100644
> --- a/net/tipc/crypto.c
> +++ b/net/tipc/crypto.c
> @@ -1894,6 +1894,7 @@ static void tipc_crypto_rcv_complete(struct net *net, struct tipc_aead *aead,
> struct tipc_aead *tmp = NULL;
> struct tipc_ehdr *ehdr;
> struct tipc_node *n;
> + int ret;
>
> /* Is this completed by TX? */
> if (unlikely(is_tx(aead->crypto))) {
> @@ -1960,7 +1961,9 @@ 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);
> + ret = pskb_trim(*skb, (*skb)->len - aead->authsize);
> + if (ret)
No need to define ret.
> + goto free_skb;
>
> /* Validate TIPCv2 message */
> if (unlikely(!tipc_msg_validate(skb))) {
> --
> 2.17.1
Powered by blists - more mailing lists