Skip to content

Commit 63a960b

Browse files
oneukumgregkh
authored andcommitted
media: rc: xbox_remote: heed DMA restrictions
commit e280d1e upstream. The buffer for IO must not be part of the device structure because that violates the DMA coherency rules. Fixes: 02d32bd ("media: rc: add driver for Xbox DVD Movie Playback Kit") Cc: stable@vger.kernel.org Signed-off-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a8ada5b commit 63a960b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

drivers/media/rc/xbox_remote.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct xbox_remote {
5555
struct usb_interface *interface;
5656

5757
struct urb *irq_urb;
58-
unsigned char inbuf[DATA_BUFSIZE] __aligned(sizeof(u16));
58+
u8 *inbuf;
5959

6060
char rc_name[NAME_BUFSIZE];
6161
char rc_phys[NAME_BUFSIZE];
@@ -218,6 +218,10 @@ static int xbox_remote_probe(struct usb_interface *interface,
218218
if (!xbox_remote || !rc_dev)
219219
goto exit_free_dev_rdev;
220220

221+
xbox_remote->inbuf = kzalloc(DATA_BUFSIZE, GFP_KERNEL);
222+
if (!xbox_remote->inbuf)
223+
goto exit_free_inbuf;
224+
221225
/* Allocate URB buffer */
222226
xbox_remote->irq_urb = usb_alloc_urb(0, GFP_KERNEL);
223227
if (!xbox_remote->irq_urb)
@@ -262,6 +266,8 @@ static int xbox_remote_probe(struct usb_interface *interface,
262266
usb_kill_urb(xbox_remote->irq_urb);
263267
exit_free_buffers:
264268
usb_free_urb(xbox_remote->irq_urb);
269+
exit_free_inbuf:
270+
kfree(xbox_remote->inbuf);
265271
exit_free_dev_rdev:
266272
rc_free_device(rc_dev);
267273
kfree(xbox_remote);
@@ -286,6 +292,7 @@ static void xbox_remote_disconnect(struct usb_interface *interface)
286292
usb_kill_urb(xbox_remote->irq_urb);
287293
rc_unregister_device(xbox_remote->rdev);
288294
usb_free_urb(xbox_remote->irq_urb);
295+
kfree(xbox_remote->inbuf);
289296
kfree(xbox_remote);
290297
}
291298

0 commit comments

Comments
 (0)