Skip to contentSkip to conversation

2.4.4-ac4 - oops on unload "cdrom" module

DISCUSSION Applied Andrzej Krzysztofowicz 3 participants 4 messages May 4, 2001

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines

This oops happens when I run "rmmod cdrom" on a 2.4.4-ac4 kernel with CONFIG_SYSCTL enabled. It doesn't happen if CONFIG_SYSCTL is disabled.

sr_mod isn't loaded at this point. Reference to sd_mod looks weird. After this oops the "cdrom" module remains in memory in the "deleted" state.

Unable to handle kernel NULL pointer dereference at virtual address 00000008

[...]

Quoted 1 line
Quoted 1 line
Quoted 1 line

EIP; c0118051 <unregister_sysctl_table+5/2c> <=====

The following patch fixes unloading of cdrom module when no cdrom driver loaded (2.4.5-pre, 2.4.4-ac):

cdrom/cdrom.c renamed from cdrom/cdrom.c.old +2 -1
@@ -2698,7 +2698,8 @@
 
 static void cdrom_sysctl_unregister(void)
 {
-	unregister_sysctl_table(cdrom_sysctl_header);
+	if (cdrom_sysctl_header)
+		unregister_sysctl_table(cdrom_sysctl_header);
 }
 
 #endif /* CONFIG_SYSCTL */

Andrzej

Signature · 4 lines
=======================================================================
  Andrzej M. Krzysztofowicz               [email protected]
  tel.  (0-58) 347 14 61
Wydz.Fizyki Technicznej i Matematyki Stosowanej Politechniki Gdanskiej
#1 lore raw

Hi, Andrzej!

Quoted 2 lines

The following patch fixes unloading of cdrom module when no cdrom driver loaded (2.4.5-pre, 2.4.4-ac):

It works for me. Thank you! You have even managed to find out that I had my CD-ROM disconnected :-)

By the way, shouldn't we register sysctl, /proc/sys/dev/cdrom/ and /dev/cdrom/ always when the cdrom driver is loaded/initialized, not when a cdrom unit is found?

I don't know what's the official "policy" is, but wouldn't it be logical to have some control over the drivers that handle no devices in the moment?

Actually, the scsi module behaves differently. Right now I have empty /dev/scsi and /proc/scsi/scsi contains "Attached devices: none"

Anyway, the patch is small, straightforward and consistent with the current behavior of the driver. And it works.

Signature · 2 lines
Regards,
Pavel Roskin
Applied
#2 lore raw
In reply to Andrzej Krzysztofowicz
Quoted 16 lines · Andrzej Krzysztofowicz
Quoted 7 lines

This oops happens when I run "rmmod cdrom" on a 2.4.4-ac4 kernel with CONFIG_SYSCTL enabled. It doesn't happen if CONFIG_SYSCTL is disabled.

sr_mod isn't loaded at this point. Reference to sd_mod looks weird. After this oops the "cdrom" module remains in memory in the "deleted" state.

Unable to handle kernel NULL pointer dereference at virtual address 00000008

[...]

Quoted 1 line
Quoted 1 line
Quoted 1 line

EIP; c0118051 <unregister_sysctl_table+5/2c> <=====

The following patch fixes unloading of cdrom module when no cdrom driver loaded (2.4.5-pre, 2.4.4-ac):

cdrom/cdrom.c line 2705

Quoted 9 lines
cdrom/cdrom.c renamed from cdrom/cdrom.c.old +2 -1
@@ -2698,7 +2698,8 @@
 
 static void cdrom_sysctl_unregister(void)
 {
-	unregister_sysctl_table(cdrom_sysctl_header);
+	if (cdrom_sysctl_header)
+		unregister_sysctl_table(cdrom_sysctl_header);
 }
 
 #endif /* CONFIG_SYSCTL */

Thanks applied.

Signature · 1 line
Jens Axboe
#3 lore raw
In reply to Andrzej Krzysztofowicz
Quoted 6 lines · Pavel Roskin
Quoted 2 lines

The following patch fixes unloading of cdrom module when no cdrom driver loaded (2.4.5-pre, 2.4.4-ac):

It works for me. Thank you! You have even managed to find out that I had my CD-ROM disconnected :-)

Quoted 7 lines

By the way, shouldn't we register sysctl, /proc/sys/dev/cdrom/ and /dev/cdrom/ always when the cdrom driver is loaded/initialized, not when a cdrom unit is found?

I don't know what's the official "policy" is, but wouldn't it be logical to have some control over the drivers that handle no devices in the moment?

We should, the -ac tree has the first cut of the cdrom updates and they didn't have the linking right. The right init sequence fixes the issue as well, not just initing after the first cdrom driver registers.

Signature · 1 line
Jens Axboe