mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
two server fixes
-----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEE6fsu8pdIjtWE/DpLiiy9cAdyT1EFAmmgciQACgkQiiy9cAdy T1E6sgv5Af03XrmItc5aiXdm0D8DAxhE23aCczTduaIwvaxfYNr2a1AxBO0jTi0Y qgJWJeSwcwZL63wMulp4yFxKICA6uhNL5EdGgX1O9gilN1kZmMBKXu1KGNU8Rp4Q t9BncLsokv6QtxE+VCrPAVlRpcBc7RhBFrl90p1IWIcT0RYTLwmRO3hrqs/n1Dya 1IJqK6VUd89ViEIrgAdG3AqBAz8jBQLFc0Fl+CuhYA5PLQoZBwtNdVNjDahb/A+F Je96qj9U5fT4CGWzLEktGHf5O3gV9Trv6cob+9sNrjZCm4wtDvqsEZJZjS6LXA59 dusZG2WyapdGLBCCcn3y68C2uMuRYEVV3eMGSqbCQ4aG0J5BLtSb/xjSGTYel9Ab JEjq+mgzuhI2JWIBmPbI4UtrHuC3y5QY0gXuf6QICGTsFWEYHePtgTMExcsnrBP8 CxMXc5FLgf+bL5gX5i1JSlKCO1JyA3Gvf6LZvcIafBuav3VoFXdRCGXZeZLw9kPn agTEC/l6 =bhLy -----END PGP SIGNATURE----- Merge tag 'v7.0-rc1-ksmbd-server-fixes' of git://git.samba.org/ksmbd Pull smb server fixes from Steve French: - auth security improvement - fix potential buffer overflow in smbdirect negotiation * tag 'v7.0-rc1-ksmbd-server-fixes' of git://git.samba.org/ksmbd: ksmbd: fix signededness bug in smb_direct_prepare_negotiation() ksmbd: Compare MACs in constant time
This commit is contained in:
commit
a75cb869a8
4 changed files with 9 additions and 5 deletions
|
|
@ -13,6 +13,7 @@ config SMB_SERVER
|
|||
select CRYPTO_LIB_MD5
|
||||
select CRYPTO_LIB_SHA256
|
||||
select CRYPTO_LIB_SHA512
|
||||
select CRYPTO_LIB_UTILS
|
||||
select CRYPTO_CMAC
|
||||
select CRYPTO_AEAD2
|
||||
select CRYPTO_CCM
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include <crypto/aead.h>
|
||||
#include <crypto/md5.h>
|
||||
#include <crypto/sha2.h>
|
||||
#include <crypto/utils.h>
|
||||
#include <linux/random.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
|
|
@ -165,7 +166,8 @@ int ksmbd_auth_ntlmv2(struct ksmbd_conn *conn, struct ksmbd_session *sess,
|
|||
ntlmv2_rsp, CIFS_HMAC_MD5_HASH_SIZE,
|
||||
sess->sess_key);
|
||||
|
||||
if (memcmp(ntlmv2->ntlmv2_hash, ntlmv2_rsp, CIFS_HMAC_MD5_HASH_SIZE) != 0)
|
||||
if (crypto_memneq(ntlmv2->ntlmv2_hash, ntlmv2_rsp,
|
||||
CIFS_HMAC_MD5_HASH_SIZE))
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* Copyright (C) 2018 Samsung Electronics Co., Ltd.
|
||||
*/
|
||||
|
||||
#include <crypto/utils.h>
|
||||
#include <linux/inetdevice.h>
|
||||
#include <net/addrconf.h>
|
||||
#include <linux/syscalls.h>
|
||||
|
|
@ -8880,7 +8881,7 @@ int smb2_check_sign_req(struct ksmbd_work *work)
|
|||
ksmbd_sign_smb2_pdu(work->conn, work->sess->sess_key, iov, 1,
|
||||
signature);
|
||||
|
||||
if (memcmp(signature, signature_req, SMB2_SIGNATURE_SIZE)) {
|
||||
if (crypto_memneq(signature, signature_req, SMB2_SIGNATURE_SIZE)) {
|
||||
pr_err("bad smb2 signature\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -8968,7 +8969,7 @@ int smb3_check_sign_req(struct ksmbd_work *work)
|
|||
if (ksmbd_sign_smb3_pdu(conn, signing_key, iov, 1, signature))
|
||||
return 0;
|
||||
|
||||
if (memcmp(signature, signature_req, SMB2_SIGNATURE_SIZE)) {
|
||||
if (crypto_memneq(signature, signature_req, SMB2_SIGNATURE_SIZE)) {
|
||||
pr_err("bad smb2 signature\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2540,9 +2540,9 @@ static int smb_direct_prepare(struct ksmbd_transport *t)
|
|||
goto put;
|
||||
|
||||
req = (struct smbdirect_negotiate_req *)recvmsg->packet;
|
||||
sp->max_recv_size = min_t(int, sp->max_recv_size,
|
||||
sp->max_recv_size = min_t(u32, sp->max_recv_size,
|
||||
le32_to_cpu(req->preferred_send_size));
|
||||
sp->max_send_size = min_t(int, sp->max_send_size,
|
||||
sp->max_send_size = min_t(u32, sp->max_send_size,
|
||||
le32_to_cpu(req->max_receive_size));
|
||||
sp->max_fragmented_send_size =
|
||||
le32_to_cpu(req->max_fragmented_size);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue