[openib-general] Re: [openib-commits] r2629 - in gen2/branches/shaharf-ibat/src/linux-kernel/infiniband: core include

Hal Rosenstock halr at voltaire.com
Mon Jun 27 05:55:12 PDT 2005


On Mon, 2005-06-27 at 07:01, Bernhard Fischer wrote:
> Hal,
> 
> On Wed, Jun 15, 2005 at 12:27:18PM -0700, halr at openib.org wrote:
> 
> >Support callback for route by ip
> 
> >Modified: gen2/branches/shaharf-ibat/src/linux-kernel/infiniband/core/uat.c
> >===================================================================
> >--- gen2/branches/shaharf-ibat/src/linux-kernel/infiniband/core/uat.c	2005-06-15 18:22:01 UTC (rev 2628)
> >+++ gen2/branches/shaharf-ibat/src/linux-kernel/infiniband/core/uat.c	2005-06-15 19:27:17 UTC (rev 2629)
> 
> >@@ -414,13 +495,30 @@
> > 			printk(KERN_ERR "ib_uat_event: uevent %p ctx %p status %d not completed\n", uevent, uevent->ctx, uevent->ctx->status);
> > 			uevent->ctx->rec_num = -EIO;
> > 		}
> >-		/* Copy path records returned from SA back to userspace */
> >-		if (copy_to_user(uevent->ctx->user_path_arr,
> >-				 uevent->ctx->path_arr,
> >-				 uevent->ctx->user_length))
> >-			uevent->ctx->status = IB_USER_AT_STATUS_ERROR;
> >-		kfree(uevent->ctx->path_arr);
> >-		uevent->ctx->path_arr = NULL;
> >+		switch (uevent->type) {
> >+		case IB_UAT_PATH_EVENT:
> >+			/* Copy path records returned from SA to userspace */
> >+			if (copy_to_user(uevent->ctx->user_path_arr,
> >+					 uevent->ctx->path_arr,
> >+					 uevent->ctx->user_length))
> Should { result be set to FAULT here
> >+				uevent->ctx->status = IB_USER_AT_STATUS_ERROR;
> }
> >+			kfree(uevent->ctx->path_arr);
> >+			uevent->ctx->path_arr = NULL;
> 
> 
> 
> >+			break;
> >+		case IB_UAT_ROUTE_EVENT:
> >+			if (copy_to_user(uevent->ctx->user_ib_route,
> >+					 uevent->ctx->ib_route,
> >+					 sizeof(*uevent->ctx->user_ib_route)))
> 
> .. and here {
> >+				uevent->ctx->status = IB_USER_AT_STATUS_ERROR;
> }
> >+			kfree(uevent->ctx->ib_route);
> >+			uevent->ctx->ib_route = NULL;
> 
> 
> 
> >+			break;
> >+		case IB_UAT_ATS_EVENT:
> >+		default:
> >+			printk(KERN_ERR "ib_uat_event: type %d not handled\n",
> >+			       uevent->type);
> >+			break;
> >+		}
> > 		uevent->resp.callback = (u64)(unsigned long)uevent->ctx->user_callback;
> > 		uevent->resp.context = (u64)(unsigned long)uevent->ctx->user_context;
> > 		uevent->resp.req_id = uevent->ctx->req_id;
> >
> .. and take result into account before putting the response back to the
> user or is setting the status like you did above enough?

I just changed this to deal with this error as you suggested.

-- Hal




More information about the general mailing list