aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2010-03-31 10:26:39 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2010-04-10 10:51:13 -0400
commit4ba1d9c0c22947a9207029e7184733252e6135f1 (patch)
tree7801ca5b28bfb50a1992483ebbf86b46471b05dc
parentfe43d6d9cf59d8f8cbfdcde2018de13ffd1285c7 (diff)
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: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r--drivers/firewire/core-cdev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
index 8be720b278b7..bbb8160e2c99 100644
--- a/drivers/firewire/core-cdev.c
+++ b/drivers/firewire/core-cdev.c
@@ -968,7 +968,8 @@ static int ioctl_queue_iso(struct client *client, union ioctl_arg *arg)
968 if (ctx->header_size == 0) { 968 if (ctx->header_size == 0) {
969 if (u.packet.header_length > 0) 969 if (u.packet.header_length > 0)
970 return -EINVAL; 970 return -EINVAL;
971 } else if (u.packet.header_length % ctx->header_size != 0) { 971 } else if (u.packet.header_length == 0 ||
972 u.packet.header_length % ctx->header_size != 0) {
972 return -EINVAL; 973 return -EINVAL;
973 } 974 }
974 header_length = 0; 975 header_length = 0;