Only IPSEC (xfrm) routes have a dst->child which is non-NULL.
xfrm routes are identified by dst->xfrm being non-NULL.

Codify this explicitly in dst_destroy().

Signed-off-by: David S. Miller <da...@davemloft.net>
---
 net/core/dst.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/core/dst.c b/net/core/dst.c
index 662a2d4a3d19..6a3c21b8fc8d 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -116,12 +116,14 @@ EXPORT_SYMBOL(dst_alloc);
 
 struct dst_entry *dst_destroy(struct dst_entry * dst)
 {
-       struct dst_entry *child;
+       struct dst_entry *child = NULL;
 
        smp_rmb();
 
-       child = dst->child;
-
+#ifdef CONFIG_XFRM
+       if (dst->xfrm)
+               child = dst->child;
+#endif
        if (!(dst->flags & DST_NOCOUNT))
                dst_entries_add(dst->ops, -1);
 
-- 
2.13.6

Reply via email to