18 Apr, 2019

4 commits

  • This patch revert commit 01154ef5820a ("media: v4l2-common: get rid of
    v4l2_routing dead struct") to fix the compilation warnings.

    In file included from drivers/media/platform/mxc/capture/mxc_v4l2_capture.c:42:
    drivers/media/platform/mxc/capture/v4l2-int-device.h:294:44: warning: ‘struct v4l2_routing’ declared inside parameter list will not be visible outside of this definition or declaration
    V4L2_INT_WRAPPER_1(s_video_routing, struct v4l2_routing, *);
    ^~~~~~~~~~~~
    drivers/media/platform/mxc/capture/v4l2-int-device.h:261:10: note: in definition of macro ‘V4L2_INT_WRAPPER_1’
    arg_type asterisk arg) \
    ^~~~~~~~
    drivers/media/platform/mxc/capture/v4l2-int-device.h:294:44: warning: ‘struct v4l2_routing’ declared inside parameter list will not be visible outside of this definition or declaration
    V4L2_INT_WRAPPER_1(s_video_routing, struct v4l2_routing, *);
    ^~~~~~~~~~~~
    drivers/media/platform/mxc/capture/v4l2-int-device.h:270:5: note: in definition of macro ‘V4L2_INT_WRAPPER_1’
    arg_type asterisk)) \
    ^~~~~~~~

    Signed-off-by: Vipul Kumar

    Vipul Kumar
     
  • This patch reverts commit 8180b4f4f589 ("media: v4l2-subdev.h: remove
    obsolete g/s_parm") to fix the compilation errors.

    drivers/media/platform/mxc/subdev/mx6s_capture.c: In function ‘mx6s_vidioc_g_parm’:
    ./include/media/v4l2-subdev.h:1097:42: error: ‘const struct v4l2_subdev_video_ops’ has no member named ‘g_parm’
    else if (!((sd)->ops->o && (sd)->ops->o->f)) \
    ^~
    drivers/media/platform/mxc/subdev/mx6s_capture.c:1575:9: note: in expansion of macro ‘v4l2_subdev_call’
    return v4l2_subdev_call(sd, video, g_parm, a);
    ^~~~~~~~~~~~~~~~
    ./include/media/v4l2-subdev.h:1100:27: error: ‘const struct v4l2_subdev_video_ops’ has no member named ‘g_parm’
    __result = (sd)->ops->o->f((sd), ##args); \
    ^~
    drivers/media/platform/mxc/subdev/mx6s_capture.c:1575:9: note: in expansion of macro ‘v4l2_subdev_call’
    return v4l2_subdev_call(sd, video, g_parm, a);
    ^~~~~~~~~~~~~~~~
    drivers/media/platform/mxc/subdev/mx6s_capture.c: In function ‘mx6s_vidioc_s_parm’:
    ./include/media/v4l2-subdev.h:1097:42: error: ‘const struct v4l2_subdev_video_ops’ has no member named ‘s_parm’
    else if (!((sd)->ops->o && (sd)->ops->o->f)) \
    ^~
    drivers/media/platform/mxc/subdev/mx6s_capture.c:1584:9: note: in expansion of macro ‘v4l2_subdev_call’
    return v4l2_subdev_call(sd, video, s_parm, a);
    ^~~~~~~~~~~~~~~~
    ./include/media/v4l2-subdev.h:1100:27: error: ‘const struct v4l2_subdev_video_ops’ has no member named ‘s_parm’
    __result = (sd)->ops->o->f((sd), ##args); \
    ^~
    drivers/media/platform/mxc/subdev/mx6s_capture.c:1584:9: note: in expansion of macro ‘v4l2_subdev_call’
    return v4l2_subdev_call(sd, video, s_parm, a);

    Signed-off-by: Vipul Kumar

    Vipul Kumar
     
  • This reverts commit 5cf6f7f327c95f09be859889be39e78950516556.

    (Vipul: Fixed merge conflicts)

    Signed-off-by: Vipul Kumar

    Sandor Yu
     
  • This reverts commit b71c99801e18eb172ae34851daf25044a3bf644a.

    Signed-off-by: Oliver Brown
    (cherry picked from commit 5c74966c0e7deb0ac84b3fa8a84c6c942e7d434f)

    Conflicts:
    drivers/media/v4l2-core/v4l2-compat-ioctl32.c
    include/media/v4l2-subdev.h
    (Vipul: Fixed merge conflicts)
    Signed-off-by: Vipul Kumar

    Oliver Brown
     

10 Jan, 2019

1 commit

  • commit 32804fcb612bf867034a093f459415e485cf044b upstream.

    I noticed that repeatedly running 'cec-ctl --playback' would occasionally
    select 'Playback Device 2' instead of 'Playback Device 1', even though there
    were no other Playback devices in the HDMI topology. This happened both with
    'real' hardware and with the vivid CEC emulation, suggesting that this was an
    issue in the core code that claims a logical address.

    What 'cec-ctl --playback' does is to first clear all existing logical addresses,
    and immediately after that configure the new desired device type.

    The core code will poll the logical addresses trying to find a free address.
    When found it will issue a few standard messages as per the CEC spec and return.
    Those messages are queued up and will be transmitted asynchronously.

    What happens is that if you run two 'cec-ctl --playback' commands in quick
    succession, there is still a message of the first cec-ctl command being transmitted
    when you reconfigure the adapter again in the second cec-ctl command.

    When the logical addresses are cleared, then all information about outstanding
    transmits inside the CEC core is also cleared, and the core is no longer aware
    that there is still a transmit in flight.

    When the hardware finishes the transmit it calls transmit_done and the CEC core
    thinks it is actually in response of a POLL messages that is trying to find a
    free logical address. The result of all this is that the core thinks that the
    logical address for Playback Device 1 is in use, when it is really an earlier
    transmit that ended.

    The main transmit thread looks at adap->transmitting to check if a transmit
    is in progress, but that is set to NULL when the adapter is unconfigured.
    adap->transmitting represents the view of userspace, not that of the hardware.
    So when unconfiguring the adapter the message is marked aborted from the point
    of view of userspace, but seen from the PoV of the hardware it is still ongoing.

    So introduce a new bool transmit_in_progress that represents the hardware state
    and use that instead of adap->transmitting. Now the CEC core waits until the
    hardware finishes the transmit before starting a new transmit.

    Signed-off-by: Hans Verkuil
    Cc: # for v4.18 and up
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Hans Verkuil
     

14 Nov, 2018

2 commits

  • commit 7d867a1b765e2b70815fec4964d7822a976ed349 upstream.

    The calculation of the Signal Free Time in the framework was not
    correct. If a message was received, then the next transmit should be
    considered a New Initiator and use a shorter SFT value.

    This was not done with the result that if both sides where continually
    sending messages, they both could use the same SFT value and one side
    could deny the other side access to the bus.

    Note that this fix does not take the corner case into account where
    a receive is in progress when you call adap_transmit.

    Signed-off-by: Hans Verkuil
    Cc: # for v4.18 and up
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Hans Verkuil
     
  • commit b915bf575d5b7774d0f22d57d6c143e07dcaade2 upstream.

    This function is needed by both V4L2 and CEC, so move this to
    cec.h as a static inline since there are no obvious shared
    modules between the two subsystems.

    This patch, together with the following ones, fixes a
    dependency bug: if CEC_CORE is disabled, then building adv7604
    (and other HDMI receivers) will fail because an essential
    function is now stubbed out.

    Signed-off-by: Hans Verkuil
    Cc: # for v4.17 and up
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Hans Verkuil
     

03 Oct, 2018

1 commit

  • The event subscriptions are added to the subscribed event list while
    holding a spinlock, but that lock is subsequently released while still
    accessing the subscription object. This makes it possible to unsubscribe
    the event --- and freeing the subscription object's memory --- while
    the subscription object is simultaneously accessed.

    Prevent this by adding a mutex to serialise the event subscription and
    unsubscription. This also gives a guarantee to the callback ops that the
    add op has returned before the del op is called.

    This change also results in making the elems field less special:
    subscriptions are only added to the event list once they are fully
    initialised.

    Signed-off-by: Sakari Ailus
    Reviewed-by: Hans Verkuil
    Reviewed-by: Laurent Pinchart
    Cc: stable@vger.kernel.org # for 4.14 and up
    Fixes: c3b5b0241f62 ("V4L/DVB: V4L: Events: Add backend")
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     

21 Aug, 2018

1 commit

  • Pull MFD updates from Lee Jones:
    "New Drivers:
    - Add Cirrus Logic Madera Codec (CS47L35, CS47L85 and CS47L90/91) driver
    - Add ChromeOS EC CEC driver
    - Add ROHM BD71837 PMIC driver

    New Device Support:
    - Add support for Dialog Semi DA9063L PMIC variant to DA9063
    - Add support for Intel Ice Lake to Intel-PLSS-PCI
    - Add support for X-Powers AXP806 to AXP20x

    New Functionality:
    - Add support for USB Charging to the ChromeOS Embedded Controller
    - Add support for HDMI CEC to the ChromeOS Embedded Controller
    - Add support for HDMI CEC to Intel HDMI
    - Add support for accessory detection to Madera devices
    - Allow individual pins to be configured via DT' wlf,csnaddr-pd
    - Provide legacy platform specific EEPROM/Watchdog commands; rave-sp

    Fix-upsL
    - Trivial renaming/spelling fixes; cros_ec, da9063-*
    - Convert to Managed Resources (devm_*); da9063-*, ti_am335x_tscadc
    - Transition to helper macros/functions; da9063-*
    - Constify; kempld-core
    - Improve error path/messages; wm8994-core
    - Disable IRQs locally instead of relying on USB subsystem; dln2
    - Remove unused code; rave-sp
    - New exports; sec-core

    Bug Fixes:
    - Fix possible false I2C transaction error; arizona-core
    - Fix declared memory area size; hi655x-pmic
    - Fix checksum type; rave-sp
    - Fix incorrect default serial port configuration: rave-sp
    - Fix incorrect coherent DMA mask for sub-devices; sm501"

    * tag 'mfd-next-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (60 commits)
    mfd: madera: Add register definitions for accessory detect
    mfd: sm501: Set coherent_dma_mask when creating subdevices
    mfd: bd71837: Devicetree bindings for ROHM BD71837 PMIC
    mfd: bd71837: Core driver for ROHM BD71837 PMIC
    media: platform: cros-ec-cec: Fix dependency on MFD_CROS_EC
    mfd: sec-core: Export OF module alias table
    mfd: as3722: Disable auto-power-on when AC OK
    mfd: axp20x: Support AXP806 in I2C mode
    mfd: axp20x: Add self-working mode support for AXP806
    dt-bindings: mfd: axp20x: Add "self-working" mode for AXP806
    mfd: wm8994: Allow to configure CS/ADDR Pulldown from dts
    mfd: wm8994: Allow to configure Speaker Mode Pullup from dts
    mfd: rave-sp: Emulate CMD_GET_STATUS on device that don't support it
    mfd: rave-sp: Add legacy watchdog ping command translation
    mfd: rave-sp: Add legacy EEPROM access command translation
    mfd: rave-sp: Initialize flow control and parity of the port
    mfd: rave-sp: Fix incorrectly specified checksum type
    mfd: rave-sp: Remove unused defines
    mfd: hi655x: Fix regmap area declared size for hi655x
    mfd: ti_am335x_tscadc: Fix struct clk memory leak
    ...

    Linus Torvalds
     

04 Aug, 2018

1 commit

  • Calculate the top and bottom fields for the interlaced frames and
    utilise the extended display list command feature to implement the
    auto-field operations. This allows the DU to update the VSP2 registers
    dynamically based upon the currently processing field.

    Signed-off-by: Kieran Bingham
    Signed-off-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab

    Kieran Bingham
     

03 Aug, 2018

2 commits

  • Right now, satellite frontend drivers specify frequencies in kHz,
    while terrestrial/cable ones specify in Hz. That's confusing
    for developers.

    However, the main problem is that universal frontends capable
    of handling both satellite and non-satelite delivery systems
    are appearing. We end by needing to hack the drivers in
    order to support such hybrid frontends.

    So, convert everything to specify frontend frequencies in Hz.

    Tested-by: Katsuhiro Suzuki
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • Right now, satellite tuner drivers specify frequencies in kHz,
    while terrestrial/cable ones specify in Hz. That's confusing
    for developers.

    However, the main problem is that universal tuners capable
    of handling both satellite and non-satelite delivery systems
    are appearing. We end by needing to hack the drivers in
    order to support such hybrid tuners.

    So, convert everything to specify tuner frequencies in Hz.

    Plese notice that a similar patch is also needed for frontends.

    Tested-by: Katsuhiro Suzuki
    Acked-by: Michael Büsch
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

25 Jul, 2018

5 commits


13 Jul, 2018

1 commit

  • In non device-tree world, we can need to get the notifier by the driver
    name directly and eventually defer probe if not yet created.

    This patch adds a variant of the get function by using the device name
    instead and will not create a notifier if not yet created.

    But the i915 driver exposes at least 2 HDMI connectors, this patch also
    adds the possibility to add a connector name tied to the notifier device
    to form a tuple and associate different CEC controllers for each HDMI
    connectors.

    Signed-off-by: Neil Armstrong
    Reviewed-by: Hans Verkuil
    Signed-off-by: Lee Jones

    Neil Armstrong
     

04 Jul, 2018

1 commit

  • A memory-to-memory pipeline device consists in three
    entities: two DMA engine and one video processing entities.
    The DMA engine entities are linked to a V4L interface.

    This commit add a new v4l2_m2m_{un}register_media_controller
    API to register this topology.

    For instance, a typical mem2mem device topology would
    look like this:

    Device topology
    - entity 1: source (1 pad, 1 link)
    type Node subtype V4L flags 0
    pad0: Source
    -> "proc":1 [ENABLED,IMMUTABLE]

    - entity 3: proc (2 pads, 2 links)
    type Node subtype Unknown flags 0
    pad0: Source
    -> "sink":0 [ENABLED,IMMUTABLE]
    pad1: Sink

    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia
     

28 Jun, 2018

4 commits

  • This sparse warning is emitted by using v4l2_find_nearest_size in some
    cases. Fix it in the framework.

    >> drivers/media/i2c/ov5640.c:1394:14: sparse: incorrect type in assignment
    +(different base types) @@ expected struct ov5640_mode_info const *mode @@
    +got ststruct ov5640_mode_info const *mode @@
    drivers/media/i2c/ov5640.c:1394:14: expected struct ov5640_mode_info const
    +*mode
    drivers/media/i2c/ov5640.c:1394:14: got struct ov5640_mode_info const ( *<
    +noident> )[9]

    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • Commit f1a81afc98e3 ("[media] m2m: fix bad unlock balance")
    removed the last use of v4l2_m2m_ops.lock and
    v4l2_m2m_ops.unlock hooks. They are not actually
    used anymore. Remove them.

    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Ezequiel Garcia
     
  • Prepare for adding a new IOCTL VIDIOC_SUBDEV_ENUMSTD which would
    enumerate the standards for a subdevice by breaking out the code which
    could be shared between the video and subdevice versions of this IOCTL.

    Signed-off-by: Niklas Söderlund
    Signed-off-by: Hans Verkuil
    [hans.verkuil@cisco.com: fixed 'sdandard' typos in v4l2-ioctl.h]
    Signed-off-by: Mauro Carvalho Chehab

    Niklas Söderlund
     
  • Add support for LM3559, as found in Motorola Droid 4 phone, for
    example. SW interface seems to be identical.

    Signed-off-by: Pavel Machek
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Pavel Machek
     

29 May, 2018

2 commits

  • The ioctl serialization mutex (vdev->lock or q->lock for vb2 queues)
    was taken at the highest level in v4l2-dev.c. This prevents more
    fine-grained locking since at that level we cannot examine the ioctl
    arguments, we can only do that after video_usercopy is called.

    So push the locking down to __video_do_ioctl() and subdev_do_ioctl_lock().

    This also allows us to make a few functions in v4l2-ioctl.c static and
    video_usercopy() is no longer exported.

    The locking scheme is not changed by this patch, just pushed down.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • The last user of this 'feature' was the gspca driver. Now that
    that driver has been converted to vb2 we can delete this code.

    Signed-off-by: Hans Verkuil
    Reviewed-by: Hans de Goede
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

17 May, 2018

2 commits


14 May, 2018

1 commit


12 May, 2018

1 commit

  • During destruction, a race condition in
    dvb_media_controller_disable_source() can cause a kernel crash,
    because the "mdev" pointer has been read successfully while another
    task executes dvb_usb_media_device_unregister(), which destroys the
    object. Example for such a crash:

    general protection fault: 0000 [#1] SMP
    CPU: 1 PID: 301 Comm: vdr Not tainted 4.8.1-nuc+ #102
    [142B blob data]
    task: ffff8802301f2040 task.stack: ffff880233728000
    RIP: 0010:[] [] dvb_frontend_release+0xcb/0x120
    RSP: 0018:ffff88023372bdd8 EFLAGS: 00010202
    RAX: 001fd55c000000da RBX: ffff880236bad810 RCX: 0000000000000000
    RDX: ffff880235bd81f0 RSI: 0000000000000246 RDI: ffff880235bd81e8
    RBP: ffff88023372be00 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: ffff88022f009910 R12: 0000000000000000
    R13: ffff880235a21a80 R14: ffff880235bd8000 R15: ffff880235bb8a78
    FS: 0000000000000000(0000) GS:ffff88023fd00000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f96edd69818 CR3: 0000000002406000 CR4: 00000000001006e0
    Stack:
    ffff88022f009900 0000000000000008 ffff880235bb8a78 ffff8802344fbb20
    ffff880236437b40 ffff88023372be48 ffffffff8117a81e ffff880235bb8a78
    ffff88022f009910 ffff8802335a7400 ffff8802301f2040 ffff88022f009900
    Call Trace:
    [] __fput+0xde/0x1d0
    [] ____fput+0x9/0x10
    [] task_work_run+0x7e/0xa0
    [] do_exit+0x27b/0xa50
    [] ? __do_page_fault+0x1c3/0x430
    [] do_group_exit+0x42/0xb0
    [] SyS_exit_group+0xf/0x10
    [] entry_SYSCALL_64_fastpath+0x13/0x8f
    Code: 31 c9 49 8d be e8 01 00 00 ba 01 00 00 00 be 03 00 00 00 e8 68 2d a0 ff 48 8b 83 10 03 00 00 48 8b 80 88 00 00 00 48 85 c0 74 12 8b 80 88 02 00 00 48 85 c0 74 06 49 8b 7d
    RIP [] dvb_frontend_release+0xcb/0x120

    [mchehab+samsung@kernel.org: fix a Coding Style issue]
    Signed-off-by: Max Kellermann
    Signed-off-by: Mauro Carvalho Chehab

    Max Kellermann
     

11 May, 2018

1 commit

  • The mdev field is only present if CONFIG_MEDIA_CONTROLLER is set.
    But since we will need to pass the media_device to vb2 and the
    control framework it is very convenient to just make this field
    available all the time. If CONFIG_MEDIA_CONTROLLER is not set,
    then it will just be NULL.

    Signed-off-by: Hans Verkuil
    Acked-by: Sakari Ailus
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

10 May, 2018

3 commits

  • Linux 4.17-rc4

    * tag 'v4.17-rc4': (920 commits)
    Linux 4.17-rc4
    KVM: x86: remove APIC Timer periodic/oneshot spikes
    genksyms: fix typo in parse.tab.{c,h} generation rules
    kbuild: replace hardcoded bison in cmd_bison_h with $(YACC)
    gcc-plugins: fix build condition of SANCOV plugin
    MAINTAINERS: Update Kbuild entry with a few paths
    Revert "usb: host: ehci: Use dma_pool_zalloc()"
    platform/x86: Kconfig: Fix dell-laptop dependency chain.
    platform/x86: asus-wireless: Fix NULL pointer dereference
    arm64: vgic-v2: Fix proxying of cpuif access
    KVM: arm/arm64: vgic_init: Cleanup reference to process_maintenance
    KVM: arm64: Fix order of vcpu_write_sys_reg() arguments
    MAINTAINERS & files: Canonize the e-mails I use at files
    media: imx-media-csi: Fix inconsistent IS_ERR and PTR_ERR
    tools: power/acpi, revert to LD = gcc
    bdi: Fix oops in wb_workfn()
    RDMA/cma: Do not query GID during QP state transition to RTR
    IB/mlx4: Fix integer overflow when calculating optimal MTT size
    IB/hfi1: Fix memory leak in exception path in get_irq_affinity()
    IB/{hfi1, rdmavt}: Fix memory leak in hfi1_alloc_devdata() upon failure
    ...

    Mauro Carvalho Chehab
     
  • Fix this warning when building the docs:

    include/media/v4l2-dev.h:42: warning: Enum value 'VFL_TYPE_MAX' not described in enum 'vfl_devnode_type'

    Acked-by: Sakari Ailus
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • s/dose/does/

    Fixes: d295c6a460cd2ac6 ("[media] media: entity: Add media_entity_get_fwnode_pad() function")

    Signed-off-by: Niklas Söderlund
    Reviewed-by: Simon Horman
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Niklas Söderlund
     

05 May, 2018

1 commit


04 May, 2018

2 commits

  • Videobuf has been replaced by videobuf2. Now, no drivers use
    the videobuf-dvb helper module anymore. So, get rid of it.

    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • From now on, I'll start using my @kernel.org as my development e-mail.

    As such, let's remove the entries that point to the old
    mchehab@s-opensource.com at MAINTAINERS file.

    For the files written with a copyright with mchehab@s-opensource,
    let's keep Samsung on their names, using mchehab+samsung@kernel.org,
    in order to keep pointing to my employer, with sponsors the work.

    For the files written before I join Samsung (on July, 4 2013),
    let's just use mchehab@kernel.org.

    For bug reports, we can simply point to just kernel.org, as
    this will reach my mchehab+samsung inbox anyway.

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Brian Warner
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

24 Apr, 2018

1 commit


11 Apr, 2018

1 commit

  • Pull media fixes from Mauro Carvalho Chehab:
    "A series of media updates/fixes for 4.17.

    There are two important core fix patches in this series:

    - A regression fix on Kernel 4.16 with causes it to not work with
    some input devices that depend on media core

    - A fix at compat32 bits with causes it to OOPS on overlay, and
    affects the Kernels where the CVE-2017-13166 was backported

    The remaining ones are other random fixes at the documentation and on
    drivers.

    The biggest part of this series is a set of 18 patches for the Intel
    atomisp driver. Currently, it produces hundreds of warnings/errors on
    sparse/smatch, causing me to sometimes ignore new warnings on other
    drivers that are not so broken. This driver is on really poor state,
    even for staging standards: it has several layers of abstraction on
    it, and it supports two different hardware. Selecting between them
    require to add a define (there isn't even a Kconfig option for such
    purpose). Just on this smatch cleanup, I could easily get rid of 8
    "do-nothing" files. So, I'm seriously considering its removal from
    upstream, if I don't see any real work on addressing the problems
    there along this year"

    * tag 'media/v4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (48 commits)
    media: v4l2-core: fix size of devnode_nums[] bitarray
    media: v4l2-compat-ioctl32: don't oops on overlay
    media: i2c: adv748x: afe: fix sparse warning
    media: extended-controls.rst: transmitter -> receiver
    media: staging: atomisp: stop duplicating input format types
    media: staging: atomisp: get rid of an unused var
    media: staging: atomisp: stop mixing enum types
    media: staging: atomisp: get rid of some static warnings
    media: staging: atomisp: use %p to print pointers
    media: staging: atomisp: remove an useless check
    media: staging: atomisp: avoid a warning if 32 bits build
    media: staging: atomisp: don't access a NULL var
    media: staging: atomisp: Get rid of *default.host.[ch]
    media: staging: atomisp: get rid of an unused function
    media: staging: atomisp: remove unused set_pd_base()
    media: staging: atomisp: fix endianess issues
    media: staging: atomisp: add a missing include
    media: staging: atomisp: get rid of stupid statements
    media: staging: atomisp: declare static vars as such
    media: staging: atomisp: ia_css_output.host: don't use var before check
    ...

    Linus Torvalds
     

07 Apr, 2018

1 commit

  • Pull misc vfs updates from Al Viro:
    "Assorted stuff, including Christoph's I_DIRTY patches"

    * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs: move I_DIRTY_INODE to fs.h
    ubifs: fix bogus __mark_inode_dirty(I_DIRTY_SYNC | I_DIRTY_DATASYNC) call
    ntfs: fix bogus __mark_inode_dirty(I_DIRTY_SYNC | I_DIRTY_DATASYNC) call
    gfs2: fix bogus __mark_inode_dirty(I_DIRTY_SYNC | I_DIRTY_DATASYNC) calls
    fs: fold open_check_o_direct into do_dentry_open
    vfs: Replace stray non-ASCII homoglyph characters with their ASCII equivalents
    vfs: make sure struct filename->iname is word-aligned
    get rid of pointless includes of fs_struct.h
    [poll] annotate SAA6588_CMD_POLL users

    Linus Torvalds
     

05 Apr, 2018

1 commit

  • The size of devnode_nums[] bit array is too short to store information
    for VFL_TYPE_TOUCH. That causes it to override other memory regions.

    Thankfully, on recent reports, it is overriding video_device[] array,
    trigging a WARN_ON(). Yet, it just warns about the problem, but let
    the code excecuting, with generates an OOPS:

    [ 43.177394] WARNING: CPU: 1 PID: 711 at drivers/media/v4l2-core/v4l2-dev.c:945 __video_register_device+0xc99/0x1090 [videodev]
    [ 43.177396] Modules linked in: hid_sensor_custom hid_sensor_als hid_sensor_incl_3d hid_sensor_rotation hid_sensor_magn_3d hid_sensor_accel_3d hid_sensor_gyro_3d hid_sensor_trigger industrialio_triggered_buffer kfifo_buf joydev hid_sensor_iio_common hid_rmi(+) rmi_core industrialio videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev hid_multitouch media hid_sensor_hub binfmt_misc nls_iso8859_1 snd_hda_codec_hdmi arc4 snd_soc_skl snd_soc_skl_ipc snd_hda_ext_core snd_soc_sst_dsp snd_soc_sst_ipc snd_hda_codec_realtek snd_soc_acpi snd_hda_codec_generic snd_soc_core snd_compress ac97_bus snd_pcm_dmaengine snd_hda_intel snd_hda_codec intel_rapl snd_hda_core x86_pkg_temp_thermal snd_hwdep intel_powerclamp coretemp snd_pcm kvm_intel snd_seq_midi snd_seq_midi_event snd_rawmidi crct10dif_pclmul
    [ 43.177426] crc32_pclmul ghash_clmulni_intel iwlmvm pcbc mac80211 snd_seq aesni_intel iwlwifi aes_x86_64 snd_seq_device crypto_simd glue_helper cryptd snd_timer intel_cstate intel_rapl_perf input_leds serio_raw intel_wmi_thunderbolt snd wmi_bmof cfg80211 soundcore ideapad_laptop sparse_keymap idma64 virt_dma tpm_crb acpi_pad int3400_thermal acpi_thermal_rel intel_pch_thermal processor_thermal_device mac_hid int340x_thermal_zone mei_me intel_soc_dts_iosf mei intel_lpss_pci shpchp intel_lpss sch_fq_codel vfio_pci nfsd vfio_virqfd parport_pc ppdev auth_rpcgss nfs_acl lockd grace lp parport sunrpc ip_tables x_tables autofs4 hid_logitech_hidpp hid_logitech_dj hid_generic usbhid kvmgt vfio_mdev mdev vfio_iommu_type1 vfio kvm irqbypass i915 i2c_algo_bit drm_kms_helper syscopyarea sdhci_pci sysfillrect
    [ 43.177466] sysimgblt cqhci fb_sys_fops sdhci drm i2c_hid wmi hid video pinctrl_sunrisepoint pinctrl_intel
    [ 43.177474] CPU: 1 PID: 711 Comm: systemd-udevd Not tainted 4.16.0 #1
    [ 43.177475] Hardware name: LENOVO 80UE/VIUU4, BIOS 2UCN10T 10/14/2016
    [ 43.177481] RIP: 0010:__video_register_device+0xc99/0x1090 [videodev]
    [ 43.177482] RSP: 0000:ffffa5c5c231b420 EFLAGS: 00010202
    [ 43.177484] RAX: 0000000000000000 RBX: 0000000000000005 RCX: 0000000000000000
    [ 43.177485] RDX: ffffffffc0c44cc0 RSI: ffffffffffffffff RDI: ffffffffc0c44cc0
    [ 43.177486] RBP: ffffa5c5c231b478 R08: ffffffffc0c96900 R09: ffff8eda1a51f018
    [ 43.177487] R10: 0000000000000600 R11: 00000000000003b6 R12: 0000000000000000
    [ 43.177488] R13: 0000000000000005 R14: ffffffffc0c96900 R15: ffff8eda1d6d91c0
    [ 43.177489] FS: 00007fd2d8ef2480(0000) GS:ffff8eda33480000(0000) knlGS:0000000000000000
    [ 43.177490] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 43.177491] CR2: 00007ffe0a6ad01c CR3: 0000000456ae2004 CR4: 00000000003606e0
    [ 43.177492] Call Trace:
    [ 43.177498] ? devres_add+0x5f/0x70
    [ 43.177502] rmi_f54_probe+0x437/0x470 [rmi_core]
    [ 43.177505] rmi_function_probe+0x25/0x30 [rmi_core]
    [ 43.177507] driver_probe_device+0x310/0x480
    [ 43.177509] __device_attach_driver+0x86/0x100
    [ 43.177511] ? __driver_attach+0xf0/0xf0
    [ 43.177512] bus_for_each_drv+0x6b/0xb0
    [ 43.177514] __device_attach+0xdd/0x160
    [ 43.177516] device_initial_probe+0x13/0x20
    [ 43.177518] bus_probe_device+0x95/0xa0
    [ 43.177519] device_add+0x44b/0x680
    [ 43.177522] rmi_register_function+0x62/0xd0 [rmi_core]
    [ 43.177525] rmi_create_function+0x112/0x1a0 [rmi_core]
    [ 43.177527] ? rmi_driver_clear_irq_bits+0xc0/0xc0 [rmi_core]
    [ 43.177530] rmi_scan_pdt+0xca/0x1a0 [rmi_core]
    [ 43.177535] rmi_init_functions+0x5b/0x120 [rmi_core]
    [ 43.177537] rmi_driver_probe+0x152/0x3c0 [rmi_core]
    [ 43.177547] ? sysfs_create_link+0x25/0x40
    [ 43.177549] driver_probe_device+0x310/0x480
    [ 43.177551] __device_attach_driver+0x86/0x100
    [ 43.177553] ? __driver_attach+0xf0/0xf0
    [ 43.177554] bus_for_each_drv+0x6b/0xb0
    [ 43.177556] __device_attach+0xdd/0x160
    [ 43.177558] device_initial_probe+0x13/0x20
    [ 43.177560] bus_probe_device+0x95/0xa0
    [ 43.177561] device_add+0x44b/0x680
    [ 43.177564] rmi_register_transport_device+0x84/0x100 [rmi_core]
    [ 43.177568] rmi_input_configured+0xbf/0x1a0 [hid_rmi]
    [ 43.177571] ? input_allocate_device+0xdf/0xf0
    [ 43.177574] hidinput_connect+0x4a9/0x37a0 [hid]
    [ 43.177578] hid_connect+0x326/0x3d0 [hid]
    [ 43.177581] hid_hw_start+0x42/0x70 [hid]
    [ 43.177583] rmi_probe+0x115/0x510 [hid_rmi]
    [ 43.177586] hid_device_probe+0xd3/0x150 [hid]
    [ 43.177588] ? sysfs_create_link+0x25/0x40
    [ 43.177590] driver_probe_device+0x310/0x480
    [ 43.177592] __driver_attach+0xbf/0xf0
    [ 43.177593] ? driver_probe_device+0x480/0x480
    [ 43.177595] bus_for_each_dev+0x74/0xb0
    [ 43.177597] ? kmem_cache_alloc_trace+0x1a6/0x1c0
    [ 43.177599] driver_attach+0x1e/0x20
    [ 43.177600] bus_add_driver+0x167/0x260
    [ 43.177602] ? 0xffffffffc0cbc000
    [ 43.177604] driver_register+0x60/0xe0
    [ 43.177605] ? 0xffffffffc0cbc000
    [ 43.177607] __hid_register_driver+0x63/0x70 [hid]
    [ 43.177610] rmi_driver_init+0x23/0x1000 [hid_rmi]
    [ 43.177612] do_one_initcall+0x52/0x191
    [ 43.177615] ? _cond_resched+0x19/0x40
    [ 43.177617] ? kmem_cache_alloc_trace+0xa2/0x1c0
    [ 43.177619] ? do_init_module+0x27/0x209
    [ 43.177621] do_init_module+0x5f/0x209
    [ 43.177623] load_module+0x1987/0x1f10
    [ 43.177626] ? ima_post_read_file+0x96/0xa0
    [ 43.177629] SYSC_finit_module+0xfc/0x120
    [ 43.177630] ? SYSC_finit_module+0xfc/0x120
    [ 43.177632] SyS_finit_module+0xe/0x10
    [ 43.177634] do_syscall_64+0x73/0x130
    [ 43.177637] entry_SYSCALL_64_after_hwframe+0x3d/0xa2
    [ 43.177638] RIP: 0033:0x7fd2d880b839
    [ 43.177639] RSP: 002b:00007ffe0a6b2368 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
    [ 43.177641] RAX: ffffffffffffffda RBX: 000055cdd86542e0 RCX: 00007fd2d880b839
    [ 43.177641] RDX: 0000000000000000 RSI: 00007fd2d84ea0e5 RDI: 0000000000000016
    [ 43.177642] RBP: 00007fd2d84ea0e5 R08: 0000000000000000 R09: 00007ffe0a6b2480
    [ 43.177643] R10: 0000000000000016 R11: 0000000000000246 R12: 0000000000000000
    [ 43.177644] R13: 000055cdd8688930 R14: 0000000000020000 R15: 000055cdd86542e0
    [ 43.177645] Code: 48 c7 c7 54 b4 c3 c0 e8 96 9d ec dd e9 d4 fb ff ff 0f 0b 41 be ea ff ff ff e9 c7 fb ff ff 0f 0b 41 be ea ff ff ff e9 ba fb ff ff 0b e9 d8 f4 ff ff 83 fa 01 0f 84 c4 02 00 00 48 83 78 68 00
    [ 43.177675] ---[ end trace d44d9bc41477c2dd ]---
    [ 43.177679] BUG: unable to handle kernel NULL pointer dereference at 0000000000000499
    [ 43.177723] IP: __video_register_device+0x1cc/0x1090 [videodev]
    [ 43.177749] PGD 0 P4D 0
    [ 43.177764] Oops: 0000 [#1] SMP PTI
    [ 43.177780] Modules linked in: hid_sensor_custom hid_sensor_als hid_sensor_incl_3d hid_sensor_rotation hid_sensor_magn_3d hid_sensor_accel_3d hid_sensor_gyro_3d hid_sensor_trigger industrialio_triggered_buffer kfifo_buf joydev hid_sensor_iio_common hid_rmi(+) rmi_core industrialio videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev hid_multitouch media hid_sensor_hub binfmt_misc nls_iso8859_1 snd_hda_codec_hdmi arc4 snd_soc_skl snd_soc_skl_ipc snd_hda_ext_core snd_soc_sst_dsp snd_soc_sst_ipc snd_hda_codec_realtek snd_soc_acpi snd_hda_codec_generic snd_soc_core snd_compress ac97_bus snd_pcm_dmaengine snd_hda_intel snd_hda_codec intel_rapl snd_hda_core x86_pkg_temp_thermal snd_hwdep intel_powerclamp coretemp snd_pcm kvm_intel snd_seq_midi snd_seq_midi_event snd_rawmidi crct10dif_pclmul
    [ 43.178055] crc32_pclmul ghash_clmulni_intel iwlmvm pcbc mac80211 snd_seq aesni_intel iwlwifi aes_x86_64 snd_seq_device crypto_simd glue_helper cryptd snd_timer intel_cstate intel_rapl_perf input_leds serio_raw intel_wmi_thunderbolt snd wmi_bmof cfg80211 soundcore ideapad_laptop sparse_keymap idma64 virt_dma tpm_crb acpi_pad int3400_thermal acpi_thermal_rel intel_pch_thermal processor_thermal_device mac_hid int340x_thermal_zone mei_me intel_soc_dts_iosf mei intel_lpss_pci shpchp intel_lpss sch_fq_codel vfio_pci nfsd vfio_virqfd parport_pc ppdev auth_rpcgss nfs_acl lockd grace lp parport sunrpc ip_tables x_tables autofs4 hid_logitech_hidpp hid_logitech_dj hid_generic usbhid kvmgt vfio_mdev mdev vfio_iommu_type1 vfio kvm irqbypass i915 i2c_algo_bit drm_kms_helper syscopyarea sdhci_pci sysfillrect
    [ 43.178337] sysimgblt cqhci fb_sys_fops sdhci drm i2c_hid wmi hid video pinctrl_sunrisepoint pinctrl_intel
    [ 43.178380] CPU: 1 PID: 711 Comm: systemd-udevd Tainted: G W 4.16.0 #1
    [ 43.178411] Hardware name: LENOVO 80UE/VIUU4, BIOS 2UCN10T 10/14/2016
    [ 43.178441] RIP: 0010:__video_register_device+0x1cc/0x1090 [videodev]
    [ 43.178467] RSP: 0000:ffffa5c5c231b420 EFLAGS: 00010202
    [ 43.178490] RAX: ffffffffc0c44cc0 RBX: 0000000000000005 RCX: ffffffffc0c454c0
    [ 43.178519] RDX: 0000000000000001 RSI: ffff8eda1d6d9118 RDI: ffffffffc0c44cc0
    [ 43.178549] RBP: ffffa5c5c231b478 R08: ffffffffc0c96900 R09: ffff8eda1a51f018
    [ 43.178579] R10: 0000000000000600 R11: 00000000000003b6 R12: 0000000000000000
    [ 43.178608] R13: 0000000000000005 R14: ffffffffc0c96900 R15: ffff8eda1d6d91c0
    [ 43.178636] FS: 00007fd2d8ef2480(0000) GS:ffff8eda33480000(0000) knlGS:0000000000000000
    [ 43.178669] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 43.178693] CR2: 0000000000000499 CR3: 0000000456ae2004 CR4: 00000000003606e0
    [ 43.178721] Call Trace:
    [ 43.178736] ? devres_add+0x5f/0x70
    [ 43.178755] rmi_f54_probe+0x437/0x470 [rmi_core]
    [ 43.178779] rmi_function_probe+0x25/0x30 [rmi_core]
    [ 43.178805] driver_probe_device+0x310/0x480
    [ 43.178828] __device_attach_driver+0x86/0x100
    [ 43.178851] ? __driver_attach+0xf0/0xf0
    [ 43.178884] bus_for_each_drv+0x6b/0xb0
    [ 43.178904] __device_attach+0xdd/0x160
    [ 43.178925] device_initial_probe+0x13/0x20
    [ 43.178948] bus_probe_device+0x95/0xa0
    [ 43.178968] device_add+0x44b/0x680
    [ 43.178987] rmi_register_function+0x62/0xd0 [rmi_core]
    [ 43.181747] rmi_create_function+0x112/0x1a0 [rmi_core]
    [ 43.184677] ? rmi_driver_clear_irq_bits+0xc0/0xc0 [rmi_core]
    [ 43.187505] rmi_scan_pdt+0xca/0x1a0 [rmi_core]
    [ 43.190171] rmi_init_functions+0x5b/0x120 [rmi_core]
    [ 43.192809] rmi_driver_probe+0x152/0x3c0 [rmi_core]
    [ 43.195403] ? sysfs_create_link+0x25/0x40
    [ 43.198253] driver_probe_device+0x310/0x480
    [ 43.201083] __device_attach_driver+0x86/0x100
    [ 43.203800] ? __driver_attach+0xf0/0xf0
    [ 43.206503] bus_for_each_drv+0x6b/0xb0
    [ 43.209291] __device_attach+0xdd/0x160
    [ 43.212207] device_initial_probe+0x13/0x20
    [ 43.215146] bus_probe_device+0x95/0xa0
    [ 43.217885] device_add+0x44b/0x680
    [ 43.220597] rmi_register_transport_device+0x84/0x100 [rmi_core]
    [ 43.223321] rmi_input_configured+0xbf/0x1a0 [hid_rmi]
    [ 43.226051] ? input_allocate_device+0xdf/0xf0
    [ 43.228814] hidinput_connect+0x4a9/0x37a0 [hid]
    [ 43.231701] hid_connect+0x326/0x3d0 [hid]
    [ 43.234548] hid_hw_start+0x42/0x70 [hid]
    [ 43.237302] rmi_probe+0x115/0x510 [hid_rmi]
    [ 43.239862] hid_device_probe+0xd3/0x150 [hid]
    [ 43.242558] ? sysfs_create_link+0x25/0x40
    [ 43.242828] audit: type=1400 audit(1522795151.600:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/core/4206/usr/lib/snapd/snap-confine" pid=1151 comm="apparmor_parser"
    [ 43.244859] driver_probe_device+0x310/0x480
    [ 43.244862] __driver_attach+0xbf/0xf0
    [ 43.246982] audit: type=1400 audit(1522795151.600:5): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/core/4206/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=1151 comm="apparmor_parser"
    [ 43.249403] ? driver_probe_device+0x480/0x480
    [ 43.249405] bus_for_each_dev+0x74/0xb0
    [ 43.253200] audit: type=1400 audit(1522795151.600:6): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/core/4206/usr/lib/snapd/snap-confine//snap_update_ns" pid=1151 comm="apparmor_parser"
    [ 43.254055] ? kmem_cache_alloc_trace+0x1a6/0x1c0
    [ 43.256282] audit: type=1400 audit(1522795151.604:7): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/sbin/dhclient" pid=1152 comm="apparmor_parser"
    [ 43.258436] driver_attach+0x1e/0x20
    [ 43.260875] audit: type=1400 audit(1522795151.604:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=1152 comm="apparmor_parser"
    [ 43.263118] bus_add_driver+0x167/0x260
    [ 43.267676] audit: type=1400 audit(1522795151.604:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-helper" pid=1152 comm="apparmor_parser"
    [ 43.268807] ? 0xffffffffc0cbc000
    [ 43.268812] driver_register+0x60/0xe0
    [ 43.271184] audit: type=1400 audit(1522795151.604:10): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/connman/scripts/dhclient-script" pid=1152 comm="apparmor_parser"
    [ 43.274081] ? 0xffffffffc0cbc000
    [ 43.274086] __hid_register_driver+0x63/0x70 [hid]
    [ 43.288367] rmi_driver_init+0x23/0x1000 [hid_rmi]
    [ 43.291501] do_one_initcall+0x52/0x191
    [ 43.292348] audit: type=1400 audit(1522795151.652:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/man" pid=1242 comm="apparmor_parser"
    [ 43.294212] ? _cond_resched+0x19/0x40
    [ 43.300028] ? kmem_cache_alloc_trace+0xa2/0x1c0
    [ 43.303475] ? do_init_module+0x27/0x209
    [ 43.306842] do_init_module+0x5f/0x209
    [ 43.310269] load_module+0x1987/0x1f10
    [ 43.313704] ? ima_post_read_file+0x96/0xa0
    [ 43.317174] SYSC_finit_module+0xfc/0x120
    [ 43.320754] ? SYSC_finit_module+0xfc/0x120
    [ 43.324065] SyS_finit_module+0xe/0x10
    [ 43.327387] do_syscall_64+0x73/0x130
    [ 43.330909] entry_SYSCALL_64_after_hwframe+0x3d/0xa2
    [ 43.334305] RIP: 0033:0x7fd2d880b839
    [ 43.337810] RSP: 002b:00007ffe0a6b2368 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
    [ 43.341259] RAX: ffffffffffffffda RBX: 000055cdd86542e0 RCX: 00007fd2d880b839
    [ 43.344613] RDX: 0000000000000000 RSI: 00007fd2d84ea0e5 RDI: 0000000000000016
    [ 43.347962] RBP: 00007fd2d84ea0e5 R08: 0000000000000000 R09: 00007ffe0a6b2480
    [ 43.351456] R10: 0000000000000016 R11: 0000000000000246 R12: 0000000000000000
    [ 43.354845] R13: 000055cdd8688930 R14: 0000000000020000 R15: 000055cdd86542e0
    [ 43.358224] Code: c7 05 ad 12 02 00 00 00 00 00 48 8d 88 00 08 00 00 eb 09 48 83 c0 08 48 39 c1 74 31 48 8b 10 48 85 d2 74 ef 49 8b b7 98 04 00 00 39 b2 98 04 00 00 75 df 48 63 92 f8 04 00 00 f0 48 0f ab 15
    [ 43.361764] RIP: __video_register_device+0x1cc/0x1090 [videodev] RSP: ffffa5c5c231b420
    [ 43.365281] CR2: 0000000000000499

    This patch fixes the array size and changes the WARN_ON() to return an error,
    instead of letting the Kernel to proceed with registering.

    Cc: stable@vger.kernel.org # For Kernel 4.16
    Fixes: 4839c58f034a ("media: v4l2-dev: convert VFL_TYPE_* into an enum")
    Reported-by: Peter Geis
    Reported-by: Jaak Ristioja
    Reported-by: Michał Siemek
    Reviewed-by: Hans Verkuil
    Reviewed-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab