From: K. Y. Srinivasan Date: Thu, 29 Sep 2011 18:54:45 +0000 (-0700) Subject: Staging: hv: mousevsc: Handle the case where we may get bogus report desc size X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=60e8615ad6e09f47b15c4d023f728c112b8f7294;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git Staging: hv: mousevsc: Handle the case where we may get bogus report desc size Handle the case where we may get bogus report desc size from the host. Signed-off-by: K. Y. Srinivasan Signed-off-by: Haiyang Zhang Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c index b7cc16471ec4..19cfc231ab99 100644 --- a/drivers/staging/hv/hv_mouse.c +++ b/drivers/staging/hv/hv_mouse.c @@ -341,6 +341,8 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device, /* Save the report desc */ input_device->report_desc_size = desc->desc[0].wDescriptorLength; + if (input_device->report_desc_size == 0) + goto cleanup; input_device->report_desc = kzalloc(input_device->report_desc_size, GFP_ATOMIC);