Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sat, 26 Jan 2002 02:06:23 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sat, 26 Jan 2002 02:06:14 -0500 Received: from netfinity.realnet.co.sz ([196.28.7.2]:19879 "HELO netfinity.realnet.co.sz") by vger.kernel.org with SMTP id ; Sat, 26 Jan 2002 02:05:53 -0500 Date: Sat, 26 Jan 2002 09:01:52 +0200 (SAST) From: Zwane Mwaikambo X-X-Sender: zwane@netfinity.realnet.co.sz To: Linus Torvalds Cc: Marcelo Tosatti , Linux Kernel , Dave Jones , Alexander Viro Subject: [PATCH] Oops on mounting CD as UFS Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hi Marcelo, Dave, Linus, Al This definately falls under the "Don't do that" category, but my box oopsed when i tried to mount a cd as UFS (You don't really wanna hear the details). It happened to me initially on my main box (2.4.18-pre3), so i reproduced the oops on my 2.5.2-pre3 test box. This, gentlemen, is the tale of a wandering hobo called sb->s_blocksize and his short-lived foray into the linux kernel fs/ufs/super.c ufs_read_super() { again: sb_set_blocksize(sb, block_size); <== [1] ubh = ubh_bread_uspi (uspi, sb,... [...] [1] We should have checked the return value! fs/ufs/util.c ubh_bread_uspi () { if (!(USPI_UBH->bh[i] = sb_bread(sb, fragment + i))); include/linux/fs.h sb_bread(struct super_block *sb, int block) { return __bread(sb->s_bdev, block, sb->s_blocksize); } fs/buffer.c struct buffer_head * __bread(struct block_device *bdev, int block, int size) { struct buffer_head * bh = __getblk(bdev, block, size); struct buffer_head * __getblk(struct block_device *bdev, sector_t block, int size) { if (!grow_buffers(bdev, block, size)) <== static int grow_buffers(struct block_device *bdev, unsigned long block, int size) { /* Size must be within 512 bytes and PAGE_SIZE */ if (size < 512 || size > PAGE_SIZE) BUG(); <== *Tadow* size is 0, hobo dude dies here Patch for 2.5.3-pre5 --- linux-2.5.3-pre5/fs/ufs/super.c.orig Sat Jan 26 08:41:33 2002 +++ linux-2.5.3-pre5/fs/ufs/super.c Sat Jan 26 08:42:51 2002 @@ -597,7 +597,10 @@ } again: - sb_set_blocksize(sb, block_size); + if (!sb_set_blocksize(sb, block_size)) { + printk(KERN_ERR "UFS: failed to set blocksize\n"); + goto failed; + } /* * read ufs super block from device Patch for 2.4.18-pre7 --- linux-2.4.18-pre7/fs/ufs/super.c.orig Sat Jan 26 08:52:35 2002 +++ linux-2.4.18-pre7/fs/ufs/super.c Sat Jan 26 08:53:18 2002 @@ -597,7 +597,11 @@ } again: - set_blocksize (sb->s_dev, block_size); + if (!set_blocksize (sb->s_dev, block_size)) { + printk(KERN_ERR "UFS: failed to set blocksize\n"); + goto failed; + } + sb->s_blocksize = block_size; /* The Oops.. invalid operand: 0000 CPU: 0 EIP: 0010:[] Not tainted EFLAGS: 00010282 eax: 0000001d ebx: 00001640 ecx: c031eea4 edx: 00001c31 esi: 00000008 edi: 00000000 ebp: c156df18 esp: c87b1d98 ds: 0018 es: 0018 ss: 0018 Process mount (pid: 970, stackpage=c87b1000) Stack: c02eaf0f 00000894 00000000 c9a6d0c4 00000000 00003634 00000000 00000008 c156df18 00000002 c014c4f7 c156df18 00000008 00000000 00000000 00000000 c8c37a00 c014c807 c156df18 00000008 00000000 cc8d48ee c87b1dfc c037bca0 Call Trace: [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Code: 0f 0b 59 5b b9 ff ff ff ff 89 f6 8d bc 27 00 00 00 00 41 89 >>EIP; c014e51e <===== Trace; c014c4f7 <__getblk+27/40> Trace; c014c807 <__bread+17/80> Trace; cc8d48ee <[ufs]ufs_parse_options+29e/2c0> Trace; c0209584 Trace; cc8d726d <[ufs]ubh_bread_uspi+5d/c0> Trace; c011a44b <__wake_up+7b/e0> Trace; cc8d50ee <[ufs]ufs_read_super+39e/e80> Trace; c01ea216 Trace; c01ea234 Trace; c01529be Trace; c015119b Trace; cc8da24c <[ufs]ufs_fs_type+0/34> Trace; c015146b Trace; cc8da24c <[ufs]ufs_fs_type+0/34> Trace; c0167f96 Trace; c01185a0 Trace; c01091dc Trace; c016825b Trace; c01680ac Trace; c01688bf Trace; c01090eb Code; c014e51e 00000000 <_EIP>: Code; c014e51e <===== 0: 0f 0b ud2a <===== Code; c014e520 2: 59 pop %ecx Code; c014e521 3: 5b pop %ebx Code; c014e522 4: b9 ff ff ff ff mov $0xffffffff,%ecx Code; c014e527 9: 89 f6 mov %esi,%esi Code; c014e529 b: 8d bc 27 00 00 00 00 lea 0x0(%edi,1),%edi Code; c014e530 12: 41 inc %ecx Code; c014e531 13: 89 00 mov %eax,(%eax) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/