29 Aug, 2020

1 commit


23 Jun, 2020

1 commit

  • Syzbot reports a NULL-ptr deref in the kref_put() call:

    BUG: KASAN: null-ptr-deref in media_request_put drivers/media/mc/mc-request.c:81 [inline]
    kref_put include/linux/kref.h:64 [inline]
    media_request_put drivers/media/mc/mc-request.c:81 [inline]
    media_request_close+0x4d/0x170 drivers/media/mc/mc-request.c:89
    __fput+0x2ed/0x750 fs/file_table.c:281
    task_work_run+0x147/0x1d0 kernel/task_work.c:123
    tracehook_notify_resume include/linux/tracehook.h:188 [inline]
    exit_to_usermode_loop arch/x86/entry/common.c:165 [inline]
    prepare_exit_to_usermode+0x48e/0x600 arch/x86/entry/common.c:196

    What led to this crash was an injected memory allocation failure in
    media_request_alloc():

    FAULT_INJECTION: forcing a failure.
    name failslab, interval 1, probability 0, space 0, times 0
    should_failslab+0x5/0x20
    kmem_cache_alloc_trace+0x57/0x300
    ? anon_inode_getfile+0xe5/0x170
    media_request_alloc+0x339/0x440
    media_device_request_alloc+0x94/0xc0
    media_device_ioctl+0x1fb/0x330
    ? do_vfs_ioctl+0x6ea/0x1a00
    ? media_ioctl+0x101/0x120
    ? __media_device_usb_init+0x430/0x430
    ? media_poll+0x110/0x110
    __se_sys_ioctl+0xf9/0x160
    do_syscall_64+0xf3/0x1b0

    When that allocation fails, filp->private_data is left uninitialized
    which media_request_close() does not expect and crashes.

    To avoid this, reorder media_request_alloc() such that
    allocating the struct file happens as the last step thus
    media_request_close() will no longer get called for a partially created
    media request.

    Reported-by: syzbot+6bed2d543cf7e48b822b@syzkaller.appspotmail.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Tuomas Tynkkynen
    Fixes: 10905d70d788 ("media: media-request: implement media requests")
    Reviewed-by: Hans Verkuil
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Tuomas Tynkkynen
     

18 May, 2020

1 commit

  • Add a missing pointer to the entity in the media_entity operation
    get_fwnode_pad. There are no implementers of this op yet, but a future
    entity that does so will almost certainly need a reference to itself
    to carry out the work.

    operation")

    Fixes: ae45cd5efc120 ("[media] media: entity: Add get_fwnode_pad entity
    Signed-off-by: Steve Longerbeam
    Reviewed-by: Laurent Pinchart
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Steve Longerbeam
     

17 Apr, 2020

1 commit

  • When the request API got merged, only drivers at staging were
    using it. As we wanted to be able to do future changes on it,
    we added an artificial depends on STAGING_MEDIA.

    Yet, request API is there for quite some time now, and
    didn't suffer any API breakages during this time. So, drop
    this.

    Reported-by: Stephen Rothwell
    Suggested-by: Ezequiel Garcia
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

16 Apr, 2020

1 commit


14 Apr, 2020

3 commits


25 Feb, 2020

1 commit


24 Feb, 2020

1 commit

  • These are bits so to test if a pad is a sink you use & but not ==.

    It looks like the only reason this hasn't caused problems before is that
    media_get_pad_index() is currently only used with pads that do not set the
    MEDIA_PAD_FL_MUST_CONNECT flag. So a pad really had only the SINK or SOURCE
    flag set and nothing else.

    Signed-off-by: Hans Verkuil
    Cc: # for v5.3 and up
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

01 Oct, 2019

1 commit


12 Jun, 2019

1 commit

  • There are some conflicts due to SPDX changes. We also have more
    patches being merged via media tree touching them.

    So, let's merge back from upstream and address those.

    Linux 5.2-rc4

    * tag 'v5.2-rc4': (767 commits)
    Linux 5.2-rc4
    MAINTAINERS: Karthikeyan Ramasubramanian is MIA
    i2c: xiic: Add max_read_len quirk
    lockref: Limit number of cmpxchg loop retries
    uaccess: add noop untagged_addr definition
    x86/insn-eval: Fix use-after-free access to LDT entry
    kbuild: use more portable 'command -v' for cc-cross-prefix
    s390/unwind: correct stack switching during unwind
    block, bfq: add weight symlink to the bfq.weight cgroup parameter
    cgroup: let a symlink too be created with a cftype file
    drm/nouveau/secboot/gp10[2467]: support newer FW to fix SEC2 failures on some boards
    drm/nouveau/secboot: enable loading of versioned LS PMU/SEC2 ACR msgqueue FW
    drm/nouveau/secboot: split out FW version-specific LS function pointers
    drm/nouveau/secboot: pass max supported FW version to LS load funcs
    drm/nouveau/core: support versioned firmware loading
    drm/nouveau/core: pass subdev into nvkm_firmware_get, rather than device
    block: free sched's request pool in blk_cleanup_queue
    pktgen: do not sleep with the thread lock held.
    net: mvpp2: Use strscpy to handle stat strings
    net: rds: fix memory leak in rds_ib_flush_mr_pool
    ...

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

29 May, 2019

2 commits

  • You can't memset the contents of a __user pointer. Instead, call copy_to_user to
    copy links.reserved (which is zeroed) to the user memory.

    This fixes this sparse warning:

    SPARSE:drivers/media/mc/mc-device.c drivers/media/mc/mc-device.c:521:16: warning: incorrect type in argument 1 (different address spaces)

    Fixes: f49308878d720 ("media: media_device_enum_links32: clean a reserved field")

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

    Hans Verkuil
     
  • It is really weird that the media controller sources are all top-level
    in drivers/media. It is a bit of a left-over from long ago when most
    media sources were all at the top-level. At some point we reorganized
    the directory structure, but the media-*.c sources where never moved
    to their own directory.

    So create a new mc directory and move all sources there. Also rename
    the prefix from media- to mc-.

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

    Hans Verkuil