linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Colin Ian King <colin.king@canonical.com>,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: [PATCH AUTOSEL 5.3 082/203] media: vsp1: fix memory leak of dl on error return path
Date: Sun, 22 Sep 2019 14:41:48 -0400	[thread overview]
Message-ID: <20190922184350.30563-82-sashal@kernel.org> (raw)
In-Reply-To: <20190922184350.30563-1-sashal@kernel.org>

From: Colin Ian King <colin.king@canonical.com>

[ Upstream commit 70c55c1ad1a76e804ee5330e134674f5d2741cb7 ]

Currently when the call vsp1_dl_body_get fails and returns null the
error return path leaks the allocation of dl. Fix this by kfree'ing
dl before returning.

Addresses-Coverity: ("Resource leak")

Fixes: 5d7936b8e27d ("media: vsp1: Convert display lists to use new body pool")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/platform/vsp1/vsp1_dl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/vsp1/vsp1_dl.c b/drivers/media/platform/vsp1/vsp1_dl.c
index 104b6f5145364..d7b43037e500a 100644
--- a/drivers/media/platform/vsp1/vsp1_dl.c
+++ b/drivers/media/platform/vsp1/vsp1_dl.c
@@ -557,8 +557,10 @@ static struct vsp1_dl_list *vsp1_dl_list_alloc(struct vsp1_dl_manager *dlm)
 
 	/* Get a default body for our list. */
 	dl->body0 = vsp1_dl_body_get(dlm->pool);
-	if (!dl->body0)
+	if (!dl->body0) {
+		kfree(dl);
 		return NULL;
+	}
 
 	header_offset = dl->body0->max_entries * sizeof(*dl->body0->entries);
 
-- 
2.20.1


  parent reply	other threads:[~2019-09-22 18:46 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190922184350.30563-1-sashal@kernel.org>
2019-09-22 18:40 ` [PATCH AUTOSEL 5.3 015/203] media: dib0700: fix link error for dibx000_i2c_set_speed Sasha Levin
2019-09-22 18:40 ` [PATCH AUTOSEL 5.3 016/203] media: mtk-cir: lower de-glitch counter for rc-mm protocol Sasha Levin
2019-09-22 18:40 ` [PATCH AUTOSEL 5.3 018/203] media: exynos4-is: fix leaked of_node references Sasha Levin
2019-09-22 18:40 ` [PATCH AUTOSEL 5.3 019/203] media: vivid:add sanity check to avoid divide error and set value to 1 if 0 Sasha Levin
2019-09-22 18:40 ` [PATCH AUTOSEL 5.3 020/203] media: vb2: reorder checks in vb2_poll() Sasha Levin
2019-09-22 18:40 ` [PATCH AUTOSEL 5.3 021/203] media: vivid: work around high stack usage with clang Sasha Levin
2019-09-22 18:40 ` [PATCH AUTOSEL 5.3 022/203] media: hdpvr: Add device num check and handling Sasha Levin
2019-09-22 18:40 ` [PATCH AUTOSEL 5.3 023/203] media: i2c: ov5640: Check for devm_gpiod_get_optional() error Sasha Levin
2019-09-22 18:41 ` [PATCH AUTOSEL 5.3 038/203] media: iguanair: add sanity checks Sasha Levin
2019-09-22 18:41 ` [PATCH AUTOSEL 5.3 053/203] media: media/platform: fsl-viu.c: fix build for MICROBLAZE Sasha Levin
2019-09-22 18:41 ` [PATCH AUTOSEL 5.3 054/203] media: staging: tegra-vde: Fix build error Sasha Levin
2019-09-22 18:41 ` [PATCH AUTOSEL 5.3 067/203] media: gspca: zero usb_buf on error Sasha Levin
2019-09-22 18:41 ` [PATCH AUTOSEL 5.3 070/203] media: mtk-mdp: fix reference count on old device tree Sasha Levin
2019-09-22 18:41 ` [PATCH AUTOSEL 5.3 071/203] media: i2c: tda1997x: prevent potential NULL pointer access Sasha Levin
2019-09-22 18:41 ` [PATCH AUTOSEL 5.3 072/203] media: fdp1: Reduce FCP not found message level to debug Sasha Levin
2019-09-22 18:41 ` [PATCH AUTOSEL 5.3 073/203] media: em28xx: modules workqueue not inited for 2nd device Sasha Levin
2019-09-22 18:41 ` [PATCH AUTOSEL 5.3 076/203] media: rc: imon: Allow iMON RC protocol for ffdc 7e device Sasha Levin
2019-09-22 18:41 ` Sasha Levin [this message]
2019-09-22 18:41 ` [PATCH AUTOSEL 5.3 083/203] media: i2c: ov5645: Fix power sequence Sasha Levin
2019-09-22 18:41 ` [PATCH AUTOSEL 5.3 084/203] media: omap3isp: Don't set streaming state on random subdevs Sasha Levin
2019-09-23  7:19   ` Sakari Ailus
2019-09-23  7:25     ` Laurent Pinchart
2019-09-23 13:35       ` Sasha Levin
2019-10-01 14:30     ` Sasha Levin
2019-09-22 18:41 ` [PATCH AUTOSEL 5.3 085/203] media: imx: mipi csi-2: Don't fail if initial state times-out Sasha Levin
2019-09-22 18:42 ` [PATCH AUTOSEL 5.3 094/203] media: radio/si470x: kill urb on error Sasha Levin
2019-09-22 18:42 ` [PATCH AUTOSEL 5.3 095/203] media: hdpvr: add terminating 0 at end of string Sasha Levin
2019-09-22 18:42 ` [PATCH AUTOSEL 5.3 107/203] media: mceusb: fix (eliminate) TX IR signal length limit Sasha Levin
2019-09-22 18:42 ` [PATCH AUTOSEL 5.3 108/203] media: dvb-frontends: use ida for pll number Sasha Levin
2019-09-22 18:42 ` [PATCH AUTOSEL 5.3 110/203] media: dvb-core: fix a memory leak bug Sasha Levin
2019-09-22 18:42 ` [PATCH AUTOSEL 5.3 123/203] media: cec-notifier: clear cec_adap in cec_notifier_unregister Sasha Levin
2019-09-22 18:42 ` [PATCH AUTOSEL 5.3 124/203] media: saa7146: add cleanup in hexium_attach() Sasha Levin
2019-09-22 18:42 ` [PATCH AUTOSEL 5.3 125/203] media: cpia2_usb: fix memory leaks Sasha Levin
2019-09-22 18:42 ` [PATCH AUTOSEL 5.3 126/203] media: saa7134: fix terminology around saa7134_i2c_eeprom_md7134_gate() Sasha Levin
2019-09-22 18:42 ` [PATCH AUTOSEL 5.3 130/203] media: aspeed-video: address a protential usage of an unitialized var Sasha Levin
2019-09-22 18:42 ` [PATCH AUTOSEL 5.3 131/203] media: ov9650: add a sanity check Sasha Levin
2019-09-22 18:43 ` [PATCH AUTOSEL 5.3 188/203] media: technisat-usb2: break out of loop at end of buffer Sasha Levin
2019-09-22 18:43 ` [PATCH AUTOSEL 5.3 194/203] media: ttusb-dec: Fix info-leak in ttusb_dec_send_command() Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190922184350.30563-82-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab+samsung@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).