diff options
author | Alex Woods <devnull@localhost> | 2004-02-03 01:22:35 +0000 |
---|---|---|
committer | Alex Woods <devnull@localhost> | 2004-02-03 01:22:35 +0000 |
commit | 4ad2f3cc042821eff75eb63e495584c983fa48c1 (patch) | |
tree | bea5413570574c011f97399bb51e9db36e03bede | |
parent | b8652ebf107b39293f6f38fc864b346a74eaf7f0 (diff) | |
download | mediapointer-dvb-s2-4ad2f3cc042821eff75eb63e495584c983fa48c1.tar.gz mediapointer-dvb-s2-4ad2f3cc042821eff75eb63e495584c983fa48c1.tar.bz2 |
Apply patch from Oliver Neukem that fixes:
this driver does DMA to the stack via usb_bulk_msg(). The patch is against
Linus' BK tree and compiles.
-rw-r--r-- | linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 95e1e62c9..2a05108e2 100644 --- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -1,7 +1,7 @@ /* * TTUSB DEC Driver * - * Copyright (C) 2003 Alex Woods <linux-dvb@giblets.org> + * Copyright (C) 2003-2004 Alex Woods <linux-dvb@giblets.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -210,12 +210,23 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, int *result_length, u8 cmd_result[]) { int result, actual_len, i; - u8 b[COMMAND_PACKET_SIZE + 4]; - u8 c[COMMAND_PACKET_SIZE + 4]; + u8 *b; + u8 *c; dprintk("%s\n", __FUNCTION__); + b = kmalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL); + if (!b) + return -ENOMEM; + c = kmalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL); + if (!c) { + kfree(b); + return -ENOMEM; + } + if ((result = down_interruptible(&dec->usb_sem))) { + kfree(b); + kfree(c); printk("%s: Failed to down usb semaphore.\n", __FUNCTION__); return result; } @@ -236,22 +247,26 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, } result = usb_bulk_msg(dec->udev, dec->command_pipe, b, - sizeof(b), &actual_len, HZ); + COMMAND_PACKET_SIZE + 4, &actual_len, HZ); if (result) { printk("%s: command bulk message failed: error %d\n", __FUNCTION__, result); up(&dec->usb_sem); + kfree(b); + kfree(c); return result; } result = usb_bulk_msg(dec->udev, dec->result_pipe, c, - sizeof(c), &actual_len, HZ); + COMMAND_PACKET_SIZE + 4, &actual_len, HZ); if (result) { printk("%s: result bulk message failed: error %d\n", __FUNCTION__, result); up(&dec->usb_sem); + kfree(b); + kfree(c); return result; } else { if (debug) { @@ -268,6 +283,8 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, up(&dec->usb_sem); + kfree(b); + kfree(c); return 0; } } |