diff mbox

[1/2] ASoC: rt298: fix null deref on acpi driver data

Message ID 1463026130-18651-1-git-send-email-vinod.koul@intel.com (mailing list archive)
State Accepted
Commit bb7cb54b388d8d0fbb3af27f14b121ee9c92e867
Headers show

Commit Message

Vinod Koul May 12, 2016, 4:08 a.m. UTC
ACPI driver data can be NULL so we need to check that before
dereference the driver data.

Signed-off-by: Senthilnathan Veppur <senthilnathanx.veppur@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 sound/soc/codecs/rt298.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bard Liao May 12, 2016, 5:59 a.m. UTC | #1
> -----Original Message-----
> From: Vinod Koul [mailto:vinod.koul@intel.com]
> Sent: Thursday, May 12, 2016 12:09 PM
> To: alsa-devel@alsa-project.org
> Cc: broonie@kernel.org; liam.r.girdwood@linux.intel.com;
> patches.audio@intel.com; Bard Liao; Vinod Koul; Senthilnathan Veppur
> Subject: [PATCH 1/2] ASoC: rt298: fix null deref on acpi driver data
> 
> ACPI driver data can be NULL so we need to check that before
> dereference the driver data.
> 
> Signed-off-by: Senthilnathan Veppur <senthilnathanx.veppur@intel.com>
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>

Acked-by: Bard Liao <bardliao@realtek.com>

> ---
>  sound/soc/codecs/rt298.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index
> 68cf8d5a174f..45dc5fa24961 100644
> --- a/sound/soc/codecs/rt298.c
> +++ b/sound/soc/codecs/rt298.c
> @@ -1179,7 +1179,7 @@ static int rt298_i2c_probe(struct i2c_client
> *i2c,
> 
>  	/* enable jack combo mode on supported devices */
>  	acpiid = acpi_match_device(dev->driver->acpi_match_table, dev);
> -	if (acpiid) {
> +	if (acpiid && acpiid->driver_data) {
>  		rt298->pdata = *(struct rt298_platform_data *)
>  				acpiid->driver_data;
>  	}
> --
> 1.9.1
diff mbox

Patch

diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c
index 68cf8d5a174f..45dc5fa24961 100644
--- a/sound/soc/codecs/rt298.c
+++ b/sound/soc/codecs/rt298.c
@@ -1179,7 +1179,7 @@  static int rt298_i2c_probe(struct i2c_client *i2c,
 
 	/* enable jack combo mode on supported devices */
 	acpiid = acpi_match_device(dev->driver->acpi_match_table, dev);
-	if (acpiid) {
+	if (acpiid && acpiid->driver_data) {
 		rt298->pdata = *(struct rt298_platform_data *)
 				acpiid->driver_data;
 	}