svn commit: r341544 - head/sys/dev/mlx4/mlx4_core
Slava Shwartsman
slavash at FreeBSD.org
Wed Dec 5 13:30:17 UTC 2018
Author: slavash
Date: Wed Dec 5 13:30:16 2018
New Revision: 341544
URL: https://svnweb.freebsd.org/changeset/base/341544
Log:
mlx4core: Add checks for invalid port numbers.
Submitted by: hselasky@
Approved by: hselasky (mentor)
MFC after: 1 week
Sponsored by: Mellanox Technologies
Modified:
head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c
Modified: head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c
==============================================================================
--- head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c Wed Dec 5 13:29:46 2018 (r341543)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c Wed Dec 5 13:30:16 2018 (r341544)
@@ -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
More information about the svn-src-head
mailing list