Skip to content

Commit f186fd2

Browse files
committed
Merge tag 'sound-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "A collection of small fixes: - fixes for regressions by the recent ALSA control hash usages - fixes for UAF with del_timer() at removals in a few drivers - char signedness fixes - a few memory leak fixes in error paths - device-specific fixes / quirks for Intel SOF, AMD, HD-audio, USB-audio, and various ASoC codecs" * tag 'sound-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (50 commits) ALSA: aoa: Fix I2S device accounting ALSA: Use del_timer_sync() before freeing timer ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev() ALSA: rme9652: use explicitly signed char ALSA: au88x0: use explicitly signed char ALSA: hda/realtek: Add another HP ZBook G9 model quirks ALSA: usb-audio: Add quirks for M-Audio Fast Track C400/600 ASoC: SOF: Intel: hda-codec: fix possible memory leak in hda_codec_device_init() ASoC: amd: yc: Add Lenovo Thinkbook 14+ 2022 21D0 to quirks table ASoC: Intel: Skylake: fix possible memory leak in skl_codec_device_init() ALSA: ac97: Use snd_ctl_rename() to rename a control ALSA: ca0106: Use snd_ctl_rename() to rename a control ALSA: emu10k1: Use snd_ctl_rename() to rename a control ALSA: hda/realtek: Use snd_ctl_rename() to rename a control ALSA: usb-audio: Use snd_ctl_rename() to rename a control ALSA: control: add snd_ctl_rename() ALSA: ac97: fix possible memory leak in snd_ac97_dev_register() ASoC: SOF: Intel: pci-tgl: fix ADL-N descriptor ASoC: qcom: lpass-cpu: Mark HDMI TX parity register as volatile ASoC: amd: yc: Adding Lenovo ThinkBook 14 Gen 4+ ARA and Lenovo ThinkBook 16 Gen 4+ ARA to the Quirks List ...
2 parents e3493d6 + f1fae47 commit f186fd2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+364
-122
lines changed

include/sound/control.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol);
138138
int snd_ctl_replace(struct snd_card *card, struct snd_kcontrol *kcontrol, bool add_on_replace);
139139
int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id);
140140
int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id);
141+
void snd_ctl_rename(struct snd_card *card, struct snd_kcontrol *kctl, const char *name);
141142
int snd_ctl_activate_id(struct snd_card *card, struct snd_ctl_elem_id *id, int active);
142143
struct snd_kcontrol *snd_ctl_find_numid(struct snd_card * card, unsigned int numid);
143144
struct snd_kcontrol *snd_ctl_find_id(struct snd_card * card, struct snd_ctl_elem_id *id);

include/sound/simple_card_utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ void asoc_simple_convert_fixup(struct asoc_simple_data *data,
177177
struct snd_pcm_hw_params *params);
178178
void asoc_simple_parse_convert(struct device_node *np, char *prefix,
179179
struct asoc_simple_data *data);
180+
bool asoc_simple_is_convert_required(const struct asoc_simple_data *data);
180181

181182
int asoc_simple_parse_routing(struct snd_soc_card *card,
182183
char *prefix);

sound/aoa/soundbus/i2sbus/core.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index,
147147
return rc;
148148
}
149149

