public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Atul Gupta <atul.gupta@chelsio.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Harsh Jain <harsh@chelsio.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [crypto-chtls] Supicious code in chtls_io
Date: Wed, 4 Apr 2018 15:31:29 +0530	[thread overview]
Message-ID: <e9b07de5-4c48-b85e-e4d5-6bfc7df1982c@chelsio.com> (raw)
In-Reply-To: <20180403214652.GA31283@embeddedor.com>



On 4/4/2018 3:16 AM, Gustavo A. R. Silva wrote:
> Hi all,
>
> While doing some static analysis I came across the following piece of code at drivers/crypto/chelsio/chtls/chtls_io.c:1203:
>
> 1203                 if (!size)
> 1204                         break;
> 1205 
> 1206                 if (unlikely(ULP_SKB_CB(skb)->flags & ULPCB_FLAG_NO_APPEND))
> 1207                         push_frames_if_head(sk);
> 1208                 continue;
> 1209 
> 1210                 set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
> 1211         }
>
>
> The issue is that in the code above, set_bit is never reached due to the 'continue' statement at line 1208.
>
> I wonder if the actual intention of the code was something like this:
>
> diff --git a/drivers/crypto/chelsio/chtls/chtls_io.c b/drivers/crypto/chelsio/chtls/chtls_io.c
> index 5a75be4..a949a6c 100644
> --- a/drivers/crypto/chelsio/chtls/chtls_io.c
> +++ b/drivers/crypto/chelsio/chtls/chtls_io.c
> @@ -1203,9 +1203,10 @@ int chtls_sendpage(struct sock *sk, struct page *page,
>                 if (!size)
>                         break;
>  
> -               if (unlikely(ULP_SKB_CB(skb)->flags & ULPCB_FLAG_NO_APPEND))
> +               if (unlikely(ULP_SKB_CB(skb)->flags & ULPCB_FLAG_NO_APPEND)) {
>                         push_frames_if_head(sk);
> -               continue;
> +                       continue;
> +               }
>  
>                 set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
>         }
>
>
> What do you think?
Thanks for pointing, there is additional change required. I will send the patch once the window opens.
>
> I can send a proper patch for this.
>
> Thanks
> --
> Gustavo

      reply	other threads:[~2018-04-04 10:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-03 21:46 [crypto-chtls] Supicious code in chtls_io Gustavo A. R. Silva
2018-04-04 10:01 ` Atul Gupta [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e9b07de5-4c48-b85e-e4d5-6bfc7df1982c@chelsio.com \
    --to=atul.gupta@chelsio.com \
    --cc=davem@davemloft.net \
    --cc=gustavo@embeddedor.com \
    --cc=harsh@chelsio.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox