From: Peter Osterlund <petero2@telia.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/5] Fix bogus BUG_ON in pktcdvd
Date: 11 Sep 2005 18:42:01 +0200 [thread overview]
Message-ID: <m3irx7v9nq.fsf@telia.com> (raw)
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>
---
drivers/block/pktcdvd.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
--- 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 pkt
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);
--
Peter Osterlund - petero2@telia.com
http://web.telia.com/~u89404340
next reply other threads:[~2005-09-11 16:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-11 16:42 Peter Osterlund [this message]
2005-09-11 16:43 ` [PATCH 2/5] pktcdvd documentation update Peter Osterlund
2005-09-11 16:44 ` [PATCH 3/5] pktcdvd: More accurate I/O accounting Peter Osterlund
2005-09-11 16:46 ` [PATCH 4/5] Use kcalloc and kzalloc in pktcdvd Peter Osterlund
2005-09-11 16:47 ` [PATCH 5/5] pktcdvd: BUG_ON cleanups Peter Osterlund
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=m3irx7v9nq.fsf@telia.com \
--to=petero2@telia.com \
--cc=akpm@osdl.org \
--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