The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] media: pwc: Fix the URB buffer allocation
@ 2021-01-21 20:28 Takashi Iwai
  2021-01-22  8:57 ` Robert Foss
  2021-02-05 12:36 ` Hans Verkuil
  0 siblings, 2 replies; 10+ messages in thread
From: Takashi Iwai @ 2021-01-21 20:28 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Mauro Carvalho Chehab, linux-media, linux-kernel

The URB buffer allocation of pwc driver involves with the
dma_map_single(), and it needs to pass the right device.  Currently it
passes usb_device.dev, but it's no real device that manages the DMA.
Since the passed device has no DMA mask set up, now the pwc driver
hits the WARN_ON_ONCE() check in dma_map_page_attrs() (that was
introduced in 5.10), resulting in an error at URB allocations.
Eventually this ended up with the black output.

This patch fixes the bug by passing the proper device, the bus
controller, to make the URB allocation and map working again.

BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1181133
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/media/usb/pwc/pwc-if.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c
index 61869636ec61..d771160bb168 100644
--- a/drivers/media/usb/pwc/pwc-if.c
+++ b/drivers/media/usb/pwc/pwc-if.c
@@ -461,7 +461,7 @@ static int pwc_isoc_init(struct pwc_device *pdev)
 		urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint);
 		urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
 		urb->transfer_buffer_length = ISO_BUFFER_SIZE;
-		urb->transfer_buffer = pwc_alloc_urb_buffer(&udev->dev,
+		urb->transfer_buffer = pwc_alloc_urb_buffer(udev->bus->controller,
 							    urb->transfer_buffer_length,
 							    &urb->transfer_dma);
 		if (urb->transfer_buffer == NULL) {
@@ -524,7 +524,7 @@ static void pwc_iso_free(struct pwc_device *pdev)
 		if (urb) {
 			PWC_DEBUG_MEMORY("Freeing URB\n");
 			if (urb->transfer_buffer)
-				pwc_free_urb_buffer(&urb->dev->dev,
+				pwc_free_urb_buffer(urb->dev->bus->controller,
 						    urb->transfer_buffer_length,
 						    urb->transfer_buffer,
 						    urb->transfer_dma);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-02-06  0:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-21 20:28 [PATCH] media: pwc: Fix the URB buffer allocation Takashi Iwai
2021-01-22  8:57 ` Robert Foss
2021-02-05 12:36 ` Hans Verkuil
2021-02-05 12:53   ` Andrew Lunn
2021-02-05 13:03     ` Takashi Iwai
2021-02-05 13:13       ` Andrew Lunn
2021-02-05 13:42         ` Takashi Iwai
2021-02-05 13:53           ` Andrew Lunn
2021-02-05 14:05             ` Hans Verkuil
2021-02-05 14:19               ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox