user_mad.c: Only allow ib_umad_open to succeed on IB node types
Signed-off-by: Hal Rosenstock <[EMAIL PROTECTED]>
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);
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general
To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general