diff mbox series

ksmbd: uninitialized variable in create_socket()

Message ID 20220115114900.GB7552@kili (mailing list archive)
State New, archived
Headers show
Series ksmbd: uninitialized variable in create_socket() | expand

Commit Message

Dan Carpenter Jan. 15, 2022, 11:49 a.m. UTC
The "ksmbd_socket" variable is not initialized on this error path.

Cc: stable@vger.kernel.org
Fixes: 0626e6641f6b ("cifsd: add server handler for central processing and tranport layers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/ksmbd/transport_tcp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Namjae Jeon Jan. 16, 2022, 12:47 p.m. UTC | #1
2022-01-15 20:49 GMT+09:00, Dan Carpenter <dan.carpenter@oracle.com>:
> The "ksmbd_socket" variable is not initialized on this error path.
>
> Cc: stable@vger.kernel.org
> Fixes: 0626e6641f6b ("cifsd: add server handler for central processing and
> tranport layers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>

Thanks!
diff mbox series

Patch

diff --git a/fs/ksmbd/transport_tcp.c b/fs/ksmbd/transport_tcp.c
index c14320e03b69..82a1429bbe12 100644
--- a/fs/ksmbd/transport_tcp.c
+++ b/fs/ksmbd/transport_tcp.c
@@ -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;
 }