Skip to content

Commit

Permalink
[PATCH] pktcdvd: fix bogus BUG_ON
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Osterlund authored and Linus Torvalds committed Sep 13, 2005
1 parent b9f0bd0 commit d0272e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/block/pktcdvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,6 @@ static int pkt_handle_queue(struct pktcdvd_device *pd)
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;

/*
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit d0272e7

Please sign in to comment.