This series fixes two independent problems in the fbdev paths used by
the udlfb driver. Both were found while analyzing failures observed on
a DisplayLink USB adapter; the changes are compile-tested only and no
hardware testing was performed.

Patch 1 fixes an out-of-bounds read when the framebuffer is switched to
a larger mode while the shadow buffer is disabled or its allocation
fails. The driver kept the previous, smaller shadow buffer and
dlfb_render_hline() used it to compare lines of the larger framebuffer.

Patch 2 fixes framebuffer registration reporting a failure after the
framebuffer has already been registered. A failed console takeover is
not fatal for the framebuffer itself, but drivers treated the error as
fatal, freed the live fb_info and left a dangling entry in
registered_fb[]; the next open then dereferenced freed memory.

Changes in v4:
  - Patch 1: keep the change local to the driver and reuse
    dlfb->render_mutex for publishing the buffers and the line length;
    no local geometry snapshots.
  - Patch 2: unchanged; the return-value cleanup of the fbcon hooks is
    left for a separate patch.

Changes in v3:
  - Patch 1: capture line_length and smem_len under dlfb->render_mutex
    and use the captured values for the bounds check and for rendering;
    publish the new line length under the same lock.
  - Patch 2: drop the now unused return value from fbcon_fb_registered()
    and do_fb_registered().

Changes in v2:
  - Patch 1: publish the new buffers under dlfb->render_mutex and free
    the stale shadow buffer directly instead of deferring it.

Based on v7.3.5.

YuanZhe Liu (2):
  fbdev: udlfb: fix shadow buffer handling when the framebuffer grows
  fbdev: fbmem: don't fail registration when fbcon cannot take over

 drivers/video/fbdev/core/fbmem.c |  8 +++++-
 drivers/video/fbdev/udlfb.c      | 44 ++++++++++++++++++++++++--------
 2 files changed, 41 insertions(+), 11 deletions(-)

-- 
2.34.1

Reply via email to