diff options
author | Liam Girdwood <liam.r.girdwood@linux.intel.com> | 2019-09-27 16:05:36 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-10-01 13:31:53 -0400 |
commit | ff2be865633e6fa523cd2db3b73197d795dec991 (patch) | |
tree | 34b7f9d9922ee58a045bba7d8658c4a45829ffe2 /sound | |
parent | 4ff5f6439fe69624e8f7d559915e9b54a6477684 (diff) |
ASoC: SOF: Intel: initialise and verify FW crash dump data.
FW mailbox offset was not set before use and HDR size was not validated.
Fix this.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190927200538.660-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/sof/intel/bdw.c | 7 | ||||
-rw-r--r-- | sound/soc/sof/intel/byt.c | 6 | ||||
-rw-r--r-- | sound/soc/sof/intel/hda.c | 7 |
3 files changed, 20 insertions, 0 deletions
diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c index e282179263e8..80e2826fb447 100644 --- a/sound/soc/sof/intel/bdw.c +++ b/sound/soc/sof/intel/bdw.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #define MBOX_SIZE 0x1000 | 37 | #define MBOX_SIZE 0x1000 |
38 | #define MBOX_DUMP_SIZE 0x30 | 38 | #define MBOX_DUMP_SIZE 0x30 |
39 | #define EXCEPT_OFFSET 0x800 | 39 | #define EXCEPT_OFFSET 0x800 |
40 | #define EXCEPT_MAX_HDR_SIZE 0x400 | ||
40 | 41 | ||
41 | /* DSP peripherals */ | 42 | /* DSP peripherals */ |
42 | #define DMAC0_OFFSET 0xFE000 | 43 | #define DMAC0_OFFSET 0xFE000 |
@@ -228,6 +229,11 @@ static void bdw_get_registers(struct snd_sof_dev *sdev, | |||
228 | /* note: variable AR register array is not read */ | 229 | /* note: variable AR register array is not read */ |
229 | 230 | ||
230 | /* then get panic info */ | 231 | /* then get panic info */ |
232 | if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) { | ||
233 | dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", | ||
234 | xoops->arch_hdr.totalsize); | ||
235 | return; | ||
236 | } | ||
231 | offset += xoops->arch_hdr.totalsize; | 237 | offset += xoops->arch_hdr.totalsize; |
232 | sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info)); | 238 | sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info)); |
233 | 239 | ||
@@ -451,6 +457,7 @@ static int bdw_probe(struct snd_sof_dev *sdev) | |||
451 | /* TODO: add offsets */ | 457 | /* TODO: add offsets */ |
452 | sdev->mmio_bar = BDW_DSP_BAR; | 458 | sdev->mmio_bar = BDW_DSP_BAR; |
453 | sdev->mailbox_bar = BDW_DSP_BAR; | 459 | sdev->mailbox_bar = BDW_DSP_BAR; |
460 | sdev->dsp_oops_offset = MBOX_OFFSET; | ||
454 | 461 | ||
455 | /* PCI base */ | 462 | /* PCI base */ |
456 | mmio = platform_get_resource(pdev, IORESOURCE_MEM, | 463 | mmio = platform_get_resource(pdev, IORESOURCE_MEM, |
diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c index 5e7a6aaa627a..a1e514f71739 100644 --- a/sound/soc/sof/intel/byt.c +++ b/sound/soc/sof/intel/byt.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #define MBOX_OFFSET 0x144000 | 28 | #define MBOX_OFFSET 0x144000 |
29 | #define MBOX_SIZE 0x1000 | 29 | #define MBOX_SIZE 0x1000 |
30 | #define EXCEPT_OFFSET 0x800 | 30 | #define EXCEPT_OFFSET 0x800 |
31 | #define EXCEPT_MAX_HDR_SIZE 0x400 | ||
31 | 32 | ||
32 | /* DSP peripherals */ | 33 | /* DSP peripherals */ |
33 | #define DMAC0_OFFSET 0x098000 | 34 | #define DMAC0_OFFSET 0x098000 |
@@ -126,6 +127,11 @@ static void byt_get_registers(struct snd_sof_dev *sdev, | |||
126 | /* note: variable AR register array is not read */ | 127 | /* note: variable AR register array is not read */ |
127 | 128 | ||
128 | /* then get panic info */ | 129 | /* then get panic info */ |
130 | if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) { | ||
131 | dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", | ||
132 | xoops->arch_hdr.totalsize); | ||
133 | return; | ||
134 | } | ||
129 | offset += xoops->arch_hdr.totalsize; | 135 | offset += xoops->arch_hdr.totalsize; |
130 | sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info)); | 136 | sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info)); |
131 | 137 | ||
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index c72e9a09eee1..06e84679087b 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348) | 35 | #define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348) |
36 | #define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8) | 36 | #define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8) |
37 | 37 | ||
38 | #define EXCEPT_MAX_HDR_SIZE 0x400 | ||
39 | |||
38 | /* | 40 | /* |
39 | * Debug | 41 | * Debug |
40 | */ | 42 | */ |
@@ -131,6 +133,11 @@ static void hda_dsp_get_registers(struct snd_sof_dev *sdev, | |||
131 | /* note: variable AR register array is not read */ | 133 | /* note: variable AR register array is not read */ |
132 | 134 | ||
133 | /* then get panic info */ | 135 | /* then get panic info */ |
136 | if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) { | ||
137 | dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", | ||
138 | xoops->arch_hdr.totalsize); | ||
139 | return; | ||
140 | } | ||
134 | offset += xoops->arch_hdr.totalsize; | 141 | offset += xoops->arch_hdr.totalsize; |
135 | sof_block_read(sdev, sdev->mmio_bar, offset, | 142 | sof_block_read(sdev, sdev->mmio_bar, offset, |
136 | panic_info, sizeof(*panic_info)); | 143 | panic_info, sizeof(*panic_info)); |