Patch 2.4.18-pre9-SERIAL:Address in use error, mem based cards

Patch 2.4.18-pre9-SERIAL:Address in use error, mem based cards

Post by Roman Kuraki » Tue, 12 Feb 2002 18:10:09



Hi,

  I have found a bug. It is in support of serial cards which uses memory
for I/O
insted of ports. I made a patch for serial.c and fix one place, but
probably the
problem like this one could be somewhere else.

Description:
  If you try to use setserial with such cards you will get "Address in
use" (-EADDRINUSE)

Best regards,
                      Kurakin Roman

[ serial-2.4.18.pch < 1K ]
--- serial.c.orig       Mon Feb 11 11:54:21 2002

        unsigned int            i,change_irq,change_port;
        int                     retval = 0;
        unsigned long           new_port;
+       unsigned long           new_mem;

        if (copy_from_user(&new_serial,new_info,sizeof(new_serial)))

        if (HIGH_BITS_OFFSET)
                new_port += (unsigned long) new_serial.port_high << HIGH_BITS_OFFSET;

+       new_mem = new_serial.iomem_base;
+
        change_irq = new_serial.irq != state->irq;
        change_port = (new_port != ((int) state->port)) ||

                for (i = 0 ; i < NR_PORTS; i++)
                        if ((state != &rs_table[i]) &&
                            (rs_table[i].port == new_port) &&
+                           (rs_table[i].iomem_base == new_mem) &&
                            rs_table[i].type)
                                return -EADDRINUSE;
        }