Merge tag 'drm-misc-fixes-2020-10-01' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
drm-misc-fixes for v5.9: - Small doc fix. - Re-add FB_ARMCLCD for android. - Fix global-out-of-bounds read in fbcon_get_font(). Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/8585daa2-fcbc-3924-ac4f-e7b5668808e0@linux.intel.com
This commit is contained in:
@@ -2299,6 +2299,9 @@ static int fbcon_get_font(struct vc_data *vc, struct console_font *font)
|
||||
|
||||
if (font->width <= 8) {
|
||||
j = vc->vc_font.height;
|
||||
if (font->charcount * j > FNTSIZE(fontdata))
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < font->charcount; i++) {
|
||||
memcpy(data, fontdata, j);
|
||||
memset(data + j, 0, 32 - j);
|
||||
@@ -2307,6 +2310,9 @@ static int fbcon_get_font(struct vc_data *vc, struct console_font *font)
|
||||
}
|
||||
} else if (font->width <= 16) {
|
||||
j = vc->vc_font.height * 2;
|
||||
if (font->charcount * j > FNTSIZE(fontdata))
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < font->charcount; i++) {
|
||||
memcpy(data, fontdata, j);
|
||||
memset(data + j, 0, 64 - j);
|
||||
@@ -2314,6 +2320,9 @@ static int fbcon_get_font(struct vc_data *vc, struct console_font *font)
|
||||
fontdata += j;
|
||||
}
|
||||
} else if (font->width <= 24) {
|
||||
if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata))
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < font->charcount; i++) {
|
||||
for (j = 0; j < vc->vc_font.height; j++) {
|
||||
*data++ = fontdata[0];
|
||||
@@ -2326,6 +2335,9 @@ static int fbcon_get_font(struct vc_data *vc, struct console_font *font)
|
||||
}
|
||||
} else {
|
||||
j = vc->vc_font.height * 4;
|
||||
if (font->charcount * j > FNTSIZE(fontdata))
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < font->charcount; i++) {
|
||||
memcpy(data, fontdata, j);
|
||||
memset(data + j, 0, 128 - j);
|
||||
|
||||
@@ -152,13 +152,6 @@ static inline int attr_col_ec(int shift, struct vc_data *vc,
|
||||
#define attr_bgcol_ec(bgshift, vc, info) attr_col_ec(bgshift, vc, info, 0)
|
||||
#define attr_fgcol_ec(fgshift, vc, info) attr_col_ec(fgshift, vc, info, 1)
|
||||
|
||||
/* Font */
|
||||
#define REFCOUNT(fd) (((int *)(fd))[-1])
|
||||
#define FNTSIZE(fd) (((int *)(fd))[-2])
|
||||
#define FNTCHARCNT(fd) (((int *)(fd))[-3])
|
||||
#define FNTSUM(fd) (((int *)(fd))[-4])
|
||||
#define FONT_EXTRA_WORDS 4
|
||||
|
||||
/*
|
||||
* Scroll Method
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <linux/fb.h>
|
||||
#include <linux/vt_kern.h>
|
||||
#include <linux/console.h>
|
||||
#include <linux/font.h>
|
||||
#include <asm/types.h>
|
||||
#include "fbcon.h"
|
||||
#include "fbcon_rotate.h"
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <linux/fb.h>
|
||||
#include <linux/vt_kern.h>
|
||||
#include <linux/console.h>
|
||||
#include <linux/font.h>
|
||||
#include <asm/types.h>
|
||||
#include "fbcon.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user