From: Roland Dreier <roland@topspin.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: [PATCH][2/11] IB: fix vendor MAD deregistration
Date: Wed, 2 Mar 2005 21:31:22 -0800 [thread overview]
Message-ID: <2005322131.5pgryiWlkZPYdcE7@topspin.com> (raw)
In-Reply-To: <2005322131.pkxanHLh4SQ8X31k@topspin.com>
From: Shahar Frank <shaharf@voltaire.com>
Fix bug when deregistering a vendor class MAD agent.
Signed-off-by: Roland Dreier <roland@topspin.com>
--- linux-export.orig/drivers/infiniband/core/mad.c 2005-03-02 20:26:03.185796628 -0800
+++ linux-export/drivers/infiniband/core/mad.c 2005-03-02 20:26:10.980104746 -0800
@@ -41,7 +41,6 @@
#include "smi.h"
#include "agent.h"
-
MODULE_LICENSE("Dual BSD/GPL");
MODULE_DESCRIPTION("kernel IB MAD API");
MODULE_AUTHOR("Hal Rosenstock");
@@ -490,6 +489,7 @@
cancel_mads(mad_agent_priv);
port_priv = mad_agent_priv->qp_info->port_priv;
+
cancel_delayed_work(&mad_agent_priv->timed_work);
flush_workqueue(port_priv->wq);
@@ -1266,12 +1266,12 @@
}
port_priv = agent_priv->qp_info->port_priv;
+ mgmt_class = convert_mgmt_class(agent_priv->reg_req->mgmt_class);
class = port_priv->version[
agent_priv->reg_req->mgmt_class_version].class;
if (!class)
goto vendor_check;
- mgmt_class = convert_mgmt_class(agent_priv->reg_req->mgmt_class);
method = class->method_table[mgmt_class];
if (method) {
/* Remove any methods for this mad agent */
@@ -1293,16 +1293,21 @@
}
vendor_check:
+ if (!is_vendor_class(mgmt_class))
+ goto out;
+
+ /* normalize mgmt_class to vendor range 2 */
+ mgmt_class = vendor_class_index(agent_priv->reg_req->mgmt_class);
vendor = port_priv->version[
agent_priv->reg_req->mgmt_class_version].vendor;
+
if (!vendor)
goto out;
- mgmt_class = vendor_class_index(agent_priv->reg_req->mgmt_class);
vendor_class = vendor->vendor_class[mgmt_class];
if (vendor_class) {
index = find_vendor_oui(vendor_class, agent_priv->reg_req->oui);
- if (index == -1)
+ if (index < 0)
goto out;
method = vendor_class->method_table[index];
if (method) {
--- linux-export.orig/drivers/infiniband/core/mad_priv.h 2005-03-02 20:26:03.185796628 -0800
+++ linux-export/drivers/infiniband/core/mad_priv.h 2005-03-02 20:26:10.980104746 -0800
@@ -58,8 +58,8 @@
#define MAX_MGMT_CLASS 80
#define MAX_MGMT_VERSION 8
#define MAX_MGMT_OUI 8
-#define MAX_MGMT_VENDOR_RANGE2 IB_MGMT_CLASS_VENDOR_RANGE2_END - \
- IB_MGMT_CLASS_VENDOR_RANGE2_START + 1
+#define MAX_MGMT_VENDOR_RANGE2 (IB_MGMT_CLASS_VENDOR_RANGE2_END - \
+ IB_MGMT_CLASS_VENDOR_RANGE2_START + 1)
struct ib_mad_list_head {
struct list_head list;
next prev parent reply other threads:[~2005-03-03 5:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-03 5:31 [PATCH][0/11] InfiniBand fixes Roland Dreier
2005-03-03 5:31 ` [PATCH][1/11] IB: simplify MAD code Roland Dreier
2005-03-03 5:31 ` Roland Dreier [this message]
2005-03-03 5:31 ` [PATCH][3/11] IB: sparse fixes Roland Dreier
2005-03-03 5:31 ` [PATCH][4/11] IB/mthca: add missing break Roland Dreier
2005-03-03 5:31 ` [PATCH][5/11] IB/mthca: fix reset value endianness Roland Dreier
2005-03-03 5:31 ` [PATCH][6/11] IB/ipoib: fix rx memory leak Roland Dreier
2005-03-03 5:31 ` [PATCH][7/11] IB/ipoib: use list_for_each_entry_safe when required Roland Dreier
2005-03-03 5:31 ` [PATCH][8/11] IB/ipoib: rename global symbols Roland Dreier
2005-03-03 5:31 ` [PATCH][9/11] IB/ipoib: small fixes Roland Dreier
2005-03-03 5:31 ` [PATCH][10/11] IB/ipoib: don't call ipoib_put_ah with lock held Roland Dreier
2005-03-03 5:31 ` [PATCH][11/11] IB/ipoib: fix locking on path deletion Roland Dreier
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=2005322131.5pgryiWlkZPYdcE7@topspin.com \
--to=roland@topspin.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=openib-general@openib.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.