DigiBoard driver bugs (PATCH)

Martin Mares (mj@k332.feld.cvut.cz)
Sat, 20 Jul 1996 23:25:31 +0200 (MET DST)


Hi,

I've played with the DigiBoard PC/X driver in recent kernels and found two
serious bugs:

(1) The pcxe_table is never cleared after it's allocated although it should
be. This causes random crashes when trying to open the device. It's possible
some of the other allocations should be cleared, too.

(2) CLOCAL is ignored -- termios2digi_c shouldn't discard it.

The following patch should fix these problems, but the maintainer should take
a look on it before including it to the kernel as I didn't have enough time
to examine the driver closer.

Martin

--- pcxx.c.old Sat Jul 20 23:22:18 1996
+++ pcxx.c Sat Jul 20 23:24:16 1996
@@ -30,6 +30,7 @@
* variable handling, instead of using the old pcxxconfig.h
* 1.5.6 April 16, 1996 Christoph Lameter: Pointer cleanup, macro cleanup.
* Call out devices changed to /dev/cudxx.
+ * 1.5.7 July 20, 1996 Martin Mares: CLOCAL fix, pcxe_table clearing.
*
*/

@@ -66,8 +67,8 @@
#include <asm/segment.h>
#include <asm/bitops.h>

-#define VERSION "1.5.6"
-static char *banner = "Digiboard PC/X{i,e,eve} driver v1.5.6. Christoph Lameter <clameter@fuller.edu>.";
+#define VERSION "1.5.7"
+static char *banner = "Digiboard PC/X{i,e,eve} driver v1.5.7. Christoph Lameter <clameter@fuller.edu>.";

/*#define DEFAULT_HW_FLOW 1 */
/*#define DEBUG_IOCTL */
@@ -998,6 +999,7 @@
pcxe_table = kmalloc(sizeof(struct tty_struct *) * nbdevs, GFP_KERNEL);
if (!pcxe_table)
panic("Unable to allocate pcxe_table struct");
+ memset(pcxe_table, 0, sizeof(struct tty_struct *) * nbdevs);

pcxe_termios = kmalloc(sizeof(struct termios *) * nbdevs, GFP_KERNEL);
if (!pcxe_termios)
@@ -1610,7 +1612,7 @@
if (cflag & B115200) res|=1;
}
else ch->digiext.digi_flags &= ~DIGI_FAST;
- res |= cflag & (CBAUD | PARODD | PARENB | CSTOPB | CSIZE);
+ res |= cflag & (CBAUD | PARODD | PARENB | CSTOPB | CSIZE | CLOCAL);
return res;
}