All of lore.kernel.org
 help / color / mirror / Atom feed
* Fix an uninitialized read in smb3_qfs_tcon()
@ 2023-02-09 17:21 Volker Lendecke
  2023-02-09 17:46 ` Paulo Alcantara
  2023-02-09 18:03 ` Steve French
  0 siblings, 2 replies; 9+ messages in thread
From: Volker Lendecke @ 2023-02-09 17:21 UTC (permalink / raw)
  To: linux-cifs

[-- Attachment #1: Type: text/plain, Size: 490 bytes --]

Hi!

Attached find a patch that fixes another case where oparms.mode is
uninitialized. This patch fixes it with a struct assignment, relying
on the implicit initialization of unmentioned fields. Please note that
the assignment does not explicitly mention "reconnect" anymore,
relying on the implicit "false" value.

Is this kernel-style? Shall we just go through all of the oparms
initializations, there are quite a few other cases that might have the
mode uninitialized.

Regards,

Volker

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1181 bytes --]

From 848e2d42a731ed0612a5c5de188659b98734edce Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl@samba.org>
Date: Wed, 11 Jan 2023 12:37:58 +0100
Subject: [PATCH] cifs: Fix uninitialized memory read in smb3_qfs_tcon()

Signed-off-by: Volker Lendecke <vl@samba.org>
---
 fs/cifs/smb2ops.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index e6bcd2baf446..34c2ff0247db 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -729,12 +729,13 @@ smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon,
 	struct cifs_fid fid;
 	struct cached_fid *cfid = NULL;
 
-	oparms.tcon = tcon;
-	oparms.desired_access = FILE_READ_ATTRIBUTES;
-	oparms.disposition = FILE_OPEN;
-	oparms.create_options = cifs_create_options(cifs_sb, 0);
-	oparms.fid = &fid;
-	oparms.reconnect = false;
+	oparms = (struct cifs_open_parms) {
+		.tcon = tcon,
+		.desired_access = FILE_READ_ATTRIBUTES,
+		.disposition = FILE_OPEN,
+		.create_options = cifs_create_options(cifs_sb, 0),
+		.fid = &fid,
+	};
 
 	rc = open_cached_dir(xid, tcon, "", cifs_sb, false, &cfid);
 	if (rc == 0)
-- 
2.30.2


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

end of thread, other threads:[~2023-02-17  6:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-09 17:21 Fix an uninitialized read in smb3_qfs_tcon() Volker Lendecke
2023-02-09 17:46 ` Paulo Alcantara
2023-02-09 18:30   ` Volker Lendecke
2023-02-09 19:43   ` Steve French
2023-02-10 12:29     ` Volker Lendecke
     [not found]       ` <CAH2r5mvzVQKAT-a+MJ-qN=Ogn8PqNdMz=3zYntaq26UdgcY0Cg@mail.gmail.com>
2023-02-13  7:50         ` Volker Lendecke
2023-02-14 22:54           ` Steve French
2023-02-17  6:13             ` Steve French
2023-02-09 18:03 ` Steve French

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.