Skip to content

Commit e65a495

Browse files
eqvinoxdavem330
authored andcommitted
net: check type when freeing metadata dst
Commit 3fcece1 ("net: store port/representator id in metadata_dst") added a new type field to metadata_dst, but metadata_dst_free() wasn't updated to check it before freeing the METADATA_IP_TUNNEL specific dst cache entry. This is not currently causing problems since it's far enough back in the struct to be zeroed for the only other type currently in existance (METADATA_HW_PORT_MUX), but nevertheless it's not correct. Fixes: 3fcece1 ("net: store port/representator id in metadata_dst") Signed-off-by: David Lamparter <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Sridhar Samudrala <[email protected]> Cc: Simon Horman <[email protected]> Cc: David S. Miller <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4832c30 commit e65a495

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/core/dst.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ EXPORT_SYMBOL_GPL(metadata_dst_alloc);
299299
void metadata_dst_free(struct metadata_dst *md_dst)
300300
{
301301
#ifdef CONFIG_DST_CACHE
302-
dst_cache_destroy(&md_dst->u.tun_info.dst_cache);
302+
if (md_dst->type == METADATA_IP_TUNNEL)
303+
dst_cache_destroy(&md_dst->u.tun_info.dst_cache);
303304
#endif
304305
kfree(md_dst);
305306
}

0 commit comments

Comments
 (0)