[openib-general] Re: ib_uat kernel panic without async callback

Hal Rosenstock halr at voltaire.com
Mon Jul 18 07:07:44 PDT 2005


Hi Arlin,

On Fri, 2005-07-15 at 13:04, Arlin Davis wrote:
> Your implementation is fine, as long as the correct return values are used
> and the sync version works. I currently get returned a 1 but the ib_route
> data is not filled in and the req_id == 0. I would expect a 0 returned 
> and a
> valid req_id if the ib_route cannot be processed.
> 
> for ret = ib_at_route_by_ip( async_cb provided ), I read this as: 
> 
>   if ret > 0  then ib_route output data is written, resolve complete
>   if ret == 0 then req_id is written with valid id to cancel or poll
>   if ret < 0 error
> 
> Am I reading this right?

Try this patch and let me know if this works for you.

Thanks.

-- Hal

Index: uat.c
===================================================================
--- uat.c	(revision 2849)
+++ uat.c	(working copy)
@@ -271,9 +271,15 @@ static ssize_t ib_uat_route_by_ip(struct
 			goto err4;
 		}
 	}
-	if (result == 1) 
+	if (result == 1) { 
+		/* Copy route back to userspace */
+		if (copy_to_user(ctx->user_ib_route, ctx->ib_route,
+				 sizeof(*ctx->user_ib_route))) {
+			result = -EFAULT;
+			goto err3;
+		}
 		ib_uat_route_callback(ctx->req_id, ctx, result);
-	else if (result < 0) {
+	} else if (result < 0) {
 		ib_uat_ctx_put(ctx);
 		goto err3;
 	}
@@ -363,9 +369,15 @@ static ssize_t ib_uat_paths_by_route(str
 			goto err4;
 		}
 	}
-	if (result == 1)
+	if (result == 1) {
+		/* Copy path records returned from SA to userspace */
+		if (copy_to_user(ctx->user_path_arr, ctx->path_arr,
+				 ctx->user_length)) {
+			result = -EFAULT;
+			goto err3;
+		}
 		ib_uat_path_callback(ctx->req_id, ctx, result);
-	else if (result < 0) {
+	} else if (result < 0) {
 		ib_uat_ctx_put(ctx);
 		goto err3;
 	}
@@ -453,9 +465,14 @@ static ssize_t ib_uat_ips_by_gid(struct 
 			goto err4;
 		}
 	}
-	if (result == 1)
+	if (result == 1) {
+		/* Copy IP addresses back to userspace */
+		if (copy_to_user(ctx->user_ips, ctx->ips, ctx->user_length)) {
+			result = -EFAULT;
+			goto err3;
+		}
 		ib_uat_ips_callback(ctx->req_id, ctx, result);
-	else if (result < 0) {
+	} else if (result < 0) {
 		ib_uat_ctx_put(ctx);
 		goto err3;
 	}








More information about the general mailing list