Commit 4ba1d9c0 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Stefan Richter

firewire: cdev: disallow receive packets without header

In receive contexts, reject packets with header_length==0.  This would
be an instruction to queue zero packets which would not make sense.

This prevents a division by zero in the OHCI driver.
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent fe43d6d9
...@@ -968,7 +968,8 @@ static int ioctl_queue_iso(struct client *client, union ioctl_arg *arg) ...@@ -968,7 +968,8 @@ static int ioctl_queue_iso(struct client *client, union ioctl_arg *arg)
if (ctx->header_size == 0) { if (ctx->header_size == 0) {
if (u.packet.header_length > 0) if (u.packet.header_length > 0)
return -EINVAL; return -EINVAL;
} else if (u.packet.header_length % ctx->header_size != 0) { } else if (u.packet.header_length == 0 ||
u.packet.header_length % ctx->header_size != 0) {
return -EINVAL; return -EINVAL;
} }
header_length = 0; header_length = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment