svn commit: r341556 - head/sys/dev/mlx5/mlx5_core
Slava Shwartsman
slavash at FreeBSD.org
Wed Dec 5 13:41:38 UTC 2018
Author: slavash
Date: Wed Dec 5 13:41:37 2018
New Revision: 341556
URL: https://svnweb.freebsd.org/changeset/base/341556
Log:
mlx5: Fix for potential memory leaks.
Make sure allocated data gets freed in error cases.
Submitted by: hselasky@
Approved by: hselasky (mentor)
MFC after: 1 week
Sponsored by: Mellanox Technologies
Modified:
head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c
head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c
head/sys/dev/mlx5/mlx5_core/mlx5_vport.c
Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c Wed Dec 5 13:41:06 2018 (r341555)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c Wed Dec 5 13:41:37 2018 (r341556)
@@ -1601,9 +1601,10 @@ static char *get_dest_name(struct mlx5_flow_destinatio
case MLX5_FLOW_CONTEXT_DEST_TYPE_TIR:
snprintf(name, 20, "dest_%s_%u", "tir", dest->tir_num);
return name;
+ default:
+ kfree(name);
+ return NULL;
}
-
- return NULL;
}
/* assumed fg is locked */
Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Wed Dec 5 13:41:06 2018 (r341555)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Wed Dec 5 13:41:37 2018 (r341556)
@@ -153,6 +153,7 @@ failure:
bus_dmamem_free(dev->cmd.dma_tag, fwp[x].virt_addr, fwp[x].dma_map);
}
sx_xunlock(&dev->cmd.dma_sx);
+ kfree(fwp);
return (NULL);
}
Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vport.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_vport.c Wed Dec 5 13:41:06 2018 (r341555)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_vport.c Wed Dec 5 13:41:37 2018 (r341556)
@@ -1597,8 +1597,8 @@ int mlx5_query_vport_counter(struct mlx5_core_dev *dev
err = mlx5_cmd_exec(dev, in, in_sz, out, out_size);
- kvfree(in);
ex:
+ kvfree(in);
return err;
}
EXPORT_SYMBOL_GPL(mlx5_query_vport_counter);
More information about the svn-src-head
mailing list