* [PATCH ipsec-next v3] xfrm: cleanup error path in xfrm_add_policy()
@ 2026-04-14 2:09 Deepanshu Kartikey
2026-04-29 2:01 ` Deepanshu Kartikey
0 siblings, 1 reply; 4+ messages in thread
From: Deepanshu Kartikey @ 2026-04-14 2:09 UTC (permalink / raw)
To: steffen.klassert, herbert, davem, edumazet, kuba, pabeni, horms,
sd
Cc: netdev, linux-kernel, Deepanshu Kartikey
Replace the open-coded manual cleanup in the error path of
xfrm_add_policy() with xfrm_policy_destroy(), which already
handles all the necessary cleanup internally. This is consistent
with how xfrm_policy_construct() handles its own error paths.
The walk.dead flag must be set before calling xfrm_policy_destroy()
as required by BUG_ON(!policy->walk.dead).
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
v3:
- Changed prefix to ipsec-next as this is a cleanup
- Dropped syzbot references as suggested by Sabrina Dubroca
v2:
- Reworded commit message to reflect cleanup rather than bugfix
as suggested by Sabrina Dubroca
- Removed incorrect Fixes: and Closes: tags
- Corrected subject prefix to PATCH ipsec
---
net/xfrm/xfrm_user.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index d56450f61669..ae144d1e4a65 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2267,9 +2267,8 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
if (err) {
xfrm_dev_policy_delete(xp);
- xfrm_dev_policy_free(xp);
- security_xfrm_policy_free(xp->security);
- kfree(xp);
+ xp->walk.dead = 1;
+ xfrm_policy_destroy(xp);
return err;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH ipsec-next v3] xfrm: cleanup error path in xfrm_add_policy()
2026-04-14 2:09 [PATCH ipsec-next v3] xfrm: cleanup error path in xfrm_add_policy() Deepanshu Kartikey
@ 2026-04-29 2:01 ` Deepanshu Kartikey
2026-04-29 7:33 ` Steffen Klassert
0 siblings, 1 reply; 4+ messages in thread
From: Deepanshu Kartikey @ 2026-04-29 2:01 UTC (permalink / raw)
To: steffen.klassert, herbert, davem, edumazet, kuba, pabeni, horms,
sd
Cc: netdev, linux-kernel
On Tue, Apr 14, 2026 at 7:39 AM Deepanshu Kartikey
<kartikey406@gmail.com> wrote:
>
> Replace the open-coded manual cleanup in the error path of
> xfrm_add_policy() with xfrm_policy_destroy(), which already
> handles all the necessary cleanup internally. This is consistent
> with how xfrm_policy_construct() handles its own error paths.
>
> The walk.dead flag must be set before calling xfrm_policy_destroy()
> as required by BUG_ON(!policy->walk.dead).
>
> Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
> ---
> v3:
> - Changed prefix to ipsec-next as this is a cleanup
> - Dropped syzbot references as suggested by Sabrina Dubroca
> v2:
> - Reworded commit message to reflect cleanup rather than bugfix
> as suggested by Sabrina Dubroca
> - Removed incorrect Fixes: and Closes: tags
> - Corrected subject prefix to PATCH ipsec
> ---
> net/xfrm/xfrm_user.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
> index d56450f61669..ae144d1e4a65 100644
> --- a/net/xfrm/xfrm_user.c
> +++ b/net/xfrm/xfrm_user.c
> @@ -2267,9 +2267,8 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
>
> if (err) {
> xfrm_dev_policy_delete(xp);
> - xfrm_dev_policy_free(xp);
> - security_xfrm_policy_free(xp->security);
> - kfree(xp);
> + xp->walk.dead = 1;
> + xfrm_policy_destroy(xp);
> return err;
> }
>
> --
> 2.43.0
>
Gentle ping on this patch . Please let me know the status of this patch.
If anything is required from my side
Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH ipsec-next v3] xfrm: cleanup error path in xfrm_add_policy()
2026-04-29 2:01 ` Deepanshu Kartikey
@ 2026-04-29 7:33 ` Steffen Klassert
2026-05-04 8:07 ` Steffen Klassert
0 siblings, 1 reply; 4+ messages in thread
From: Steffen Klassert @ 2026-04-29 7:33 UTC (permalink / raw)
To: Deepanshu Kartikey
Cc: herbert, davem, edumazet, kuba, pabeni, horms, sd, netdev,
linux-kernel
On Wed, Apr 29, 2026 at 07:31:40AM +0530, Deepanshu Kartikey wrote:
> On Tue, Apr 14, 2026 at 7:39 AM Deepanshu Kartikey
> <kartikey406@gmail.com> wrote:
> >
> > Replace the open-coded manual cleanup in the error path of
> > xfrm_add_policy() with xfrm_policy_destroy(), which already
> > handles all the necessary cleanup internally. This is consistent
> > with how xfrm_policy_construct() handles its own error paths.
> >
> > The walk.dead flag must be set before calling xfrm_policy_destroy()
> > as required by BUG_ON(!policy->walk.dead).
> >
> > Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
> > ---
> > v3:
> > - Changed prefix to ipsec-next as this is a cleanup
> > - Dropped syzbot references as suggested by Sabrina Dubroca
> > v2:
> > - Reworded commit message to reflect cleanup rather than bugfix
> > as suggested by Sabrina Dubroca
> > - Removed incorrect Fixes: and Closes: tags
> > - Corrected subject prefix to PATCH ipsec
> > ---
> > net/xfrm/xfrm_user.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
> > index d56450f61669..ae144d1e4a65 100644
> > --- a/net/xfrm/xfrm_user.c
> > +++ b/net/xfrm/xfrm_user.c
> > @@ -2267,9 +2267,8 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
> >
> > if (err) {
> > xfrm_dev_policy_delete(xp);
> > - xfrm_dev_policy_free(xp);
> > - security_xfrm_policy_free(xp->security);
> > - kfree(xp);
> > + xp->walk.dead = 1;
> > + xfrm_policy_destroy(xp);
> > return err;
> > }
> >
> > --
> > 2.43.0
> >
> Gentle ping on this patch . Please let me know the status of this patch.
> If anything is required from my side
Your patch was submitted during the merge window. The net-next
and ipsec-next trees don't accept patches during this period.
The merge window ended last Sunday with the release of 7.1-rc1.
I prepared the ipsec-next tree for the new development cycle
yesterday. I'll consider your patch now.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH ipsec-next v3] xfrm: cleanup error path in xfrm_add_policy()
2026-04-29 7:33 ` Steffen Klassert
@ 2026-05-04 8:07 ` Steffen Klassert
0 siblings, 0 replies; 4+ messages in thread
From: Steffen Klassert @ 2026-05-04 8:07 UTC (permalink / raw)
To: Deepanshu Kartikey
Cc: herbert, davem, edumazet, kuba, pabeni, horms, sd, netdev,
linux-kernel
On Wed, Apr 29, 2026 at 09:33:32AM +0200, Steffen Klassert wrote:
> On Wed, Apr 29, 2026 at 07:31:40AM +0530, Deepanshu Kartikey wrote:
> > On Tue, Apr 14, 2026 at 7:39 AM Deepanshu Kartikey
> > <kartikey406@gmail.com> wrote:
> > >
> > > Replace the open-coded manual cleanup in the error path of
> > > xfrm_add_policy() with xfrm_policy_destroy(), which already
> > > handles all the necessary cleanup internally. This is consistent
> > > with how xfrm_policy_construct() handles its own error paths.
> > >
> > > The walk.dead flag must be set before calling xfrm_policy_destroy()
> > > as required by BUG_ON(!policy->walk.dead).
> > >
> > > Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
> > > ---
> > > v3:
> > > - Changed prefix to ipsec-next as this is a cleanup
> > > - Dropped syzbot references as suggested by Sabrina Dubroca
> > > v2:
> > > - Reworded commit message to reflect cleanup rather than bugfix
> > > as suggested by Sabrina Dubroca
> > > - Removed incorrect Fixes: and Closes: tags
> > > - Corrected subject prefix to PATCH ipsec
> > > ---
> > > net/xfrm/xfrm_user.c | 5 ++---
> > > 1 file changed, 2 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
> > > index d56450f61669..ae144d1e4a65 100644
> > > --- a/net/xfrm/xfrm_user.c
> > > +++ b/net/xfrm/xfrm_user.c
> > > @@ -2267,9 +2267,8 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
> > >
> > > if (err) {
> > > xfrm_dev_policy_delete(xp);
> > > - xfrm_dev_policy_free(xp);
> > > - security_xfrm_policy_free(xp->security);
> > > - kfree(xp);
> > > + xp->walk.dead = 1;
> > > + xfrm_policy_destroy(xp);
> > > return err;
> > > }
> > >
> > > --
> > > 2.43.0
> > >
> > Gentle ping on this patch . Please let me know the status of this patch.
> > If anything is required from my side
>
> Your patch was submitted during the merge window. The net-next
> and ipsec-next trees don't accept patches during this period.
>
> The merge window ended last Sunday with the release of 7.1-rc1.
> I prepared the ipsec-next tree for the new development cycle
> yesterday. I'll consider your patch now.
Now applied to ipsec-next, thanks Deepanshu!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-04 8:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-14 2:09 [PATCH ipsec-next v3] xfrm: cleanup error path in xfrm_add_policy() Deepanshu Kartikey
2026-04-29 2:01 ` Deepanshu Kartikey
2026-04-29 7:33 ` Steffen Klassert
2026-05-04 8:07 ` Steffen Klassert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox