[openib-general] [PATCH] user_mad.c: Only allow ib_umad_open to succeed on IB node types

Hal Rosenstock halr at voltaire.com
Fri Nov 4 12:43:07 PST 2005


user_mad.c: Only allow ib_umad_open to succeed on IB node types

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: user_mad.c
===================================================================
--- user_mad.c  (revision 3968)
+++ user_mad.c  (working copy)
@@ -595,6 +595,12 @@ static int ib_umad_open(struct inode *in
                goto out;
        }
 
+       if (port->ib_dev->node_type < IB_NODE_CA ||
+           port->ib_dev->node_type > IB_NODE_ROUTER) {
+               ret = -ENODEV;
+               goto out;
+       }
+
        file = kzalloc(sizeof *file, GFP_KERNEL);
        if (!file) {
                kref_put(&port->umad_dev->ref, ib_umad_release_dev);





More information about the general mailing list