Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH v2 1/5] ksmbd: fix memory leak in smb2_handle_negotiate
@ 2022-07-28 13:49 Namjae Jeon
  2022-07-28 13:49 ` [PATCH v2 2/5] ksmbd: fix use-after-free bug in smb2_tree_disconect Namjae Jeon
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Namjae Jeon @ 2022-07-28 13:49 UTC (permalink / raw)
  To: linux-cifs
  Cc: smfrench, hyc.lee, senozhatsky, gregkh, Namjae Jeon, stable,
	zdi-disclosures

The allocated memory didn't free under an error
path in smb2_handle_negotiate().

Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Cc: stable@vger.kernel.org
Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-17815
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
---
 v2:
   - add missing fixes and stable tags.

 fs/ksmbd/smb2pdu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index 1f4f2d5217a6..41ef076af072 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -1142,12 +1142,16 @@ int smb2_handle_negotiate(struct ksmbd_work *work)
 			       status);
 			rsp->hdr.Status = status;
 			rc = -EINVAL;
+			kfree(conn->preauth_info);
+			conn->preauth_info = NULL;
 			goto err_out;
 		}
 
 		rc = init_smb3_11_server(conn);
 		if (rc < 0) {
 			rsp->hdr.Status = STATUS_INVALID_PARAMETER;
+			kfree(conn->preauth_info);
+			conn->preauth_info = NULL;
 			goto err_out;
 		}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-28 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-28 13:49 [PATCH v2 1/5] ksmbd: fix memory leak in smb2_handle_negotiate Namjae Jeon
2022-07-28 13:49 ` [PATCH v2 2/5] ksmbd: fix use-after-free bug in smb2_tree_disconect Namjae Jeon
2022-07-28 13:49 ` [PATCH v2 3/5] ksmbd: prevent out of bound read for SMB2_WRITE Namjae Jeon
2022-07-28 13:49 ` [PATCH v2 4/5] ksmbd: prevent out of bound read for SMB2_TREE_CONNNECT Namjae Jeon
2022-07-28 13:49 ` [PATCH v2 5/5] ksmbd: fix heap-based overflow in set_ntacl_dacl() Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox