Skip to content

Commit 32fbdb6

Browse files
oneukumgregkh
authored andcommitted
media: rc: ttusbir: respect DMA coherency rules
[ Upstream commit 50acaad ] Buffers must not share a cache line with other data structures. Allocate separately. Fixes: 0938069 ("[media] rc: Add support for the TechnoTrend USB IR Receiver") 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> [ kept kzalloc(sizeof(*tt), GFP_KERNEL) instead of kzalloc_obj() ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 35bcafc commit 32fbdb6

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

drivers/media/rc/ttusbir.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct ttusbir {
3232

3333
struct led_classdev led;
3434
struct urb *bulk_urb;
35-
uint8_t bulk_buffer[5];
35+
u8 *bulk_buffer;
3636
int bulk_out_endp, iso_in_endp;
3737
bool led_on, is_led_on;
3838
atomic_t led_complete;
@@ -186,13 +186,16 @@ static int ttusbir_probe(struct usb_interface *intf,
186186
struct rc_dev *rc;
187187
int i, j, ret;
188188
int altsetting = -1;
189+
u8 *buffer;
189190

190191
tt = kzalloc(sizeof(*tt), GFP_KERNEL);
192+
buffer = kzalloc(5, GFP_KERNEL);
191193
rc = rc_allocate_device(RC_DRIVER_IR_RAW);
192-
if (!tt || !rc) {
194+
if (!tt || !rc || buffer) {
193195
ret = -ENOMEM;
194196
goto out;
195197
}
198+
tt->bulk_buffer = buffer;
196199

197200
/* find the correct alt setting */
198201
for (i = 0; i < intf->num_altsetting && altsetting == -1; i++) {
@@ -281,8 +284,8 @@ static int ttusbir_probe(struct usb_interface *intf,
281284
tt->bulk_buffer[3] = 0x01;
282285

283286
usb_fill_bulk_urb(tt->bulk_urb, tt->udev, usb_sndbulkpipe(tt->udev,
284-
tt->bulk_out_endp), tt->bulk_buffer, sizeof(tt->bulk_buffer),
285-
ttusbir_bulk_complete, tt);
287+
tt->bulk_out_endp), tt->bulk_buffer, 5,
288+
ttusbir_bulk_complete, tt);
286289

287290
tt->led.name = "ttusbir:green:power";
288291
tt->led.default_trigger = "rc-feedback";
@@ -351,6 +354,7 @@ static int ttusbir_probe(struct usb_interface *intf,
351354
kfree(tt);
352355
}
353356
rc_free_device(rc);
357+
kfree(buffer);
354358

355359
return ret;
356360
}
@@ -373,6 +377,7 @@ static void ttusbir_disconnect(struct usb_interface *intf)
373377
}
374378
usb_kill_urb(tt->bulk_urb);
375379
usb_free_urb(tt->bulk_urb);
380+
kfree(tt->bulk_buffer);
376381
usb_set_intfdata(intf, NULL);
377382
kfree(tt);
378383
}

0 commit comments

Comments
 (0)