diff mbox series

[ipsec-next] xfrm: Initialise dir in xfrm_hash_rebuild()

Message ID 20240830-xfrm_hash_rebuild-dir-v1-1-f75092d07e1b@kernel.org (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series [ipsec-next] xfrm: Initialise dir in xfrm_hash_rebuild() | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Simon Horman Aug. 30, 2024, 5:01 p.m. UTC
The cited commit removed the initialisation of dir in one place too
many: it is still used within the loop this patch updates.

Compile tested only.

Fixes: 08c2182cf0b4 ("xfrm: policy: use recently added helper in more places")
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Closes: https://lore.kernel.org/netdev/CA+G9fYtemFfuhc7=eNyP3TezM9Euc8sFtHe4GDR4Z9XdHzXSJA@mail.gmail.com/
Signed-off-by: Simon Horman <horms@kernel.org>
---
 net/xfrm/xfrm_policy.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Simon Horman Aug. 31, 2024, 8:25 a.m. UTC | #1
+ Nathan

On Fri, Aug 30, 2024 at 06:01:50PM +0100, Simon Horman wrote:
> The cited commit removed the initialisation of dir in one place too
> many: it is still used within the loop this patch updates.
> 
> Compile tested only.
> 
> Fixes: 08c2182cf0b4 ("xfrm: policy: use recently added helper in more places")
> Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
> Closes: https://lore.kernel.org/netdev/CA+G9fYtemFfuhc7=eNyP3TezM9Euc8sFtHe4GDR4Z9XdHzXSJA@mail.gmail.com/
> Signed-off-by: Simon Horman <horms@kernel.org>

Nathan advises me that this fix is incomplete and
that he has sent a complete fix here:

https://lore.kernel.org/all/20240829-xfrm-restore-dir-assign-xfrm_hash_rebuild-v2-1-1cf8958f6e8e@kernel.org/
diff mbox series

Patch

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 6336baa8a93c..02eb4bd0fde6 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1283,6 +1283,7 @@  static void xfrm_hash_rebuild(struct work_struct *work)
 		if (xfrm_policy_is_dead_or_sk(policy))
 			continue;
 
+		dir = xfrm_policy_id2dir(policy->index);
 		if ((dir & XFRM_POLICY_MASK) == XFRM_POLICY_OUT) {
 			if (policy->family == AF_INET) {
 				dbits = rbits4;