Skip to contentSkip to conversation

possible bug in net/tc35815.c in linux-2.6.19

DISCUSSION Michal Piotrowski 5 participants 9 messages Feb 24, 2007 – Feb 28, 2007 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Philip,

Philip Guo napisał(a):

Quoted 20 lines

Hi,

I am a graduate student working on finding bugs in Linux drivers using an automated research tool. I think I've found a possible bug in net/tc35815.c, and I'd appreciate it if you could confirm/disconfirm it.

Thanks,
Philip

---
net/tc35815.c

tc35815_driver is never unregistered in tc35815_cleanup_module()

static int __init tc35815_init_module(void)

{
    return pci_register_driver(&tc35815_driver);
}

static void __exit tc35815_cleanup_module(void)

Quoted 14 lines
{
    struct net_device *next_dev;

    while (root_tc35815_dev) {
        struct net_device *dev = root_tc35815_dev;
        next_dev = ((struct tc35815_local *)dev->priv)->next_module;
        iounmap((void *)(dev->base_addr));
        unregister_netdev(dev);
        free_netdev(dev);
        root_tc35815_dev = next_dev;
    }
}

I think that you are right, but I don't know this code.

Jeff, what do you think about this?

Regards,
Michal

PS. Philip, please sign this patch.

Signature · 19 lines
Michal K. K. Piotrowski
LTG - Linux Testers Group (PL)
(http://www.stardust.webpages.pl/ltg/)
LTG - Linux Testers Group (EN)
(http://www.stardust.webpages.pl/linux_testers_group_en/)

Signed-off-by: Michal Piotrowski <[email protected]>

--- linux-mm-clean/drivers/net/tc35815.c	2007-02-04 19:44:54.000000000 +0100
+++ linux-mm/drivers/net/tc35815.c	2007-02-24 13:07:34.000000000 +0100
@@ -1740,6 +1740,8 @@ static void __exit tc35815_cleanup_modul
 		free_netdev(dev);
 		root_tc35815_dev = next_dev;
 	}
+
+	pci_unregister_driver(&tc35815_driver);
 }
 module_init(tc35815_init_module);
 module_exit(tc35815_cleanup_module);
#2 lore raw
Quoted 38 lines · Michal Piotrowski

Hi Philip,

Philip Guo napisał(a):

Quoted 20 lines

Hi,

I am a graduate student working on finding bugs in Linux drivers using an automated research tool. I think I've found a possible bug in net/tc35815.c, and I'd appreciate it if you could confirm/disconfirm it.

Thanks,
Philip

---
net/tc35815.c

tc35815_driver is never unregistered in tc35815_cleanup_module()

static int __init tc35815_init_module(void)

{
    return pci_register_driver(&tc35815_driver);
}

static void __exit tc35815_cleanup_module(void)

Quoted 14 lines
{
    struct net_device *next_dev;

    while (root_tc35815_dev) {
        struct net_device *dev = root_tc35815_dev;
        next_dev = ((struct tc35815_local *)dev->priv)->next_module;
        iounmap((void *)(dev->base_addr));
        unregister_netdev(dev);
        free_netdev(dev);
        root_tc35815_dev = next_dev;
    }
}
Quoted 6 lines

I think that you are right, but I don't know this code.

Jeff, what do you think about this?

Regards,
Michal

I created my own patch for this (and one other bug), and checked it in.

Really, though, someone in MIPS-land should give this driver some loving care. It is filled with bugs and 2.4-era anachronisms.

Jeff

#3 lore raw
Quoted 37 lines · Jeff Garzik
Quoted 37 lines
Quoted 18 lines

I am a graduate student working on finding bugs in Linux drivers using an automated research tool. I think I've found a possible bug in net/tc35815.c, and I'd appreciate it if you could confirm/disconfirm it.

Thanks,
Philip

---
net/tc35815.c

tc35815_driver is never unregistered in tc35815_cleanup_module()

static int __init tc35815_init_module(void)

{
   return pci_register_driver(&tc35815_driver);
}

static void __exit tc35815_cleanup_module(void)

Quoted 14 lines
{
   struct net_device *next_dev;

   while (root_tc35815_dev) {
       struct net_device *dev = root_tc35815_dev;
       next_dev = ((struct tc35815_local *)dev->priv)->next_module;
       iounmap((void *)(dev->base_addr));
       unregister_netdev(dev);
       free_netdev(dev);
       root_tc35815_dev = next_dev;
   }
}

I think that you are right, but I don't know this code.

Jeff, what do you think about this?

