]> git.baikalelectronics.ru Git - kernel.git/commit
xfrm: use net device refcount tracker helpers
authorEric Dumazet <edumazet@google.com>
Tue, 7 Dec 2021 19:32:03 +0000 (11:32 -0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 9 Dec 2021 19:51:45 +0000 (11:51 -0800)
commit552f9737a18961a15a96c7f48026ceff0f10e41a
tree141e5833f6344cde8782b002a085184a8d91ae92
parent37d5274b48fb3cab6f0917a2b058e98e968b24ff
xfrm: use net device refcount tracker helpers

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 3a92777c9d08e ("xfrm6:
release dev before returning error")

Fixes: f80094ecb556 ("net: dst: add net device refcount tracking to dst_entry")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Cong Wang <amwang@redhat.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Link: https://lore.kernel.org/r/20211207193203.2706158-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/xfrm4_policy.c
net/ipv6/xfrm6_policy.c