Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94448e21 authored by Brad Love's avatar Brad Love Committed by Mauro Carvalho Chehab
Browse files

media: lgdt3306a: Fix a double kfree on i2c device remove



Both lgdt33606a_release and lgdt3306a_remove kfree state, but _release is
called first, then _remove operates on states members before kfree'ing it.
This can lead to random oops/GPF/etc on USB disconnect.

Signed-off-by: default avatarBrad Love <brad@nextdimension.cc>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 835d6617
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1814,6 +1814,12 @@ static void lgdt3306a_release(struct dvb_frontend *fe)
	struct lgdt3306a_state *state = fe->demodulator_priv;

	dbg_info("\n");

	/*
	 * If state->muxc is not NULL, then we are an i2c device
	 * and lgdt3306a_remove will clean up state
	 */
	if (!state->muxc)
		kfree(state);
}