Skip to content

Commit 8c73e7c

Browse files
Thomas Bartschiesgregkh
authored andcommitted
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 <[email protected]> Signed-off-by: Steffen Klassert <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 95302ce commit 8c73e7c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/key/af_key.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2935,7 +2935,7 @@ static int count_ah_combs(const struct xfrm_tmpl *t)
29352935
break;
29362936
if (!aalg->pfkey_supported)
29372937
continue;
2938-
if (aalg_tmpl_set(t, aalg))
2938+
if (aalg_tmpl_set(t, aalg) && aalg->available)
29392939
sz += sizeof(struct sadb_comb);
29402940
}
29412941
return sz + sizeof(struct sadb_prop);
@@ -2953,7 +2953,7 @@ static int count_esp_combs(const struct xfrm_tmpl *t)
29532953
if (!ealg->pfkey_supported)
29542954
continue;
29552955

2956-
if (!(ealg_tmpl_set(t, ealg)))
2956+
if (!(ealg_tmpl_set(t, ealg) && ealg->available))
29572957
continue;
29582958

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

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

0 commit comments

Comments
 (0)