All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Atul Gupta <atul.gupta@chelsio.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,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [crypto-chtls] Supicious code in chtls_io
Date: Tue, 3 Apr 2018 16:46:52 -0500	[thread overview]
Message-ID: <20180403214652.GA31283@embeddedor.com> (raw)

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?

I can send a proper patch for this.

Thanks
--
Gustavo

             reply	other threads:[~2018-04-03 21:46 UTC|newest]

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

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=20180403214652.GA31283@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=atul.gupta@chelsio.com \
    --cc=davem@davemloft.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.