From: Eric Dumazet <hidden> Date: 2021-12-07 19:32:10
From: Eric Dumazet <redacted>
xfrm4_fill_dst() and xfrm6_fill_dst() build dst,
getting a device reference that will likely be released
by standard dst_release() code.
We have to track these references or risk a warning if
CONFIG_NET_DEV_REFCNT_TRACKER=y
Note to XFRM maintainers :
Error path in xfrm6_fill_dst() releases the reference,
but does not clear xdst->u.dst.dev, so I wonder
if this could lead to double dev_put() in some cases,
where a dst_release() _is_ called by the callers in their
error path.
This extra dev_put() was added in commit 84c4a9dfbf430 ("xfrm6:
release dev before returning error")
Fixes: 9038c320001d ("net: dst: add net device refcount tracking to dst_entry")
Signed-off-by: Eric Dumazet <redacted>
Cc: Cong Wang <redacted>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
---
net/ipv4/xfrm4_policy.c | 2 +-
net/ipv6/xfrm6_policy.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
@@ -77,7 +77,7 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,xdst->u.rt.rt_iif=fl4->flowi4_iif;xdst->u.dst.dev=dev;-dev_hold(dev);+dev_hold_track(dev,&xdst->u.dst.dev_tracker,GFP_ATOMIC);/* Sheit... I remember I did this right. Apparently,*itwasmagicallylost,sothiscodeneedsaudit*/
On Tue, Dec 07, 2021 at 11:32:03AM -0800, Eric Dumazet wrote:
From: Eric Dumazet <redacted>
xfrm4_fill_dst() and xfrm6_fill_dst() build dst,
getting a device reference that will likely be released
by standard dst_release() code.
We have to track these references or risk a warning if
CONFIG_NET_DEV_REFCNT_TRACKER=y
Note to XFRM maintainers :
Error path in xfrm6_fill_dst() releases the reference,
but does not clear xdst->u.dst.dev, so I wonder
if this could lead to double dev_put() in some cases,
where a dst_release() _is_ called by the callers in their
error path.
Yes, looks like it can, so this should be fixed.
This extra dev_put() was added in commit 84c4a9dfbf430 ("xfrm6:
release dev before returning error")
Fixes: 9038c320001d ("net: dst: add net device refcount tracking to dst_entry")
Signed-off-by: Eric Dumazet <redacted>
Cc: Cong Wang <redacted>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
As the refcount tracking infrastructure is not yet in ipsec-next:
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Thanks!
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-12-09 19:53:58
On Thu, 9 Dec 2021 10:20:36 +0100 Steffen Klassert wrote:
On Tue, Dec 07, 2021 at 11:32:03AM -0800, Eric Dumazet wrote:
quoted
From: Eric Dumazet <redacted>
release dev before returning error")
Fixes: 9038c320001d ("net: dst: add net device refcount tracking to dst_entry")
Signed-off-by: Eric Dumazet <redacted>
Cc: Cong Wang <redacted>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
As the refcount tracking infrastructure is not yet in ipsec-next:
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski [off-list ref]:
On Tue, 7 Dec 2021 11:32:03 -0800 you wrote:
From: Eric Dumazet <redacted>
xfrm4_fill_dst() and xfrm6_fill_dst() build dst,
getting a device reference that will likely be released
by standard dst_release() code.
We have to track these references or risk a warning if
CONFIG_NET_DEV_REFCNT_TRACKER=y
[...]