Skip to contentSkip to conversation

ksmbd: uninitialized variable in create_socket()

PATCH In review Dan Carpenter 2 participants 2 messages Jan 15, 2022 – Jan 16, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ksmbd: uninitialized variable in create_socket()

The "ksmbd_socket" variable is not initialized on this error path.

Fixes 0626e6641f6b ("cifsd: add server handler for central processing and tranport layers")
---
 fs/ksmbd/transport_tcp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ksmbd/transport_tcp.c +2 -1
index c14320e03b69..82a1429bbe12 100644
@@ -404,7 +404,7 @@ static int create_socket(struct interface *iface)
 				  &ksmbd_socket);
 		if (ret) {
 			pr_err("Can't create socket for ipv4: %d\n", ret);
-			goto out_error;
+			goto out_clear;
 		}
 
 		sin.sin_family = PF_INET;
@@ -462,6 +462,7 @@ static int create_socket(struct interface *iface)
 
 out_error:
 	tcp_destroy_socket(ksmbd_socket);
+out_clear:
 	iface->ksmbd_socket = NULL;
 	return ret;
 }
Signature · 1 line
2.20.1