clear-pkgs-linux-iot-lts2018/1059-ASoC-Intel-Skl-Virt-Ch...

39 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Wojciech Jablonski <wojciech.jablonski@intel.com>
Date: Mon, 18 Mar 2019 11:38:35 +0100
Subject: [PATCH] ASoC: Intel: Skl: Virt: Check NULL ptr on virual FE attach
BE service startup is independent of component driver probe.
Thus, when the probe ends up with failure and BE service is started
successfully, any virtio FE attach will cause kernel panic.
This patch prevents kernel panic by checking if component pointer
has valid address.
Change-Id: I31cc3040bcc993465934b6ca0dbfa21468d3c7a8
Signed-off-by: Wojciech Jablonski <wojciech.jablonski@intel.com>
---
sound/soc/intel/skylake/virtio/skl-virtio-be.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/skylake/virtio/skl-virtio-be.c b/sound/soc/intel/skylake/virtio/skl-virtio-be.c
index 097e6a9c4fb4..72d5300cc19c 100644
--- a/sound/soc/intel/skylake/virtio/skl-virtio-be.c
+++ b/sound/soc/intel/skylake/virtio/skl-virtio-be.c
@@ -1145,8 +1145,12 @@ int vbe_skl_attach(struct snd_skl_vbe *vbe, struct skl *skl)
static bool kctl_init;
if (!kctl_init) {
+
+ if (unlikely(!skl || !skl->component || !skl->component->card))
+ return -EINVAL;
+
kctl_init_proxy(vbe->dev, &vbe_kctl_ops);
- kctl_notify_machine_ready(vbe->sdev->component->card);
+ kctl_notify_machine_ready(skl->component->card);
kctl_init = true;
}
--
https://clearlinux.org