Skip to contentSkip to conversation

Oops with 2.4.0-test10 during ripping an audio cd with cdda2wav

DISCUSSION Bernd Nottelmann 2 participants 5 messages Nov 10, 2000 – Nov 22, 2000

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

I am not sure, if this is a reiserfs related issue, so I send this Oops report both to the kernel mailing list and to the reiserfs people (kernel has been patched with reiserfs-3.6.18).

During ripping the last song from a cd (a long time song of 9.50 min) I was wondering about the time consumption of this process. After the cdda2wav process had been finished I found the following oops:

---------------------- starts here ---------------------- ksymoops 2.3.5 on i686 2.4.0-test10. Options used
-V (default)
-k /proc/ksyms (default)
-l /proc/modules (default)
-o /lib/modules/2.4.0-test10/ (default)
-m /usr/src/linux/System.map (default)

Warning: You did not tell me where to find symbol information. I will assume that the log matches the kernel and modules that are running right now and I'll use the default options above for symbol resolution. If the current kernel and/or modules do not match the log, you can get more accurate output by telling me the kernel version and where to find map, modules, ksyms etc. ksymoops -h explains the options.

kernel BUG at slab.c:1542!

invalid operand: 0000
CPU:    0
EIP:    0010:[<c012b8b0>]

Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00010282
eax: 0000001b ebx: 00000b00 ecx: 0000001f edx: 00000002
esi: ffffc8e0 edi: fffffffa ebp: 00040bce esp: c5c819e0
ds: 0018 es: 0018 ss: 0018
Process cdda2wav (pid: 16228, stackpage=c5c81000)

Stack: c022dbe5 c022dc65 00000606 00000b00 ffffc8e0 fffffffa 00040bce 
c5c80000 
       c01e0806 ffffc8e0 00000007 0000530e 080701d0 0000530e 080701d0 
cfae0c00 
       c5c81aec 00000000 c017486a c01748d1 00000000 c5c81efc c0181721 
00004980 
Call Trace: [<c022dbe5>] [<c022dc65>] [<c01e0806>] [<c017486a>] [<c01748d1>] 
[<c0181721>] [<c01a2b3a>] 
       [<c01e84a0>] [<c01e8657>] [<c01ea345>] [<c010cb35>] [<c01dfef2>] 
[<c0168850>] [<c01601f1>] [<c01e6d94>] 
       [<c0172870>] [<c01ea217>] [<c01a2502>] [<c01a8f51>] [<c01ad036>] 
[<c01acf30>] [<c01aa77c>] [<c01acf30>] 
       [<c010c911>] [<c0117db7>] [<c0114eba>] [<c0114f7d>] [<c0115267>] 
[<c0140e7b>] [<c01acf30>] [<d0914c00>] 
       [<c020c034>] [<c020c3a2>] [<c01f30df>] [<c01f3040>] [<c0140ee2>] 
[<d0914c00>] [<c020c034>] [<c020c3a2>] 
       [<c01f30df>] [<c01f3040>] [<c01e6d94>] [<c01f2cb8>] [<c01f3040>] 
[<c01f3322>] [<c01f3158>] [<c01e6d94>] 
       [<c0117db7>] [<c013c6cc>] [<c013a4cc>] [<c01413c7>] [<c010b197>] 
Code: 0f 0b 83 c4 0c 31 c0 5b 5e 5f 5d 59 c3 8d 76 00 83 ec 04 57 
Quoted 1 line
Quoted 1 line

EIP; c012b8b0 <kmalloc+100/110> <=====

Trace; c022dbe5 <tvecs+161d/ba58>
Trace; c022dc65 <tvecs+169d/ba58>
Trace; c01e0806 <mmc_ioctl+2e6/d58>
Trace; c017486a <get_cnode+1e/90>
Trace; c01748d1 <get_cnode+85/90>
Trace; c0181721 <end_that_request_first+61/b8> Trace; c01a2b3a <tulip_interrupt+5b2/6d8>
Trace; c01e84a0 <kfree_skbmem+28/84>
Trace; c01e8657 <__kfree_skb+15b/164>
Trace; c01ea345 <net_tx_action+59/110>
Trace; c010cb35 <do_IRQ+e5/f4>
Trace; c01dfef2 <cdrom_ioctl+87e/e00>
Trace; c0168850 <reiserfs_kfree+14/38>
Trace; c01601f1 <do_balance+ed/fc>
Trace; c01e6d94 <nf_hook_slow+7c/b8>
Trace; c0172870 <reiserfs_insert_item+98/100> Trace; c01ea217 <netif_rx+bb/128>
Trace; c01a2502 <tulip_rx+2d6/35c>
Trace; c01a8f51 <ide_set_handler+65/78>
Trace; c01ad036 <write_intr+106/128>
Trace; c01acf30 <write_intr+0/128>
Trace; c01aa77c <ide_intr+128/194>
Trace; c01acf30 <write_intr+0/128>
Trace; c010c911 <handle_IRQ_event+4d/78>
Trace; c0117db7 <reschedule_idle+20f/218>
Trace; c0114eba <deliver_signal+4a/88>
Trace; c0114f7d <send_sig_info+85/b0>
Trace; c0115267 <send_sig+1b/20>
Trace; c0140e7b <send_sigio_to_task+d3/e0>
Trace; c01acf30 <write_intr+0/128>
Trace; d0914c00 <[ipchains]ip_conntrack_protocol_udp+0/40> Trace; c020c034 <udp_queue_rcv_skb+68/e0>
Trace; c020c3a2 <udp_rcv+14a/27c>
Trace; c01f30df <ip_local_deliver_finish+9f/118> Trace; c01f3040 <ip_local_deliver_finish+0/118> Trace; c0140ee2 <send_sigio+5a/a4>
Trace; d0914c00 <[ipchains]ip_conntrack_protocol_udp+0/40> Trace; c020c034 <udp_queue_rcv_skb+68/e0>
Trace; c020c3a2 <udp_rcv+14a/27c>
Trace; c01f30df <ip_local_deliver_finish+9f/118> Trace; c01f3040 <ip_local_deliver_finish+0/118> Trace; c01e6d94 <nf_hook_slow+7c/b8>
Trace; c01f2cb8 <ip_local_deliver+15c/164>
Trace; c01f3040 <ip_local_deliver_finish+0/118> Trace; c01f3322 <ip_rcv_finish+1ca/218>
Trace; c01f3158 <ip_rcv_finish+0/218>
Trace; c01e6d94 <nf_hook_slow+7c/b8>
Trace; c0117db7 <reschedule_idle+20f/218>
Trace; c013c6cc <pipe_write+230/2ac>
Trace; c013a4cc <blkdev_ioctl+28/34>
Trace; c01413c7 <sys_ioctl+1bb/214>
Trace; c010b197 <system_call+33/38>
Code; c012b8b0 <kmalloc+100/110>
00000000 <_EIP>:
Code; c012b8b0 <kmalloc+100/110> <=====
0: 0f 0b ud2a <=====
Code; c012b8b2 <kmalloc+102/110>
2: 83 c4 0c add $0xc,%esp
Code; c012b8b5 <kmalloc+105/110>
5: 31 c0 xor %eax,%eax
Code; c012b8b7 <kmalloc+107/110>
7: 5b pop %ebx
Code; c012b8b8 <kmalloc+108/110>
8: 5e pop %esi
Code; c012b8b9 <kmalloc+109/110>
9: 5f pop %edi
Code; c012b8ba <kmalloc+10a/110>
a: 5d pop %ebp
Code; c012b8bb <kmalloc+10b/110>
b: 59 pop %ecx
Code; c012b8bc <kmalloc+10c/110>
c: c3 ret
Code; c012b8bd <kmalloc+10d/110>
d: 8d 76 00 lea 0x0(%esi),%esi
Code; c012b8c0 <kmem_cache_free+0/88>
10: 83 ec 04 sub $0x4,%esp
Code; c012b8c3 <kmem_cache_free+3/88>
13: 57 push %edi

