From: Bjorn Helgaas on
With CONFIG_NETXEN_NIC=y, I got the following crash. Turning off
NETXEN_NIC avoided it (this machine has no NetXen NIC).

This is on bea4c899f2b5fad80099aea979780ef19f9b1987 (Linus upstream from
yesterday).

Bjorn


Linux version 2.6.32 (helgaas(a)bob) (gcc version 4.3.2 (Debian 4.3.2-1.1) ) #9 SMP Fri Dec 18 13:13:03 MST 2009
....
QLogic/NetXen Network Driver v4.0.65
BUG: unable to handle kernel NULL pointer dereference at 0000000000000080
IP: [<ffffffff81130dc6>] sysfs_create_file+0x9/0x27
PGD 0
Oops: 0000 [#1] SMP
last sysfs file:
CPU 0
Pid: 1, comm: swapper Not tainted 2.6.32 #9 /ProLiant DL380 G6
RIP: 0010:[<ffffffff81130dc6>] [<ffffffff81130dc6>] sysfs_create_file+0x9/0x27
RSP: 0000:ffff88041e46bed0 EFLAGS: 00010206
RAX: 0000000000000000 RBX: ffffffff81b818e8 RCX: ffffffff81abdf98
RDX: 0000000000000000 RSI: ffffffff81a61c50 RDI: 0000000000000050
RBP: ffff88041e46bed0 R08: 0000000000000000 R09: ffffffff81b818d8
R10: 00000000fffffffe R11: ffff88041e46be00 R12: ffffffff81b30bd1
R13: 0000000000000000 R14: ffffffff81ae2068 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff880028200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000080 CR3: 0000000001a0c000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process swapper (pid: 1, threadinfo ffff88041e46a000, task ffff88081e050000)
Stack:
ffff88041e46bee0 ffffffff81b30c13 ffff88041e46bf10 ffffffff810001f0
<0> ffff88041e46bf10 ffffffff81b818e8 0000000000000040 ffffffff81ae2060
<0> ffff88041e46bf40 ffffffff81b01671 0000000000000000 0000000000000000
Call Trace:
[<ffffffff81b30c13>] netxen_init_module+0x42/0x72
[<ffffffff810001f0>] do_one_initcall+0x5a/0x14a
[<ffffffff81b01671>] kernel_init+0x166/0x1bc
[<ffffffff810037d4>] kernel_thread_helper+0x4/0x10
[<ffffffff81b0150b>] ? kernel_init+0x0/0x1bc
[<ffffffff810037d0>] ? kernel_thread_helper+0x0/0x10
Code: 24 0f 94 c0 84 c0 74 0f 4c 89 e7 e8 2e 08 00 00 eb 05 bb fe ff ff ff 41 59 89 d8 5b 41 5c 41 5d c9 c3 55 48 85 ff 48 89 e5 74 0e <48> 8b 7f 30 48 85 ff 74 05 48 85 f6 75 04 0f 0b eb fe ba 02 00
RIP [<ffffffff81130dc6>] sysfs_create_file+0x9/0x27
RSP <ffff88041e46bed0>
CR2: 0000000000000080
---[ end trace 15e5ef3802483def ]---
swapper used greatest stack depth: 3808 bytes left
Kernel panic - not syncing: Attempted to kill init!
Pid: 1, comm: swapper Tainted: G D 2.6.32 #9
Call Trace:
[<ffffffff815e8add>] panic+0xa0/0x15c
[<ffffffff81089fd8>] ? call_rcu+0x9/0xb
[<ffffffff8103f195>] ? put_files_struct+0xb5/0xc2
[<ffffffff81046f2d>] ? exit_ptrace+0x33/0x12b
[<ffffffff81040844>] do_exit+0x79/0x759
[<ffffffff8103e1c0>] ? kmsg_dump+0x112/0x12c
[<ffffffff815ebc09>] oops_end+0xb2/0xba
[<ffffffff81025418>] no_context+0x1f3/0x202
[<ffffffff8103d579>] ? __call_console_drivers+0x67/0x79
[<ffffffff810255e1>] __bad_area_nosemaphore+0x1ba/0x1e0
[<ffffffff8103e082>] ? vprintk+0x30c/0x338
[<ffffffff81025615>] bad_area_nosemaphore+0xe/0x10
[<ffffffff815ed4a7>] do_page_fault+0x186/0x2c3
[<ffffffff81b30bd1>] ? netxen_init_module+0x0/0x72
[<ffffffff815eb11f>] page_fault+0x1f/0x30
[<ffffffff81b30bd1>] ? netxen_init_module+0x0/0x72
[<ffffffff81130dc6>] ? sysfs_create_file+0x9/0x27
[<ffffffff81b30c13>] netxen_init_module+0x42/0x72
[<ffffffff810001f0>] do_one_initcall+0x5a/0x14a
[<ffffffff81b01671>] kernel_init+0x166/0x1bc
[<ffffffff810037d4>] kernel_thread_helper+0x4/0x10
[<ffffffff81b0150b>] ? kernel_init+0x0/0x1bc
[<ffffffff810037d0>] ? kernel_thread_helper+0x0/0x10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Stephen Hemminger on
On Fri, 18 Dec 2009 13:24:28 -0700
Bjorn Helgaas <bjorn.helgaas(a)hp.com> wrote:

> With CONFIG_NETXEN_NIC=y, I got the following crash. Turning off
> NETXEN_NIC avoided it (this machine has no NetXen NIC).
>
> This is on bea4c899f2b5fad80099aea979780ef19f9b1987 (Linus upstream from
> yesterday).
>
> Bjorn

Subject: [PATCH] netxen: use module parameter correctly

Netxen driver is doing this bogus thing to create a control file.
This fails if device doesn't exist, and overall is a bad way to do
the module parameter. Rather than fix borked code, just rewrite.
Just using a writeable module parameter of 0/1 is the correct way

Signed-off-by: Stephen Hemminger <shemminger(a)vyatta.com>

--- a/drivers/net/netxen/netxen_nic_main.c 2009-12-18 16:13:20.169390067 -0800
+++ b/drivers/net/netxen/netxen_nic_main.c 2009-12-18 16:17:43.650014965 -0800
@@ -57,7 +57,9 @@ static int use_msi = 1;

static int use_msi_x = 1;

-static unsigned long auto_fw_reset = AUTO_FW_RESET_ENABLED;
+static int auto_fw_reset = AUTO_FW_RESET_ENABLED;
+module_param(auto_fw_reset, int, 0644);
+MODULE_PARM_DESC(auto_fw_reset,"Auto firmware reset (0=disabled, 1=enabled");

static int __devinit netxen_nic_probe(struct pci_dev *pdev,
const struct pci_device_id *ent);
@@ -2534,42 +2536,6 @@ static struct bin_attribute bin_attr_mem
.write = netxen_sysfs_write_mem,
};

