ASoC: soc-core: Fix null pointer dereference
PATCH 1/1 ASoC: soc-core: Fix null pointer dereference
In case the codec driver did not provide a read/write function, codec->driver->read|write will be NULL. Ensure that we use the one specified in codec->read|write to avoid oopsing when we access the debugfs entries. This is achieved by using snd_soc_read() and snd_soc_write().
--- sound/soc/soc-core.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/soc-core.c +2 -2
@@ -117,7 +117,7 @@ static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf)* the register being volatile and the device being * powered off. */ - ret = codec->driver->read (codec, i); + ret =snd_soc_read (codec, i);if (ret >=0 ) count += snprintf(buf + count, PAGE_SIZE - count,
@@ -228,7 +228,7 @@ static ssize_t codec_reg_write_file(struct file *file, start++;if (strict_strtoul (start,16 , &value))return -EINVAL ; - codec->driver->write (codec, reg, value); +snd_soc_write (codec, reg, value);return buf_size; }
Signature · 1 line
1.7.3.3
Quoted 8 lines · Dimitris Papastamos
In case the codec driver did not provide a read/write function, codec->driver->read|write will be NULL. Ensure that we use the one specified in codec->read|write to avoid oopsing when we access the debugfs entries. This is achieved by using
snd_soc_read()andsnd_soc_write().Signed-off-by Dimitris Papastamos <[email protected]>---
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk
Mark Brown
AppliedQuoted 7 lines · Dimitris Papastamos
In case the codec driver did not provide a read/write function, codec->driver->read|write will be NULL. Ensure that we use the one specified in codec->read|write to avoid oopsing when we access the debugfs entries. This is achieved by using
snd_soc_read()andsnd_soc_write().Signed-off-by Dimitris Papastamos <[email protected]>
Applied, thanks.