Netdev List
 help / color / mirror / Atom feed
From: Vakul Garg <vakul.garg@nxp.com>
To: netdev@vger.kernel.org
Cc: borisp@mellanox.com, aviadye@mellanox.com, davejwatson@fb.com,
	davem@davemloft.net, Vakul Garg <vakul.garg@nxp.com>
Subject: [net-next v3 5/5] net/tls: Rework error checking after decrypt_skb_update()
Date: Thu, 19 Jul 2018 16:46:43 +0530	[thread overview]
Message-ID: <20180719111643.12787-6-vakul.garg@nxp.com> (raw)
In-Reply-To: <20180719111643.12787-1-vakul.garg@nxp.com>

Error checking code after invoking decrypt_skb_update() for zero-copy
and non-zero-copy cases in tls_sw_recvmsg has been made common.

Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
---
 net/tls/tls_sw.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index ae0b40d6671b..da3b884bea93 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -824,18 +824,16 @@ int tls_sw_recvmsg(struct sock *sk,
 				err = decrypt_skb_update(sk, skb, sgin);
 				for (; pages > 0; pages--)
 					put_page(sg_page(&sgin[pages]));
-				if (err < 0) {
-					tls_err_abort(sk, EBADMSG);
-					goto recv_end;
-				}
 			} else {
 fallback_to_reg_recv:
 				err = decrypt_skb_update(sk, skb, NULL);
-				if (err < 0) {
-					tls_err_abort(sk, EBADMSG);
-					goto recv_end;
-				}
 			}
+
+			if (err < 0) {
+				tls_err_abort(sk, EBADMSG);
+				goto recv_end;
+			}
+
 			ctx->decrypted = true;
 		}
 
-- 
2.13.6

      parent reply	other threads:[~2018-07-19  6:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19 11:16 [net-next v3 0/5] net/tls: Minor code cleanup patches Vakul Garg
2018-07-19 11:16 ` [net-next v3 1/5] net/tls: Do not enable zero-copy prematurely Vakul Garg
2018-07-19 10:28   ` Boris Pismenny
2018-07-19 10:32     ` Vakul Garg
2018-07-19 11:16 ` [net-next v3 2/5] net/tls: Use socket data_ready callback on record availability Vakul Garg
2018-07-19 11:16 ` [net-next v3 3/5] net/tls: Remove redundant variable assignments and wakeup Vakul Garg
2018-07-19 11:16 ` [net-next v3 4/5] net/tls: Remove redundant array allocation Vakul Garg
2018-07-19 11:16 ` Vakul Garg [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=20180719111643.12787-6-vakul.garg@nxp.com \
    --to=vakul.garg@nxp.com \
    --cc=aviadye@mellanox.com \
    --cc=borisp@mellanox.com \
    --cc=davejwatson@fb.com \
    --cc=davem@davemloft.net \
    --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