[Z/A/linux-eom][PATCH] Reading HDA capability register crashes the kernel

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Z/A/linux-eom][PATCH] Reading HDA capability register crashes the kernel

Hui Wang
BugLink: http://bugs.launchpad.net/bugs/1730261

This patch is for Zesty, Artful and OEM kernel, since the OEM project is waiting for
this patch, we need to merge this patch to oem kernel ASAP(ahead of Artful kernel).

Xenial kernel doesn't read capability register in the HDA driver, we don't merge
this patch to Xenial kernel.

[Impact]
The kernel will crash on some machines when HDA driver initializes, this issue turn out
to be a firmware issue (capability register has wrong values), but we can imporve the
driver as this patch does to avoid crash the kernel.


[Test Case]
Applying the patch and boot the new kernel on those machines.

[Fix]
Abort reading the register when it meets a wrong value.

[Regression Potential]
No, it does not change any existing functions.


Takashi Iwai (1):
  ALSA: hda: Abort capability probe at invalid register read

 sound/hda/hdac_controller.c | 5 +++++
 1 file changed, 5 insertions(+)

--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[Z/A/linux-eom][PATCH] ALSA: hda: Abort capability probe at invalid register read

Hui Wang
From: Takashi Iwai <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1730261

The loop in snd_hdac_bus_parse_capabilities() may go to nirvana when
it hits an invalid register value read:

 BUG: unable to handle kernel paging request at ffffad5dc41f3fff
 IP: pci_azx_readl+0x5/0x10 [snd_hda_intel]
 Call Trace:
  snd_hdac_bus_parse_capabilities+0x3c/0x1f0 [snd_hda_core]
  azx_probe_continue+0x7d5/0x940 [snd_hda_intel]
  .....

This happened on a new Intel machine, and we need to check the value
and abort the loop accordingly.

[Note: the fixes tag below indicates only the commit where this patch
 can be applied; the original problem was introduced even before that
 commit]

Fixes: 6720b38420a0 ("ALSA: hda - move bus_parse_capabilities to core")
Cc: <[hidden email]>
Acked-by: Vinod Koul <[hidden email]>
Signed-off-by: Takashi Iwai <[hidden email]>
(cherry picked from commit 098a0a62c1554f5a3813ef1b8539563214ada8f6)
Signed-off-by: Hui Wang <[hidden email]>
---
 sound/hda/hdac_controller.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c
index 978dc18..f6d2985 100644
--- a/sound/hda/hdac_controller.c
+++ b/sound/hda/hdac_controller.c
@@ -284,6 +284,11 @@ int snd_hdac_bus_parse_capabilities(struct hdac_bus *bus)
  dev_dbg(bus->dev, "HDA capability ID: 0x%x\n",
  (cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF);
 
+ if (cur_cap == -1) {
+ dev_dbg(bus->dev, "Invalid capability reg read\n");
+ break;
+ }
+
  switch ((cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF) {
  case AZX_ML_CAP_ID:
  dev_dbg(bus->dev, "Found ML capability\n");
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [Z/A/linux-eom][PATCH] Reading HDA capability register crashes the kernel

Hui Wang
In reply to this post by Hui Wang
Please ignore this thread, the title should contain linux-oem instead of
linux-eom. will resend a updated one.

On 2017年11月06日 11:52, Hui Wang wrote:

> BugLink: http://bugs.launchpad.net/bugs/1730261
>
> This patch is for Zesty, Artful and OEM kernel, since the OEM project is waiting for
> this patch, we need to merge this patch to oem kernel ASAP(ahead of Artful kernel).
>
> Xenial kernel doesn't read capability register in the HDA driver, we don't merge
> this patch to Xenial kernel.
>
> [Impact]
> The kernel will crash on some machines when HDA driver initializes, this issue turn out
> to be a firmware issue (capability register has wrong values), but we can imporve the
> driver as this patch does to avoid crash the kernel.
>
>
> [Test Case]
> Applying the patch and boot the new kernel on those machines.
>
> [Fix]
> Abort reading the register when it meets a wrong value.
>
> [Regression Potential]
> No, it does not change any existing functions.
>
>
> Takashi Iwai (1):
>    ALSA: hda: Abort capability probe at invalid register read
>
>   sound/hda/hdac_controller.c | 5 +++++
>   1 file changed, 5 insertions(+)
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team