diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-18 18:10:05 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-18 18:10:05 -0500 |
commit | 3ea369eea07eb64adf36a6fb7fddb5d082c84143 (patch) | |
tree | 976e44b7baf67bc1f9837ebed447e4b686ad4187 /drivers/media/pci | |
parent | a310410f616c78f24490de1274487a7b7b137d97 (diff) | |
parent | 3cdcf7369cdb3406c61090e453b78cb8d4882ef8 (diff) |
Merge branch 'topic/kbuild-fixes-for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media build fixes from Mauro Carvalho Chehab:
"A series of patches that fix compilation on non-x86 archs.
While most of them are just build fixes, there are some fixes for real
bugs, as there are a number of drivers using dynamic stack allocation.
A few of those might be considered a security risk, if the i2c-dev
module is loaded, as someone could be sending very long I2C data that
could potentially overflow the Kernel stack. Ok, as using /dev/i2c-*
devnodes usually requires root on usual distros, and exploiting it
would require a DVB board or USB stick, the risk is not high"
* 'topic/kbuild-fixes-for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (28 commits)
[media] platform drivers: Fix build on frv arch
[media] lirc_zilog: Don't use dynamic static allocation
[media] mxl111sf: Don't use dynamic static allocation
[media] af9035: Don't use dynamic static allocation
[media] af9015: Don't use dynamic static allocation
[media] dw2102: Don't use dynamic static allocation
[media] dibusb-common: Don't use dynamic static allocation
[media] cxusb: Don't use dynamic static allocation
[media] v4l2-async: Don't use dynamic static allocation
[media] cimax2: Don't use dynamic static allocation
[media] tuner-xc2028: Don't use dynamic static allocation
[media] tuners: Don't use dynamic static allocation
[media] av7110_hw: Don't use dynamic static allocation
[media] stv090x: Don't use dynamic static allocation
[media] stv0367: Don't use dynamic static allocation
[media] stb0899_drv: Don't use dynamic static allocation
[media] dvb-frontends: Don't use dynamic static allocation
[media] dvb-frontends: Don't use dynamic static allocation
[media] s5h1420: Don't use dynamic static allocation
[media] uvc/lirc_serial: Fix some warnings on parisc arch
...
Diffstat (limited to 'drivers/media/pci')
-rw-r--r-- | drivers/media/pci/cx18/cx18-driver.c | 20 | ||||
-rw-r--r-- | drivers/media/pci/cx23885/cimax2.c | 13 | ||||
-rw-r--r-- | drivers/media/pci/ttpci/av7110_hw.c | 19 | ||||
-rw-r--r-- | drivers/media/pci/zoran/Kconfig | 1 |
4 files changed, 42 insertions, 11 deletions
diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c index ff7232023f56..c1f8cc6f14b2 100644 --- a/drivers/media/pci/cx18/cx18-driver.c +++ b/drivers/media/pci/cx18/cx18-driver.c | |||
@@ -324,23 +324,24 @@ static void cx18_eeprom_dump(struct cx18 *cx, unsigned char *eedata, int len) | |||
324 | /* Hauppauge card? get values from tveeprom */ | 324 | /* Hauppauge card? get values from tveeprom */ |
325 | void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) | 325 | void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) |
326 | { | 326 | { |
327 | struct i2c_client c; | 327 | struct i2c_client *c; |
328 | u8 eedata[256]; | 328 | u8 eedata[256]; |
329 | 329 | ||
330 | memset(&c, 0, sizeof(c)); | 330 | c = kzalloc(sizeof(*c), GFP_KERNEL); |
331 | strlcpy(c.name, "cx18 tveeprom tmp", sizeof(c.name)); | 331 | |
332 | c.adapter = &cx->i2c_adap[0]; | 332 | strlcpy(c->name, "cx18 tveeprom tmp", sizeof(c->name)); |
333 | c.addr = 0xA0 >> 1; | 333 | c->adapter = &cx->i2c_adap[0]; |
334 | c->addr = 0xa0 >> 1; | ||
334 | 335 | ||
335 | memset(tv, 0, sizeof(*tv)); | 336 | memset(tv, 0, sizeof(*tv)); |
336 | if (tveeprom_read(&c, eedata, sizeof(eedata))) | 337 | if (tveeprom_read(c, eedata, sizeof(eedata))) |
337 | return; | 338 | goto ret; |
338 | 339 | ||
339 | switch (cx->card->type) { | 340 | switch (cx->card->type) { |
340 | case CX18_CARD_HVR_1600_ESMT: | 341 | case CX18_CARD_HVR_1600_ESMT: |
341 | case CX18_CARD_HVR_1600_SAMSUNG: | 342 | case CX18_CARD_HVR_1600_SAMSUNG: |
342 | case CX18_CARD_HVR_1600_S5H1411: | 343 | case CX18_CARD_HVR_1600_S5H1411: |
343 | tveeprom_hauppauge_analog(&c, tv, eedata); | 344 | tveeprom_hauppauge_analog(c, tv, eedata); |
344 | break; | 345 | break; |
345 | case CX18_CARD_YUAN_MPC718: | 346 | case CX18_CARD_YUAN_MPC718: |
346 | case CX18_CARD_GOTVIEW_PCI_DVD3: | 347 | case CX18_CARD_GOTVIEW_PCI_DVD3: |
@@ -354,6 +355,9 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) | |||
354 | cx18_eeprom_dump(cx, eedata, sizeof(eedata)); | 355 | cx18_eeprom_dump(cx, eedata, sizeof(eedata)); |
355 | break; | 356 | break; |
356 | } | 357 | } |
358 | |||
359 | ret: | ||
360 | kfree(c); | ||
357 | } | 361 | } |
358 | 362 | ||
359 | static void cx18_process_eeprom(struct cx18 *cx) | 363 | static void cx18_process_eeprom(struct cx18 *cx) |
diff --git a/drivers/media/pci/cx23885/cimax2.c b/drivers/media/pci/cx23885/cimax2.c index 7344849183a7..16fa7ea4d4aa 100644 --- a/drivers/media/pci/cx23885/cimax2.c +++ b/drivers/media/pci/cx23885/cimax2.c | |||
@@ -26,6 +26,10 @@ | |||
26 | #include "cx23885.h" | 26 | #include "cx23885.h" |
27 | #include "cimax2.h" | 27 | #include "cimax2.h" |
28 | #include "dvb_ca_en50221.h" | 28 | #include "dvb_ca_en50221.h" |
29 | |||
30 | /* Max transfer size done by I2C transfer functions */ | ||
31 | #define MAX_XFER_SIZE 64 | ||
32 | |||
29 | /**** Bit definitions for MC417_RWD and MC417_OEN registers *** | 33 | /**** Bit definitions for MC417_RWD and MC417_OEN registers *** |
30 | bits 31-16 | 34 | bits 31-16 |
31 | +-----------+ | 35 | +-----------+ |
@@ -125,7 +129,7 @@ static int netup_write_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, | |||
125 | u8 *buf, int len) | 129 | u8 *buf, int len) |
126 | { | 130 | { |
127 | int ret; | 131 | int ret; |
128 | u8 buffer[len + 1]; | 132 | u8 buffer[MAX_XFER_SIZE]; |
129 | 133 | ||
130 | struct i2c_msg msg = { | 134 | struct i2c_msg msg = { |
131 | .addr = addr, | 135 | .addr = addr, |
@@ -134,6 +138,13 @@ static int netup_write_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, | |||
134 | .len = len + 1 | 138 | .len = len + 1 |
135 | }; | 139 | }; |
136 | 140 | ||
141 | if (1 + len > sizeof(buffer)) { | ||
142 | printk(KERN_WARNING | ||
143 | "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
144 | KBUILD_MODNAME, reg, len); | ||
145 | return -EINVAL; | ||
146 | } | ||
147 | |||
137 | buffer[0] = reg; | 148 | buffer[0] = reg; |
138 | memcpy(&buffer[1], buf, len); | 149 | memcpy(&buffer[1], buf, len); |
139 | 150 | ||
diff --git a/drivers/media/pci/ttpci/av7110_hw.c b/drivers/media/pci/ttpci/av7110_hw.c index f1cbfe526989..6299d5dadb82 100644 --- a/drivers/media/pci/ttpci/av7110_hw.c +++ b/drivers/media/pci/ttpci/av7110_hw.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 | * Or, point your browser to http://www.gnu.org/copyleft/gpl.html | 23 | * Or, point your browser to http://www.gnu.org/copyleft/gpl.html |
24 | * | 24 | * |
25 | * the project's page is at http://www.linuxtv.org/ | 25 | * the project's page is at http://www.linuxtv.org/ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | /* for debugging ARM communication: */ | 28 | /* for debugging ARM communication: */ |
@@ -40,6 +40,14 @@ | |||
40 | 40 | ||
41 | #define _NOHANDSHAKE | 41 | #define _NOHANDSHAKE |
42 | 42 | ||
43 | /* | ||
44 | * Max transfer size done by av7110_fw_cmd() | ||
45 | * | ||
46 | * The maximum size passed to this function is 6 bytes. The buffer also | ||
47 | * uses two additional ones for type and size. So, 8 bytes is enough. | ||
48 | */ | ||
49 | #define MAX_XFER_SIZE 8 | ||
50 | |||
43 | /**************************************************************************** | 51 | /**************************************************************************** |
44 | * DEBI functions | 52 | * DEBI functions |
45 | ****************************************************************************/ | 53 | ****************************************************************************/ |
@@ -488,11 +496,18 @@ static int av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
488 | int av7110_fw_cmd(struct av7110 *av7110, int type, int com, int num, ...) | 496 | int av7110_fw_cmd(struct av7110 *av7110, int type, int com, int num, ...) |
489 | { | 497 | { |
490 | va_list args; | 498 | va_list args; |
491 | u16 buf[num + 2]; | 499 | u16 buf[MAX_XFER_SIZE]; |
492 | int i, ret; | 500 | int i, ret; |
493 | 501 | ||
494 | // dprintk(4, "%p\n", av7110); | 502 | // dprintk(4, "%p\n", av7110); |
495 | 503 | ||
504 | if (2 + num > sizeof(buf)) { | ||
505 | printk(KERN_WARNING | ||
506 | "%s: %s len=%d is too big!\n", | ||
507 | KBUILD_MODNAME, __func__, num); | ||
508 | return -EINVAL; | ||
509 | } | ||
510 | |||
496 | buf[0] = ((type << 8) | com); | 511 | buf[0] = ((type << 8) | com); |
497 | buf[1] = num; | 512 | buf[1] = num; |
498 | 513 | ||
diff --git a/drivers/media/pci/zoran/Kconfig b/drivers/media/pci/zoran/Kconfig index 26ca8702e33f..39ec35bd21a5 100644 --- a/drivers/media/pci/zoran/Kconfig +++ b/drivers/media/pci/zoran/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config VIDEO_ZORAN | 1 | config VIDEO_ZORAN |
2 | tristate "Zoran ZR36057/36067 Video For Linux" | 2 | tristate "Zoran ZR36057/36067 Video For Linux" |
3 | depends on PCI && I2C_ALGOBIT && VIDEO_V4L2 && VIRT_TO_BUS | 3 | depends on PCI && I2C_ALGOBIT && VIDEO_V4L2 && VIRT_TO_BUS |
4 | depends on !ALPHA | ||
4 | help | 5 | help |
5 | Say Y for support for MJPEG capture cards based on the Zoran | 6 | Say Y for support for MJPEG capture cards based on the Zoran |
6 | 36057/36067 PCI controller chipset. This includes the Iomega | 7 | 36057/36067 PCI controller chipset. This includes the Iomega |