Re: linux-kernel-digest V1 #505

Brett Thomas (quark@darwin.baz.com)
Sun, 22 Sep 1996 14:08:18 -0400


Linus & Co.:

Enclosed is a little patch to the eql code (eql.c) which should go
into 2.0, if possible. The basic problem is that calling
ioctl(...,EQL_ENSLAVE...) without previously running ifconfig on the
master device causes an oops.

This patch (which has been reviewed & approved by Simon Janes, the eql
maintainer) simply inserts a check to make sure the master device is
up and running prior to executing the enslave logic.

This isn't a big problem (I don't think there are too many people
using eql at this time), but, as a bug fix, it probably belongs in the
next 2.0 release, if possible.

I've tested this on my machine, and it works fine - if anyone else who
uses eql wants to try it, that'd be fine, too.

Also, for any users of eql out there: Simon Janes is putting up an
eql page (and mailing list) at http://www.abies.com. I'm also copying
this patch there and would encourage any eql users to test it.

Regards,

Brett A. Thomas
quark@baz.com

====
--- eql.c Mon May 6 05:26:08 1996
+++ ../../../linux-2.0.21-devel/drivers/net/eql.c Sun Sep 22 13:53:07 1996
@@ -17,7 +17,7 @@
*/

static const char *version =
- "Equalizer1996: $Revision: 1.2 $ $Date: 1996/04/11 17:51:52 $ Simon Janes (simon@ncm.com)\n";
+ "Equalizer1996: $Revision: 1.2.1 $ $Date: 1996/09/22 13:52:00 $ Simon Janes (simon@ncm.com)\n";

/*
* Sources:
@@ -459,28 +459,35 @@

if (master_dev != 0 && slave_dev != 0)
{
- if (! eql_is_master (slave_dev) && /* slave is not a master */
- ! eql_is_slave (slave_dev) ) /* slave is not already a slave */
- {
- slave_t *s = eql_new_slave ();
- equalizer_t *eql = (equalizer_t *) master_dev->priv;
- s->dev = slave_dev;
- s->priority = srq.priority;
- s->priority_bps = srq.priority;
- s->priority_Bps = srq.priority / 8;
- slave_dev->flags |= IFF_SLAVE;
- eql_insert_slave (eql->queue, s);
- return 0;
+ if ((master_dev->flags & IFF_UP) == IFF_UP)
+ {
+ /*slave is not a master & not already a slave:*/
+ if (! eql_is_master (slave_dev) &&
+ ! eql_is_slave (slave_dev) )
+ {
+ slave_t *s = eql_new_slave ();
+ equalizer_t *eql =
+ (equalizer_t *) master_dev->priv;
+ s->dev = slave_dev;
+ s->priority = srq.priority;
+ s->priority_bps = srq.priority;
+ s->priority_Bps = srq.priority / 8;
+ slave_dev->flags |= IFF_SLAVE;
+ eql_insert_slave (eql->queue, s);
+ return 0;
+ }
+#ifdef EQL_DEBUG
+ else if (eql_debug >= 20)
+ printk ("EQL enslave: slave is master or slave is already slave\n");
+#endif
}
#ifdef EQL_DEBUG
- if (eql_debug >= 20)
- printk ("EQL enslave: slave is master or slave is already slave\n");
+ else if (eql_debug >= 20)
+ printk ("EQL enslave: master device not up!\n");
#endif
-
- return -EINVAL;
}
#ifdef EQL_DEBUG
- if (eql_debug >= 20)
+ else if (eql_debug >= 20)
printk ("EQL enslave: master or slave are NULL");
#endif
return -EINVAL;