summaryrefslogtreecommitdiffstats
path: root/drivers/block/pktcdvd.c
diff options
context:
space:
mode:
authorPeter Osterlund <petero2@telia.com>2005-09-13 10:25:27 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-13 17:22:30 +0200
commitd0272e78eee4dc53c887fd132e9035daf037d423 (patch)
treeb17c64ef5cc44adef6879c03d09e7291887ca874 /drivers/block/pktcdvd.c
parent[PATCH] cciss: SCSI tape info for /proc (diff)
downloadlinux-d0272e78eee4dc53c887fd132e9035daf037d423.tar.xz
linux-d0272e78eee4dc53c887fd132e9035daf037d423.zip
[PATCH] pktcdvd: fix bogus BUG_ON
In the packet writing driver, if the drive reports a packet size larger than the driver can handle, bail out safely instead of triggering a BUG_ON. Signed-off-by: Peter Osterlund <petero2@telia.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/block/pktcdvd.c')
-rw-r--r--drivers/block/pktcdvd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 7b838342f0a3..58d01c820799 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -946,7 +946,6 @@ try_next_bio:
pd->current_sector = zone + pd->settings.size;
pkt->sector = zone;
pkt->frames = pd->settings.size >> 2;
- BUG_ON(pkt->frames > PACKET_MAX_SIZE);
pkt->write_size = 0;
/*
@@ -1636,6 +1635,10 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
printk("pktcdvd: detected zero packet size!\n");
pd->settings.size = 128;
}
+ if (pd->settings.size > PACKET_MAX_SECTORS) {
+ printk("pktcdvd: packet size is too big\n");
+ return -ENXIO;
+ }
pd->settings.fp = ti.fp;
pd->offset = (be32_to_cpu(ti.track_start) << 2) & (pd->settings.size - 1);