Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Dec 2018 12:06:20 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r341925 - stable/12/sys/dev/mlx5/mlx5_core
Message-ID:  <201812121206.wBCC6KSR069368@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Dec 12 12:06:20 2018
New Revision: 341925
URL: https://svnweb.freebsd.org/changeset/base/341925

Log:
  MFC r341556:
  mlx5: Fix for potential memory leaks.
  
  Make sure allocated data gets freed in error cases.
  
  Sponsored by:   Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_vport.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c	Wed Dec 12 12:04:56 2018	(r341924)
+++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c	Wed Dec 12 12:06:20 2018	(r341925)
@@ -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: stable/12/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c	Wed Dec 12 12:04:56 2018	(r341924)
+++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c	Wed Dec 12 12:06:20 2018	(r341925)
@@ -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: stable/12/sys/dev/mlx5/mlx5_core/mlx5_vport.c
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_core/mlx5_vport.c	Wed Dec 12 12:04:56 2018	(r341924)
+++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_vport.c	Wed Dec 12 12:06:20 2018	(r341925)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812121206.wBCC6KSR069368>