Commit 78f4e737 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'for-6.16/dm-fixes' of...

Merge tag 'for-6.16/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm

Pull device mapper fixes from Mikulas Patocka:

 - dm-crypt: fix a crash on 32-bit machines

 - dm-raid: replace "rdev" with correct loop variable name "r"

* tag 'for-6.16/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
  dm-raid: fix variable in journal device check
  dm-crypt: Extend state buffer size in crypt_iv_lmk_one
parents cb0de0e2 db538051
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -517,7 +517,10 @@ static int crypt_iv_lmk_one(struct crypt_config *cc, u8 *iv,
{
	struct iv_lmk_private *lmk = &cc->iv_gen_private.lmk;
	SHASH_DESC_ON_STACK(desc, lmk->hash_tfm);
	union {
		struct md5_state md5state;
		u8 state[CRYPTO_MD5_STATESIZE];
	} u;
	__le32 buf[4];
	int i, r;

@@ -548,13 +551,13 @@ static int crypt_iv_lmk_one(struct crypt_config *cc, u8 *iv,
		return r;

	/* No MD5 padding here */
	r = crypto_shash_export(desc, &md5state);
	r = crypto_shash_export(desc, &u.md5state);
	if (r)
		return r;

	for (i = 0; i < MD5_HASH_WORDS; i++)
		__cpu_to_le32s(&md5state.hash[i]);
	memcpy(iv, &md5state.hash, cc->iv_size);
		__cpu_to_le32s(&u.md5state.hash[i]);
	memcpy(iv, &u.md5state.hash, cc->iv_size);

	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -2407,7 +2407,7 @@ static int super_init_validation(struct raid_set *rs, struct md_rdev *rdev)
	 */
	sb_retrieve_failed_devices(sb, failed_devices);
	rdev_for_each(r, mddev) {
		if (test_bit(Journal, &rdev->flags) ||
		if (test_bit(Journal, &r->flags) ||
		    !r->sb_page)
			continue;
		sb2 = page_address(r->sb_page);
+2 −0
Original line number Diff line number Diff line
@@ -202,6 +202,8 @@ struct shash_desc {
#define HASH_REQUEST_CLONE(name, gfp) \
	hash_request_clone(name, sizeof(__##name##_req), gfp)

#define CRYPTO_HASH_STATESIZE(coresize, blocksize) (coresize + blocksize + 1)

/**
 * struct shash_alg - synchronous message digest definition
 * @init: see struct ahash_alg
+4 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
#ifndef _CRYPTO_MD5_H
#define _CRYPTO_MD5_H

#include <crypto/hash.h>
#include <linux/types.h>

#define MD5_DIGEST_SIZE		16
@@ -15,6 +16,9 @@
#define MD5_H2	0x98badcfeUL
#define MD5_H3	0x10325476UL

#define CRYPTO_MD5_STATESIZE \
	CRYPTO_HASH_STATESIZE(MD5_STATE_SIZE, MD5_HMAC_BLOCK_SIZE)

extern const u8 md5_zero_message_hash[MD5_DIGEST_SIZE];

struct md5_state {