Skip to content

Commit 8ea2c51

Browse files
committed
Merge tag 'drm-misc-fixes-2022-02-03' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
* dma-buf/heaps: Fix potential spectre v1 gadget * drm/kmb: Fix potential out-of-bounds access * drm/mxsfb: Fix NULL-pointer dereference * drm/nouveau: Fix potential out-of-bounds access in BIOS decoding * fbdev: Re-add support for fbcon hardware acceleration Signed-off-by: Dave Airlie <[email protected]> From: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/Yfu8mTZQUNt1RwZd@linux-uq9g
2 parents 7eb3848 + 622c9a3 commit 8ea2c51

File tree

16 files changed

+761
-76
lines changed

16 files changed

+761
-76
lines changed

Documentation/gpu/todo.rst

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -300,30 +300,6 @@ Contact: Daniel Vetter, Noralf Tronnes
300300

301301
Level: Advanced
302302

303-
Garbage collect fbdev scrolling acceleration
304-
--------------------------------------------
305-
306-
Scroll acceleration has been disabled in fbcon. Now it works as the old
307-
SCROLL_REDRAW mode. A ton of code was removed in fbcon.c and the hook bmove was
308-
removed from fbcon_ops.
309-
Remaining tasks:
310-
311-
- a bunch of the hooks in fbcon_ops could be removed or simplified by calling
312-
directly instead of the function table (with a switch on p->rotate)
313-
314-
- fb_copyarea is unused after this, and can be deleted from all drivers
315-
316-
- after that, fb_copyarea can be deleted from fb_ops in include/linux/fb.h as
317-
well as cfb_copyarea
318-
319-
Note that not all acceleration code can be deleted, since clearing and cursor
320-
support is still accelerated, which might be good candidates for further
321-
deletion projects.
322-
323-
Contact: Daniel Vetter
324-
325-
Level: Intermediate
326-
327303
idr_init_base()
328304
---------------
329305

drivers/dma-buf/dma-heap.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/xarray.h>
1515
#include <linux/list.h>
1616
#include <linux/slab.h>
17+
#include <linux/nospec.h>
1718
#include <linux/uaccess.h>
1819
#include <linux/syscalls.h>
1920
#include <linux/dma-heap.h>
@@ -135,6 +136,7 @@ static long dma_heap_ioctl(struct file *file, unsigned int ucmd,
135136
if (nr >= ARRAY_SIZE(dma_heap_ioctl_cmds))
136137
return -EINVAL;
137138

139+
nr = array_index_nospec(nr, ARRAY_SIZE(dma_heap_ioctl_cmds));
138140
/* Get the kernel ioctl cmd that matches */
139141
kcmd = dma_heap_ioctl_cmds[nr];
140142

drivers/gpu/drm/kmb/kmb_plane.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,6 @@ static void kmb_plane_atomic_disable(struct drm_plane *plane,
158158
case LAYER_1:
159159
kmb->plane_status[plane_id].ctrl = LCD_CTRL_VL2_ENABLE;
160160
break;
161-
case LAYER_2:
162-
kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL1_ENABLE;
163-
break;
164-
case LAYER_3:
165-
kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL2_ENABLE;
166-
break;
167161
}
168162

169163
kmb->plane_status[plane_id].disable = true;

drivers/gpu/drm/mxsfb/mxsfb_kms.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,11 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc,
361361
bridge_state =
362362
drm_atomic_get_new_bridge_state(state,
363363
mxsfb->bridge);
364-
bus_format = bridge_state->input_bus_cfg.format;
364+
if (!bridge_state)
365+
bus_format = MEDIA_BUS_FMT_FIXED;
366+
else
367+
bus_format = bridge_state->input_bus_cfg.format;
368+
365369
if (bus_format == MEDIA_BUS_FMT_FIXED) {
366370
dev_warn_once(drm->dev,
367371
"Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n"

drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ nvbios_addr(struct nvkm_bios *bios, u32 *addr, u8 size)
3838
*addr += bios->imaged_addr;
3939
}
4040

41-
if (unlikely(*addr + size >= bios->size)) {
41+
if (unlikely(*addr + size > bios->size)) {
4242
nvkm_error(&bios->subdev, "OOB %d %08x %08x\n", size, p, *addr);
4343
return false;
4444
}

drivers/video/console/Kconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,26 @@ config FRAMEBUFFER_CONSOLE
7878
help
7979
Low-level framebuffer-based console driver.
8080

81+
config FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
82+
bool "Enable legacy fbcon hardware acceleration code"
83+
depends on FRAMEBUFFER_CONSOLE
84+
default y if PARISC
85+
default n
86+
help
87+
This option enables the fbcon (framebuffer text-based) hardware
88+
acceleration for graphics drivers which were written for the fbdev
89+
graphics interface.
90+
91+
On modern machines, on mainstream machines (like x86-64) or when
92+
using a modern Linux distribution those fbdev drivers usually aren't used.
93+
So enabling this option wouldn't have any effect, which is why you want
94+
to disable this option on such newer machines.
95+
96+
If you compile this kernel for older machines which still require the
97+
fbdev drivers, you may want to say Y.
98+
99+
If unsure, select n.
100+
81101
config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
82102
bool "Map the console to the primary display device"
83103
depends on FRAMEBUFFER_CONSOLE

drivers/video/fbdev/core/bitblit.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,21 @@ static void update_attr(u8 *dst, u8 *src, int attribute,
4343
}
4444
}
4545

46+
static void bit_bmove(struct vc_data *vc, struct fb_info *info, int sy,
47+
int sx, int dy, int dx, int height, int width)
48+
{
49+
struct fb_copyarea area;
50+
51+
area.sx = sx * vc->vc_font.width;
52+
area.sy = sy * vc->vc_font.height;
53+
area.dx = dx * vc->vc_font.width;
54+
area.dy = dy * vc->vc_font.height;
55+
area.height = height * vc->vc_font.height;
56+
area.width = width * vc->vc_font.width;
57+
58+
info->fbops->fb_copyarea(info, &area);
59+
}
60+
4661
static void bit_clear(struct vc_data *vc, struct fb_info *info, int sy,
4762
int sx, int height, int width)
4863
{
@@ -378,6 +393,7 @@ static int bit_update_start(struct fb_info *info)
378393

379394
void fbcon_set_bitops(struct fbcon_ops *ops)
380395
{
396+
ops->bmove = bit_bmove;
381397
ops->clear = bit_clear;
382398
ops->putcs = bit_putcs;
383399
ops->clear_margins = bit_clear_margins;

0 commit comments

Comments
 (0)