iwch_cm: fix possible null pointer
Subsystems (3)
PATCH 1/1 iwch_cm: fix possible null pointer
This patch fixes bugzilla #9583:
https://bugzilla.kernel.org/show_bug.cgi?id=9583
The patch adds NULL check for 'ep->com.cm_id' before derefenrence, since 'ep->com.cm_id' is testing for NULL before. But it depends on the relationship between 'status' and 'ep->com.cm_id'.
Signed-off-by Jinqiu Yang<[email protected]>
--- iwch_cm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/cxgb3/iwch_cm.c +2 -1
@@ -746,7 +746,8 @@ static void connect_reply_upcall(struct ep->com.cm_id->event_handler (ep->com.cm_id, &event); }if (status <0 ) { - ep->com.cm_id->rem_ref (ep->com.cm_id); +if (ep->com.cm_id) + ep->com.cm_id->rem_ref (ep->com.cm_id); ep->com.cm_id =NULL ; ep->com.qp =NULL ; }