Skip to content

Commit a5c62f4

Browse files
aaptelSteve French
authored andcommitted
CIFS: fix uninitialized ptr deref in smb2 signing
server->secmech.sdeschmacsha256 is not properly initialized before smb2_shash_allocate(), set shash after that call. also fix typo in error message Fixes: 8de8c46 ("cifs: Fix validation of signed data in smb2") Signed-off-by: Aurelien Aptel <[email protected]> Reviewed-by: Paulo Alcantara <[email protected]> Reported-by: Xiaoli Feng <[email protected]> Signed-off-by: Steve French <[email protected]> CC: Stable <[email protected]>
1 parent fd09b7d commit a5c62f4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/cifs/smb2transport.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
171171
struct kvec *iov = rqst->rq_iov;
172172
struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)iov[0].iov_base;
173173
struct cifs_ses *ses;
174-
struct shash_desc *shash = &server->secmech.sdeschmacsha256->shash;
174+
struct shash_desc *shash;
175175
struct smb_rqst drqst;
176176

177177
ses = smb2_find_smb_ses(server, shdr->SessionId);
@@ -185,7 +185,7 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
185185

186186
rc = smb2_crypto_shash_allocate(server);
187187
if (rc) {
188-
cifs_dbg(VFS, "%s: shah256 alloc failed\n", __func__);
188+
cifs_dbg(VFS, "%s: sha256 alloc failed\n", __func__);
189189
return rc;
190190
}
191191

@@ -196,6 +196,7 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
196196
return rc;
197197
}
198198

199+
shash = &server->secmech.sdeschmacsha256->shash;
199200
rc = crypto_shash_init(shash);
200201
if (rc) {
201202
cifs_dbg(VFS, "%s: Could not init sha256", __func__);

0 commit comments

Comments
 (0)