Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Dec 2018 11:42:21 +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: r341902 - stable/12/sys/dev/mlx4/mlx4_core
Message-ID:  <201812121142.wBCBgL1Q057302@repo.freebsd.org>

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

Log:
  MFC r341544:
  mlx4core: Add checks for invalid port numbers.
  
  Sponsored by:   Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx4/mlx4_core/mlx4_cmd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx4/mlx4_core/mlx4_cmd.c
==============================================================================
--- stable/12/sys/dev/mlx4/mlx4_core/mlx4_cmd.c	Wed Dec 12 11:41:33 2018	(r341901)
+++ stable/12/sys/dev/mlx4/mlx4_core/mlx4_cmd.c	Wed Dec 12 11:42:21 2018	(r341902)
@@ -961,6 +961,8 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, 
 				if (!err && slave != mlx4_master_func_num(dev)) {
 					u8 *state = outsmp->data + PORT_STATE_OFFSET;
 
+					if (port < 1 || port > dev->caps.num_ports)
+						return -EINVAL;
 					*state = (*state & 0xf0) | vf_port_state(dev, port, slave);
 					slave_cap_mask = priv->mfunc.master.slave_state[slave].ib_cap_mask[port];
 					memcpy(outsmp->data + PORT_CAPABILITY_LOCATION_IN_SMP, &slave_cap_mask, 4);
@@ -968,8 +970,12 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, 
 				return err;
 			}
 			if (smp->attr_id == IB_SMP_ATTR_GUID_INFO) {
-				__be64 guid = mlx4_get_admin_guid(dev, slave,
-								  port);
+				__be64 guid;
+
+				if (port < 1 || port > dev->caps.num_ports)
+					return -EINVAL;
+
+				guid = mlx4_get_admin_guid(dev, slave, port);
 
 				/* set the PF admin guid to the FW/HW burned
 				 * GUID, if it wasn't yet set



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