[ofw] RE: [PATCH] IBAL - fix ual_get_gid_index()

Leonid Keller leonid at mellanox.co.il
Mon Sep 1 07:57:13 PDT 2008


Done in rev.1549, thank you.


________________________________

	From: Reuven Amitai 
	Sent: Sunday, August 31, 2008 5:39 PM
	To: Leonid Keller
	Cc: ofw at lists.openfabrics.org
	Subject: [PATCH] IBAL - fix ual_get_gid_index()
	
	
	Hi Leonid,

	The patch fix accessing p_user_attr field which lead to access
violation, the actual field is p_pnp_attr.
	It also moves port checking to the head of the function stack.
	 
	Thanks, Reuven.
	 
	>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	Index: core/al/al_av.c
	
===================================================================
	--- core/al/al_av.c (revision 1534)
	+++ core/al/al_av.c (working copy)
	@@ -112,7 +112,23 @@
	 }
	 
	 
	+static ib_api_status_t
	+__check_av_port(
	+ IN  const al_ci_ca_t* const   p_ci_ca,
	+ IN  const ib_av_attr_t* const   p_av_attr )
	+{
	+ ib_api_status_t status = IB_SUCCESS;
	 
	+ if (p_av_attr->port_num == 0 || p_av_attr->port_num >
p_ci_ca->num_ports)
	+ {
	+  AL_PRINT(TRACE_LEVEL_WARNING ,AL_DBG_AV,
	+   ("invalid port number specified (%d)\n",
p_av_attr->port_num) );
	+  status = IB_INVALID_PORT;
	+ }
	+ return status;
	+}
	+
	+
	 ib_api_status_t
	 create_av(
	  IN  const ib_pd_handle_t    h_pd,
	@@ -137,6 +153,13 @@
	   return IB_INVALID_PD_HANDLE;
	  }
	 
	+ status = __check_av_port(h_pd->obj.p_ci_ca, p_av_attr);
	+ if( status != IB_SUCCESS )
	+ {
	+  AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
("IB_INVALID_PORT\n") );
	+  return status;
	+ }
	+ 
	  /* Get an AV tracking structure. */
	  h_av = alloc_av();
	  if( !h_av )
	@@ -302,6 +325,13 @@
	   return IB_INVALID_PARAMETER;
	  }
	 
	+ status = __check_av_port(h_av->obj.p_ci_ca, p_av_mod);
	+ if( status != IB_SUCCESS )
	+ {
	+  AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
("IB_INVALID_PORT\n") );
	+  return status;
	+ }
	+
	  status = verbs_modify_av(h_av, p_av_mod);
	 
	  /* Record av for special qp access */
	Index: core/al/user/ual_av.c
	
===================================================================
	--- core/al/user/ual_av.c (revision 1534)
	+++ core/al/user/ual_av.c (working copy)
	@@ -58,17 +58,7 @@
	  uint16_t   i;
	 
	  ci_ca_lock_attr( p_ci_ca );
	-
	- // sanity check
	- if (port_num == 0 || port_num >
p_ci_ca->p_user_attr->num_ports)
	- {
	-  AL_PRINT(TRACE_LEVEL_WARNING ,AL_DBG_AV,
	-   ("UAL_GET_GID_INDEX: invalid port number specified (%d)\n",
port_num) );
	-  status = IB_INVALID_PORT;
	-  goto out;
	- }
	-
	- p_port_attr = &p_ci_ca->p_user_attr->p_port_attr[port_num];
	+ p_port_attr = &p_ci_ca->p_pnp_attr->p_port_attr[port_num];
	  for( i = 0; i < p_port_attr->num_gids; i++ )
	  {
	   if( !cl_memcmp(p_gid, &p_port_attr->p_gid_table[i],
sizeof(ib_gid_t)) )
	@@ -78,8 +68,6 @@
	    break;
	   }
	  }
	-
	-out:
	  ci_ca_unlock_attr( p_ci_ca );
	 
	  return status;
	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080901/46a8278c/attachment.html>


More information about the ofw mailing list