From: Hal Rosenstock Date: Fri, 3 Aug 2007 17:45:17 +0000 (-0700) Subject: IB/mad: Fix memory leak in switch handling in ib_mad_recv_done_handler() X-Git-Tag: upstream/snapshot3+hdmi~31455^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86dfbecdea733a6e940b958e94a85af45b89a0b9;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git IB/mad: Fix memory leak in switch handling in ib_mad_recv_done_handler() If agent_send_response() returns an error, we shouldn't do anything differently than if it succeeds; setting response to NULL just means that the response buffer gets leaked. Signed-off-by: Suresh Shelvapille Signed-off-by: Hal Rosenstock Signed-off-by: Roland Dreier --- diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 9697857..6f42877 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -1916,12 +1916,11 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, response->header.recv_wc.recv_buf.mad = &response->mad.mad; response->header.recv_wc.recv_buf.grh = &response->grh; - if (!agent_send_response(&response->mad.mad, - &response->grh, wc, - port_priv->device, - smi_get_fwd_port(&recv->mad.smp), - qp_info->qp->qp_num)) - response = NULL; + agent_send_response(&response->mad.mad, + &response->grh, wc, + port_priv->device, + smi_get_fwd_port(&recv->mad.smp), + qp_info->qp->qp_num); goto out; }