提交 d0272e78 编写于 作者: P Peter Osterlund 提交者: Linus Torvalds

[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: NPeter Osterlund <petero2@telia.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 b9f0bd08
......@@ -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;
/*
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册