netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Atul Gupta <atul.gupta@chelsio.com>
To: herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org
Cc: gustavo@embeddedor.com, dan.carpenter@oracle.com,
	netdev@vger.kernel.org, davem@davemloft.net,
	atul.gupta@chelsio.com
Subject: [PATCH v2 3/5] crypto: chtls: dereference null variable
Date: Sun, 27 May 2018 21:15:20 +0530	[thread overview]
Message-ID: <1527435922-6727-4-git-send-email-atul.gupta@chelsio.com> (raw)
In-Reply-To: <1527435922-6727-1-git-send-email-atul.gupta@chelsio.com>

skb dereferenced before check in sendpage

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Atul Gupta <atul.gupta@chelsio.com>
---
 drivers/crypto/chelsio/chtls/chtls_io.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/crypto/chelsio/chtls/chtls_io.c b/drivers/crypto/chelsio/chtls/chtls_io.c
index 7aa5d90..8cfc27b 100644
--- a/drivers/crypto/chelsio/chtls/chtls_io.c
+++ b/drivers/crypto/chelsio/chtls/chtls_io.c
@@ -1230,9 +1230,8 @@ int chtls_sendpage(struct sock *sk, struct page *page,
 		struct sk_buff *skb = skb_peek_tail(&csk->txq);
 		int copy, i;
 
-		copy = mss - skb->len;
 		if (!skb || (ULP_SKB_CB(skb)->flags & ULPCB_FLAG_NO_APPEND) ||
-		    copy <= 0) {
+		    (copy = mss - skb->len) <= 0) {
 new_buf:
 			if (!csk_mem_free(cdev, sk))
 				goto wait_for_sndbuf;
-- 
1.8.3.1

  parent reply	other threads:[~2018-05-27 15:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-27 15:45 [PATCH v2 0/5] build warnings cleanup Atul Gupta
2018-05-27 15:45 ` [PATCH v2 1/5] crypto:chtls: key len correction Atul Gupta
2018-05-27 15:45 ` [PATCH v2 2/5] crypto: chtls: wait for memory sendmsg, sendpage Atul Gupta
2018-05-27 15:45 ` Atul Gupta [this message]
2018-05-27 15:45 ` [PATCH v2 4/5] crypto: chtls: kbuild warnings Atul Gupta
2018-05-27 15:45 ` [PATCH v2 5/5] crypto: chtls: free beyond end rspq_skb_cache Atul Gupta
2018-05-30 16:28 ` [PATCH v2 0/5] build warnings cleanup Herbert Xu

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=1527435922-6727-4-git-send-email-atul.gupta@chelsio.com \
    --to=atul.gupta@chelsio.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=gustavo@embeddedor.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).