[openib-general] [PATCH] user_mad: fix error handling

Michael S. Tsirkin mst at mellanox.co.il
Sun Nov 6 05:31:47 PST 2005


Fix off-by-one bug in error handling in ib_umad_add_one:
we are storing port pointer in port[i - s], so we should use that
for ib_umad_kill_port.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: linux-kernel/drivers/infiniband/core/user_mad.c
===================================================================
--- linux-kernel/drivers/infiniband/core/user_mad.c	(revision 3956)
+++ linux-kernel/drivers/infiniband/core/user_mad.c	(working copy)
@@ -913,7 +913,7 @@ static void ib_umad_add_one(struct ib_de
 
 err:
 	while (--i >= s)
-		ib_umad_kill_port(&umad_dev->port[i]);
+		ib_umad_kill_port(&umad_dev->port[i - s]);
 
 	kref_put(&umad_dev->ref, ib_umad_release_dev);
 }

-- 
MST



More information about the general mailing list