public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Osterlund <petero2@telia.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, Phillip Susi <psusi@cfl.rr.com>
Subject: [PATCH 1/5] pktcdvd: Fix overflow for discs with large packets
Date: 03 Feb 2006 21:16:27 +0100	[thread overview]
Message-ID: <m3bqxoci5g.fsf@telia.com> (raw)

From: Phillip Susi <psusi@cfl.rr.com>

The pktcdvd driver was using an 8 bit field to store the packet length
obtained from the disc track info.  This causes it to overflow packet
length values of 128KB or more.  I changed the field to 32 bits to fix
this.

The pktcdvd driver defaulted to its maximum allowed packet length
when it detected a 0 in the track info field.  I changed this to fail
the operation and refuse to access the media.  This seems more sane
than attempting to access it with a value that almost certainly will
not work.

Signed-off-by: Peter Osterlund <petero2@telia.com>
---

 drivers/block/pktcdvd.c |    2 +-
 include/linux/pktcdvd.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 81ad466..f0a0ad4 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -1640,7 +1640,7 @@ static int pkt_probe_settings(struct pkt
 	pd->settings.size = be32_to_cpu(ti.fixed_packet_size) << 2;
 	if (pd->settings.size == 0) {
 		printk("pktcdvd: detected zero packet size!\n");
-		pd->settings.size = 128;
+		return -ENXIO;
 	}
 	if (pd->settings.size > PACKET_MAX_SECTORS) {
 		printk("pktcdvd: packet size is too big\n");
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h
index 2c177e4..d1c9c4a 100644
--- a/include/linux/pktcdvd.h
+++ b/include/linux/pktcdvd.h
@@ -114,7 +114,7 @@ struct pkt_ctrl_command {
 
 struct packet_settings
 {
-	__u8			size;		/* packet size in (512 byte) sectors */
+	__u32			size;		/* packet size in (512 byte) sectors */
 	__u8			fp;		/* fixed packets */
 	__u8			link_loss;	/* the rest is specified
 						 * as per Mt Fuji */
-- 
Peter Osterlund - petero2@telia.com
http://web.telia.com/~u89404340

             reply	other threads:[~2006-02-03 20:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-03 20:16 Peter Osterlund [this message]
2006-02-03 20:18 ` [PATCH 2/5] pktcdvd: Remove version string Peter Osterlund
2006-02-03 20:19   ` [PATCH 3/5] Let CDROM_PKTCDVD_WCACHE depend on EXPERIMENTAL Peter Osterlund
2006-02-03 20:20     ` [PATCH 4/5] pktcdvd: Don't waste kernel memory Peter Osterlund
2006-02-03 20:21       ` [PATCH 5/5] pktcdvd: Allow larger packets Peter Osterlund
2006-02-03 20:29   ` [PATCH 2/5] pktcdvd: Remove version string Ismail Donmez
2006-02-03 20:49     ` 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=m3bqxoci5g.fsf@telia.com \
    --to=petero2@telia.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=psusi@cfl.rr.com \
    /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