Commit 25b1bc67 authored by shaharf@voltaire.com's avatar shaharf@voltaire.com Committed by Linus Torvalds

[PATCH] IB: fix vendor MAD deregistration

Fix bug when deregistering a vendor class MAD agent.
Signed-off-by: default avatarRoland Dreier <roland@topspin.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f5482964
......@@ -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 @@ static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
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 @@ static void remove_mad_reg_req(struct ib_mad_agent_private *agent_priv)
}
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 @@ static void remove_mad_reg_req(struct ib_mad_agent_private *agent_priv)
}
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) {
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment