From 4af5dfb8dca3a6ad18feb6b2adcfffb4dc874e50 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 10 Mar 2026 12:50:20 -0700 Subject: smb: client: Compare MACs in constant time commit 26bc83b88bbbf054f0980a4a42047a8d1e210e4c upstream. To prevent timing attacks, MAC comparisons need to be constant-time. Replace the memcmp() with the correct function, crypto_memneq(). Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Acked-by: Paulo Alcantara (Red Hat) Signed-off-by: Eric Biggers Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/smb/client/cifsencrypt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/smb/client/cifsencrypt.c') diff --git a/fs/smb/client/cifsencrypt.c b/fs/smb/client/cifsencrypt.c index 801824825ecf..b9e20bcaa8b5 100644 --- a/fs/smb/client/cifsencrypt.c +++ b/fs/smb/client/cifsencrypt.c @@ -26,6 +26,7 @@ #include #include #include +#include static int cifs_sig_update(struct cifs_calc_sig_ctx *ctx, const u8 *data, size_t len) @@ -277,7 +278,7 @@ int cifs_verify_signature(struct smb_rqst *rqst, /* cifs_dump_mem("what we think it should be: ", what_we_think_sig_should_be, 16); */ - if (memcmp(server_response_sig, what_we_think_sig_should_be, 8)) + if (crypto_memneq(server_response_sig, what_we_think_sig_should_be, 8)) return -EACCES; else return 0; -- cgit v1.2.3