[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200722130651.GC220681@mwanda>
Date: Wed, 22 Jul 2020 16:06:51 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>,
Dave Stevenson <dave.stevenson@...pberrypi.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jacopo Mondi <jacopo@...ndi.org>,
Jamal Shareef <jamal.k.shareef@...il.com>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
Stefan Wahren <wahrenst@....net>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
bcm-kernel-feedback-list@...adcom.com,
linux-rpi-kernel@...ts.infradead.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH] staging: vchiq: Fix refcounting bug in buffer_from_host()
If we fail to queue the buffer then it can never be dequeued. This can
lead to a forever loop in stop_streaming() when we wait for everything
to finish.
Fixes: 70ec64ccdaac ("staging: bcm2835-camera: Ensure all buffers are returned on disable")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
>From static analysis. Not tested. Please review carefully etc.
drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
index dc767730db43..65dd2a55b3da 100644
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
@@ -441,6 +441,8 @@ buffer_from_host(struct vchiq_mmal_instance *instance,
ret = vchiq_queue_kernel_message(instance->service_handle, &m,
sizeof(struct mmal_msg_header) +
sizeof(m.u.buffer_from_host));
+ if (ret)
+ atomic_dec(&port->buffers_with_vpu);
vchiq_release_service(instance->service_handle);
--
2.27.0
Powered by blists - more mailing lists