diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-01-11 06:08:57 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2013-01-13 17:44:33 -0500 |
commit | 242187b362555849e8c971dfbbfd55f8bd9fa717 (patch) | |
tree | 6ec50cb4197fdf8a5d1ad8391d483f6f33ec7dbd /drivers/gpu/drm/udl | |
parent | c930812fe5ebe725760422c9c351d1f6fde1502d (diff) |
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/gpu/drm/udl')
-rw-r--r-- | drivers/gpu/drm/udl/udl_connector.c | 8 |
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 3e6208f773e2..353bc1ea6f68 100644 --- a/drivers/gpu/drm/udl/udl_connector.c +++ b/drivers/gpu/drm/udl/udl_connector.c | |||
@@ -22,13 +22,17 @@ | |||
22 | static u8 *udl_get_edid(struct udl_device *udl) | 22 | static u8 *udl_get_edid(struct udl_device *udl) |
23 | { | 23 | { |
24 | u8 *block; | 24 | u8 *block; |
25 | char rbuf[3]; | 25 | char *rbuf; |
26 | int ret, i; | 26 | int ret, i; |
27 | 27 | ||
28 | block = kmalloc(EDID_LENGTH, GFP_KERNEL); | 28 | block = kmalloc(EDID_LENGTH, GFP_KERNEL); |
29 | if (block == NULL) | 29 | if (block == NULL) |
30 | return NULL; | 30 | return NULL; |
31 | 31 | ||
32 | rbuf = kmalloc(2, GFP_KERNEL); | ||
33 | if (rbuf == NULL) | ||
34 | goto error; | ||
35 | |||
32 | for (i = 0; i < EDID_LENGTH; i++) { | 36 | for (i = 0; i < EDID_LENGTH; i++) { |
33 | ret = usb_control_msg(udl->ddev->usbdev, | 37 | ret = usb_control_msg(udl->ddev->usbdev, |
34 | usb_rcvctrlpipe(udl->ddev->usbdev, 0), (0x02), | 38 | usb_rcvctrlpipe(udl->ddev->usbdev, 0), (0x02), |
@@ -42,10 +46,12 @@ static u8 *udl_get_edid(struct udl_device *udl) | |||
42 | block[i] = rbuf[1]; | 46 | block[i] = rbuf[1]; |
43 | } | 47 | } |
44 | 48 | ||
49 | kfree(rbuf); | ||
45 | return block; | 50 | return block; |
46 | 51 | ||
47 | error: | 52 | error: |
48 | kfree(block); | 53 | kfree(block); |
54 | kfree(rbuf); | ||
49 | return NULL; | 55 | return NULL; |
50 | } | 56 | } |
51 | 57 | ||