Commit 242187b3 authored by Hans de Goede's avatar Hans de Goede Committed by Dave Airlie

udldrmfb: udl_get_edid: usb_control_msg buffer must not be on the stack

The buffer passed to usb_control_msg may end up in scatter-gather list, and
may thus not be on the stack. Having it on the stack usually works on x86, but
not on other archs.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent c930812f
...@@ -22,13 +22,17 @@ ...@@ -22,13 +22,17 @@
static u8 *udl_get_edid(struct udl_device *udl) static u8 *udl_get_edid(struct udl_device *udl)
{ {
u8 *block; u8 *block;
char rbuf[3]; char *rbuf;
int ret, i; int ret, i;
block = kmalloc(EDID_LENGTH, GFP_KERNEL); block = kmalloc(EDID_LENGTH, GFP_KERNEL);
if (block == NULL) if (block == NULL)
return NULL; return NULL;
rbuf = kmalloc(2, GFP_KERNEL);
if (rbuf == NULL)
goto error;
for (i = 0; i < EDID_LENGTH; i++) { for (i = 0; i < EDID_LENGTH; i++) {
ret = usb_control_msg(udl->ddev->usbdev, ret = usb_control_msg(udl->ddev->usbdev,
usb_rcvctrlpipe(udl->ddev->usbdev, 0), (0x02), usb_rcvctrlpipe(udl->ddev->usbdev, 0), (0x02),
...@@ -42,10 +46,12 @@ static u8 *udl_get_edid(struct udl_device *udl) ...@@ -42,10 +46,12 @@ static u8 *udl_get_edid(struct udl_device *udl)
block[i] = rbuf[1]; block[i] = rbuf[1];
} }
kfree(rbuf);
return block; return block;
error: error:
kfree(block); kfree(block);
kfree(rbuf);
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment