* [PATCH AUTOSEL 6.4 12/58] PCI: tegra194: Fix possible array out of bounds access
[not found] <20230724011338.2298062-1-sashal@kernel.org>
@ 2023-07-24 1:12 ` Sasha Levin
2023-07-24 1:12 ` [PATCH AUTOSEL 6.4 28/58] ALSA: hda: Add Loongson LS7A HD-Audio support Sasha Levin
1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2023-07-24 1:12 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Sumit Gupta, Bjorn Helgaas, Lorenzo Pieralisi, Thierry Reding,
Sasha Levin, kw, bhelgaas, thierry.reding, jonathanh, mani,
Sergey.Semin, robh, dmitry.baryshkov, linux-pci, linux-tegra
From: Sumit Gupta <sumitg@nvidia.com>
[ Upstream commit 205b3d02d57ce6dce96f6d2b9c230f56a9bf9817 ]
Add check to fix the possible array out of bounds violation by
making speed equal to GEN1_CORE_CLK_FREQ when its value is more
than the size of "pcie_gen_freq" array. This array has size of
four but possible speed (CLS) values are from "0 to 0xF". So,
"speed - 1" values are "-1 to 0xE".
Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
Link: https://lore.kernel.org/lkml/72b9168b-d4d6-4312-32ea-69358df2f2d0@nvidia.com/
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/pci/controller/dwc/pcie-tegra194.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index 09825b4a075e5..e6eec85480ca9 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -223,6 +223,7 @@
#define EP_STATE_ENABLED 1
static const unsigned int pcie_gen_freq[] = {
+ GEN1_CORE_CLK_FREQ, /* PCI_EXP_LNKSTA_CLS == 0; undefined */
GEN1_CORE_CLK_FREQ,
GEN2_CORE_CLK_FREQ,
GEN3_CORE_CLK_FREQ,
@@ -459,7 +460,11 @@ static irqreturn_t tegra_pcie_ep_irq_thread(int irq, void *arg)
speed = dw_pcie_readw_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKSTA) &
PCI_EXP_LNKSTA_CLS;
- clk_set_rate(pcie->core_clk, pcie_gen_freq[speed - 1]);
+
+ if (speed >= ARRAY_SIZE(pcie_gen_freq))
+ speed = 0;
+
+ clk_set_rate(pcie->core_clk, pcie_gen_freq[speed]);
if (pcie->of_data->has_ltr_req_fix)
return IRQ_HANDLED;
@@ -1020,7 +1025,11 @@ static int tegra_pcie_dw_start_link(struct dw_pcie *pci)
speed = dw_pcie_readw_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKSTA) &
PCI_EXP_LNKSTA_CLS;
- clk_set_rate(pcie->core_clk, pcie_gen_freq[speed - 1]);
+
+ if (speed >= ARRAY_SIZE(pcie_gen_freq))
+ speed = 0;
+
+ clk_set_rate(pcie->core_clk, pcie_gen_freq[speed]);
tegra_pcie_enable_interrupts(pp);
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH AUTOSEL 6.4 28/58] ALSA: hda: Add Loongson LS7A HD-Audio support
[not found] <20230724011338.2298062-1-sashal@kernel.org>
2023-07-24 1:12 ` [PATCH AUTOSEL 6.4 12/58] PCI: tegra194: Fix possible array out of bounds access Sasha Levin
@ 2023-07-24 1:12 ` Sasha Levin
2023-07-24 3:00 ` Yanteng Si
1 sibling, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2023-07-24 1:12 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Yanteng Si, Huacai Chen, Takashi Iwai, Sasha Levin, bhelgaas,
perex, tiwai, rafael, chenhuacai, gregkh, pierre-louis.bossart,
mengyingkun, fred.oh, kai.vehmanen, jasontao, amadeuszx.slawinski,
mkumard, linux-pci, alsa-devel
From: Yanteng Si <siyanteng@loongson.cn>
[ Upstream commit 28bd137a3c8e105587ba8c55b68ef43b519b270f ]
Add the new PCI ID 0x0014 0x7a07 and the new PCI ID 0x0014 0x7a37
Loongson HDA controller.
Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
Link: https://lore.kernel.org/r/993587483b9509796b29a416f257fcfb4b15c6ea.1686128807.git.siyanteng@loongson.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/pci_ids.h | 3 +++
sound/hda/hdac_device.c | 1 +
sound/pci/hda/hda_intel.c | 7 +++++++
sound/pci/hda/patch_hdmi.c | 1 +
4 files changed, 12 insertions(+)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 95f33dadb2be2..c0c4ca8e28510 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -158,6 +158,9 @@
#define PCI_VENDOR_ID_LOONGSON 0x0014
+#define PCI_DEVICE_ID_LOONGSON_HDA 0x7a07
+#define PCI_DEVICE_ID_LOONGSON_HDMI 0x7a37
+
#define PCI_VENDOR_ID_TTTECH 0x0357
#define PCI_DEVICE_ID_TTTECH_MC322 0x000a
diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index 6c043fbd606f1..bbf7bcdb449a8 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -645,6 +645,7 @@ struct hda_vendor_id {
};
static const struct hda_vendor_id hda_vendor_ids[] = {
+ { 0x0014, "Loongson" },
{ 0x1002, "ATI" },
{ 0x1013, "Cirrus Logic" },
{ 0x1057, "Motorola" },
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 3226691ac923c..9c353dc7740c4 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -237,6 +237,7 @@ enum {
AZX_DRIVER_CTHDA,
AZX_DRIVER_CMEDIA,
AZX_DRIVER_ZHAOXIN,
+ AZX_DRIVER_LOONGSON,
AZX_DRIVER_GENERIC,
AZX_NUM_DRIVERS, /* keep this as last entry */
};
@@ -360,6 +361,7 @@ static const char * const driver_short_names[] = {
[AZX_DRIVER_CTHDA] = "HDA Creative",
[AZX_DRIVER_CMEDIA] = "HDA C-Media",
[AZX_DRIVER_ZHAOXIN] = "HDA Zhaoxin",
+ [AZX_DRIVER_LOONGSON] = "HDA Loongson",
[AZX_DRIVER_GENERIC] = "HD-Audio Generic",
};
@@ -2809,6 +2811,11 @@ static const struct pci_device_id azx_ids[] = {
.driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_HDMI },
/* Zhaoxin */
{ PCI_DEVICE(0x1d17, 0x3288), .driver_data = AZX_DRIVER_ZHAOXIN },
+ /* Loongson HDAudio*/
+ {PCI_DEVICE(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_HDA),
+ .driver_data = AZX_DRIVER_LOONGSON },
+ {PCI_DEVICE(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_HDMI),
+ .driver_data = AZX_DRIVER_LOONGSON },
{ 0, }
};
MODULE_DEVICE_TABLE(pci, azx_ids);
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 5c0b1a09fd57c..260d3e64f6589 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -4505,6 +4505,7 @@ static int patch_gf_hdmi(struct hda_codec *codec)
* patch entries
*/
static const struct hda_device_id snd_hda_id_hdmi[] = {
+HDA_CODEC_ENTRY(0x00147a47, "Loongson HDMI", patch_generic_hdmi),
HDA_CODEC_ENTRY(0x1002793c, "RS600 HDMI", patch_atihdmi),
HDA_CODEC_ENTRY(0x10027919, "RS600 HDMI", patch_atihdmi),
HDA_CODEC_ENTRY(0x1002791a, "RS690/780 HDMI", patch_atihdmi),
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH AUTOSEL 6.4 28/58] ALSA: hda: Add Loongson LS7A HD-Audio support
2023-07-24 1:12 ` [PATCH AUTOSEL 6.4 28/58] ALSA: hda: Add Loongson LS7A HD-Audio support Sasha Levin
@ 2023-07-24 3:00 ` Yanteng Si
0 siblings, 0 replies; 3+ messages in thread
From: Yanteng Si @ 2023-07-24 3:00 UTC (permalink / raw)
To: Sasha Levin, linux-kernel, stable
Cc: Huacai Chen, Takashi Iwai, bhelgaas, perex, tiwai, rafael,
chenhuacai, gregkh, pierre-louis.bossart, mengyingkun, fred.oh,
kai.vehmanen, jasontao, amadeuszx.slawinski, mkumard, linux-pci,
alsa-devel
Hi Sasha,
在 2023/7/24 09:12, Sasha Levin 写道:
> From: Yanteng Si <siyanteng@loongson.cn>
>
> [ Upstream commit 28bd137a3c8e105587ba8c55b68ef43b519b270f ]
>
> Add the new PCI ID 0x0014 0x7a07 and the new PCI ID 0x0014 0x7a37
> Loongson HDA controller.
>
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> Acked-by: Huacai Chen <chenhuacai@loongson.cn>
> Link: https://lore.kernel.org/r/993587483b9509796b29a416f257fcfb4b15c6ea.1686128807.git.siyanteng@loongson.cn
Loongson HDA can't work if AUTOSEL only ports this one patch, because
6.4 also needs the other three patches inside this thread. Also, 6.1,
5.15, and 5.10 have the same problem.
Give me a shout if you need anything.
Thanks,
Yanteng
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> include/linux/pci_ids.h | 3 +++
> sound/hda/hdac_device.c | 1 +
> sound/pci/hda/hda_intel.c | 7 +++++++
> sound/pci/hda/patch_hdmi.c | 1 +
> 4 files changed, 12 insertions(+)
>
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index 95f33dadb2be2..c0c4ca8e28510 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -158,6 +158,9 @@
>
> #define PCI_VENDOR_ID_LOONGSON 0x0014
>
> +#define PCI_DEVICE_ID_LOONGSON_HDA 0x7a07
> +#define PCI_DEVICE_ID_LOONGSON_HDMI 0x7a37
> +
> #define PCI_VENDOR_ID_TTTECH 0x0357
> #define PCI_DEVICE_ID_TTTECH_MC322 0x000a
>
> diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
> index 6c043fbd606f1..bbf7bcdb449a8 100644
> --- a/sound/hda/hdac_device.c
> +++ b/sound/hda/hdac_device.c
> @@ -645,6 +645,7 @@ struct hda_vendor_id {
> };
>
> static const struct hda_vendor_id hda_vendor_ids[] = {
> + { 0x0014, "Loongson" },
> { 0x1002, "ATI" },
> { 0x1013, "Cirrus Logic" },
> { 0x1057, "Motorola" },
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index 3226691ac923c..9c353dc7740c4 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -237,6 +237,7 @@ enum {
> AZX_DRIVER_CTHDA,
> AZX_DRIVER_CMEDIA,
> AZX_DRIVER_ZHAOXIN,
> + AZX_DRIVER_LOONGSON,
> AZX_DRIVER_GENERIC,
> AZX_NUM_DRIVERS, /* keep this as last entry */
> };
> @@ -360,6 +361,7 @@ static const char * const driver_short_names[] = {
> [AZX_DRIVER_CTHDA] = "HDA Creative",
> [AZX_DRIVER_CMEDIA] = "HDA C-Media",
> [AZX_DRIVER_ZHAOXIN] = "HDA Zhaoxin",
> + [AZX_DRIVER_LOONGSON] = "HDA Loongson",
> [AZX_DRIVER_GENERIC] = "HD-Audio Generic",
> };
>
> @@ -2809,6 +2811,11 @@ static const struct pci_device_id azx_ids[] = {
> .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_HDMI },
> /* Zhaoxin */
> { PCI_DEVICE(0x1d17, 0x3288), .driver_data = AZX_DRIVER_ZHAOXIN },
> + /* Loongson HDAudio*/
> + {PCI_DEVICE(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_HDA),
> + .driver_data = AZX_DRIVER_LOONGSON },
> + {PCI_DEVICE(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_HDMI),
> + .driver_data = AZX_DRIVER_LOONGSON },
> { 0, }
> };
> MODULE_DEVICE_TABLE(pci, azx_ids);
> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
> index 5c0b1a09fd57c..260d3e64f6589 100644
> --- a/sound/pci/hda/patch_hdmi.c
> +++ b/sound/pci/hda/patch_hdmi.c
> @@ -4505,6 +4505,7 @@ static int patch_gf_hdmi(struct hda_codec *codec)
> * patch entries
> */
> static const struct hda_device_id snd_hda_id_hdmi[] = {
> +HDA_CODEC_ENTRY(0x00147a47, "Loongson HDMI", patch_generic_hdmi),
> HDA_CODEC_ENTRY(0x1002793c, "RS600 HDMI", patch_atihdmi),
> HDA_CODEC_ENTRY(0x10027919, "RS600 HDMI", patch_atihdmi),
> HDA_CODEC_ENTRY(0x1002791a, "RS690/780 HDMI", patch_atihdmi),
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-24 3:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230724011338.2298062-1-sashal@kernel.org>
2023-07-24 1:12 ` [PATCH AUTOSEL 6.4 12/58] PCI: tegra194: Fix possible array out of bounds access Sasha Levin
2023-07-24 1:12 ` [PATCH AUTOSEL 6.4 28/58] ALSA: hda: Add Loongson LS7A HD-Audio support Sasha Levin
2023-07-24 3:00 ` Yanteng Si
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox