diff options
| author | Vatsal Bucha <vbucha@codeaurora.org> | 2018-06-19 12:06:52 +0530 |
|---|---|---|
| committer | Vatsal Bucha <vbucha@codeaurora.org> | 2018-06-21 11:36:28 +0530 |
| commit | 1ae05057ff531c464df08e9be865e6cfe2454fce (patch) | |
| tree | e894ae82c5f9b37f6933524bd2fc255b1ed31a46 | |
| parent | 1cbd1cdf8491634cca7f06812dbe8d1906033656 (diff) | |
sdm660_cdc: Fix NULL pointer dereference in digital suspend
If soundcard registration has failed because of custom
driver probe failure and at the same time
msm_dig_suspend is called, this will lead to
null pointer dereference when component is accessed.
Add NULL check to avoid this.
CRs-Fixed: 2263093
Change-Id: I2d321814a316d9b3af1ff0f8963f2999520e60d2
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
| -rw-r--r-- | sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c b/sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c index e64956aa2f40..d5ceff8e0b94 100644 --- a/sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c +++ b/sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -2136,6 +2136,10 @@ static int msm_dig_suspend(struct device *dev) pr_debug("%s:digcodec not initialized, return\n", __func__); return 0; } + if (!registered_digcodec->component.card) { + pr_debug("%s:component not initialized, return\n", __func__); + return 0; + } pdata = snd_soc_card_get_drvdata(registered_digcodec->component.card); if (!pdata) { pr_debug("%s:card not initialized, return\n", __func__); |
