Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e619506e authored by Thomas Bartschies's avatar Thomas Bartschies Committed by Greg Kroah-Hartman
Browse files

net: af_key: check encryption module availability consistency



[ Upstream commit 015c44d7bff3f44d569716117becd570c179ca32 ]

Since the recent introduction supporting the SM3 and SM4 hash algos for IPsec, the kernel
produces invalid pfkey acquire messages, when these encryption modules are disabled. This
happens because the availability of the algos wasn't checked in all necessary functions.
This patch adds these checks.

Signed-off-by: default avatarThomas Bartschies <thomas.bartschies@cvk.de>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent fa77d2a3
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -2904,7 +2904,7 @@ static int count_ah_combs(const struct xfrm_tmpl *t)
			break;
			break;
		if (!aalg->pfkey_supported)
		if (!aalg->pfkey_supported)
			continue;
			continue;
		if (aalg_tmpl_set(t, aalg))
		if (aalg_tmpl_set(t, aalg) && aalg->available)
			sz += sizeof(struct sadb_comb);
			sz += sizeof(struct sadb_comb);
	}
	}
	return sz + sizeof(struct sadb_prop);
	return sz + sizeof(struct sadb_prop);
@@ -2922,7 +2922,7 @@ static int count_esp_combs(const struct xfrm_tmpl *t)
		if (!ealg->pfkey_supported)
		if (!ealg->pfkey_supported)
			continue;
			continue;


		if (!(ealg_tmpl_set(t, ealg)))
		if (!(ealg_tmpl_set(t, ealg) && ealg->available))
			continue;
			continue;


		for (k = 1; ; k++) {
		for (k = 1; ; k++) {
@@ -2933,7 +2933,7 @@ static int count_esp_combs(const struct xfrm_tmpl *t)
			if (!aalg->pfkey_supported)
			if (!aalg->pfkey_supported)
				continue;
				continue;


			if (aalg_tmpl_set(t, aalg))
			if (aalg_tmpl_set(t, aalg) && aalg->available)
				sz += sizeof(struct sadb_comb);
				sz += sizeof(struct sadb_comb);
		}
		}
	}
	}