mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Jay Fenlason <fenlason@redhat.com>,
	Stefan Richter <stefanr@s5r6.in-berlin.de>
Subject: [03/18] firewire: ohci: handle receive packets with a data length of zero
Date: Wed, 16 Dec 2009 16:45:54 -0800	[thread overview]
Message-ID: <20091217004707.341234770@mini.kroah.org> (raw)
In-Reply-To: <20091217005306.GA6230@kroah.com>

2.6.27-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Jay Fenlason <fenlason@redhat.com>

commit 8c0c0cc2d9f4c523fde04bdfe41e4380dec8ee54 upstream.

Queueing to receive an ISO packet with a payload length of zero
silently does nothing in dualbuffer mode, and crashes the kernel in
packet-per-buffer mode.  Return an error in dualbuffer mode, because
the DMA controller won't let us do what we want, and work correctly in
packet-per-buffer mode.

Signed-off-by: Jay Fenlason <fenlason@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/firewire/fw-ohci.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -2146,6 +2146,13 @@ ohci_queue_iso_receive_dualbuffer(struct
 	page     = payload >> PAGE_SHIFT;
 	offset   = payload & ~PAGE_MASK;
 	rest     = p->payload_length;
+	/*
+	 * The controllers I've tested have not worked correctly when
+	 * second_req_count is zero.  Rather than do something we know won't
+	 * work, return an error
+	 */
+	if (rest == 0)
+		return -EINVAL;
 
 	/* FIXME: make packet-per-buffer/dual-buffer a context option */
 	while (rest > 0) {
@@ -2199,7 +2206,7 @@ ohci_queue_iso_receive_packet_per_buffer
 					 unsigned long payload)
 {
 	struct iso_context *ctx = container_of(base, struct iso_context, base);
-	struct descriptor *d = NULL, *pd = NULL;
+	struct descriptor *d, *pd;
 	struct fw_iso_packet *p = packet;
 	dma_addr_t d_bus, page_bus;
 	u32 z, header_z, rest;
@@ -2237,8 +2244,9 @@ ohci_queue_iso_receive_packet_per_buffer
 		d->data_address = cpu_to_le32(d_bus + (z * sizeof(*d)));
 
 		rest = payload_per_buffer;
+		pd = d;
 		for (j = 1; j < z; j++) {
-			pd = d + j;
+			pd++;
 			pd->control = cpu_to_le16(DESCRIPTOR_STATUS |
 						  DESCRIPTOR_INPUT_MORE);
 



  parent reply	other threads:[~2009-12-17  0:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-17  0:53 [00/18] 2.6.27.42-stable review Greg KH
2009-12-17  0:45 ` [01/18] signal: Fix alternate signal stack check Greg KH
2009-12-17  0:45 ` [02/18] debugfs: fix create mutex racy fops and private data Greg KH
2009-12-17  0:45 ` Greg KH [this message]
2009-12-17  0:45 ` [04/18] fuse: reject O_DIRECT flag also in fuse_create Greg KH
2009-12-17  1:36   ` David Daney
2009-12-17  4:15     ` Greg KH
2009-12-17  0:45 ` [05/18] hfs: fix a potential buffer overflow Greg KH
2009-12-17  0:45 ` [06/18] pata_hpt{37x|3x2n}: fix timing register masks (take 2) Greg KH
2009-12-17  0:45 ` [07/18] ssb: Fix range check in sprom write Greg KH
2009-12-17  0:45 ` [08/18] V4L/DVB: Fix test in copy_reg_bits() Greg KH
2009-12-17  0:46 ` [09/18] x86, apic: Enable lapic nmi watchdog on AMD Family 11h Greg KH
2009-12-17  0:46 ` [10/18] x86: ASUS P4S800 reboot=bios quirk Greg KH
2009-12-17  0:46 ` [11/18] x86, Calgary IOMMU quirk: Find nearest matching Calgary while walking up the PCI tree Greg KH
2009-12-17  0:46 ` [12/18] x86: Fix iommu=nodac parameter handling Greg KH
2009-12-17  0:46 ` [13/18] x86: GART: pci-gart_64.c: Use correct length in strncmp Greg KH
2009-12-17  0:46 ` [14/18] [IA64] fix csum_ipv6_magic() Greg KH
2009-12-17  0:46 ` [15/18] USB: fix mos7840 problem with minor numbers Greg KH
2009-12-17  0:46 ` [16/18] backlight: lcd - Fix wrong sizeof Greg KH
2009-12-17  0:46 ` [17/18] jffs2: Fix long-standing bug with symlink garbage collection Greg KH
2009-12-17  0:46 ` [18/18] matroxfb: fix problems with display stability Greg KH

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=20091217004707.341234770@mini.kroah.org \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=fenlason@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=stefanr@s5r6.in-berlin.de \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®