Skip to content

Commit 56a14c6

Browse files
committed
Merge tag 'hyperv-fixes-signed-20220128' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux
Pull hyperv fixes from Wei Liu: - Fix screen resolution for hyperv framebuffer (Michael Kelley) - Fix packet header accounting for balloon driver (Yanming Liu) * tag 'hyperv-fixes-signed-20220128' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux: video: hyperv_fb: Fix validation of screen resolution Drivers: hv: balloon: account for vmbus packet header in max_pkt_size
2 parents 3cd7cd8 + 9ff5549 commit 56a14c6

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

drivers/hv/hv_balloon.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,13 @@ static int balloon_connect_vsp(struct hv_device *dev)
16601660
unsigned long t;
16611661
int ret;
16621662

1663+
/*
1664+
* max_pkt_size should be large enough for one vmbus packet header plus
1665+
* our receive buffer size. Hyper-V sends messages up to
1666+
* HV_HYP_PAGE_SIZE bytes long on balloon channel.
1667+
*/
1668+
dev->channel->max_pkt_size = HV_HYP_PAGE_SIZE * 2;
1669+
16631670
ret = vmbus_open(dev->channel, dm_ring_size, dm_ring_size, NULL, 0,
16641671
balloon_onchannelcallback, dev);
16651672
if (ret)

drivers/video/fbdev/hyperv_fb.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,6 @@ struct hvfb_par {
287287

288288
static uint screen_width = HVFB_WIDTH;
289289
static uint screen_height = HVFB_HEIGHT;
290-
static uint screen_width_max = HVFB_WIDTH;
291-
static uint screen_height_max = HVFB_HEIGHT;
292290
static uint screen_depth;
293291
static uint screen_fb_size;
294292
static uint dio_fb_size; /* FB size for deferred IO */
@@ -582,7 +580,6 @@ static int synthvid_get_supported_resolution(struct hv_device *hdev)
582580
int ret = 0;
583581
unsigned long t;
584582
u8 index;
585-
int i;
586583

587584
memset(msg, 0, sizeof(struct synthvid_msg));
588585
msg->vid_hdr.type = SYNTHVID_RESOLUTION_REQUEST;
@@ -613,13 +610,6 @@ static int synthvid_get_supported_resolution(struct hv_device *hdev)
613610
goto out;
614611
}
615612

616-
for (i = 0; i < msg->resolution_resp.resolution_count; i++) {
617-
screen_width_max = max_t(unsigned int, screen_width_max,
618-
msg->resolution_resp.supported_resolution[i].width);
619-
screen_height_max = max_t(unsigned int, screen_height_max,
620-
msg->resolution_resp.supported_resolution[i].height);
621-
}
622-
623613
screen_width =
624614
msg->resolution_resp.supported_resolution[index].width;
625615
screen_height =
@@ -941,7 +931,7 @@ static void hvfb_get_option(struct fb_info *info)
941931

942932
if (x < HVFB_WIDTH_MIN || y < HVFB_HEIGHT_MIN ||
943933
(synthvid_ver_ge(par->synthvid_version, SYNTHVID_VERSION_WIN10) &&
944-
(x > screen_width_max || y > screen_height_max)) ||
934+
(x * y * screen_depth / 8 > screen_fb_size)) ||
945935
(par->synthvid_version == SYNTHVID_VERSION_WIN8 &&
946936
x * y * screen_depth / 8 > SYNTHVID_FB_SIZE_WIN8) ||
947937
(par->synthvid_version == SYNTHVID_VERSION_WIN7 &&
@@ -1194,8 +1184,8 @@ static int hvfb_probe(struct hv_device *hdev,
11941184
}
11951185

11961186
hvfb_get_option(info);
1197-
pr_info("Screen resolution: %dx%d, Color depth: %d\n",
1198-
screen_width, screen_height, screen_depth);
1187+
pr_info("Screen resolution: %dx%d, Color depth: %d, Frame buffer size: %d\n",
1188+
screen_width, screen_height, screen_depth, screen_fb_size);
11991189

12001190
ret = hvfb_getmem(hdev, info);
12011191
if (ret) {

0 commit comments

Comments
 (0)