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