Skip to content

Commit 49a73b1

Browse files
committed
Merge tag 'firewire-fixes-6.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394
Pull firewire fixes from Takashi Sakamoto: "Two driver fixes: - The firewire-ohci driver for 1394 OHCI hardware does not fill time stamp for response packet when handling asynchronous transaction to local destination. This brings an inconvenience that the response packet is not equivalent between the transaction to local and remote. It is fixed by fulfilling the time stamp with hardware time. The fix should be applied to Linux kernel v6.5 or later as well. - The nosy driver for Texas Instruments TSB12LV21A (PCILynx) has long-standing issue about the behaviour when user space application passes less size of buffer than expected. It is fixed by returning zero according to the convention of UNIX-like systems" * tag 'firewire-fixes-6.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394: firewire: ohci: fulfill timestamp for some local asynchronous transaction firewire: nosy: ensure user_length is taken into account when fetching packet contents
2 parents 6aed7b9 + 09773bf commit 49a73b1

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

drivers/firewire/nosy.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,12 @@ packet_buffer_get(struct client *client, char __user *data, size_t user_length)
148148
if (atomic_read(&buffer->size) == 0)
149149
return -ENODEV;
150150

151-
/* FIXME: Check length <= user_length. */
151+
length = buffer->head->length;
152+
153+
if (length > user_length)
154+
return 0;
152155

153156
end = buffer->data + buffer->capacity;
154-
length = buffer->head->length;
155157

156158
if (&buffer->head->data[length] < end) {
157159
if (copy_to_user(data, buffer->head->data, length))

drivers/firewire/ohci.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,6 +1556,8 @@ static int handle_at_packet(struct context *context,
15561556
#define HEADER_GET_DATA_LENGTH(q) (((q) >> 16) & 0xffff)
15571557
#define HEADER_GET_EXTENDED_TCODE(q) (((q) >> 0) & 0xffff)
15581558

1559+
static u32 get_cycle_time(struct fw_ohci *ohci);
1560+
15591561
static void handle_local_rom(struct fw_ohci *ohci,
15601562
struct fw_packet *packet, u32 csr)
15611563
{
@@ -1580,6 +1582,8 @@ static void handle_local_rom(struct fw_ohci *ohci,
15801582
(void *) ohci->config_rom + i, length);
15811583
}
15821584

1585+
// Timestamping on behalf of the hardware.
1586+
response.timestamp = cycle_time_to_ohci_tstamp(get_cycle_time(ohci));
15831587
fw_core_handle_response(&ohci->card, &response);
15841588
}
15851589

@@ -1628,6 +1632,8 @@ static void handle_local_lock(struct fw_ohci *ohci,
16281632
fw_fill_response(&response, packet->header, RCODE_BUSY, NULL, 0);
16291633

16301634
out:
1635+
// Timestamping on behalf of the hardware.
1636+
response.timestamp = cycle_time_to_ohci_tstamp(get_cycle_time(ohci));
16311637
fw_core_handle_response(&ohci->card, &response);
16321638
}
16331639

@@ -1670,8 +1676,6 @@ static void handle_local_request(struct context *ctx, struct fw_packet *packet)
16701676
}
16711677
}
16721678

1673-
static u32 get_cycle_time(struct fw_ohci *ohci);
1674-
16751679
static void at_context_transmit(struct context *ctx, struct fw_packet *packet)
16761680
{
16771681
unsigned long flags;

0 commit comments

Comments
 (0)