mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
firewire: ohci: handle receive packets with a data length of zero
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> Cc: stable@kernel.org
This commit is contained in:
parent
af0940dac3
commit
8c0c0cc2d9
1 changed files with 10 additions and 2 deletions
|
@ -2189,6 +2189,13 @@ static int ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base,
|
||||||
page = payload >> PAGE_SHIFT;
|
page = payload >> PAGE_SHIFT;
|
||||||
offset = payload & ~PAGE_MASK;
|
offset = payload & ~PAGE_MASK;
|
||||||
rest = p->payload_length;
|
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 */
|
/* FIXME: make packet-per-buffer/dual-buffer a context option */
|
||||||
while (rest > 0) {
|
while (rest > 0) {
|
||||||
|
@ -2242,7 +2249,7 @@ static int ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base,
|
||||||
unsigned long payload)
|
unsigned long payload)
|
||||||
{
|
{
|
||||||
struct iso_context *ctx = container_of(base, struct iso_context, base);
|
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;
|
struct fw_iso_packet *p = packet;
|
||||||
dma_addr_t d_bus, page_bus;
|
dma_addr_t d_bus, page_bus;
|
||||||
u32 z, header_z, rest;
|
u32 z, header_z, rest;
|
||||||
|
@ -2280,8 +2287,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)));
|
d->data_address = cpu_to_le32(d_bus + (z * sizeof(*d)));
|
||||||
|
|
||||||
rest = payload_per_buffer;
|
rest = payload_per_buffer;
|
||||||
|
pd = d;
|
||||||
for (j = 1; j < z; j++) {
|
for (j = 1; j < z; j++) {
|
||||||
pd = d + j;
|
pd++;
|
||||||
pd->control = cpu_to_le16(DESCRIPTOR_STATUS |
|
pd->control = cpu_to_le16(DESCRIPTOR_STATUS |
|
||||||
DESCRIPTOR_INPUT_MORE);
|
DESCRIPTOR_INPUT_MORE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue