summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorShiraz Saleem <shiraz.saleem@intel.com>2016-08-23 01:16:37 +0200
committerDoug Ledford <dledford@redhat.com>2016-08-24 17:21:51 +0200
commit5dfd5e5e3bc68ab3912acc712c8180942094fc69 (patch)
tree259952755056eeba2376710d697a848a387e8dcb /drivers
parentiw_cxgb4: Fix cxgb4 arm CQ logic w/IB_CQ_REPORT_MISSED_EVENTS (diff)
downloadlinux-5dfd5e5e3bc68ab3912acc712c8180942094fc69.tar.xz
linux-5dfd5e5e3bc68ab3912acc712c8180942094fc69.zip
i40iw: Add missing NULL check for MPA private data
Add NULL check for pdata and pdata->addr before the memcpy in i40iw_form_cm_frame(). This fixes a NULL pointer de-reference which occurs when the MPA private data pointer is NULL. Also only copy pdata->size bytes in the memcpy to prevent reading past the length of the private data buffer provided by upper layer. Fixes: f27b4746f378 ("i40iw: add connection management code") Reported-by: Stefan Assmann <sassmann@redhat.com> Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_cm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c
index 5026dc79978a..64343985e0b7 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
@@ -535,8 +535,8 @@ static struct i40iw_puda_buf *i40iw_form_cm_frame(struct i40iw_cm_node *cm_node,
buf += hdr_len;
}
- if (pd_len)
- memcpy(buf, pdata->addr, pd_len);
+ if (pdata && pdata->addr)
+ memcpy(buf, pdata->addr, pdata->size);
atomic_set(&sqbuf->refcount, 1);