Commit 5dfd5e5e authored by Shiraz Saleem's avatar Shiraz Saleem Committed by Doug Ledford

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: f27b4746 ("i40iw: add connection management code")
Reported-by: default avatarStefan Assmann <sassmann@redhat.com>
Signed-off-by: default avatarMustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: default avatarShiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent cff069b7
...@@ -535,8 +535,8 @@ static struct i40iw_puda_buf *i40iw_form_cm_frame(struct i40iw_cm_node *cm_node, ...@@ -535,8 +535,8 @@ static struct i40iw_puda_buf *i40iw_form_cm_frame(struct i40iw_cm_node *cm_node,
buf += hdr_len; buf += hdr_len;
} }
if (pd_len) if (pdata && pdata->addr)
memcpy(buf, pdata->addr, pd_len); memcpy(buf, pdata->addr, pdata->size);
atomic_set(&sqbuf->refcount, 1); atomic_set(&sqbuf->refcount, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment