summaryrefslogtreecommitdiff
path: root/drivers/media
AgeCommit message (Collapse)Author
2017-09-14Merge branch 'work.set_fs' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs Pull more set_fs removal from Al Viro: "Christoph's 'use kernel_read and friends rather than open-coding set_fs()' series" * 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fs: unexport vfs_readv and vfs_writev fs: unexport vfs_read and vfs_write fs: unexport __vfs_read/__vfs_write lustre: switch to kernel_write gadget/f_mass_storage: stop messing with the address limit mconsole: switch to kernel_read btrfs: switch write_buf to kernel_write net/9p: switch p9_fd_read to kernel_write mm/nommu: switch do_mmap_private to kernel_read serial2002: switch serial2002_tty_write to kernel_{read/write} fs: make the buf argument to __kernel_write a void pointer fs: fix kernel_write prototype fs: fix kernel_read prototype fs: move kernel_read to fs/read_write.c fs: move kernel_write to fs/read_write.c autofs4: switch autofs4_write to __kernel_write ashmem: switch to ->read_iter
2017-09-13drivers/media/cec/cec-adap.c: fix build with gcc-4.4.4Andrew Morton
gcc-4.4.4 has issues with initialization of anonymous unions: drivers/media/cec/cec-adap.c: In function 'cec_queue_msg_fh': drivers/media/cec/cec-adap.c:184: error: unknown field 'lost_msgs' specified in initializer work around this. Fixes: 6b2bbb08747a5 ("media: cec: rework the cec event handling") Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Hans Verkuil <hans.verkuil@cisco.com> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-09-12Merge tag 'dma-mapping-4.14' of git://git.infradead.org/users/hch/dma-mappingLinus Torvalds
Pull dma-mapping updates from Christoph Hellwig: - removal of the old dma_alloc_noncoherent interface - remove unused flags to dma_declare_coherent_memory - restrict OF DMA configuration to specific physical busses - use the iommu mailing list for dma-mapping questions and patches * tag 'dma-mapping-4.14' of git://git.infradead.org/users/hch/dma-mapping: dma-coherent: fix dma_declare_coherent_memory() logic error ARM: imx: mx31moboard: Remove unused 'dma' variable dma-coherent: remove an unused variable MAINTAINERS: use the iommu list for the dma-mapping subsystem dma-coherent: remove the DMA_MEMORY_MAP and DMA_MEMORY_IO flags dma-coherent: remove the DMA_MEMORY_INCLUDES_CHILDREN flag of: restrict DMA configuration dma-mapping: remove dma_alloc_noncoherent and dma_free_noncoherent i825xx: switch to switch to dma_alloc_attrs au1000_eth: switch to dma_alloc_attrs sgiseeq: switch to dma_alloc_attrs dma-mapping: reduce dma_mapping_error inline bloat
2017-09-07Merge tag 'media/v4.14-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media updates from Mauro Carvalho Chehab: "Brazil's Independence Day pull request :-) This is one of the biggest media pull requests, with 625 patches affecting almost all parts of media (RC, DVB, V4L2, CEC, docs). This contains: - A lot of new drivers: * DVB frontends: mxl5xx, stv0910, stv6111; * camera flash: as3645a led driver; * HDMI receiver: adv748X; * camera sensor: Omnivision 6650 5M driver (ov6650); * HDMI CEC: ao-cec meson driver; * V4L2: Qualcom camss driver; * Remote controller: gpio-ir-tx, pwm-ir-tx and zx-irdec drivers. - The DDbridge DVB driver got a massive update, with makes it in sync with modern hardware from that vendor; - There's an important milestone on this series: the DVB documentation was written in 2003, but only started to be updated in 2007. It also used to contain several gaps from the time it was kept out of tree, mentioning error codes and device nodes that never existed upstream. On this series, it received a massive update: all non-deprecated digital TV APIs are now in sync with the current implementation; - Some DVB APIs that aren't used by any upstream driver got removed; - Other parts of the media documentation algo got updated, fixing some bugs on its PDF output and making it compatible with Sphinx version 1.6. As the number of hacks required to build PDF output reduced, I hope we'll have less troubles as newer versions of our documentation toolchain are released (famous last words); - As usual, lots of driver cleanups and improvements" * tag 'media/v4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (624 commits) media: leds: as3645a: add V4L2_FLASH_LED_CLASS dependency media: get rid of removed DMX_GET_CAPS and DMX_SET_SOURCE leftovers media: Revert "[media] v4l: async: make v4l2 coexist with devicetree nodes in a dt overlay" media: staging: atomisp: sh_css_calloc shall return a pointer to the allocated space media: Revert "[media] lirc_dev: remove superfluous get/put_device() calls" media: add qcom_camss.rst to v4l-drivers rst file media: dvb headers: make checkpatch happier media: dvb uapi: move frontend legacy API to another part of the book media: pixfmt-srggb12p.rst: better format the table for PDF output media: docs-rst: media: Don't use \small for V4L2_PIX_FMT_SRGGB10 documentation media: index.rst: don't write "Contents:" on PDF output media: pixfmt*.rst: replace a two dots by a comma media: vidioc-g-fmt.rst: adjust table format media: vivid.rst: add a blank line to correct ReST format media: v4l2 uapi book: get rid of driver programming's chapter media: format.rst: use the right markup for important notes media: docs-rst: cardlists: change their format to flat-tables media: em28xx-cardlist.rst: update to reflect last changes media: v4l2-event.rst: adjust table to fit on PDF output media: docs: don't show ToC for each part on PDF output ...
2017-09-05media: get rid of removed DMX_GET_CAPS and DMX_SET_SOURCE leftoversMauro Carvalho Chehab
Those two ioctls were never used within the Kernel. Still, there used to have compat32 code there (and an if #0 block at the core). Get rid of them. Fixes: 286fe1ca3fa1 ("media: dmx.h: get rid of DMX_GET_CAPS") Fixes: 13adefbe9e56 ("media: dmx.h: get rid of DMX_SET_SOURCE") Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-09-05media: Revert "[media] v4l: async: make v4l2 coexist with devicetree nodes ↵Rob Herring
in a dt overlay" This reverts commit d2180e0cf77dc7a7049671d5d57dfa0a228f83c1. The commit was flawed in that if the device_node pointers are different, then in fact a different device is present and the device node could be different in ways other than full_name. As Frank Rowand explained: "When an overlay (1) is removed, all uses and references to the nodes and properties in that overlay are no longer valid. Any driver that uses any information from the overlay _must_ stop using any data from the overlay. Any driver that is bound to a new node in the overlay _must_ unbind. Any driver that became bound to a pre-existing node that was modified by the overlay (became bound after the overlay was applied) _must_ adjust itself to account for any changes to that node when the overlay is removed. One way to do this is to unbind when notified that the overlay is about to be removed, then to re-bind after the overlay is completely removed. If an overlay (2) is subsequently applied, a node with the same full_name as from overlay (1) may exist. There is no guarantee that overlay (1) and overlay (2) are the same overlay, even if that node has the same full_name in both cases." Also, there's not sufficient overlay support in mainline to actually remove and re-apply an overlay to hit this condition as overlays can only be applied from in kernel APIs. Fixes: d2180e0cf77d ("[media] v4l: async: make v4l2 coexist with devicetree nodes in a dt overlay") Cc: Javier Martinez Canillas <javier@osg.samsung.com> Cc: Sylwester Nawrocki <s.nawrocki@samsung.com> Cc: Frank Rowand <frowand.list@gmail.com> Signed-off-by: Rob Herring <robh@kernel.org> Acked-by: Javi Merino <javi.merino@kernel.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-09-05media: Revert "[media] lirc_dev: remove superfluous get/put_device() calls"Sean Young
This reverts commit 5be2b76a9ca4ea5fd3e221114d62eeb0d78267ca. Only when the lirc device is freed, should we drop our reference to rc_dev, else we the rc_dev is freed to early. If userspace has a file descriptor open during unplug, it goes bang. ================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x7bb/0x1e10 Read of size 8 at addr ffff8801d7d61ed0 by task ir-rec/2609 -snip- mutex_lock_nested+0x1b/0x20 ? mutex_lock_nested+0x1b/0x20 rc_close.part.6+0x20/0x60 [rc_core] rc_close+0x13/0x20 [rc_core] lirc_dev_fop_close+0x62/0xd0 [lirc_dev] __fput+0x236/0x410 ? fput+0xb0/0xb0 ? do_raw_spin_trylock+0x110/0x110 ? set_rq_offline.part.70+0xa0/0xa0 ____fput+0xe/0x10 task_work_run+0x116/0x180 ? task_work_cancel+0x170/0x170 ? _raw_spin_unlock+0x27/0x40 ? switch_task_namespaces+0x5f/0x90 do_exit+0x68b/0xe80 Cc: stable@vger.kernel.org # For Kernel 4.13 Fixes: 5be2b76a9ca4 ("[media] lirc_dev: remove superfluous get/put_device() calls") Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-09-05media: dst_ca: remove CA_SET_DESCR boilerplateMauro Carvalho Chehab
This ioctl is not implemented at dst_ca driver. There's just a boilerplate code there. Remove it, as it is unlikely that anyone would implement it those days. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-09-05media: dst_ca: return a proper error code from CA errorsMauro Carvalho Chehab
Right now, on several places, the driver is returning a "-1" error to userspace, instead of a proper error code. Fix it. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-09-05media: ca.h: get rid of CA_SET_PIDMauro Carvalho Chehab
This ioctl seems to be some attempt to support a feature at the bt8xx dst_ca driver. Yet, as said there, it "needs more work". Right now, the code there is just a boilerplate. At the end of the day, no driver uses this ioctl, nor it is documented anywhere (except for "needs more work"). So, get rid of it. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-09-05media: dvb/frontend.h: move out a private internal structureMauro Carvalho Chehab
struct dtv_cmds_h is just an ancillary struct used by the dvb_frontend.c to internally store frontend commands. It doesn't belong to the userspace header, nor it is used anywhere, except inside the DVB core. So, remove it from the header. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-09-05media: dmx.h: split typedefs from structsMauro Carvalho Chehab
Using typedefs inside the Kernel is against CodingStyle, and there's no good usage here. Just like we did at frontend.h, at commit 0df289a209e0 ("[media] dvb: Get rid of typedev usage for enums"), let's keep those typedefs only to provide userspace backward compatibility. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-09-05media: ca.h: split typedefs from structsMauro Carvalho Chehab
Using typedefs inside the Kernel is against CodingStyle, and there's no good usage here. Just like we did at frontend.h, at commit 0df289a209e0 ("[media] dvb: Get rid of typedev usage for enums"), let's keep those typedefs only to provide userspace backward compatibility. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-09-04fs: fix kernel_read prototypeChristoph Hellwig
Use proper ssize_t and size_t types for the return value and count argument, move the offset last and make it an in/out argument like all other read/write helpers, and make the buf argument a void pointer to get rid of lots of casts in the callers. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-09-01dma-coherent: remove the DMA_MEMORY_MAP and DMA_MEMORY_IO flagsChristoph Hellwig
DMA_MEMORY_IO was never used in the tree, so remove it. That means there is no need for the DMA_MEMORY_MAP flag either now, so remove it as well and change dma_declare_coherent_memory to return a normal errno value. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
2017-08-31media: serial_ir: fix tx timing calculation on 32-bitSean Young
Move the calculation to where it is needed, so the result doesn't need to be stored in the device struct. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-31media: rc: gpio-ir-tx: use ktime accessor functionsSean Young
Prefer using accessor functions so we are not dependent on the ktime_t type. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-31media: rc: use ktime accessor functionsJasmin Jessich
Prefer using accessor functions so we are not dependent on the ktime_t type. Signed-off-by: Jasmin Jessich <jasmin@anw.at> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: max2175: Propagate the real error on devm_clk_get() failureFabio Estevam
When devm_clk_get() fails we should return the real error code instead of always returning -ENODEV. This allows defer probe to happen in the case the clock provider has not been enabled by the time max2175 driver gets probed. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: cx23885: Explicitly list Hauppauge model numbers of HVR-4400 and HVR-5500Matthias Schwarzott
Add two new model numbers to suppress this message in kernel log: cx23885: cx23885[0]: warning: unknown hauppauge model #121029 Add these model numbers: * Model 121019 - WinTV-HVR4400 * Model 121029 - WinTV-HVR5500 For WinTV-HVR4400 the documentation and my hardware differ: Documentation says it supports DVB-S/S2 and DVB-T, but my hardware also supports DVB-C. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: i2c: adv748x: Export I2C device table entries as module aliasesJavier Martinez Canillas
The I2C core always reports a MODALIAS of the form i2c:<foo> even if the device was registered via OF, and the driver is only exporting the OF ID table entries as module aliases. So if the driver is built as module, autoload won't work since udev/kmod won't be able to match the registered OF device with its driver module. Before this patch: $ modinfo drivers/media/i2c/adv748x/adv748x.ko | grep alias alias: of:N*T*Cadi,adv7482C* alias: of:N*T*Cadi,adv7482 alias: of:N*T*Cadi,adv7481C* alias: of:N*T*Cadi,adv7481 After this patch: modinfo drivers/media/i2c/adv748x/adv748x.ko | grep alias alias: of:N*T*Cadi,adv7482C* alias: of:N*T*Cadi,adv7482 alias: of:N*T*Cadi,adv7481C* alias: of:N*T*Cadi,adv7481 alias: i2c:adv7482 alias: i2c:adv7481 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: dw2102: make dvb_usb_device_description structures constBhumika Goyal
dvb_usb_device_description structures are only used during a copy operation. Therefore, declare them as const. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: mn88473: reset stream ID reg if no PLP givenOlli Salonen
If the PLP given is NO_STREAM_ID_FILTER (~0u) don't try to set that into the PLP register. Set PLP to 0 instead. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: mn88472: reset stream ID reg if no PLP givenOlli Salonen
If the PLP given is NO_STREAM_ID_FILTER (~0u) don't try to set that into the PLP register. Set PLP to 0 instead. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: dvb_frontend: initialize variable s with FE_NONE instead of 0Colin Ian King
GIT_AUTHOR_NAME=Colin King GIT_AUTHOR_EMAIL=colin.king@canonical.com In a previous commit, we added FE_NONE as an unknown fe_status. Initialize variable s to FE_NONE instead of the more opaque value 0. Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: dvb_frontend: ensure that inital front end status initializedColin Ian King
The fe_status variable s is not initialized meaning it can have any random garbage status. This could be problematic if fe->ops.tune is false as s is not updated by the call to fe->ops.tune() and a subsequent check on the change status will using a garbage value. Fix this by adding FE_NONE to the enum fe_status and initializing s to this. Detected by CoverityScan, CID#112887 ("Uninitialized scalar variable") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: usbvision: Improve a size determination in usbvision_alloc()Markus Elfring
Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: usbvision: Adjust eight checks for null pointersMarkus Elfring
The script “checkpatch.pl” pointed information out like the following. Comparison to NULL could be written !… Thus fix the affected source code places. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: usbvision: Delete an error message for a failed memory allocation in ↵Markus Elfring
usbvision_probe() Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: radio: make video_device constBhumika Goyal
Make these const as they are only used in a copy operation. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: dib8000: remove some bogus dead codeDan Carpenter
This function is broken. It sets the wrong front_end to NULL. But it's not used, so let's just delete it. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: dib9000: delete some unused broken codeDan Carpenter
The dib9000_remove_slave_frontend() function isn't used. I was reviewing it because my static checker claims it writes one element beyond the end of the array. That's a false positive. What it actually does is, if there are two or more front ends, then it prints a debug message to say that it removed the first one, stored in state->fe[1], and then it "removes" (scare quotes on purpose) the second one, stored in state->fe[2]. Deleting a front end from the middle is not really supported and breaks code like dib9000_release() which assumes the first NULL front end marks the end of the list. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: usbtv: make v4l2_file_operations constBhumika Goyal
Make this const as it is only stored in a const field of a video_device structure. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: cx18: make v4l2_file_operations constBhumika Goyal
Make this const as it is only stored in a const field of a video_device structure. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: usb: make video_device constBhumika Goyal
Make these const as they are only used during a copy operation. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Acked-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: pci: make video_device constBhumika Goyal
Make these const as they are either used during a copy operation or passed to a const argument of the function cx88_vdev_init. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: platform: make video_device constBhumika Goyal
Make these const as they are only used during a copy operation. Done using Coccinelle: @match disable optional_qualifier@ identifier s; @@ static struct video_device s = {...}; @ref@ position p; identifier match.s; @@ s@p @good1@ identifier match.s; expression list[3] es; position ref.p; @@ cx88_vdev_init(es,&s@p,...) @good2@ position ref.p; identifier match.s,f,c; expression e; @@ ( e = s@p | e = s@p.f | c(...,s@p.f,...) | c(...,s@p,...) ) @bad depends on !good1 && !good2@ position ref.p; identifier match.s; @@ s@p @depends on forall !bad disable optional_qualifier@ identifier match.s; @@ static + const struct video_device s; Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: au0828: fix RC_CORE dependencyArnd Bergmann
When RC_CORE is a loadable module, and au0828 is built-in including the RC support, we get a link error: drivers/media/usb/au0828/au0828-input.o: In function `au0828_get_key_au8522': au0828-input.c:(.text+0x474): undefined reference to `ir_raw_event_store' drivers/media/usb/au0828/au0828-input.o: In function `au0828_rc_register': au0828-input.c:(.text+0x7c8): undefined reference to `rc_allocate_device' au0828-input.c:(.text+0x8f8): undefined reference to `rc_register_device' This adds an additional dependency, similar to the one for em28xx, to ensure the broken configuration is never used. Fixes: 2fcfd317f66c ("[media] au0828: add support for IR on HVR-950Q") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: dib0090: fix duplicated code for different branchesGustavo A. R. Silva
Refactor code in order to avoid identical code for different branches. This issue was detected with the help of Coccinelle. Addresses-Coverity-ID: 1226795 Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: mx2_emmaprp: Check for platform_get_irq() errorFabio Estevam
platform_get_irq() may fail, so we should better check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: dvb-frontends/stv0367: remove QAM_AUTO from ddb_fe_opsDaniel Scheller
Since the cab_* codepath doesn't recognize QAM_AUTO, don't announce that it is supported when it really isn't. Fixes ie. w_scan from unconditionally using QAM_AUTO on DVB-C scans. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: mxl111sf: Fix potential null pointer dereferenceEugeniu Rosca
Reviewing the delta between cppcheck output of v4.9.39 and v4.9.40 stable updates, I stumbled on the new warning: mxl111sf.c:80: (warning) Possible null pointer dereference: rbuf Since copying state->rcvbuf into rbuf is not needed in the 'write-only' scenario (i.e. calling mxl111sf_ctrl_msg() from mxl111sf_i2c_send_data() or from mxl111sf_write_reg()), bypass memcpy() in this case. Fixes: d90b336f3f65 ("[media] mxl111sf: Fix driver to use heap allocate buffers for USB messages") Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: au0828: fix unbalanced lock/unlock in au0828_usb_probeGustavo A. R. Silva
Call mutex_unlock and free dev on failure. Reported-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: dvb-usb: Add memory free on error path in dw2102_probe()Anton Vasilyev
If dw2102_probe() fails on dvb_usb_device_init(), then memleak occurs. The patch adds deallocation to the error path. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru> Reviewed-by: Enrico Mioso <mrkiko.rs@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: dvb-frontends/stv0910: change minsymrate to 100Ksyms/sDaniel Scheller
The demodulator supports symbol rates as low as 100Ksyms/s - the demod setup in start() already handles such low symbol rates and reviewers of stv0910 equipped cards even found and tested transponders with SRs in that range. So, announce this in the fe_ops. Cc: Ralph Metzler <rjkm@metzlerbros.de> Cc: Richard Scobie <r.scobie@clear.net.nz> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: ddbridge: fix sparse warningsDaniel Scheller
Fix several drivers/media/pci/ddbridge/ddbridge-core.c: warning: symbol ... was not declared. Should it be static? drivers/media/pci/ddbridge/ddbridge-core.c: warning: Using plain integer as NULL pointer drivers/media/pci/ddbridge/ddbridge-io.h: warning: cast removes address space of expression drivers/media/pci/ddbridge/ddbridge-io.h: warning: incorrect type in argument 1 (different address spaces) at multiple places. Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: ddbridge: fix teardown/deregistration order in ddb_input_detach()Daniel Scheller
Brought to attention by Matthias Schwarzott <zzam@gentoo.org> by fixing possible use-after-free faults in some demod drivers: In ddb_input_detach(), the i2c_client is unregistered and removed before dvb frontends are unregistered and detached. While no use-after-free issue was observed so far, there is another issue with this: dvb->attached keeps track of the state of the input/output registration, and the i2c_client unregistration takes place only if everything was successful (dvb->attached == 0x31). If for some reason an error occurred during the frontend setup, that value stays at 0x20. In the following error handling and cleanup, ddb_input_detach() will skip down to that state, leaving the i2c_client registered, causing refcount issues. Fix this by moving the i2c_client deregistration down to case 0x20. Cc: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: dvb-frontends/stv0910: release lock on gate_ctrl() failureDaniel Scheller
Whenever write_reg() fails to open/close the demod's I2C gate, release the lock to avoid deadlocking situations. If I2c gate open failed, there's no need to hold a lock, and if close fails, the mutex_unlock() at the end of the function is never reached, leaving the mutex_lock in locked state, which in turn will cause potential for deadlocks. Thus, release the lock on failure. While we're touching gate_ctrl(), add some explanation about the need for locking and the shared I2C bus/gate. Cc: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: cx231xx: fix use-after-free when unregistering the i2c_client for the ↵Matthias Schwarzott
dvb demod Calling i2c_unregister_device for a demod driver destroys the frontend object. Later it is accessed by calling dvb_unregister_frontend and dvb_frontend_detach. In some cases this leads to a general protection fault with this callstack: dvb_unregister_frontend+0x25/0x50 [dvb_core] dvb_fini+0xdb/0x160 [cx231xx_dvb] cx231xx_unregister_extension+0x3d/0xb0 [cx231xx] cx231xx_dvb_unregister+0x10/0x809 [cx231xx_dvb] SyS_delete_module+0x18a/0x240 ? exit_to_usermode_loop+0x7b/0x80 entry_SYSCALL_64_fastpath+0x17/0x98 Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: cx23885: Fix use-after-free when unregistering the i2c_client for the ↵Matthias Schwarzott
dvb demod Unregistering the i2c_client of the demod driver destroys the frontend object. Calling vb2_dvb_unregister_bus later accesses the frontend (and with the refcount_t) conversion the refcount_t code complains: kernel: ------------[ cut here ]------------ kernel: WARNING: CPU: 0 PID: 7883 at lib/refcount.c:128 refcount_sub_and_test+0x70/0x80 kernel: refcount_t: underflow; use-after-free. kernel: Modules linked in: bluetooth si2165(O) a8293(O) tda10071(O) tea5767(O) tuner(O) cx23885(O-) tda18271(O) videobuf2_dvb(O) videobuf2_dma_sg(O) m88ds3103(O) tveeprom(O) cx2341x(O) v4l2_common(O) dvb_core(O) rc_core(O) videobuf2_memops(O) videobuf2_v4l2(O) ums_realtek videobuf2_core(O) uas videodev(O) media(O) rtl8192cu i2c_mux usb_storage rtl_usb rtl8192c_common rtlwifi snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core x86_pkg_temp_thermal kvm_intel kvm irqbypass kernel: CPU: 0 PID: 7883 Comm: rmmod Tainted: G W O 4.11.3-gentoo #3 kernel: Hardware name: MEDION E2050 2391/H81H3-EM2, BIOS H81EM2W08.308 08/25/2014 kernel: Call Trace: kernel: dump_stack+0x4d/0x66 kernel: __warn+0xc6/0xe0 kernel: warn_slowpath_fmt+0x46/0x50 kernel: ? kobject_put+0x2f/0x60 kernel: refcount_sub_and_test+0x70/0x80 kernel: refcount_dec_and_test+0x11/0x20 kernel: dvb_unregister_frontend+0x42/0x60 [dvb_core] kernel: vb2_dvb_dealloc_frontends+0x9e/0x100 [videobuf2_dvb] kernel: vb2_dvb_unregister_bus+0xd/0x20 [videobuf2_dvb] kernel: cx23885_dvb_unregister+0xc3/0x110 [cx23885] kernel: cx23885_dev_unregister+0xea/0x150 [cx23885] kernel: cx23885_finidev+0x4f/0x70 [cx23885] kernel: pci_device_remove+0x34/0xb0 kernel: device_release_driver_internal+0x150/0x200 kernel: driver_detach+0x33/0x70 kernel: bus_remove_driver+0x47/0xa0 kernel: driver_unregister+0x27/0x50 kernel: pci_unregister_driver+0x34/0x90 kernel: cx23885_fini+0x10/0x12 [cx23885] kernel: SyS_delete_module+0x166/0x220 kernel: ? exit_to_usermode_loop+0x7b/0x80 kernel: entry_SYSCALL_64_fastpath+0x17/0x98 kernel: RIP: 0033:0x7f5901680b07 kernel: RSP: 002b:00007ffdf6cdb028 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0 kernel: RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f5901680b07 kernel: RDX: 000000000000000a RSI: 0000000000000800 RDI: 0000000001500258 kernel: RBP: 00000000015001f0 R08: 0000000000000000 R09: 1999999999999999 kernel: R10: 0000000000000884 R11: 0000000000000206 R12: 00007ffdf6cda010 kernel: R13: 0000000000000000 R14: 00000000015001f0 R15: 00000000014ff010 kernel: ---[ end trace c3a4659b89086061 ]--- Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>