1 warning issued. Results may not be reliable. ---------------------- ends here ----------------------

The oops should have been emitted by the BUG() in void * kmalloc (size_t size, int flags) in linux/mm/slab.c.

cdda2wav (version 1.9) was called with the following options (I think this options are correct, but I am not really sure, because it was called by grip)

-D1,0,0 -x -H -t9 -O wav

the .wav-file has been written to the reiserfs partition (ide-disk, without DMA).
The cdrom drive is a Ricoh MP9060A, up to now there never occured any problems with that. The ide-scsi driver has not been compiled as a module, it is tightly integrated into the kernel as well as the generic scsi support (sg).

(Maybe I should mention that the kernel has been compiled with gcc-2.95.2, but I think, it is not very important.)

For the sake of completeness I append my .config at the end of this mail (all lines with "is not set" removed)

My hardware:
Soyo SMP board SY-D6IBA
(from lspci:)
Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (rev 02) Intel Corporation 440BX/ZX - 82443BX/ZX AGP bridge (rev 02)
IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 01)
USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01)
Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 02)
SCSI storage controller: Adaptec AIC-7880U (rev 01)
Ethernet controller: Digital Equipment Corporation DECchip 21040 [Tulip] (rev
24)
Multimedia audio controller: Creative Labs SB Live! EMU10000 (rev 08) Input device controller: Creative Labs SB Live! (rev 08)
VGA compatible controller: nVidia Corporation Riva TnT2 Ultra [NV5] (rev
11)
256 MB RAM

Bernd

---------------------- snip here ---------------------- #
# Automatically generated make config: don't edit #
CONFIG_X86=y
CONFIG_ISA=y
CONFIG_UID16=y

#
# Code maturity level options
#
CONFIG_EXPERIMENTAL=y

#
# Loadable module support
#
CONFIG_MODULES=y
CONFIG_KMOD=y

#
# Processor type and features
#
CONFIG_M686=y
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_CMPXCHG=y
CONFIG_X86_BSWAP=y
CONFIG_X86_POPAD_OK=y
CONFIG_X86_L1_CACHE_SHIFT=5
CONFIG_X86_TSC=y
CONFIG_X86_GOOD_APIC=y
CONFIG_X86_PGE=y
CONFIG_X86_USE_PPRO_CHECKSUM=y
CONFIG_MICROCODE=y
CONFIG_X86_MSR=y
CONFIG_X86_CPUID=y
CONFIG_NOHIGHMEM=y
CONFIG_MTRR=y
CONFIG_SMP=y
CONFIG_HAVE_DEC_LOCK=y

#
# General setup
#
CONFIG_NET=y
CONFIG_X86_IO_APIC=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_PCI=y
CONFIG_PCI_GODIRECT=y
CONFIG_PCI_DIRECT=y
CONFIG_PCI_NAMES=y
CONFIG_SYSVIPC=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_SYSCTL=y
CONFIG_KCORE_ELF=y
CONFIG_BINFMT_AOUT=m
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_MISC=m
CONFIG_PM=y
CONFIG_APM=y
CONFIG_APM_DO_ENABLE=y
CONFIG_APM_CPU_IDLE=y
CONFIG_APM_RTC_IS_GMT=y

#
# Memory Technology Devices (MTD)
#

#
# Parallel port support
#
CONFIG_PARPORT=m

#
# Plug and Play configuration
#

#
# Block devices
#
CONFIG_BLK_DEV_FD=y
CONFIG_PARIDE=m
CONFIG_PARIDE_PARPORT=m

#
# Parallel IDE high-level drivers
#
CONFIG_PARIDE_PD=m

#
# Parallel IDE protocol modules
#
CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_NBD=m
CONFIG_BLK_DEV_RAM=m
CONFIG_BLK_DEV_RAM_SIZE=4096

#
# Multi-device support (RAID and LVM)
#

