From 54d0ee10d85125ef70cff370385f1fc2d376981b Mon Sep 17 00:00:00 2001 From: Dennis Cagle Date: Mon, 1 Aug 2016 11:48:04 -0700 Subject: [PATCH] adf: Zero out the mapping data The adf_device_post_nocopy function eventually calls the dma_buf_attach and dma_buf_map_attachment functions. If the dma_buf_attach function succeeds but the dma_buf_map_attachment function fails, both the adf_buffer_map function and the adf_device_post_nocopy function will call the dma_buf_detach function to tear down the same dma-buf attachment. b/28447556 Change-Id: I8eb40486496fe2a2ae5dfa1be4b76a4af0d6b827 Signed-off-by: Dennis Cagle --- drivers/video/adf/adf_client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/video/adf/adf_client.c b/drivers/video/adf/adf_client.c index 8061d8e6b9fb..75b2f0b18522 100644 --- a/drivers/video/adf/adf_client.c +++ b/drivers/video/adf/adf_client.c @@ -305,8 +305,10 @@ static int adf_buffer_map(struct adf_device *dev, struct adf_buffer *buf, } done: - if (ret < 0) + if (ret < 0) { adf_buffer_mapping_cleanup(mapping, buf); + memset(mapping, 0, sizeof(*mapping)); + } return ret; }