summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorThomas Bartschies <thomas.bartschies@cvk.de>2022-05-18 08:32:18 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-06 08:24:20 +0200
commit539d5deba06e0700807840e8d77507fcb6e4be3c (patch)
treee3b5bcb2c8fd4f7a11ac8ce3574f6361d370c328 /net
parentb322e833697c61a1ee1c239dd4a42b38f6ad531e (diff)
downloadlinux-stable-539d5deba06e0700807840e8d77507fcb6e4be3c.tar.gz
linux-stable-539d5deba06e0700807840e8d77507fcb6e4be3c.tar.bz2
linux-stable-539d5deba06e0700807840e8d77507fcb6e4be3c.zip
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: Thomas Bartschies <thomas.bartschies@cvk.de> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/key/af_key.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 170960ef7e36..1bbb6ec89ff3 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2910,7 +2910,7 @@ static int count_ah_combs(const struct xfrm_tmpl *t)
break;
if (!aalg->pfkey_supported)
continue;
- if (aalg_tmpl_set(t, aalg))
+ if (aalg_tmpl_set(t, aalg) && aalg->available)
sz += sizeof(struct sadb_comb);
}
return sz + sizeof(struct sadb_prop);
@@ -2928,7 +2928,7 @@ static int count_esp_combs(const struct xfrm_tmpl *t)
if (!ealg->pfkey_supported)
continue;
- if (!(ealg_tmpl_set(t, ealg)))
+ if (!(ealg_tmpl_set(t, ealg) && ealg->available))
continue;
for (k = 1; ; k++) {
@@ -2939,7 +2939,7 @@ static int count_esp_combs(const struct xfrm_tmpl *t)
if (!aalg->pfkey_supported)
continue;
- if (aalg_tmpl_set(t, aalg))
+ if (aalg_tmpl_set(t, aalg) && aalg->available)
sz += sizeof(struct sadb_comb);
}
}