Bug 1898 - fdomain module crashes on load in 2.6.x
Summary: fdomain module crashes on load in 2.6.x
Status: CLOSED PATCH_ALREADY_AVAILABLE
Alias: None
Product: SCSI Drivers
Classification: Unclassified
Component: FUTURE DOMAIN TMC-16x0 (show other bugs)
Hardware: i386 Linux
: P2 blocking
Assignee: scsi_drivers-futuredomain-tmc-16x0
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-17 16:48 UTC by Andreas Hartmetz
Modified: 2014-06-04 02:23 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.6.11
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Andreas Hartmetz 2004-01-17 16:48:02 UTC
Distribution:SuSE 7.3, but heavily updated from sources all over the net
Hardware Environment: Pentium 200 with f00f bug, 64 MB RAM, Intel chipset on
Siemens mainboard (PIIX2 IDE cntrlr), some TMC-blah-MX fdomain board
Software Environment: new modutils of course
Problem Description: fdomain driver module provokes segfault in modprobe on
load, rmmod hangs (does not terminate) when trying to unload. There is a compile
warning "check_region is deprecated" when compiling.

Steps to reproduce:
-compile kernel with fdomain module *check_region is deprecated*
-try to load fdomain module *insmod-segfault*
-try to unload fdomain module *rmmod-hang*

I worked well with 2.4.anything-I-tried like 2.4.18, 2.4.22, 2.4.23

besides, other people seem to be having the same problem
http://developers.slashdot.org/developers/03/11/26/2326253.shtml
Comment 1 Bruce LaZerte 2004-09-13 07:59:25 UTC
Exact same thing happens here with unpatched kernel.org kernel V2.6.8.1
Problem with insmod or modprobe or when compiled in. 
From syslog it appears that the driver's parameters are not being loaded 
properly before the segfault.

The driver hasn't been converted to module_param() yet, but I thought 
MODULE_PARM and __setup() were still supposed to work? It doesn't look like 
fdomain.c has been touched since at least 2001.

Works fine under kernel 2.4
Comment 2 Bruce LaZerte 2005-03-02 08:52:47 UTC
In kernel 2.6.11, still not working although the module has been upgraded to use
module_param() and I can now see that the io,irq parameters are being read.

modprobe fdomain fdomain=0x140,11
still causes a segmentation fault with dmesg giving:

scsi0: <fdomain> No BIOS; using scsi id 7
scsi0: <fdomain> TMC-1800 chip at 0x140 irq 11
scsi0 : Future Domain 16-bit SCSI Driver Version 5.51
Unable to handle kernel NULL pointer dereference at virtual address 00000080
 printing eip:
