提交 33ba0fa9 编写于 作者: K Krishna Kumar 提交者: Roland Dreier

RDMA/iwcm: Fix memory corruption bug in cm_work_handler()

Possible memory corruption scenario: after putting the work entry back
on the work_free_list, we call process_event() which dereferences
work->event, which could have been modified to another value
meanwhile.
Signed-off-by: NKrishna Kumar <krkumar2@in.ibm.com>
Acked-by: NSteve Wise <swise@opengridcomputing.com>
Signed-off-by: NRoland Dreier <rolandd@cisco.com>
上级 e54f8188
......@@ -829,7 +829,8 @@ static int process_event(struct iwcm_id_private *cm_id_priv,
*/
static void cm_work_handler(void *arg)
{
struct iwcm_work *work = arg, lwork;
struct iwcm_work *work = arg;
struct iw_cm_event levent;
struct iwcm_id_private *cm_id_priv = work->cm_id;
unsigned long flags;
int empty;
......@@ -842,11 +843,11 @@ static void cm_work_handler(void *arg)
struct iwcm_work, list);
list_del_init(&work->list);
empty = list_empty(&cm_id_priv->work_list);
lwork = *work;
levent = work->event;
put_work(work);
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
ret = process_event(cm_id_priv, &work->event);
ret = process_event(cm_id_priv, &levent);
if (ret) {
set_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags);
destroy_cm_id(&cm_id_priv->id);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册