From: Alexander Griesser <tuxx@aon.at>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: "Mario 'BitKoenig' Holbe" <Mario.Holbe@RZ.TU-Ilmenau.DE>,
linux-kernel@vger.kernel.org
Subject: Re: vfat: attempt to access beyond end of device
Date: Thu, 12 Jul 2001 23:18:30 +0200 [thread overview]
Message-ID: <20010712231830.A17654@aon.at> (raw)
In-Reply-To: <20010712141653.A483@c239-1.fem.tu-ilmenau.de> <87hewi2bgh.fsf@devron.myhome.or.jp>
In-Reply-To: <87hewi2bgh.fsf@devron.myhome.or.jp>
On Fri, Jul 13, 2001 at 04:29:02AM +0900, you wrote:
> This bug will be fixed by the following change.
>
> diff -urN linux-2.4.7-pre6.orig/fs/fat/inode.c linux-2.4.7-pre6/fs/fat/inode.c
> --- linux-2.4.7-pre6.orig/fs/fat/inode.c Tue Jun 12 11:15:27 2001
> +++ linux-2.4.7-pre6/fs/fat/inode.c Fri Jul 13 04:20:04 2001
> @@ -842,7 +842,7 @@
> struct super_block *sb = inode->i_sb;
> struct buffer_head *bh;
> struct msdos_dir_entry *raw_entry;
> - int i_pos;
> + unsigned int i_pos;
>
> retry:
> i_pos = MSDOS_I(inode)->i_location;
>
>
> But, should change ino/i_location/i_pos to unsigned long in
> fat/vfat/msdos/umsdos, IMHO.
When I try to write new files on it, I get:
kernel: attempt to access beyond end of device
kernel: 16:01: rw=0, want=2081231810, limit=80035798
According to his Problewm:
Shouldn't an "int" be enough?
2^31 = 2147483648
And he "wants": 2081231810
Should do, or did I miss something?
When I was tracking down this bug, I found some maybe interesting stuff
in /usr/src/linux-2.4.6/drivers/block/ll_rw_blk.c:
void generic_make_request (int rw, struct buffer_head * bh)
{
int major = MAJOR(bh->b_rdev);
int minorsize = 0;
request_queue_t *q;
if (!bh->b_end_io)
BUG();
/* Test device size, when known. */
if (blk_size[major])
minorsize = blk_size[major][MINOR(bh->b_rdev)];
if (minorsize) {
unsigned long maxsector = (minorsize << 1) + 1;
unsigned long sector = bh->b_rsector;
unsigned int count = bh->b_size >> 9;
^^^^^
/************** Shouldn't that be long? *****************/
if (maxsector < count || maxsector - count < sector) {
/* Yecch */
bh->b_state &= (1 << BH_Lock) | (1 << BH_Mapped);
/* This may well happen - the kernel calls bread()
without checking the size of the device, e.g.,
when mounting a device. */
/************** Here's his error message ****************/
printk(KERN_INFO
"attempt to access beyond end of device\n");
printk(KERN_INFO "%s: rw=%d, want=%ld, limit=%d\n",
kdevname(bh->b_rdev), rw,
(sector + count)>>1, minorsize);
/* Yecch again */
bh->b_end_io(bh, 0);
return;
}
}
regards, alexx
PS.: Please don't flame, if this is absolutely crap ;)
--
| .-. | CCNAIA Alexander Griesser <tuxx@aon.at> | .''`. |
| /v\ | http://www.tuxx-home.at -=- ICQ:63180135 | : :' : |
| /( )\ | echo "K..?f{1,2}e[nr]böck" >>~/.score | `. `' |
| ^^ ^^ | Linux Version 2.4.6 - Debian Unstable | `- |
next prev parent reply other threads:[~2001-07-12 21:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-12 12:16 vfat: attempt to access beyond end of device Mario 'BitKoenig' Holbe
2001-07-12 19:29 ` OGAWA Hirofumi
2001-07-12 21:18 ` Alexander Griesser [this message]
2001-07-13 15:13 ` OGAWA Hirofumi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010712231830.A17654@aon.at \
--to=tuxx@aon.at \
--cc=Mario.Holbe@RZ.TU-Ilmenau.DE \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox