[openib-general] Re: [PATCH 17 of 20] ipath - infiniband verbs support
Roland Dreier
rdreier at cisco.com
Thu Mar 9 15:44:32 PST 2006
> + /*
> + * We don't need to register a MAD agent, we just need to create
> + * a linker dependency on ib_mad so the module is loaded before
> + * this module is initialized. The call to ib_register_device()
> + * above will then cause ib_mad to create QP 0 & 1.
> + */
> + (void) ib_register_mad_agent(dev, 1, (enum ib_qp_type) 2,
> + NULL, 0, NULL, NULL, NULL);
This looks shady to me. Can this be solved in userspace by just
making sure that modprobe loads ib_mad before this module?
As it stands you're leaking a mad agent at the very least, not to
mention the hard-coded 2 in there.
> + number_of_devices = ipath_layer_get_num_of_dev();
> + i = number_of_devices * sizeof(struct ipath_ibdev *);
> + ipath_devices = kmalloc(i, GFP_ATOMIC);
> + if (ipath_devices == NULL)
> + return -ENOMEM;
> +
> + for (i = 0; i < number_of_devices; i++) {
> + struct ipath_devdata *dd;
> + int ret = ipath_verbs_register(i, ipath_ib_piobufavail,
> + ipath_ib_rcv, ipath_ib_timer,
> + &dd);
What happens if a device is hot plugged or unplugged after you call
ipath_layer_get_num_of_dev() but before you call ipath_verbs_register()?
For that matter, what happens if a device is hot plugged after this
module loads?
- R.
More information about the general
mailing list