Skip to contentSkip to conversation

ipath - infiniband verbs support

PATCH Roland Dreier 1 participant 1 message Mar 9, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Review

Quoted 8 lines
(quoted diff) +8 -0
+	/*
+	 * 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.

Review

Quoted 11 lines
(quoted diff) +11 -0
+	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.