f0fdfd29c8333594593868ef0d7adebf6b97a5f7
[openwrt/staging/stintel.git] /
1 From 0c941589b9bfb07cd31c792b445e630817e956d1 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Mon, 7 Oct 2019 14:02:57 +0100
4 Subject: [PATCH] staging: bcm2835-codec: Fix imbalance in
5 dma_buf_get/dma_buf_put
6
7 When represented with a dmabuf buffer that had previously been
8 imported, there was a call to dma_buf_get without a matching
9 dma_buf_put. This left dmabufs in limbo after all users had
10 supposedly released them.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
13 ---
14 .../staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 5 +++++
15 1 file changed, 5 insertions(+)
16
17 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
18 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
19 @@ -2112,6 +2112,11 @@ static int bcm2835_codec_buf_prepare(str
20 }
21
22 buf->mmal.dma_buf = dma_buf;
23 + } else {
24 + /* We already have a reference count on the dmabuf, so
25 + * release the one we acquired above.
26 + */
27 + dma_buf_put(dma_buf);
28 }
29 ret = 0;
30 break;