Skip to content

Commit

Permalink
udldrmfb: udl_get_edid: usb_control_msg buffer must not be on the stack
Browse files Browse the repository at this point in the history
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: Hans de Goede <hdegoede@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Hans de Goede authored and Dave Airlie committed Jan 13, 2013
1 parent c930812 commit 242187b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/gpu/drm/udl/udl_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@
static u8 *udl_get_edid(struct udl_device *udl)
{
u8 *block;
char rbuf[3];
char *rbuf;
int ret, i;

block = kmalloc(EDID_LENGTH, GFP_KERNEL);
if (block == NULL)
return NULL;

rbuf = kmalloc(2, GFP_KERNEL);
if (rbuf == NULL)
goto error;

for (i = 0; i < EDID_LENGTH; i++) {
ret = usb_control_msg(udl->ddev->usbdev,
usb_rcvctrlpipe(udl->ddev->usbdev, 0), (0x02),
Expand All @@ -42,10 +46,12 @@ static u8 *udl_get_edid(struct udl_device *udl)
block[i] = rbuf[1];
}

kfree(rbuf);
return block;

error:
kfree(block);
kfree(rbuf);
return NULL;
}

Expand Down

0 comments on commit 242187b

Please sign in to comment.