[openib-general] user_mad check question

Sean Hefty sean.hefty at intel.com
Fri Jul 7 11:30:56 PDT 2006


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)?  Isn't it still
a requirement that the TID be unique?

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