Skip to content

Commit

Permalink
[media] e4000: fix crash when attach fails
Browse files Browse the repository at this point in the history
Callbacks were set even attach failed. This leads calling
.release() in error case and resulted crash.

Reported-by: Oliver Schinagl <[email protected]>
Signed-off-by: Antti Palosaari <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
palosaari authored and Mauro Carvalho Chehab committed Sep 27, 2012
1 parent ef40c00 commit 36f647b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/media/tuners/e4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,6 @@ struct dvb_frontend *e4000_attach(struct dvb_frontend *fe,

priv->cfg = cfg;
priv->i2c = i2c;
fe->tuner_priv = priv;
memcpy(&fe->ops.tuner_ops, &e4000_tuner_ops,
sizeof(struct dvb_tuner_ops));

/* check if the tuner is there */
ret = e4000_rd_reg(priv, 0x02, &chip_id);
Expand All @@ -389,6 +386,10 @@ struct dvb_frontend *e4000_attach(struct dvb_frontend *fe,
"%s: Elonics E4000 successfully identified\n",
KBUILD_MODNAME);

fe->tuner_priv = priv;
memcpy(&fe->ops.tuner_ops, &e4000_tuner_ops,
sizeof(struct dvb_tuner_ops));

if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);

Expand Down

0 comments on commit 36f647b

Please sign in to comment.