public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: "Bryan O'Sullivan" <bos@pathscale.com>
Cc: rolandd@cisco.com, gregkh@suse.de, akpm@osdl.org,
	davem@davemloft.net, linux-kernel@vger.kernel.org,
	openib-general@openib.org
Subject: Re: [PATCH 17 of 20] ipath - infiniband verbs support
Date: Thu, 09 Mar 2006 15:44:32 -0800	[thread overview]
Message-ID: <adar75bdvz3.fsf@cisco.com> (raw)
In-Reply-To: <0bb312984cbad507f1bd.1141922830@localhost.localdomain> (Bryan O'Sullivan's message of "Thu,  9 Mar 2006 08:47:10 -0800")

 > +	/*
 > +	 * 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.

       reply	other threads:[~2006-03-09 23:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0bb312984cbad507f1bd.1141922830@localhost.localdomain>
2006-03-09 23:44 ` Roland Dreier [this message]
2006-03-10  0:35 [PATCH 0 of 20] [RFC] ipath driver - another round for review Bryan O'Sullivan
2006-03-10  0:35 ` [PATCH 17 of 20] ipath - infiniband verbs support Bryan O'Sullivan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adar75bdvz3.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=akpm@osdl.org \
    --cc=bos@pathscale.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openib-general@openib.org \
    --cc=rolandd@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox