Skip to content

Commit a4819ac

Browse files
committed
Merge tag 'fbdev-for-6.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev
Pull fbdev fixes from Helge Deller: - atyfb: Avoid hard lock up when PLL not initialized (Daniel Palmer) - pvr2fb: Fix build error when CONFIG_PVR2_DMA enabled (Florian Fuchs) - bitblit: Fix out-of-bounds read in bit_putcs* (Junjie Cao) - valkyriefb: Fix reference count leak (Miaoqian Lin) - fbcon: Fix slab-use-after-free in fb_mode_is_equal (Quanmin Yan) - fb.h: Fix typo in "vertical" (Piyush Choudhary) * tag 'fbdev-for-6.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev: fbdev: atyfb: Check if pll_ops->init_pll failed fbcon: Set fb_display[i]->mode to NULL when the mode is released fbdev: bitblit: bound-check glyph index in bit_putcs* fbdev: pvr2fb: Fix leftover reference to ONCHIP_NR_DMA_CHANNELS fbdev: valkyriefb: Fix reference count leak in valkyriefb_init video: fb: Fix typo in comment in fb.h
2 parents e576349 + 7073c7f commit a4819ac

File tree

8 files changed

+44
-8
lines changed

8 files changed

+44
-8
lines changed

drivers/video/fbdev/aty/atyfb_base.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2614,8 +2614,12 @@ static int aty_init(struct fb_info *info)
26142614
pr_cont("\n");
26152615
}
26162616
#endif
2617-
if (par->pll_ops->init_pll)
2618-
par->pll_ops->init_pll(info, &par->pll);
2617+
if (par->pll_ops->init_pll) {
2618+
ret = par->pll_ops->init_pll(info, &par->pll);
2619+
if (ret)
2620+
return ret;
2621+
}
2622+
26192623
if (par->pll_ops->resume_pll)
26202624
par->pll_ops->resume_pll(info, &par->pll);
26212625

drivers/video/fbdev/core/bitblit.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,16 @@ static inline void bit_putcs_aligned(struct vc_data *vc, struct fb_info *info,
7979
struct fb_image *image, u8 *buf, u8 *dst)
8080
{
8181
u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
82+
unsigned int charcnt = vc->vc_font.charcount;
8283
u32 idx = vc->vc_font.width >> 3;
8384
u8 *src;
8485

8586
while (cnt--) {
86-
src = vc->vc_font.data + (scr_readw(s++)&
87-
charmask)*cellsize;
87+
u16 ch = scr_readw(s++) & charmask;
88+
89+
if (ch >= charcnt)
90+
ch = 0;
91+
src = vc->vc_font.data + (unsigned int)ch * cellsize;
8892

8993
if (attr) {
9094
update_attr(buf, src, attr, vc);
@@ -112,14 +116,18 @@ static inline void bit_putcs_unaligned(struct vc_data *vc,
112116
u8 *dst)
113117
{
114118
u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
119+
unsigned int charcnt = vc->vc_font.charcount;
115120
u32 shift_low = 0, mod = vc->vc_font.width % 8;
116121
u32 shift_high = 8;
117122
u32 idx = vc->vc_font.width >> 3;
118123
u8 *src;
119124

120125
while (cnt--) {
121-
src = vc->vc_font.data + (scr_readw(s++)&
122-
charmask)*cellsize;
126+
u16 ch = scr_readw(s++) & charmask;
127+
128+
if (ch >= charcnt)
129+
ch = 0;
130+
src = vc->vc_font.data + (unsigned int)ch * cellsize;
123131

124132
if (attr) {
125133
update_attr(buf, src, attr, vc);

drivers/video/fbdev/core/fbcon.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,6 +2810,25 @@ int fbcon_mode_deleted(struct fb_info *info,
28102810
return found;
28112811
}
28122812

2813+
static void fbcon_delete_mode(struct fb_videomode *m)
2814+
{
2815+
struct fbcon_display *p;
2816+
2817+
for (int i = first_fb_vc; i <= last_fb_vc; i++) {
2818+
p = &fb_display[i];
2819+
if (p->mode == m)
2820+
p->mode = NULL;
2821+
}
2822+
}
2823+
2824+
void fbcon_delete_modelist(struct list_head *head)
2825+
{
2826+
struct fb_modelist *modelist;
2827+
2828+
list_for_each_entry(modelist, head, list)
2829+
fbcon_delete_mode(&modelist->mode);
2830+
}
2831+
28132832
#ifdef CONFIG_VT_HW_CONSOLE_BINDING
28142833
static void fbcon_unbind(void)
28152834
{

drivers/video/fbdev/core/fbmem.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ static void do_unregister_framebuffer(struct fb_info *fb_info)
544544
fb_info->pixmap.addr = NULL;
545545
}
546546

547+
fbcon_delete_modelist(&fb_info->modelist);
547548
fb_destroy_modelist(&fb_info->modelist);
548549
registered_fb[fb_info->node] = NULL;
549550
num_registered_fb--;

drivers/video/fbdev/pvr2fb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static unsigned long pvr2fb_map;
192192

193193
#ifdef CONFIG_PVR2_DMA
194194
static unsigned int shdma = PVR2_CASCADE_CHAN;
195-
static unsigned int pvr2dma = ONCHIP_NR_DMA_CHANNELS;
195+
static unsigned int pvr2dma = CONFIG_NR_ONCHIP_DMA_CHANNELS;
196196
#endif
197197

198198
static struct fb_videomode pvr2_modedb[] = {

drivers/video/fbdev/valkyriefb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,13 @@ static int __init valkyriefb_init(void)
329329

330330
if (of_address_to_resource(dp, 0, &r)) {
331331
printk(KERN_ERR "can't find address for valkyrie\n");
332+
of_node_put(dp);
332333
return 0;
333334
}
334335

335336
frame_buffer_phys = r.start;
336337
cmap_regs_phys = r.start + 0x304000;
338+
of_node_put(dp);
337339
}
338340
#endif /* ppc (!CONFIG_MAC) */
339341

include/linux/fbcon.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ void fbcon_suspended(struct fb_info *info);
1818
void fbcon_resumed(struct fb_info *info);
1919
int fbcon_mode_deleted(struct fb_info *info,
2020
struct fb_videomode *mode);
21+
void fbcon_delete_modelist(struct list_head *head);
2122
void fbcon_new_modelist(struct fb_info *info);
2223
void fbcon_get_requirement(struct fb_info *info,
2324
struct fb_blit_caps *caps);
@@ -38,6 +39,7 @@ static inline void fbcon_suspended(struct fb_info *info) {}
3839
static inline void fbcon_resumed(struct fb_info *info) {}
3940
static inline int fbcon_mode_deleted(struct fb_info *info,
4041
struct fb_videomode *mode) { return 0; }
42+
static inline void fbcon_delete_modelist(struct list_head *head) {}
4143
static inline void fbcon_new_modelist(struct fb_info *info) {}
4244
static inline void fbcon_get_requirement(struct fb_info *info,
4345
struct fb_blit_caps *caps) {}

include/uapi/linux/fb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ enum {
319319
#define FB_VBLANK_HAVE_VCOUNT 0x020 /* the vcount field is valid */
320320
#define FB_VBLANK_HAVE_HCOUNT 0x040 /* the hcount field is valid */
321321
#define FB_VBLANK_VSYNCING 0x080 /* currently in a vsync */
322-
#define FB_VBLANK_HAVE_VSYNC 0x100 /* verical syncs can be detected */
322+
#define FB_VBLANK_HAVE_VSYNC 0x100 /* vertical syncs can be detected */
323323

324324
struct fb_vblank {
325325
__u32 flags; /* FB_VBLANK flags */

0 commit comments

Comments
 (0)