-#ifdef CONFIG_MODULES
-static ssize_t
-netxen_store_auto_fw_reset(struct module_attribute *mattr,
- struct module *mod, const char *buf, size_t count)
-
-{
- unsigned long new;
-
- if (strict_strtoul(buf, 16, &new))
- return -EINVAL;
-
- if ((new == AUTO_FW_RESET_ENABLED) || (new == AUTO_FW_RESET_DISABLED)) {
- auto_fw_reset = new;
- return count;
- }
-
- return -EINVAL;
-}
-
-static ssize_t
-netxen_show_auto_fw_reset(struct module_attribute *mattr,
- struct module *mod, char *buf)
-
-{
- if (auto_fw_reset == AUTO_FW_RESET_ENABLED)
- return sprintf(buf, "enabled\n");
- else
- return sprintf(buf, "disabled\n");
-}
-
-static struct module_attribute mod_attr_fw_reset = {
- .attr = {.name = "auto_fw_reset", .mode = (S_IRUGO | S_IWUSR)},
- .show = netxen_show_auto_fw_reset,
- .store = netxen_store_auto_fw_reset,
-};
-#endif

static void
netxen_create_sysfs_entries(struct netxen_adapter *adapter)
@@ -2775,23 +2741,12 @@ static struct pci_driver netxen_driver =

static int __init netxen_init_module(void)
{
-#ifdef CONFIG_MODULES
- struct module *mod = THIS_MODULE;
-#endif
-
printk(KERN_INFO "%s\n", netxen_nic_driver_string);

#ifdef CONFIG_INET
register_netdevice_notifier(&netxen_netdev_cb);
register_inetaddr_notifier(&netxen_inetaddr_cb);
#endif
-
-#ifdef CONFIG_MODULES
- if (sysfs_create_file(&mod->mkobj.kobj, &mod_attr_fw_reset.attr))
- printk(KERN_ERR "%s: Failed to create auto_fw_reset "
- "sysfs entry.", netxen_nic_driver_name);
-#endif
-
return pci_register_driver(&netxen_driver);
}

@@ -2799,12 +2754,6 @@ module_init(netxen_init_module);

static void __exit netxen_exit_module(void)
{
-#ifdef CONFIG_MODULES
- struct module *mod = THIS_MODULE;
-
- sysfs_remove_file(&mod->mkobj.kobj, &mod_attr_fw_reset.attr);
-#endif
-
pci_unregister_driver(&netxen_driver);

#ifdef CONFIG_INET


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: David Miller on
From: Stephen Hemminger <shemminger(a)vyatta.com>
Date: Fri, 18 Dec 2009 16:20:54 -0800

> Subject: [PATCH] netxen: use module parameter correctly
>
> Netxen driver is doing this bogus thing to create a control file.
> This fails if device doesn't exist, and overall is a bad way to do
> the module parameter. Rather than fix borked code, just rewrite.
> Just using a writeable module parameter of 0/1 is the correct way
>
> Signed-off-by: Stephen Hemminger <shemminger(a)vyatta.com>

Applied, thanks Stephen.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/