chelsio/chtls: unlock on error in chtls_pt_recvmsg()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 12 May 2021 10:02:48 +0000 (13:02 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 12 May 2021 21:30:00 +0000 (14:30 -0700)
This error path needs to release some memory and call release_sock(sk);
before returning.

Fixes: 6919a8264a32 ("Crypto/chtls: add/delete TLS header in driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c

index 188d871..c320cc8 100644 (file)
@@ -1564,8 +1564,10 @@ found_ok_skb:
                        cerr = put_cmsg(msg, SOL_TLS, TLS_GET_RECORD_TYPE,
                                        sizeof(thdr->type), &thdr->type);
 
-                       if (cerr && thdr->type != TLS_RECORD_TYPE_DATA)
-                               return -EIO;
+                       if (cerr && thdr->type != TLS_RECORD_TYPE_DATA) {
+                               copied = -EIO;
+                               break;
+                       }
                        /*  don't send tls header, skip copy */
                        goto skip_copy;
                }