[PATCH] librdmacm: Avoid crash if rdma_disconnect() is called incorrectly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the cm_id is not connected, id->verbs will be NULL. Check the
pointer before dereferencing it.

Signed-off-by: Andrew Boyer <andrew.boyer@xxxxxxxx>
---
 librdmacm/cma.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/librdmacm/cma.c b/librdmacm/cma.c
index fa37065..2b36e89 100644
--- a/librdmacm/cma.c
+++ b/librdmacm/cma.c
@@ -1684,6 +1684,9 @@ int rdma_notify(struct rdma_cm_id *id, enum ibv_event_type event)
 
 int ucma_shutdown(struct rdma_cm_id *id)
 {
+	if (!id->verbs || !id->verbs->device)
+		return ERR(EINVAL);
+
 	switch (id->verbs->device->transport_type) {
 	case IBV_TRANSPORT_IB:
 		return ucma_modify_qp_err(id);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux