From 4542b5d7b4e00b11dd37d93986b624c58b198765 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 7 Oct 2019 14:02:57 +0100 Subject: [PATCH] staging: bcm2835-codec: Fix imbalance in dma_buf_get/dma_buf_put When represented with a dmabuf buffer that had previously been imported, there was a call to dma_buf_get without a matching dma_buf_put. This left dmabufs in limbo after all users had supposedly released them. Signed-off-by: Dave Stevenson --- .../staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c @@ -2112,6 +2112,11 @@ static int bcm2835_codec_buf_prepare(str } buf->mmal.dma_buf = dma_buf; + } else { + /* We already have a reference count on the dmabuf, so + * release the one we acquired above. + */ + dma_buf_put(dma_buf); } ret = 0; break;