Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fdb77da4ca68ae17a39d58c9d5c00479a7e124c0
Commit:     fdb77da4ca68ae17a39d58c9d5c00479a7e124c0
Parent:     39baf8a798926eb675c9360d5822ca86ed92866e
Author:     Alan Cox <[EMAIL PROTECTED]>
AuthorDate: Sat Feb 17 02:40:20 2007 +0100
Committer:  Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
CommitDate: Sat Feb 17 02:40:20 2007 +0100

    ide-floppy: Fix unformatted media crash
    
    A ZIP or similar with unformatted media will cause crashes when attempts
    are made to read/write it in some cases. This is because bs_factor is
    zero and we divide by it causing an oops.
    
    As the size of a non-accessible/non-existant media is really a bit of a
    zen question it doesn't matter if non-existant media is 512 bytes per
    sector or zero. Setting it to 1 causes us to generate 512 bytes/sector
    accesses and error properly.
    
    Based on a fix found lurking in an ancient bugzilla entry since about 2004 
(ugghhh)
    
    Signed-off-by: Alan Cox <[EMAIL PROTECTED]>
    Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index d33717c..07fa37d 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -1433,7 +1433,8 @@ static int idefloppy_get_capacity (ide_drive_t *drive)
        
        drive->bios_cyl = 0;
        drive->bios_head = drive->bios_sect = 0;
-       floppy->blocks = floppy->bs_factor = 0;
+       floppy->blocks = 0;
+       floppy->bs_factor = 1;
        set_capacity(floppy->disk, 0);
 
        idefloppy_create_read_capacity_cmd(&pc);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to