[PATCH] ASoC: Jack: Fix NULL pointer dereference in snd_soc_jack_report
Check for existance of jack before tracing. NULL pointer dereference has been reported by KASAN while unloading machine driver (snd_soc_cnl_rt274).
Signed-off-by: Pawel Harlozinski pawel.harlozinski@linux.intel.com
--- sound/soc/soc-jack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c index a71d2340eb05..b5748dcd490f 100644 --- a/sound/soc/soc-jack.c +++ b/sound/soc/soc-jack.c @@ -82,10 +82,9 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) unsigned int sync = 0; int enable;
- trace_snd_soc_jack_report(jack, mask, status); - if (!jack) return; + trace_snd_soc_jack_report(jack, mask, status);
dapm = &jack->card->dapm;
When machine driver is unloaded there is nothing to handle jack detect reports. This were causing flood of messages from unhandled IRQs.
Signed-off-by: Pawel Harlozinski pawel.harlozinski@linux.intel.com
--- sound/soc/codecs/rt274.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c index cbb5e176d11a..993fd365524a 100644 --- a/sound/soc/codecs/rt274.c +++ b/sound/soc/codecs/rt274.c @@ -408,13 +408,13 @@ static int rt274_mic_detect(struct snd_soc_component *component, /* Disable jack detection */ regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL, RT274_IRQ_EN, RT274_IRQ_DIS); - + disable_irq(rt274->i2c->irq); return 0; }
regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL, RT274_IRQ_EN, RT274_IRQ_EN); - + enable_irq(rt274->i2c->irq); /* Send an initial report */ rt274_irq(0, rt274);
@@ -1197,6 +1197,8 @@ static int rt274_i2c_probe(struct i2c_client *i2c, "Failed to reguest IRQ: %d\n", ret); return ret; } + /* Gets re-enabled by .set_jack = rt274_mic_detect */ + disable_irq(rt274->i2c->irq); }
ret = devm_snd_soc_register_component(&i2c->dev,
participants (1)
-
Pawel Harlozinski