Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1626056

[PATCH] ASoC: Intel: Skylake: fix dereference before NULL check on ebus

From Colin King <colin.king@canonical.com>
Newsgroups linux.kernel
Subject [PATCH] ASoC: Intel: Skylake: fix dereference before NULL check on ebus
Date 2017-04-19 14:20 +0200
Message-ID <txWKu-3m5-17@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Colin Ian King <colin.king@canonical.com>

ebus is being NULL checked however it is being dereferenced
earlier on the assignment bus = ebus_to_hbus(ebus).  Fix this
by moving the assignment to after the NULL check on ebus to
avoid a NULL pointer dereference error.

Fixes: c5a76a246989c8 ("ASoC: Intel: Skylake: Add shutdown callback")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/soc/intel/skylake/skl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 0c57d4eaae3a..21369f60fbaa 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -818,7 +818,7 @@ static int skl_probe(struct pci_dev *pci,
 static void skl_shutdown(struct pci_dev *pci)
 {
 	struct hdac_ext_bus *ebus = pci_get_drvdata(pci);
-	struct hdac_bus *bus = ebus_to_hbus(ebus);
+	struct hdac_bus *bus;
 	struct hdac_stream *s;
 	struct hdac_ext_stream *stream;
 	struct skl *skl;
@@ -826,6 +826,7 @@ static void skl_shutdown(struct pci_dev *pci)
 	if (ebus == NULL)
 		return;
 
+	bus = ebus_to_hbus(ebus);
 	skl = ebus_to_skl(ebus);
 
 	if (skl->init_failed)
-- 
2.11.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] ASoC: Intel: Skylake: fix dereference before NULL check on ebus Colin King <colin.king@canonical.com> - 2017-04-19 14:20 +0200
  Re: [PATCH] ASoC: Intel: Skylake: fix dereference before NULL check  on ebus Colin Ian King <colin.king@canonical.com> - 2017-04-19 15:40 +0200
  Re: [PATCH] ASoC: Intel: Skylake: fix dereference before NULL check  on ebus Dan Carpenter <dan.carpenter@oracle.com> - 2017-04-19 15:40 +0200

csiph-web