150+
/* Returns 1 if added, 0 for otherwise; don't return a negative value! */
150151
/* FIXME: look at device node refcounting */
151152
static int i2sbus_add_dev(struct macio_dev *macio,
152153
struct i2sbus_control *control,
@@ -213,7 +214,7 @@ static int i2sbus_add_dev(struct macio_dev *macio,
213214
* either as the second one in that case is just a modem. */
214215
if (!ok) {
215216
kfree(dev);
216-
return -ENODEV;
217+
return 0;
217218
}
218219

219220
mutex_init(&dev->lock);
@@ -302,6 +303,10 @@ static int i2sbus_add_dev(struct macio_dev *macio,
302303

303304
if (soundbus_add_one(&dev->sound)) {
304305
printk(KERN_DEBUG "i2sbus: device registration error!\n");
306+
if (dev->sound.ofdev.dev.kobj.state_initialized) {
307+
soundbus_dev_put(&dev->sound);
308+
return 0;
309+
}
305310
goto err;
306311
}
307312

sound/core/control.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,29 @@ int snd_ctl_rename_id(struct snd_card *card, struct snd_ctl_elem_id *src_id,
753753
}
754754
EXPORT_SYMBOL(snd_ctl_rename_id);
755755

756+
/**
757+
* snd_ctl_rename - rename the control on the card
758+
* @card: the card instance
759+
* @kctl: the control to rename
760+
* @name: the new name
761+
*
762+
* Renames the specified control on the card to the new name.
763+
*
764+
* Make sure to take the control write lock - down_write(&card->controls_rwsem).
765+
*/
766+
void snd_ctl_rename(struct snd_card *card, struct snd_kcontrol *kctl,
767+
const char *name)
768+
{
769+
remove_hash_entries(card, kctl);
770+
771+
if (strscpy(kctl->id.name, name, sizeof(kctl->id.name)) < 0)
772+
pr_warn("ALSA: Renamed control new name '%s' truncated to '%s'\n",
773+
name, kctl->id.name);
774+
775+
add_hash_entries(card, kctl);
776+
}
777+
EXPORT_SYMBOL(snd_ctl_rename);
778+
756779
#ifndef CONFIG_SND_CTL_FAST_LOOKUP
757780
static struct snd_kcontrol *
758781
snd_ctl_find_numid_slow(struct snd_card *card, unsigned int numid)

sound/pci/ac97/ac97_codec.c

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,6 +2009,7 @@ static int snd_ac97_dev_register(struct snd_device *device)
20092009
err = device_register(&ac97->dev);
20102010
if (err < 0) {
20112011
ac97_err(ac97, "Can't register ac97 bus\n");
2012+
put_device(&ac97->dev);
20122013
ac97->dev.bus = NULL;
20132014
return err;
20142015
}
@@ -2655,11 +2656,18 @@ EXPORT_SYMBOL(snd_ac97_resume);
26552656
*/
26562657
static void set_ctl_name(char *dst, const char *src, const char *suffix)
26572658
{
2658-
if (suffix)
2659-
sprintf(dst, "%s %s", src, suffix);
2660-
else
2661-
strcpy(dst, src);
2662-
}
2659+
const size_t msize = SNDRV_CTL_ELEM_ID_NAME_MAXLEN;
2660+
2661+
if (suffix) {
2662+
if (snprintf(dst, msize, "%s %s", src, suffix) >= msize)
2663+
pr_warn("ALSA: AC97 control name '%s %s' truncated to '%s'\n",
2664+
src, suffix, dst);
2665+
} else {
2666+
if (strscpy(dst, src, msize) < 0)
2667+
pr_warn("ALSA: AC97 control name '%s' truncated to '%s'\n",
2668+
src, dst);
2669+
}
2670+
}
26632671

26642672
/* remove the control with the given name and optional suffix */
26652673
static int snd_ac97_remove_ctl(struct snd_ac97 *ac97, const char *name,
@@ -2686,8 +2694,11 @@ static int snd_ac97_rename_ctl(struct snd_ac97 *ac97, const char *src,
26862694
const char *dst, const char *suffix)
26872695
{
26882696
struct snd_kcontrol *kctl = ctl_find(ac97, src, suffix);
2697+
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
2698+
26892699
if (kctl) {
2690-
set_ctl_name(kctl->id.name, dst, suffix);
2700+
set_ctl_name(name, dst, suffix);
2701+
snd_ctl_rename(ac97->bus->card, kctl, name);
26912702
return 0;
26922703
}
26932704
return -ENOENT;
@@ -2706,11 +2717,17 @@ static int snd_ac97_swap_ctl(struct snd_ac97 *ac97, const char *s1,
27062717
const char *s2, const char *suffix)
27072718
{
27082719
struct snd_kcontrol *kctl1, *kctl2;
2720+
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
2721+
27092722
kctl1 = ctl_find(ac97, s1, suffix);
27102723
kctl2 = ctl_find(ac97, s2, suffix);
27112724
if (kctl1 && kctl2) {
2712-
set_ctl_name(kctl1->id.name, s2, suffix);
2713-
set_ctl_name(kctl2->id.name, s1, suffix);
2725+
set_ctl_name(name, s2, suffix);
2726+
snd_ctl_rename(ac97->bus->card, kctl1, name);
2727+
2728+
set_ctl_name(name, s1, suffix);
2729+
snd_ctl_rename(ac97->bus->card, kctl2, name);
2730+
27142731
return 0;
27152732
}
27162733
return -ENOENT;

sound/pci/au88x0/au88x0.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ struct snd_vortex {
141141
#ifndef CHIP_AU8810
142142
stream_t dma_wt[NR_WT];
143143
wt_voice_t wt_voice[NR_WT]; /* WT register cache. */
144-
char mixwt[(NR_WT / NR_WTPB) * 6]; /* WT mixin objects */
144+
s8 mixwt[(NR_WT / NR_WTPB) * 6]; /* WT mixin objects */
145145
#endif
146146

147147
/* Global resources */
@@ -235,8 +235,8 @@ static int vortex_alsafmt_aspfmt(snd_pcm_format_t alsafmt, vortex_t *v);
235235
static void vortex_connect_default(vortex_t * vortex, int en);
236236
static int vortex_adb_allocroute(vortex_t * vortex, int dma, int nr_ch,
237237
int dir, int type, int subdev);
238-
static char vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out,
239-
int restype);
238+
static int vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out,
239+
int restype);
240240
#ifndef CHIP_AU8810
241241
static int vortex_wt_allocroute(vortex_t * vortex, int dma, int nr_ch);
242242
static void vortex_wt_connect(vortex_t * vortex, int en);

sound/pci/au88x0/au88x0_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1998,7 +1998,7 @@ static const int resnum[VORTEX_RESOURCE_LAST] =
19981998
out: Mean checkout if != 0. Else mean Checkin resource.
19991999
restype: Indicates type of resource to be checked in or out.
20002000
*/
2001-
static char
2001+
static int
20022002
vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out, int restype)
20032003
{
20042004
int i, qty = resnum[restype], resinuse = 0;

sound/pci/ca0106/ca0106_mixer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ static int rename_ctl(struct snd_card *card, const char *src, const char *dst)
720720
{
721721
struct snd_kcontrol *kctl = ctl_find(card, src);
722722
if (kctl) {
723-
strcpy(kctl->id.name, dst);
723+
snd_ctl_rename(card, kctl, dst);
724724
return 0;
725725
}
726726
return -ENOENT;

sound/pci/emu10k1/emumixer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,7 @@ static int rename_ctl(struct snd_card *card, const char *src, const char *dst)
17671767
{
17681768
struct snd_kcontrol *kctl = ctl_find(card, src);
17691769
if (kctl) {
1770-
strcpy(kctl->id.name, dst);
1770+
snd_ctl_rename(card, kctl, dst);
17711771
return 0;
17721772
}
17731773
return -ENOENT;

sound/pci/hda/patch_realtek.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,7 @@ static void rename_ctl(struct hda_codec *codec, const char *oldname,
21422142

21432143
kctl = snd_hda_find_mixer_ctl(codec, oldname);
21442144
if (kctl)
2145-
strcpy(kctl->id.name, newname);
2145+
snd_ctl_rename(codec->card, kctl, newname);
21462146
}
21472147

21482148
static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
@@ -6654,13 +6654,8 @@ static int comp_bind(struct device *dev)
66546654
{
66556655
struct hda_codec *cdc = dev_to_hda_codec(dev);
66566656
struct alc_spec *spec = cdc->spec;
6657-
int ret;
66586657

6659-
ret = component_bind_all(dev, spec->comps);
6660-
if (ret)
6661-
return ret;
6662-
6663-
return 0;
6658+
return component_bind_all(dev, spec->comps);
66646659
}
66656660

66666661
static void comp_unbind(struct device *dev)
@@ -9328,6 +9323,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
93289323
SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
93299324
SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
93309325
SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
9326+
SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
93319327
SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
93329328
SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
93339329
SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
@@ -9346,6 +9342,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
93469342
SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
93479343
SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
93489344
SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
9345+
SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
93499346
SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
93509347
SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
93519348
SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
@@ -9400,6 +9397,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
94009397
SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
94019398
SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
94029399
SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
9400+
SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402", ALC245_FIXUP_CS35L41_SPI_2),
94039401
SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
94049402
SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
94059403
SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),

0 commit comments

Comments
 (0)