c01d12ab
*pde = 00000000
Oops: 0000 [#1]
PREEMPT
Modules linked in: fdomain
CPU:    0
EIP:    0060:[<c01d12ab>]    Not tainted VLI
EFLAGS: 00010286   (2.6.11)
EIP is at kref_get+0xb/0x50
eax: 00000080   ebx: 00000080   ecx: 00000005   edx: 00000000
esi: c74de0b4   edi: c74de112   ebp: ffffffea   esp: c5945f24
ds: 007b   es: 007b   ss: 0068
Process modprobe (pid: 1757, threadinfo=c5944000 task=c11810a0)
Stack: c011834c 00000000 0000195b ffffffc7 00000068 c01d07ba 00000080 c74de10c
       c0205768 00000068 c0205630 00000044 c5945f78 c8827780 00000000 c74de0b4
       c74de000 ffffffea 00000000 c023aec3 c74de0b4 00000000 c8827960 c74de000
Call Trace:
 [<c011834c>] release_console_sem+0xec/0x100
 [<c01d07ba>] kobject_get+0x1a/0x30
 [<c0205768>] get_device+0x18/0x20
 [<c0205630>] device_add+0x70/0x160
 [<c023aec3>] scsi_add_host+0x73/0x140
 [<c882907e>] init_this_scsi_driver+0x7e/0xf9 [fdomain]
 [<c0131436>] sys_init_module+0x186/0x240
 [<c010272f>] syscall_call+0x7/0xb
Code: f6 83 c4 10 89 f0 5b 5e 5f 5d c3 90 90 90 90 90 8b 44 24 04 c7 00 01 00 00
00 c3 90 8d 74 26 00 83 ec 14 89 5c 24 10 8b 5c 24 18 <8b> 03 85 c0 74 0a ff 03
8b 5c 24 10 83 c4 14 c3 c7 04 24 42 81

 
Comment 3 Bruce LaZerte 2006-04-03 17:26:50 UTC
This problem has finally been fixed with kernel V2.6.16.1, for me anyway. 

Which is great because my working 2.4 kernel was getting pretty old.

Thanks to whomever or whatever is responsible.

Bruce L.
Comment 4 Andreas Hartmetz 2014-06-04 02:21:05 UTC
For historical interest: relevant history is available at https://archive.org/details/git-history-of-linux and the commit that most likely fixed this bug is aa98a175adc4165908817b7b9881b60be659d0cc which fixed a few things that were very fishy in fdomain.c.
... I probably don't have that hardware anymore though :)

    [PATCH] fdomain screwup
    
    | From: Andrew Morton
    | To: linux-scsi@vger.kernel.org
    | Subject: fdomain screwup
    |
    | - fdomain_setup() is marked __init, but is called from non-__init
    |   fdomain_16x0_detect()
    |
    | - fdomain_setup() is declared in drivers/scsi/pcmcia/fdomain_stub.c as
    |   taking two arguments, but is implemented in fdomain_setup() taking a
    |   single argument.
    |
    |   Please, never ever ever put extern function declarations in .c files.
    |   Put it in a header file which is visible to the definition and to all
    |   callsites.
    |
    | - fdomain_setup() is declared static, hence the linkage fails.
    |
    | - fdomain_16x0_bus_reset() is implemented in drivers/scsi/fdomain.c but
    |   has static scope, so the call from drivers/scsi/pcmcia/fdomain_stub.c
    |   doesn't work.
    
    [I didn't find this to be the case, so I didn't fix it.]
    
    | - fdomain_16x0_bus_reset() has an extern declaration in
    |   drivers/scsi/pcmcia/fdomain_stub.c.  This should be moved to a header
    |   file which is visible to etc...    [PATCH] fdomain screwup
    
    | From: Andrew Morton
    | To: linux-scsi@vger.kernel.org
    | Subject: fdomain screwup
    |
    | - fdomain_setup() is marked __init, but is called from non-__init
    |   fdomain_16x0_detect()
    |
    | - fdomain_setup() is declared in drivers/scsi/pcmcia/fdomain_stub.c as
    |   taking two arguments, but is implemented in fdomain_setup() taking a
    |   single argument.
    |
    |   Please, never ever ever put extern function declarations in .c files.
    |   Put it in a header file which is visible to the definition and to all
    |   callsites.
    |
    | - fdomain_setup() is declared static, hence the linkage fails.
    |
    | - fdomain_16x0_bus_reset() is implemented in drivers/scsi/fdomain.c but
    |   has static scope, so the call from drivers/scsi/pcmcia/fdomain_stub.c
    |   doesn't work.
    
    [I didn't find this to be the case, so I didn't fix it.]
    
    | - fdomain_16x0_bus_reset() has an extern declaration in
    |   drivers/scsi/pcmcia/fdomain_stub.c.  This should be moved to a header
    |   file which is visible to etc...
    
    Builds and loads.  No hardware to test.
Comment 5 Andreas Hartmetz 2014-06-04 02:23:16 UTC
Yeah, that was me clicking the wrong button. If you read from the second "[PATCH] fdomain screwup", you have the proper commit message.

Note You need to log in before you can comment on or make changes to this bug.