Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/ieee1394/linux1394-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
  firewire: ohci: handle receive packets with a data length of zero
  • Loading branch information
Linus Torvalds committed Dec 11, 2009
2 parents 880188b + 8c0c0cc commit 5f1141e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/firewire/ohci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2218,6 +2218,13 @@ static int ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base,
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) {
Expand Down Expand Up @@ -2271,7 +2278,7 @@ static int ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base,
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;
Expand Down Expand Up @@ -2309,8 +2316,9 @@ static int ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base,
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);

Expand Down

0 comments on commit 5f1141e

Please sign in to comment.