17b94a
From 0e3871a57b7a621444dc5cfd49935a1e412f6436 Mon Sep 17 00:00:00 2001
17b94a
From: Mohit Agrawal <moagrawa@redhat.com>
17b94a
Date: Mon, 8 Jun 2020 13:27:50 +0530
17b94a
Subject: [PATCH 433/449] socket: Resolve ssl_ctx leak for a brick while only
17b94a
 mgmt SSL is enabled
17b94a
17b94a
Problem: While only mgmt SSL is enabled for a brick process use_ssl flag
17b94a
         is false for a brick process and socket api's cleanup ssl_ctx only
17b94a
         while use_ssl and ssl_ctx both are valid
17b94a
17b94a
Solution: To avoid a leak check only ssl_ctx, if it is valid cleanup
17b94a
          ssl_ctx
17b94a
17b94a
> Fixes: #1196
17b94a
> Change-Id: I2f4295478f4149dcb7d608ea78ee5104f28812c3
17b94a
> Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
17b94a
> (Cherry pick from commit 9873baee34afdf0c20f5fc98a7dbf2a9f07447e2)
17b94a
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/24366/)
17b94a
17b94a
BUG: 1810924
17b94a
Change-Id: I2f4295478f4149dcb7d608ea78ee5104f28812c3
17b94a
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
17b94a
Reviewed-on: https://code.engineering.redhat.com/gerrit/202625
17b94a
Tested-by: RHGS Build Bot <nigelb@redhat.com>
17b94a
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
17b94a
---
17b94a
 rpc/rpc-transport/socket/src/socket.c | 4 ++--
17b94a
 1 file changed, 2 insertions(+), 2 deletions(-)
17b94a
17b94a
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
17b94a
index 226b2e2..54cd5df 100644
17b94a
--- a/rpc/rpc-transport/socket/src/socket.c
17b94a
+++ b/rpc/rpc-transport/socket/src/socket.c
17b94a
@@ -1163,7 +1163,7 @@ __socket_reset(rpc_transport_t *this)
17b94a
         SSL_free(priv->ssl_ssl);
17b94a
         priv->ssl_ssl = NULL;
17b94a
     }
17b94a
-    if (priv->use_ssl && priv->ssl_ctx) {
17b94a
+    if (priv->ssl_ctx) {
17b94a
         SSL_CTX_free(priv->ssl_ctx);
17b94a
         priv->ssl_ctx = NULL;
17b94a
     }
17b94a
@@ -4685,7 +4685,7 @@ fini(rpc_transport_t *this)
17b94a
             SSL_free(priv->ssl_ssl);
17b94a
             priv->ssl_ssl = NULL;
17b94a
         }
17b94a
-        if (priv->use_ssl && priv->ssl_ctx) {
17b94a
+        if (priv->ssl_ctx) {
17b94a
             SSL_CTX_free(priv->ssl_ctx);
17b94a
             priv->ssl_ctx = NULL;
17b94a
         }
17b94a
-- 
17b94a
1.8.3.1
17b94a