#
# Networking options
#
CONFIG_PACKET=m
CONFIG_PACKET_MMAP=y
CONFIG_NETLINK=y
CONFIG_NETLINK_DEV=m
CONFIG_NETFILTER=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_NET_IPIP=m
CONFIG_SYN_COOKIES=y

#
# IP: Netfilter Configuration
#
CONFIG_IP_NF_CONNTRACK=m
CONFIG_IP_NF_FTP=m
CONFIG_IP_NF_IPTABLES=m
CONFIG_IP_NF_MATCH_LIMIT=m
CONFIG_IP_NF_MATCH_MAC=m
CONFIG_IP_NF_MATCH_MARK=m
CONFIG_IP_NF_MATCH_MULTIPORT=m
CONFIG_IP_NF_MATCH_TOS=m
CONFIG_IP_NF_MATCH_UNCLEAN=m
CONFIG_IP_NF_MATCH_OWNER=m
CONFIG_IP_NF_FILTER=m
CONFIG_IP_NF_TARGET_REJECT=m
CONFIG_IP_NF_TARGET_MIRROR=m
CONFIG_IP_NF_NAT=m
CONFIG_IP_NF_NAT_NEEDED=y
CONFIG_IP_NF_TARGET_MASQUERADE=m
CONFIG_IP_NF_TARGET_REDIRECT=m
CONFIG_IP_NF_MANGLE=m
CONFIG_IP_NF_TARGET_TOS=m
CONFIG_IP_NF_TARGET_MARK=m
CONFIG_IP_NF_TARGET_LOG=m
CONFIG_IP_NF_COMPAT_IPCHAINS=m
CONFIG_IP_NF_NAT_NEEDED=y
CONFIG_IP_NF_COMPAT_IPFWADM=m
CONFIG_IP_NF_NAT_NEEDED=y

#
#
#
CONFIG_IPX=m
CONFIG_IPX_INTERN=y

#
# QoS and/or fair queueing
#

#
# Telephony Support
#

#
# ATA/IDE/MFM/RLL support
#
CONFIG_IDE=y

#
# IDE, ATA and ATAPI Block devices
#
CONFIG_BLK_DEV_IDE=y

#
# Please see Documentation/ide.txt for help/info on IDE drives #
CONFIG_BLK_DEV_IDEDISK=y
CONFIG_BLK_DEV_IDETAPE=m
CONFIG_BLK_DEV_IDEFLOPPY=y
CONFIG_BLK_DEV_IDESCSI=y

#
# IDE chipset support/bugfixes
#
CONFIG_BLK_DEV_IDEPCI=y
CONFIG_BLK_DEV_IDEDMA_PCI=y
CONFIG_BLK_DEV_IDEDMA=y
CONFIG_BLK_DEV_PIIX=y
CONFIG_BLK_DEV_IDE_MODES=y

#
# SCSI support
#
CONFIG_SCSI=y

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
CONFIG_SD_EXTRA_DEVS=40
CONFIG_CHR_DEV_ST=m
CONFIG_BLK_DEV_SR=y
CONFIG_SR_EXTRA_DEVS=2
CONFIG_CHR_DEV_SG=y

#
# Some SCSI devices (e.g. CD jukebox) support multiple LUNs #
CONFIG_SCSI_MULTI_LUN=y

#
# SCSI low-level drivers
#
CONFIG_SCSI_AIC7XXX=y
CONFIG_AIC7XXX_CMDS_PER_DEVICE=8
CONFIG_AIC7XXX_RESET_DELAY=10
CONFIG_SCSI_PPA=m
CONFIG_SCSI_IMM=m

#
# IEEE 1394 (FireWire) support
#

#
# I2O device support
#

#
# Network device support
#
CONFIG_NETDEVICES=y

#
# ARCnet devices
#
CONFIG_DUMMY=m

#
# Ethernet (10 or 100Mbit)
#
CONFIG_NET_ETHERNET=y
CONFIG_NET_PCI=y
CONFIG_TULIP=y

#
# Ethernet (1000 Mbit)
#
CONFIG_PLIP=m
CONFIG_PPP=m
CONFIG_SLIP=m
CONFIG_SLIP_COMPRESSED=y

#
# Wireless LAN (non-hamradio)
#

#
# Token Ring devices
#

#
# Wan interfaces
#

#
# Amateur Radio support
#

#
# IrDA (infrared) support
#

#
# ISDN subsystem
#

#
# Old CD-ROM drivers (not SCSI, not IDE)
#

#
# Input core support
#

#
# Character devices
#
CONFIG_VT=y
CONFIG_VT_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_SERIAL_CONSOLE=y
CONFIG_UNIX98_PTYS=y
CONFIG_UNIX98_PTY_COUNT=256
CONFIG_PRINTER=m

#
# I2C support
#

#
# Mice
#
CONFIG_MOUSE=y

#
# Joysticks
#

#
# Game port support
#

#
# Gameport joysticks
#

#
# Serial port support
#

#
# Serial port joysticks
#

#
# Parallel port joysticks
#

#
# Watchdog Cards
#
CONFIG_NVRAM=m
CONFIG_RTC=y

#
# Ftape, the floppy tape device driver
#
CONFIG_AGP=y
CONFIG_AGP_INTEL=y

#
# Multimedia devices
#

#
# File systems
#
CONFIG_AUTOFS_FS=m
CONFIG_REISERFS_FS=y
CONFIG_FAT_FS=m
CONFIG_MSDOS_FS=m
CONFIG_VFAT_FS=m
CONFIG_JFFS_FS_VERBOSE=0
CONFIG_ISO9660_FS=y
CONFIG_JOLIET=y
CONFIG_MINIX_FS=m
CONFIG_PROC_FS=y
CONFIG_DEVFS_FS=y
CONFIG_DEVFS_MOUNT=y
CONFIG_DEVPTS_FS=y
CONFIG_EXT2_FS=y
CONFIG_UDF_FS=m

