[openib-general] user_mad check question

Hal Rosenstock halr at voltaire.com
Mon Jul 10 10:10:44 PDT 2006


On Fri, 2006-07-07 at 14:30, Sean Hefty wrote:
> The following check in user_mad is done when sending a MAD.
> 
> 	/*
> 	 * If userspace is generating a request that will generate a
> 	 * response, we need to make sure the high-order part of the
> 	 * transaction ID matches the agent being used to send the
> 	 * MAD.
> 	 */
> 	method = ((struct ib_mad_hdr *) packet->msg->mad)->method;
> 
> 	if (!(method & IB_MGMT_METHOD_RESP)       &&
> 	    method != IB_MGMT_METHOD_TRAP_REPRESS &&
> 	    method != IB_MGMT_METHOD_SEND) {
> 		tid = &((struct ib_mad_hdr *) packet->msg->mad)->tid;
> 		*tid = cpu_to_be64(((u64) agent->hi_tid) << 32 |
> 				   (be64_to_cpup(tid) & 0xffffffff));
> 	}
> 
> Does anyone know the reason for the last check (method != SEND)?  

Because there is no required response to a send method.

> Isn't it still a requirement that the TID be unique?

I'm not sure if duplicate detection is based on the TID or some upper
layer protocol but if send is an operation under C13-18.1.1, each
different send is a different TID. Some SENDs have "responses" which are
sent by SEND method and others don't. I'm not sure if the matching is
transaction ID based or not.

-- Hal

> I'm trying to add some validation checks against MADs sent from userspace to
> protect against a client sending non-data RMPP MADs, duplicate MADs, etc., and
> the above check looks incorrect to me.
> 
> - Sean





More information about the general mailing list