Skip to content
  1. Jan 10, 2019
  2. Jan 09, 2019
    • Gustavo A. R. Silva's avatar
      qxl: Use struct_size() in kzalloc() · d4b9dd50
      Gustavo A. R. Silva authored
      
      
      One of the more common cases of allocation size calculations is finding the
      size of a structure that has a zero-sized array at the end, along with memory
      for some number of elements for that array. For example:
      
      struct foo {
          int stuff;
          void *entry[];
      };
      
      instance = kzalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can now
      use the new struct_size() helper:
      
      instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL);
      
      This code was detected with the help of Coccinelle.
      
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20190108162152.GA25361@embeddedor
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      d4b9dd50
    • Ezequiel Garcia's avatar
      drm/virtio: Drop deprecated load/unload initialization · d516e75c
      Ezequiel Garcia authored
      
      
      Move the code around so the driver is probed the bus
      .probe and removed from the bus .remove callbacks.
      This commit is just a cleanup and shouldn't affect
      functionality.
      
      Signed-off-by: default avatarEzequiel Garcia <ezequiel@collabora.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20190108145930.15080-1-ezequiel@collabora.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      d516e75c
    • Peter Wu's avatar
      drm/fb-helper: fix leaks in error path of drm_fb_helper_fbdev_setup · 00eb5b0d
      Peter Wu authored
      After drm_fb_helper_fbdev_setup calls drm_fb_helper_init,
      "dev->fb_helper" will be initialized (and thus drm_fb_helper_fini will
      have some effect). After that, drm_fb_helper_initial_config is called
      which may call the "fb_probe" driver callback.
      
      This driver callback may call drm_fb_helper_defio_init (as is done by
      drm_fb_helper_generic_probe) or set a framebuffer (as is done by bochs)
      as documented. These are normally cleaned up on exit by
      drm_fb_helper_fbdev_teardown which also calls drm_fb_helper_fini.
      
      If an error occurs after "fb_probe", but before setup is complete, then
      calling just drm_fb_helper_fini will leak resources. This was triggered
      by df2052cc ("bochs: convert to drm_fb_helper_fbdev_setup/teardown"):
      
          [   50.008030] bochsdrmfb: enable CONFIG_FB_LITTLE_ENDIAN to support this framebuffer
          [   50.009436] bochs-drm 0000:00:02.0: [drm:drm_fb_helper_fbdev_setup] *ERROR* fbdev: Failed to set configuration (ret=-38)
          [   50.011456] [drm] Initialized bochs-drm 1.0.0 20130925 for 0000:00:02.0 on minor 2
          [   50.013604] WARNING: CPU: 1 PID: 1 at drivers/gpu/drm/drm_mode_config.c:477 drm_mode_config_cleanup+0x280/0x2a0
          [   50.016175] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G                T 4.20.0-rc7 #1
          [   50.017732] EIP: drm_mode_config_cleanup+0x280/0x2a0
          ...
          [   50.023155] Call Trace:
          [   50.023155]  ? bochs_kms_fini+0x1e/0x30
          [   50.023155]  ? bochs_unload+0x18/0x40
      
      This can be reproduced with QEMU and CONFIG_FB_LITTLE_ENDIAN=n.
      
      Link: https://lkml.kernel.org/r/20181221083226.GI23332@shao2-debian
      Link: https://lkml.kernel.org/r/20181223004315.GA11455@al
      Fixes: 87412163
      
       ("drm/fb-helper: Add drm_fb_helper_fbdev_setup/teardown()")
      Reported-by: default avatarkernel test robot <rong.a.chen@intel.com>
      Cc: Noralf Trønnes <noralf@tronnes.org>
      Signed-off-by: default avatarPeter Wu <peter@lekensteyn.nl>
      Reviewed-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20181223005507.28328-1-peter@lekensteyn.nl
      00eb5b0d
    • Noralf Trønnes's avatar
      drm/fb-helper: generic: Fix setup error path · 6e1490cf
      Noralf Trønnes authored
      If register_framebuffer() fails during fbdev setup we will leak the
      framebuffer, the GEM buffer and the shadow buffer for defio. This is
      because drm_fb_helper_fbdev_setup() just calls drm_fb_helper_fini() on
      error not taking into account that register_framebuffer() can fail.
      
      Since the generic emulation uses DRM client for its framebuffer and
      backing buffer in addition to a shadow buffer, it's necessary to open code
      drm_fb_helper_fbdev_setup() to properly handle the error path.
      
      Error cleanup is removed from .fb_probe and is handled by one function for
      all paths.
      
      Fixes: 9060d7f4
      
       ("drm/fb-helper: Finish the generic fbdev emulation")
      Reported-by: default avatarPeter Wu <peter@lekensteyn.nl>
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Acked-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190105181846.26495-1-noralf@tronnes.org
      6e1490cf
  3. Jan 08, 2019
  4. Jan 07, 2019
  5. Jan 03, 2019
    • Chris Wilson's avatar
      drm: Reorder set_property_atomic to avoid returning with an active ww_ctx · 227ad6d9
      Chris Wilson authored
      
      
      Delay the drm_modeset_acquire_init() until after we check for an
      allocation failure so that we can return immediately upon error without
      having to unwind.
      
      WARNING: lock held when returning to user space!
      4.20.0+ #174 Not tainted
      ------------------------------------------------
      syz-executor556/8153 is leaving the kernel with locks still held!
      1 lock held by syz-executor556/8153:
        #0: 000000005100c85c (crtc_ww_class_acquire){+.+.}, at:
      set_property_atomic+0xb3/0x330 drivers/gpu/drm/drm_mode_object.c:462
      
      Reported-by: default avatar <syzbot+6ea337c427f5083ebdf2@syzkaller.appspotmail.com>
      Fixes: 144a7999
      
       ("drm: Handle properties in the core for atomic drivers")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Sean Paul <sean@poorly.run>
      Cc: David Airlie <airlied@linux.ie>
      Cc: <stable@vger.kernel.org> # v4.14+
      Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20181230122842.21917-1-chris@chris-wilson.co.uk
      227ad6d9
  6. Jan 02, 2019
  7. Dec 27, 2018
  8. Dec 24, 2018
  9. Dec 20, 2018
  10. Dec 19, 2018