#
# Network File Systems
#
CONFIG_CODA_FS=m
CONFIG_NFS_FS=m
CONFIG_NFS_V3=y
CONFIG_SUNRPC=m
CONFIG_LOCKD=m
CONFIG_LOCKD_V4=y
CONFIG_SMB_FS=m

#
# Partition Types
#
CONFIG_MSDOS_PARTITION=y
CONFIG_NLS=y

#
# Native Language Support
#
CONFIG_NLS_DEFAULT="iso8859-1"
CONFIG_NLS_CODEPAGE_437=m
CONFIG_NLS_CODEPAGE_850=m
CONFIG_NLS_CODEPAGE_852=m
CONFIG_NLS_ISO8859_1=m
CONFIG_NLS_ISO8859_2=m
CONFIG_NLS_ISO8859_7=m
CONFIG_NLS_ISO8859_15=m

#
# Console drivers
#
CONFIG_VGA_CONSOLE=y
CONFIG_VIDEO_SELECT=y

#
# Frame-buffer support
#

#
# Sound
#
CONFIG_SOUND=m
CONFIG_SOUND_EMU10K1=m
CONFIG_SOUND_OSS=m
CONFIG_SOUND_YM3812=m
CONFIG_SOUND_OPL3SA1=m

#
# USB support
#
CONFIG_USB=m

#
# Miscellaneous USB options
#

#
# USB Controllers
#

#
# USB Devices
#

#
# USB Human Interface Devices (HID)
#

#
# Input core support is needed for USB HID
#

#
# Kernel hacking
#
CONFIG_MAGIC_SYSRQ=y
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw
Quoted 20 lines · Bernd Nottelmann

Hi,

I am not sure, if this is a reiserfs related issue, so I send this Oops report both to the kernel mailing list and to the reiserfs people (kernel has been patched with reiserfs-3.6.18).

During ripping the last song from a cd (a long time song of 9.50 min) I was wondering about the time consumption of this process. After the cdda2wav process had been finished I found the following oops:

---------------------- starts here ---------------------- ksymoops 2.3.5 on i686 2.4.0-test10. Options used
-V (default)
-k /proc/ksyms (default)
-l /proc/modules (default)
-o /lib/modules/2.4.0-test10/ (default)
-m /usr/src/linux/System.map (default)

Quoted 8 lines

Warning: You did not tell me where to find symbol information. I will assume that the log matches the kernel and modules that are running right now and I'll use the default options above for symbol resolution. If the current kernel and/or modules do not match the log, you can get more accurate output by telling me the kernel version and where to find map, modules, ksyms etc. ksymoops -h explains the options.

kernel BUG at slab.c:1542!

[snip]

This looks like cdrom.c:mmc_ioctl, CDROMREADAUDIO, kmalloc'ing too much memory, which triggers the BUG() in slab.c. I'm not quite sure how this is happening though, unless cdda2wav sets a negative ra.nframes (a quick browse on a version I have here shows it does not, maybe you have a different version).

Is it reproducable? If so, could you try with this patch?

Quoted 2 lines

(Maybe I should mention that the kernel has been compiled with gcc-2.95.2, but I think, it is not very important.)

Could be...

Signature · 2 lines
* Jens Axboe <[email protected]>
* SuSE Labs
drivers/cdrom/cdrom.c renamed from opt/kernel/linux-2.4.0-test11-pre2/drivers/cdrom/cdrom.c +73 -53
diff -ur --exclude-from /home/axboe/cdrom/exclude /opt/kernel/linux-2.4.0-test11-pre2/drivers/cdrom/cdrom.c linux/drivers/cdrom/cdrom.c
@@ -224,11 +224,14 @@
   3.11 Jun 12, 2000 - Jens Axboe <[email protected]>
   -- Fix bug in getting rpc phase 2 region info.
   -- Reinstate "correct" CDROMPLAYTRKIND
- 
+
+   3.12 Oct 18, 2000 - Jens Axboe <[email protected]>
+  -- Use quiet bit on packet commands not known to work
+
 -------------------------------------------------------------------------*/
 
-#define REVISION "Revision: 3.11"
-#define VERSION "Id: cdrom.c 3.11 2000/06/12"
+#define REVISION "Revision: 3.12"
+#define VERSION "Id: cdrom.c 3.12 2000/10/18"
 
 /* I use an error-log mask to give fine grain control over the type of
    messages dumped to the system logs.  The available masks include: */
@@ -701,6 +704,21 @@
 	struct cdrom_device_ops *cdo = cdi->ops;
 	int length;
 
+	/*
+	 * Sanyo changer isn't spec compliant (doesn't use regular change
+	 * LOAD_UNLOAD command, and it doesn't implement the mech status
+	 * command below
+	 */
+	if (cdi->sanyo_slot) {
+		buf->hdr.nslots = 3;
+		buf->hdr.curslot = cdi->sanyo_slot == 3 ? 0 : cdi->sanyo_slot;
+		for (length = 0; length < 3; length++) {
+			buf->slots[length].disc_present = 1;
+			buf->slots[length].change = 0;
+		}
+		return 0;
+	}
+
 	length = sizeof(struct cdrom_mechstat_header) +
 		 cdi->capacity * sizeof(struct cdrom_slot);
 
@@ -767,9 +785,10 @@
 	/* The Sanyo 3 CD changer uses byte 7 of the 
 	GPCMD_TEST_UNIT_READY to command to switch CDs instead of
 	using the GPCMD_LOAD_UNLOAD opcode. */
-	if (cdi->sanyo_slot && slot) {
+	if (cdi->sanyo_slot && -1 < slot) {
 		cgc.cmd[0] = GPCMD_TEST_UNIT_READY;
 		cgc.cmd[7] = slot;
+		cgc.cmd[4] = cgc.cmd[8] = 0;
 		cdi->sanyo_slot = slot ? slot : 3;
 	}
 
@@ -953,6 +972,7 @@
 	cgc->buffer = (char *) buf;
 	cgc->buflen = len;
 	cgc->data_direction = type;
+	cgc->timeout = 5*HZ;
 }
 
 /* DVD handling */
