Merge tag 'dmaengine-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul...
[linux-2.6-block.git] / net / core / dst.c
index a4e738d321ba2968e388057f4bb07d7f4a1f24be..6d2dd03dafa81363521b7178b04694b398d50137 100644 (file)
@@ -316,6 +316,8 @@ void metadata_dst_free(struct metadata_dst *md_dst)
        if (md_dst->type == METADATA_IP_TUNNEL)
                dst_cache_destroy(&md_dst->u.tun_info.dst_cache);
 #endif
+       if (md_dst->type == METADATA_XFRM)
+               dst_release(md_dst->u.xfrm_info.dst_orig);
        kfree(md_dst);
 }
 EXPORT_SYMBOL_GPL(metadata_dst_free);
@@ -340,16 +342,18 @@ EXPORT_SYMBOL_GPL(metadata_dst_alloc_percpu);
 
 void metadata_dst_free_percpu(struct metadata_dst __percpu *md_dst)
 {
-#ifdef CONFIG_DST_CACHE
        int cpu;
 
        for_each_possible_cpu(cpu) {
                struct metadata_dst *one_md_dst = per_cpu_ptr(md_dst, cpu);
 
+#ifdef CONFIG_DST_CACHE
                if (one_md_dst->type == METADATA_IP_TUNNEL)
                        dst_cache_destroy(&one_md_dst->u.tun_info.dst_cache);
-       }
 #endif
+               if (one_md_dst->type == METADATA_XFRM)
+                       dst_release(one_md_dst->u.xfrm_info.dst_orig);
+       }
        free_percpu(md_dst);
 }
 EXPORT_SYMBOL_GPL(metadata_dst_free_percpu);