kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] media: stv090x: fix double free on state object
@ 2019-06-11 15:38 Colin King
  0 siblings, 0 replies; only message in thread
From: Colin King @ 2019-06-11 15:38 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Tobias Klausmann, linux-media
  Cc: kernel-janitors, linux-kernel

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

There two callers of stv090x_setup_compound manage the allocation and
freeing if state there is an error condition from stv090x_setup_compound.
Currently function stv090x_setup_compound also frees the state object
too, leading to a double free in the callers of this function.  Fix
this by removing the extraneous free in stv090x_setup_compound and just
leave the callers handle the allocation/free'ing.

Addresses-Coverity: ("Double free")
Fixes: eb5005df886b ("media: stv090x: Implement probe/remove for stv090x")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/media/dvb-frontends/stv090x.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c
index 986e585e0103..90d24131d335 100644
--- a/drivers/media/dvb-frontends/stv090x.c
+++ b/drivers/media/dvb-frontends/stv090x.c
@@ -4942,7 +4942,6 @@ static int stv090x_setup_compound(struct stv090x_state *state)
 	return 0;
 
 error:
-	kfree(state);
 	return -ENOMEM;
 err_remove:
 	remove_dev(state->internal);
-- 
2.20.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-11 15:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-11 15:38 [PATCH][next] media: stv090x: fix double free on state object Colin King

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).