@@ -1860,6 +1880,48 @@
 	return cdo->generic_packet(cdi, &cgc);
 }
 
+static int cdrom_do_cmd(struct cdrom_device_info *cdi,
+			struct cdrom_generic_command *cgc)
+{
+	struct request_sense *usense, sense;
+	unsigned char *ubuf;
+	int ret;
+
+	if (cgc->data_direction == CGC_DATA_UNKNOWN)
+		return -EINVAL;
+
+	if (cgc->buflen < 0 || cgc->buflen >= 131072)
+		return -EINVAL;
+
+	if ((ubuf = cgc->buffer)) {
+		cgc->buffer = kmalloc(cgc->buflen, GFP_KERNEL);
+		if (cgc->buffer == NULL)
+			return -ENOMEM;
+	}
+
+	usense = cgc->sense;
+	cgc->sense = &sense;
+	if (usense && !access_ok(VERIFY_WRITE, usense, sizeof(*usense)))
+		return -EFAULT;
+
+	if (cgc->data_direction == CGC_DATA_READ) {
+		if (!access_ok(VERIFY_READ, ubuf, cgc->buflen))
+			return -EFAULT;
+	} else if (cgc->data_direction == CGC_DATA_WRITE) {
+		if (copy_from_user(cgc->buffer, ubuf, cgc->buflen)) {
+			kfree(cgc->buffer);
+			return -EFAULT;
+		}
+	}
+
+	ret = cdi->ops->generic_packet(cdi, cgc);
+	__copy_to_user(usense, cgc->sense, sizeof(*usense));
+	if (!ret && cgc->data_direction == CGC_DATA_READ)
+		__copy_to_user(ubuf, cgc->buffer, cgc->buflen);
+	kfree(cgc->buffer);
+	return ret;
+}
+
 static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
 		     unsigned long arg)
 {		
@@ -1937,7 +1999,7 @@
 			return -EINVAL;
 
 		/* FIXME: we need upper bound checking, too!! */
-		if (lba < 0)
+		if (lba < 0 || ra.nframes <= 0)
 			return -EINVAL;
 
 		/* do max 8 frames at the time */
@@ -2117,52 +2179,11 @@
 		}
 
 	case CDROM_SEND_PACKET: {
-		__u8 *userbuf, copy = 0;
-		struct request_sense *sense;
 		if (!CDROM_CAN(CDC_GENERIC_PACKET))
 			return -ENOSYS;
 		cdinfo(CD_DO_IOCTL, "entering CDROM_SEND_PACKET\n"); 
 		IOCTL_IN(arg, struct cdrom_generic_command, cgc);
-		copy = !!cgc.buflen;
-		userbuf = cgc.buffer;
-		cgc.buffer = NULL;
-		sense = cgc.sense;
-		if (userbuf != NULL && copy) {
-			/* usually commands just copy data one way, i.e.
-			 * we send a buffer to the drive and the command
-			 * specifies whether the drive will read or
-			 * write to that buffer. usually the buffers
-			 * are very small, so we don't loose that much
-			 * by doing a redundant copy each time. */
-			if (!access_ok(VERIFY_WRITE, userbuf, cgc.buflen)) {
-				printk("can't get write perms\n");
-				return -EFAULT;
-			}
-			if (!access_ok(VERIFY_READ, userbuf, cgc.buflen)) {
-				printk("can't get read perms\n");
-				return -EFAULT;
-			}
-		}
-		/* reasonable limits */
-		if (cgc.buflen < 0 || cgc.buflen > 131072) {
-			printk("invalid size given\n");
-			return -EINVAL;
-		}
-		if (copy) {
-			cgc.buffer = kmalloc(cgc.buflen, GFP_KERNEL);
-			if (cgc.buffer == NULL)
-				return -ENOMEM;
-			__copy_from_user(cgc.buffer, userbuf, cgc.buflen);
-		}
-		ret = cdo->generic_packet(cdi, &cgc);
-		if (copy && !ret)
-			__copy_to_user(userbuf, cgc.buffer, cgc.buflen);
-		/* copy back sense data */
-		if (sense != NULL)
-			if (copy_to_user(sense, cgc.sense, sizeof(struct request_sense)))
-				ret = -EFAULT;
-		kfree(cgc.buffer);
-		return ret;
+		return cdrom_do_cmd(cdi, &cgc);
 		}
 	case CDROM_NEXT_WRITABLE: {
 		long next = 0;
@@ -2199,6 +2220,7 @@
 	cgc.cmd[4] = (track & 0xff00) >> 8;
 	cgc.cmd[5] = track & 0xff;
 	cgc.cmd[8] = 8;
+	cgc.quiet = 1;
 
 	if ((ret = cdo->generic_packet(cdi, &cgc)))
 		return ret;
@@ -2220,6 +2242,7 @@
 	init_cdrom_command(&cgc, di, sizeof(*di), CGC_DATA_READ);
 	cgc.cmd[0] = GPCMD_READ_DISC_INFO;
 	cgc.cmd[8] = cgc.buflen = 2;
+	cgc.quiet = 1;
 
 	if ((ret = cdo->generic_packet(cdi, &cgc)))
 		return ret;
@@ -2252,9 +2275,6 @@
 	if (!CDROM_CAN(CDC_GENERIC_PACKET))
 		goto use_toc;
 
-	if (!CDROM_CAN(CDC_CD_R | CDC_CD_RW | CDC_DVD_R | CDC_DVD_RAM))
-		goto use_toc;
-
 	if ((ret = cdrom_get_disc_info(dev, &di)))
 		goto use_toc;
 
@@ -2556,12 +2576,13 @@
 	{0}
 	};
 
+#ifdef CONFIG_PROC_FS
 /* Make sure that /proc/sys/dev is there */
 ctl_table cdrom_root_table[] = {
 	{CTL_DEV, "dev", NULL, 0, 0555, cdrom_cdrom_table},
 	{0}
 	};
-
+#endif /* CONFIG_PROC_FS */
 static struct ctl_table_header *cdrom_sysctl_header;
 
 static void cdrom_sysctl_register(void)
@@ -2572,9 +2593,8 @@
 		return;
 
 	cdrom_sysctl_header = register_sysctl_table(cdrom_root_table, 1);
-#ifdef CONFIG_PROC_FS
 	cdrom_root_table->child->de->owner = THIS_MODULE;
-#endif /* CONFIG_PROC_FS */
+
 	/* set the defaults */
 	cdrom_sysctl_settings.autoclose = autoclose;
 	cdrom_sysctl_settings.autoeject = autoeject;
drivers/ide/ide-cd.c renamed from opt/kernel/linux-2.4.0-test11-pre2/drivers/ide/ide-cd.c +84 -54

277 lines not on this page · raw message

drivers/ide/ide-cd.h renamed from opt/kernel/linux-2.4.0-test11-pre2/drivers/ide/ide-cd.h +4 -2
diff -ur --exclude-from /home/axboe/cdrom/exclude /opt/kernel/linux-2.4.0-test11-pre2/drivers/ide/ide-cd.h linux/drivers/ide/ide-cd.h
@@ -106,6 +106,7 @@
 	int buflen;
 	int stat;
 	int quiet;
+	int timeout;
 	struct request_sense *sense;
 	unsigned char c[12];
 };
@@ -628,7 +629,9 @@
 	  "Logical unit not ready - in progress [sic] of becoming ready" },
 	{ 0x020402, "Logical unit not ready - initializing command required" },
 	{ 0x020403, "Logical unit not ready - manual intervention required" },
-	{ 0x020404, "In process of becoming ready - writing" },
+	{ 0x020404, "Logical unit not ready - format in progress" },
+	{ 0x020407, "Logical unit not ready - operation in progress" },
+	{ 0x020408, "Logical unit not ready - long write in progress" },
 	{ 0x020600, "No reference position found (media may be upside down)" },
 	{ 0x023000, "Incompatible medium installed" },
 	{ 0x023a00, "Medium not present" },
@@ -678,7 +681,6 @@
 	{ 0x04b600, "Media load mechanism failed" },
 	{ 0x051a00, "Parameter list length error" },
 	{ 0x052000, "Invalid command operation code" },
-	{ 0x052c00, "Command sequence error" },
 	{ 0x052100, "Logical block address out of range" },
 	{ 0x052102, "Invalid address for write" },
 	{ 0x052400, "Invalid field in command packet" },
drivers/scsi/constants.c renamed from opt/kernel/linux-2.4.0-test11-pre2/drivers/scsi/constants.c +1 -1
diff -ur --exclude-from /home/axboe/cdrom/exclude /opt/kernel/linux-2.4.0-test11-pre2/drivers/scsi/constants.c linux/drivers/scsi/constants.c
@@ -776,7 +776,7 @@
 	    printk("%s%s: sns = %2x %2x\n", devclass,
 	      kdevname(dev), sense_buffer[0], sense_buffer[2]);
 	
-	printk("Non-extended sense class %d code 0x%0x ", sense_class, code);
+	printk("Non-extended sense class %d code 0x%0x\n", sense_class, code);
 	s = 4;
     }
     
drivers/scsi/sr.c renamed from opt/kernel/linux-2.4.0-test11-pre2/drivers/scsi/sr.c +2 -43

62 lines not on this page · raw message

drivers/scsi/sr.h renamed from opt/kernel/linux-2.4.0-test11-pre2/drivers/scsi/sr.h +1 -1
diff -ur --exclude-from /home/axboe/cdrom/exclude /opt/kernel/linux-2.4.0-test11-pre2/drivers/scsi/sr.h linux/drivers/scsi/sr.h
@@ -36,7 +36,7 @@
 
 extern Scsi_CD *scsi_CDs;
 
-int sr_do_ioctl(int, unsigned char *, void *, unsigned, int, int);
+int sr_do_ioctl(int, unsigned char *, void *, unsigned, int, int, struct request_sense *);
 
 int sr_lock_door(struct cdrom_device_info *, int);
 int sr_tray_move(struct cdrom_device_info *, int);
drivers/scsi/sr_ioctl.c renamed from opt/kernel/linux-2.4.0-test11-pre2/drivers/scsi/sr_ioctl.c +14 -11
diff -ur --exclude-from /home/axboe/cdrom/exclude /opt/kernel/linux-2.4.0-test11-pre2/drivers/scsi/sr_ioctl.c linux/drivers/scsi/sr_ioctl.c
@@ -34,7 +34,7 @@
    error code is.  Normally the UNIT_ATTENTION code will automatically
    clear after one error */
 
-int sr_do_ioctl(int target, unsigned char *sr_cmd, void *buffer, unsigned buflength, int quiet, int readwrite)
+int sr_do_ioctl(int target, unsigned char *sr_cmd, void *buffer, unsigned buflength, int quiet, int readwrite, struct request_sense *sense)
 {
 	Scsi_Request *SRpnt;
 	Scsi_Device *SDev;
@@ -132,7 +132,10 @@
 			err = -EIO;
 		}
 	}
-	result = SRpnt->sr_result;
+
+	if (sense)
+		memcpy(sense, SRpnt->sr_sense_buffer, sizeof(*sense));
+
 	/* Wake up a process waiting for device */
 	scsi_release_request(SRpnt);
 	SRpnt = NULL;
@@ -149,7 +152,7 @@
 	sr_cmd[0] = GPCMD_TEST_UNIT_READY;
 	sr_cmd[1] = ((scsi_CDs[minor].device->lun) << 5);
 	sr_cmd[2] = sr_cmd[3] = sr_cmd[4] = sr_cmd[5] = 0;
-	return sr_do_ioctl(minor, sr_cmd, NULL, 0, 1, SCSI_DATA_NONE);
+	return sr_do_ioctl(minor, sr_cmd, NULL, 0, 1, SCSI_DATA_NONE, NULL);
 }
 
 int sr_tray_move(struct cdrom_device_info *cdi, int pos)
