diff options
author | Steve Wise <swise@opengridcomputing.com> | 2014-03-21 11:10:31 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-03-24 13:07:35 -0400 |
commit | 1ce1d471acb7ad8e8b8e3a2972de9fbb5f2be79a (patch) | |
tree | e3a7a0765510a0f85d1bb2d940828110dda1bb5c | |
parent | dbb084cc5f52152f53b5fd22fa76b9bf69904594 (diff) |
RDMA/cxgb4: Fix possible memory leak in RX_PKT processing
If cxgb4_ofld_send() returns < 0, then send_fw_pass_open_req() must
free the request skb and the saved skb with the tcp header.
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/infiniband/hw/cxgb4/cm.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index e1fc5c5445c9..773d010a249c 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -3204,6 +3204,7 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb, | |||
3204 | struct sk_buff *req_skb; | 3204 | struct sk_buff *req_skb; |
3205 | struct fw_ofld_connection_wr *req; | 3205 | struct fw_ofld_connection_wr *req; |
3206 | struct cpl_pass_accept_req *cpl = cplhdr(skb); | 3206 | struct cpl_pass_accept_req *cpl = cplhdr(skb); |
3207 | int ret; | ||
3207 | 3208 | ||
3208 | req_skb = alloc_skb(sizeof(struct fw_ofld_connection_wr), GFP_KERNEL); | 3209 | req_skb = alloc_skb(sizeof(struct fw_ofld_connection_wr), GFP_KERNEL); |
3209 | req = (struct fw_ofld_connection_wr *)__skb_put(req_skb, sizeof(*req)); | 3210 | req = (struct fw_ofld_connection_wr *)__skb_put(req_skb, sizeof(*req)); |
@@ -3240,7 +3241,13 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb, | |||
3240 | req->cookie = (unsigned long)skb; | 3241 | req->cookie = (unsigned long)skb; |
3241 | 3242 | ||
3242 | set_wr_txq(req_skb, CPL_PRIORITY_CONTROL, port_id); | 3243 | set_wr_txq(req_skb, CPL_PRIORITY_CONTROL, port_id); |
3243 | cxgb4_ofld_send(dev->rdev.lldi.ports[0], req_skb); | 3244 | ret = cxgb4_ofld_send(dev->rdev.lldi.ports[0], req_skb); |
3245 | if (ret < 0) { | ||
3246 | pr_err("%s - cxgb4_ofld_send error %d - dropping\n", __func__, | ||
3247 | ret); | ||
3248 | kfree_skb(skb); | ||
3249 | kfree_skb(req_skb); | ||
3250 | } | ||
3244 | } | 3251 | } |
3245 | 3252 | ||
3246 | /* | 3253 | /* |