summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-01-11 12:08:57 +0100
committerDave Airlie <airlied@redhat.com>2013-01-14 08:44:33 +1000
commit242187b362555849e8c971dfbbfd55f8bd9fa717 (patch)
tree6ec50cb4197fdf8a5d1ad8391d483f6f33ec7dbd /drivers
parentc930812fe5ebe725760422c9c351d1f6fde1502d (diff)
downloadlinux-3.10-242187b362555849e8c971dfbbfd55f8bd9fa717.tar.gz
linux-3.10-242187b362555849e8c971dfbbfd55f8bd9fa717.tar.bz2
linux-3.10-242187b362555849e8c971dfbbfd55f8bd9fa717.zip
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: Hans de Goede <hdegoede@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/udl/udl_connector.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
index 3e6208f773e..353bc1ea6f6 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -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),
@@ -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;
}