@@ -161,7 +164,7 @@
 	sr_cmd[2] = sr_cmd[3] = sr_cmd[5] = 0;
 	sr_cmd[4] = (pos == 0) ? 0x03 /* close */ : 0x02 /* eject */ ;
 
-	return sr_do_ioctl(MINOR(cdi->dev), sr_cmd, NULL, 0, 0, SCSI_DATA_NONE);
+	return sr_do_ioctl(MINOR(cdi->dev), sr_cmd, NULL, 0, 0, SCSI_DATA_NONE, NULL);
 }
 
 int sr_lock_door(struct cdrom_device_info *cdi, int lock)
@@ -238,7 +241,7 @@
 	sr_cmd[8] = 24;
 	sr_cmd[9] = 0;
 
-	result = sr_do_ioctl(MINOR(cdi->dev), sr_cmd, buffer, 24, 0, SCSI_DATA_READ);
+	result = sr_do_ioctl(MINOR(cdi->dev), sr_cmd, buffer, 24, 0, SCSI_DATA_READ, NULL);
 
 	memcpy(mcn->medium_catalog_number, buffer + 9, 13);
 	mcn->medium_catalog_number[13] = 0;
@@ -267,7 +270,7 @@
 	sr_cmd[2] = (speed >> 8) & 0xff;	/* MSB for speed (in kbytes/sec) */
 	sr_cmd[3] = speed & 0xff;	/* LSB */
 
-	if (sr_do_ioctl(MINOR(cdi->dev), sr_cmd, NULL, 0, 0, SCSI_DATA_NONE))
+	if (sr_do_ioctl(MINOR(cdi->dev), sr_cmd, NULL, 0, 0, SCSI_DATA_NONE, NULL))
 		return -EIO;
 	return 0;
 }
@@ -296,7 +299,7 @@
 			sr_cmd[2] = sr_cmd[3] = sr_cmd[4] = sr_cmd[5] = 0;
 			sr_cmd[8] = 12;		/* LSB of length */
 
-			result = sr_do_ioctl(target, sr_cmd, buffer, 12, 1, SCSI_DATA_READ);
+			result = sr_do_ioctl(target, sr_cmd, buffer, 12, 1, SCSI_DATA_READ, NULL);
 
 			tochdr->cdth_trk0 = buffer[2];
 			tochdr->cdth_trk1 = buffer[3];
@@ -315,7 +318,7 @@
 			sr_cmd[6] = tocentry->cdte_track;
 			sr_cmd[8] = 12;		/* LSB of length */
 
-			result = sr_do_ioctl(target, sr_cmd, buffer, 12, 0, SCSI_DATA_READ);
+			result = sr_do_ioctl(target, sr_cmd, buffer, 12, 0, SCSI_DATA_READ, NULL);
 
 			tocentry->cdte_ctrl = buffer[5] & 0xf;
 			tocentry->cdte_adr = buffer[5] >> 4;
@@ -341,7 +344,7 @@
 		sr_cmd[7] = ti->cdti_trk1;
 		sr_cmd[8] = ti->cdti_ind1;
 
-		result = sr_do_ioctl(target, sr_cmd, NULL, 255, 0, SCSI_DATA_NONE);
+		result = sr_do_ioctl(target, sr_cmd, NULL, 0, 0, SCSI_DATA_NONE, NULL);
 		break;
 	}
 
@@ -402,7 +405,7 @@
 		cmd[9] = 0x10;
 		break;
 	}
-	return sr_do_ioctl(minor, cmd, dest, blksize, 0, SCSI_DATA_READ);
+	return sr_do_ioctl(minor, cmd, dest, blksize, 0, SCSI_DATA_READ, NULL);
 }
 
 /*
@@ -440,7 +443,7 @@
 	cmd[4] = (unsigned char) (lba >> 8) & 0xff;
 	cmd[5] = (unsigned char) lba & 0xff;
 	cmd[8] = 1;
-	rc = sr_do_ioctl(minor, cmd, dest, blksize, 0, SCSI_DATA_READ);
+	rc = sr_do_ioctl(minor, cmd, dest, blksize, 0, SCSI_DATA_READ, NULL);
 
 	return rc;
 }
drivers/scsi/sr_vendor.c renamed from opt/kernel/linux-2.4.0-test11-pre2/drivers/scsi/sr_vendor.c +6 -6
diff -ur --exclude-from /home/axboe/cdrom/exclude /opt/kernel/linux-2.4.0-test11-pre2/drivers/scsi/sr_vendor.c linux/drivers/scsi/sr_vendor.c
@@ -132,7 +132,7 @@
 	modesel->density = density;
 	modesel->block_length_med = (blocklength >> 8) & 0xff;
 	modesel->block_length_lo = blocklength & 0xff;
-	if (0 == (rc = sr_do_ioctl(minor, cmd, buffer, sizeof(*modesel), 0, SCSI_DATA_WRITE))) {
+	if (0 == (rc = sr_do_ioctl(minor, cmd, buffer, sizeof(*modesel), 0, SCSI_DATA_WRITE, NULL))) {
 		scsi_CDs[minor].device->sector_size = blocklength;
 	}
 #ifdef DEBUG
@@ -176,7 +176,7 @@
 		cmd[1] = (scsi_CDs[minor].device->lun << 5);
 		cmd[8] = 12;
 		cmd[9] = 0x40;
-		rc = sr_do_ioctl(minor, cmd, buffer, 12, 1, SCSI_DATA_READ);
+		rc = sr_do_ioctl(minor, cmd, buffer, 12, 1, SCSI_DATA_READ, NULL);
 		if (rc != 0)
 			break;
 		if ((buffer[0] << 8) + buffer[1] < 0x0a) {
@@ -200,7 +200,7 @@
 			cmd[0] = 0xde;
 			cmd[1] = (scsi_CDs[minor].device->lun << 5) | 0x03;
 			cmd[2] = 0xb0;
-			rc = sr_do_ioctl(minor, cmd, buffer, 0x16, 1, SCSI_DATA_READ);
+			rc = sr_do_ioctl(minor, cmd, buffer, 0x16, 1, SCSI_DATA_READ, NULL);
 			if (rc != 0)
 				break;
 			if (buffer[14] != 0 && buffer[14] != 0xb0) {
@@ -224,7 +224,7 @@
 			memset(cmd, 0, MAX_COMMAND_SIZE);
 			cmd[0] = 0xc7;
 			cmd[1] = (scsi_CDs[minor].device->lun << 5) | 3;
-			rc = sr_do_ioctl(minor, cmd, buffer, 4, 1, SCSI_DATA_READ);
+			rc = sr_do_ioctl(minor, cmd, buffer, 4, 1, SCSI_DATA_READ, NULL);
 			if (rc == -EINVAL) {
 				printk(KERN_INFO "sr%d: Hmm, seems the drive "
 				       "doesn't support multisession CD's\n", minor);
@@ -249,7 +249,7 @@
 		cmd[1] = (scsi_CDs[minor].device->lun << 5);
 		cmd[8] = 0x04;
 		cmd[9] = 0x40;
-		rc = sr_do_ioctl(minor, cmd, buffer, 0x04, 1, SCSI_DATA_READ);
+		rc = sr_do_ioctl(minor, cmd, buffer, 0x04, 1, SCSI_DATA_READ, NULL);
 		if (rc != 0) {
 			break;
 		}
@@ -263,7 +263,7 @@
 		cmd[6] = rc & 0x7f;	/* number of last session */
 		cmd[8] = 0x0c;
 		cmd[9] = 0x40;
-		rc = sr_do_ioctl(minor, cmd, buffer, 12, 1, SCSI_DATA_READ);
+		rc = sr_do_ioctl(minor, cmd, buffer, 12, 1, SCSI_DATA_READ, NULL);
 		if (rc != 0) {
 			break;
 		}
include/linux/cdrom.h renamed from opt/kernel/linux-2.4.0-test11-pre2/include/linux/cdrom.h +3 -1
diff -ur --exclude-from /home/axboe/cdrom/exclude /opt/kernel/linux-2.4.0-test11-pre2/include/linux/cdrom.h linux/include/linux/cdrom.h
@@ -280,7 +280,9 @@
 	int			stat;
 	struct request_sense	*sense;
 	unsigned char		data_direction;
-	void			*reserved[3];
+	int			quiet;
+	int			timeout;
+	void			*reserved[1];
 };
 
 
#2 lore raw
In reply to Bernd Nottelmann

On Saturday 11 November 2000 05:18, you wrote:

Hi Jens,

(Sorry for the delay)

Quoted 7 lines

This looks like cdrom.c:mmc_ioctl, CDROMREADAUDIO, kmalloc'ing too much memory, which triggers the BUG() in slab.c. I'm not quite sure how this is happening though, unless cdda2wav sets a negative ra.nframes (a quick browse on a version I have here shows it does not, maybe you have a different version).

Is it reproducable? If so, could you try with this patch?

Yes, it is. But unfortunately I cannot apply your patch. A --dry-run gave no errors, but when I really patched 2.4.0-test10, it came to some weird error message (patch tells me, that some files are already patched???). [Why not 2.4.0-test11p2? I use this machine for some numerical calculations which take long time runs and they are at the moment not restartable after a break. For this reasons I do not prefer pre-kernels (but I use the 2.4.0-beta series because it is more stable for my hardware than the 2.2-series).]

Bernd
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw

Success with 2.4.0-test11(-final) [was: Re: Oops with 2.4.0-test10 during ripping an audio cd with cdda2wav]

In reply to Bernd Nottelmann

On Saturday 11 November 2000 05:18, you wrote:
[...]

Quoted 8 lines

This looks like cdrom.c:mmc_ioctl, CDROMREADAUDIO, kmalloc'ing too much memory, which triggers the BUG() in slab.c. I'm not quite sure how this is happening though, unless cdda2wav sets a negative ra.nframes (a quick browse on a version I have here shows it does not, maybe you have a different version).

Is it reproducable? If so, could you try with this patch?

As I already told you, the bug was reproducible, as well in 2.4.0-test10 as in 2.4.0-test11. Today I tried it with 2.4.0-test11, the oops did happen again. After applying your patch I ripped the song again (I figured out that it was only one song, not the whole cd) and oops occured. Additionally I checked the song out and it was ok.

Bernd

PS: for unknown reasons your attached patch was included twice in the file I saved on disk from it, so it came to this weird error messages I mentioned in my last mail.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#4 lore raw

Re: Success with 2.4.0-test11(-final) [was: Re: Oops with 2.4.0-test10 during ripping an audio cd with cdda2wav]

In reply to Bernd Nottelmann
Quoted 9 lines · Bernd Nottelmann

On Saturday 11 November 2000 05:18, you wrote:
[...]

Quoted 7 lines

This looks like cdrom.c:mmc_ioctl, CDROMREADAUDIO, kmalloc'ing too much memory, which triggers the BUG() in slab.c. I'm not quite sure how this is happening though, unless cdda2wav sets a negative ra.nframes (a quick browse on a version I have here shows it does not, maybe you have a different version).

Quoted 7 lines
Quoted 1 line

Is it reproducable? If so, could you try with this patch?

As I already told you, the bug was reproducible, as well in 2.4.0-test10 as in 2.4.0-test11. Today I tried it with 2.4.0-test11, the oops did happen again. After applying your patch I ripped the song again (I figured out that it was only one song, not the whole cd) and oops occured. Additionally I checked the song out and it was ok.

Ok, can you send me the cdda2wav binary you are ripping audio with so I can test here? I'm at a loss as to why kmalloc() would be too big and not being caught.

Signature · 6 lines
* Jens Axboe <[email protected]>
* SuSE Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/