From 4d7a814a9e4f6c7c355c062d3a4ab990da3d5c39 Mon Sep 17 00:00:00 2001 From: Hal Rosenstock Date: Fri, 3 Aug 2007 10:45:17 -0700 Subject: [PATCH] --- yaml --- r: 64091 b: refs/heads/master c: 445d68070c9c02acdda38e6d69bd43096f521035 h: refs/heads/master i: 64089: a10088235241f740b036eb2077a1387eace02829 64087: c2a4cb8396cd7d4bb3110df83fdd245fd4564923 v: v3 --- [refs] | 2 +- trunk/drivers/infiniband/core/mad.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index d4d8b3a5d15f..6c009390f07b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5399891052badf97948098d01772113801f6ef58 +refs/heads/master: 445d68070c9c02acdda38e6d69bd43096f521035 diff --git a/trunk/drivers/infiniband/core/mad.c b/trunk/drivers/infiniband/core/mad.c index bc547f1d34ba..969785762052 100644 --- a/trunk/drivers/infiniband/core/mad.c +++ b/trunk/drivers/infiniband/core/mad.c @@ -1842,16 +1842,11 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, { struct ib_mad_qp_info *qp_info; struct ib_mad_private_header *mad_priv_hdr; - struct ib_mad_private *recv, *response; + struct ib_mad_private *recv, *response = NULL; struct ib_mad_list_head *mad_list; struct ib_mad_agent_private *mad_agent; int port_num; - response = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL); - if (!response) - printk(KERN_ERR PFX "ib_mad_recv_done_handler no memory " - "for response buffer\n"); - mad_list = (struct ib_mad_list_head *)(unsigned long)wc->wr_id; qp_info = mad_list->mad_queue->qp_info; dequeue_mad(mad_list); @@ -1879,6 +1874,13 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, if (!validate_mad(&recv->mad.mad, qp_info->qp->qp_num)) goto out; + response = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL); + if (!response) { + printk(KERN_ERR PFX "ib_mad_recv_done_handler no memory " + "for response buffer\n"); + goto out; + } + if (port_priv->device->node_type == RDMA_NODE_IB_SWITCH) port_num = wc->port_num; else