Quoted 7 lines
Quoted 2 lines

Regards,
Michal

I created my own patch for this (and one other bug), and checked it in.

Really, though, someone in MIPS-land should give this driver some loving care. It is filled with bugs and 2.4-era anachronisms.

Took a look at it. It's sort of a non-bug because the driver cannot be compiled as module, so the module_exit function cannot possibly be executed. The board support code is calling into the driver which makes it impossible to build this driver as a module, yet it's possible to select building this driver as a module ... Oh yeah, that root_tc35815_dev stuff is also pretty ugly.

Atsushi?

Ralf

#4 lore raw
Quoted 11 lines · Ralf Baechle
Quoted 4 lines

I created my own patch for this (and one other bug), and checked it in.

Really, though, someone in MIPS-land should give this driver some loving care. It is filled with bugs and 2.4-era anachronisms.

Took a look at it. It's sort of a non-bug because the driver cannot be compiled as module, so the module_exit function cannot possibly be executed. The board support code is calling into the driver which makes it impossible to build this driver as a module, yet it's possible to select building this driver as a module ... Oh yeah, that root_tc35815_dev stuff is also pretty ugly.

Yes, the driver is quite obsoleted. It was added long ago with arch/mips/jmr3927 and not maintained long time, as like as the board itself.

I know both MontaVista and CELF have new driver for the chip. If anybody in MontaVista did not complain I can send CELF's one available at http://tree.celinuxforum.org/pubwiki/moin.cgi/PatchArchive. (it needs some changes for recent kernel, for example pt_regs removal, but it would be easy).

Sergei?

---
Atsushi Nemoto

#5 lore raw

Hello.

Quoted 3 lines · Atsushi Nemoto

I know both MontaVista and CELF have new driver for the chip. If anybody in MontaVista did not complain I can send CELF's one available at http://tree.celinuxforum.org/pubwiki/moin.cgi/PatchArchive. (it

Yeah, tc35815_1.c in our looks like the one in the CELF archive (what I
didn't get is why they decided to keep both drivers around?)

Quoted 4 lines

needs some changes for recent kernel, for example pt_regs removal, but it would be easy).

Sergei?

I think everybody would be just thankful. :-)
There's quite a lot of other TX4938 patches that need pushing into
Linux/MIPS -- unfortunetely, this hasn't been done by MV... :-<

Quoted 2 lines

---
Atsushi Nemoto

BTW, does RBTX4938 boot the recent kernels for you? If so, what .config
are you using -- I'm afraid something's up with rbhma4500_defconfig?

WBR, Sergei

#6 lore raw
Quoted 2 lines · Sergei Shtylyov

Yeah, tc35815_1.c in our looks like the one in the CELF archive (what I
didn't get is why they decided to keep both drivers around?)

I think tc35815_1.c can just replace old tc35815.c. New one lacks tc35815_killall() which is currently called by arch/mips/jmr3927 code, but there would be no point doing a such thing. arch/mips/jmr3927 should be fixed.

Quoted 1 line

I think everybody would be just thankful. :-)

OK, I'll prepare a patch after some cleanup.

---
Atsushi Nemoto

#7 lore raw

rbhma4500_defconfig

In reply to Sergei Shtylyov

CC list trimmed.

Quoted 2 lines · Sergei Shtylyov

BTW, does RBTX4938 boot the recent kernels for you? If so, what .config
are you using -- I'm afraid something's up with rbhma4500_defconfig?

I have not tried recently. I'll try later, but what's the problem?

---
Atsushi Nemoto

#8 lore raw

Re: rbhma4500_defconfig

Hello.

Quoted 6 lines · Atsushi Nemoto
Quoted 2 lines · Sergei Shtylyov

BTW, does RBTX4938 boot the recent kernels for you? If so, what .config
are you using -- I'm afraid something's up with rbhma4500_defconfig?

I have not tried recently. I'll try later, but what's the problem?

No console output, IIRC.

Quoted 2 lines

---
Atsushi Nemoto

WBR, Sergei

#9 lore raw

Re: rbhma4500_defconfig

Quoted 3 lines · Sergei Shtylyov
Quoted 1 line

I have not tried recently. I'll try later, but what's the problem?

No console output, IIRC.

CONFIG_SERIAL_TXX9_CONSOLE=y
CONFIG_SERIAL_TXX9_STDSERIAL=y

and

CONFIG_VGA_CONSOLE=n
CONFIG_KEYBOARD_ATKBD=n
CONFIG_SERIO_I8042=n

Would help?
---
Atsushi Nemoto