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