OSDN Git Service

sdm660_cdc: Fix NULL pointer dereference in digital suspend
authorVatsal Bucha <vbucha@codeaurora.org>
Tue, 19 Jun 2018 06:36:52 +0000 (12:06 +0530)
committerVatsal Bucha <vbucha@codeaurora.org>
Thu, 21 Jun 2018 06:06:28 +0000 (11:36 +0530)
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>
sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c

index e64956a..d5ceff8 100644 (file)
@@ -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__);