Revert "xfrm: fix a data-race in xfrm_gen_index()"

This reverts commit 9ee49ca16c.
This commit is contained in:
Ksawlii 2024-11-17 19:38:56 +01:00
parent b0d48c6581
commit 4beaea2c30
2 changed files with 4 additions and 3 deletions

View file

@ -50,7 +50,6 @@ struct netns_xfrm {
struct list_head policy_all; struct list_head policy_all;
struct hlist_head *policy_byidx; struct hlist_head *policy_byidx;
unsigned int policy_idx_hmask; unsigned int policy_idx_hmask;
unsigned int idx_generator;
struct hlist_head policy_inexact[XFRM_POLICY_MAX]; struct hlist_head policy_inexact[XFRM_POLICY_MAX];
struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX]; struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX];
unsigned int policy_count[XFRM_POLICY_MAX * 2]; unsigned int policy_count[XFRM_POLICY_MAX * 2];

View file

@ -1376,6 +1376,8 @@ EXPORT_SYMBOL(xfrm_policy_hash_rebuild);
* of an absolute inpredictability of ordering of rules. This will not pass. */ * of an absolute inpredictability of ordering of rules. This will not pass. */
static u32 xfrm_gen_index(struct net *net, int dir, u32 index) static u32 xfrm_gen_index(struct net *net, int dir, u32 index)
{ {
static u32 idx_generator;
for (;;) { for (;;) {
struct hlist_head *list; struct hlist_head *list;
struct xfrm_policy *p; struct xfrm_policy *p;
@ -1383,8 +1385,8 @@ static u32 xfrm_gen_index(struct net *net, int dir, u32 index)
int found; int found;
if (!index) { if (!index) {
idx = (net->xfrm.idx_generator | dir); idx = (idx_generator | dir);
net->xfrm.idx_generator += 8; idx_generator += 8;
} else { } else {
idx = index; idx = index;
index = 0; index = 0;