[openib-general] mad: Validate *bad_send_wr in ib_post_send_mad()
Hal Rosenstock
halr at voltaire.com
Mon Nov 1 18:52:53 PST 2004
mad: Validate *bad_send_wr in ib_post_send_mad()
Fix previous patch
Index: mad.c
===================================================================
--- mad.c (revision 1110)
+++ mad.c (working copy)
@@ -369,16 +369,15 @@
struct ib_mad_port_private *port_priv;
/* Validate supplied parameters */
- if (!mad_agent || !send_wr || !*bad_send_wr) {
- *bad_send_wr = send_wr;
- return -EINVAL;
- }
+ if (!*bad_send_wr)
+ goto error1;
+ if (!mad_agent || !send_wr )
+ goto error2;
+
if (!mad_agent->send_handler ||
- (send_wr->wr.ud.timeout_ms && !mad_agent->recv_handler)) {
- *bad_send_wr = send_wr;
- return -EINVAL;
- }
+ (send_wr->wr.ud.timeout_ms && !mad_agent->recv_handler))
+ goto error2;
mad_agent_priv = container_of(mad_agent, struct ib_mad_agent_private,
agent);
@@ -439,6 +438,11 @@
}
return 0;
+
+error2:
+ *bad_send_wr = send_wr;
+error1:
+ return -EINVAL;
}
EXPORT_SYMBOL(ib_post_send_mad);
More information about the general
mailing list