ASoC: imx-card: Adjust over allocation of memory in imx_card_parse_of()
Subsystems (10)
Sasha Levin
maintainerPATCH 1/20 ASoC: imx-card: Adjust over allocation of memory in imx_card_parse_of()
From: Chenyuan Yang <[email protected]>
[ Upstream commit a9a69c3b38c89d7992fb53db4abb19104b531d32 ]
Incorrect types are used as sizeof() arguments in devm_kcalloc(). It should be sizeof(dai_link_data) for link_data instead of sizeof(snd_soc_dai_link).
This is found by our static analysis tool.
--- sound/soc/fsl/imx-card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/imx-card.c +1 -1
@@ -543,7 +543,7 @@ static int imx_card_parse_of(struct imx_card_data *data)if (!card->dai_link)return -ENOMEM ; - data->link_data =devm_kcalloc (dev, num_links,sizeof (*link),GFP_KERNEL ); + data->link_data =devm_kcalloc (dev, num_links,sizeof (*link_data),GFP_KERNEL );if (!data->link_data)return -ENOMEM ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/20 book3s64/radix: Fix compile errors when CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP=n
From: "Ritesh Harjani (IBM)" <[email protected]>
[ Upstream commit 29bdc1f1c1df80868fb35bc69d1f073183adc6de ]
Fix compile errors when CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP=n
--- arch/powerpc/mm/book3s64/radix_pgtable.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/mm/book3s64/radix_pgtable.c +2 -1
@@ -976,7 +976,7 @@ int __meminit radix__vmemmap_create_mapping(unsigned long start,return 0 ; } - +#ifdef CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP bool vmemmap_can_optimize (struct vmem_altmap *altmap,struct dev_pagemap *pgmap) {if (radix_enabled ())
@@ -984,6 +984,7 @@ bool vmemmap_can_optimize(struct vmem_altmap *altmap, struct dev_pagemap *pgmap) return false; } +#endif int __meminit vmemmap_check_pmd (pmd_t *pmdp,int node,unsigned long addr,unsigned long next)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 3/20 pinctrl: meson: define the pull up/down resistor value as 60 kOhm
In reply to Sasha LevinFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit e56088a13708757da68ad035269d69b93ac8c389 ]
The public datasheets of the following Amlogic SoCs describe a typical resistor value for the built-in pull up/down resistor:
- Meson8/8b/8m2: not documented
- GXBB (S905): 60 kOhm
- GXL (S905X): 60 kOhm
- GXM (S912): 60 kOhm
- G12B (S922X): 60 kOhm
- SM1 (S905D3): 60 kOhm
The public G12B and SM1 datasheets additionally state min and max values:
- min value: 50 kOhm for both, pull-up and pull-down
- max value for the pull-up: 70 kOhm
- max value for the pull-down: 130 kOhm
Use 60 kOhm in the pinctrl-meson driver as well so it's shown in the debugfs output. It may not be accurate for Meson8/8b/8m2 but in reality 60 kOhm is closer to the actual value than 1 Ohm.
--- drivers/pinctrl/meson/pinctrl-meson.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/meson/pinctrl-meson.c +1 -1
@@ -487,7 +487,7 @@ static int meson_pinconf_get(struct pinctrl_dev *pcdev, unsigned int pin,case PIN_CONFIG_BIAS_PULL_DOWN :case PIN_CONFIG_BIAS_PULL_UP :if (meson_pinconf_get_pull (pc, pin) == param) - arg =1 ; + arg =60000 ;else return -EINVAL ;break ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 4/20 smb: server: smb2pdu: check return value of xa_store()
In reply to Sasha LevinFrom: Salah Triki <[email protected]>
[ Upstream commit af5226abb40cae959f424f7ca614787a1c87ce48 ]
xa_store() may fail so check its return value and return error code if error occurred.
--- fs/smb/server/smb2pdu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/smb/server/smb2pdu.c +7 -2
@@ -1445,7 +1445,7 @@ static int ntlm_authenticate(struct ksmbd_work *work, {struct ksmbd_conn *conn = work->conn;struct ksmbd_session *sess = work->sess; -struct channel *chann =NULL ; +struct channel *chann =NULL , *old;struct ksmbd_user *user;u64 prev_id;int sz, rc;
@@ -1557,7 +1557,12 @@ static int ntlm_authenticate(struct ksmbd_work *work,return -ENOMEM ; chann->conn = conn; -xa_store (&sess->ksmbd_chann_list, (long )conn, chann,KSMBD_DEFAULT_GFP ); + old =xa_store (&sess->ksmbd_chann_list, (long )conn, chann, +KSMBD_DEFAULT_GFP ); +if (xa_is_err (old)) { +kfree (chann); +return xa_err (old); + } } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 5/20 platform/x86/intel: hid: Add Pantherlake support
In reply to Sasha LevinFrom: Saranya Gopal <[email protected]>
[ Upstream commit 12df9ec3e1955aed6a0c839f2375cd8e5d5150cf ]
Add Pantherlake ACPI device ID to the Intel HID driver.
While there, clean up the device ID table to remove the ", 0" parts.
--- drivers/platform/x86/intel/hid.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/platform/x86/intel/hid.c +11 -10
@@ -44,16 +44,17 @@ MODULE_LICENSE("GPL");MODULE_AUTHOR ("Alex Hung" );static const struct acpi_device_id intel_hid_ids[] = { - {"INT33D5" ,0 }, - {"INTC1051" ,0 }, - {"INTC1054" ,0 }, - {"INTC1070" ,0 }, - {"INTC1076" ,0 }, - {"INTC1077" ,0 }, - {"INTC1078" ,0 }, - {"INTC107B" ,0 }, - {"INTC10CB" ,0 }, - {"" ,0 }, + {"INT33D5" }, + {"INTC1051" }, + {"INTC1054" }, + {"INTC1070" }, + {"INTC1076" }, + {"INTC1077" }, + {"INTC1078" }, + {"INTC107B" }, + {"INTC10CB" }, + {"INTC10CC" }, + { } };MODULE_DEVICE_TABLE (acpi, intel_hid_ids);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 6/20 platform/x86: asus-wmi: Disable OOBE state after resume from hibernation
In reply to Sasha LevinFrom: Pavel Nikulin <[email protected]>
[ Upstream commit 77bdac73754e4c0c564c1ca80fe3d9c93b0e715a ]
ASUS firmware resets OOBE state during S4 suspend, so the keyboard blinks during resume from hibernation. This patch disables OOBE state after resume from hibernation.
--- drivers/platform/x86/asus-wmi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +10 -1
@@ -304,6 +304,7 @@ struct asus_wmi {u32 kbd_rgb_dev;bool kbd_rgb_state_available; +bool oobe_state_available;u8 throttle_thermal_policy_mode;u32 throttle_thermal_policy_dev;
@@ -1826,7 +1827,7 @@ static int asus_wmi_led_init(struct asus_wmi *asus) goto error; } -if (asus_wmi_dev_is_present (asus,ASUS_WMI_DEVID_OOBE )) { +if (asus->oobe_state_available) {/* * Disable OOBE state, so that e.g. the keyboard backlight * works.
@@ -4723,6 +4724,7 @@ static int asus_wmi_add(struct platform_device *pdev) asus->egpu_enable_available =asus_wmi_dev_is_present (asus,ASUS_WMI_DEVID_EGPU ); asus->dgpu_disable_available =asus_wmi_dev_is_present (asus,ASUS_WMI_DEVID_DGPU ); asus->kbd_rgb_state_available =asus_wmi_dev_is_present (asus,ASUS_WMI_DEVID_TUF_RGB_STATE ); + asus->oobe_state_available =asus_wmi_dev_is_present (asus,ASUS_WMI_DEVID_OOBE ); asus->ally_mcu_usb_switch =acpi_has_method (NULL ,ASUS_USB0_PWR_EC0_CSEE ) &&dmi_check_system (asus_ally_mcu_quirk);
@@ -4970,6 +4972,13 @@ static int asus_hotk_restore(struct device *device) }if (!IS_ERR_OR_NULL (asus->kbd_led.dev))kbd_led_update (asus); +if (asus->oobe_state_available) { +/* +* Disable OOBE state, so that e.g. the keyboard backlight +* works. +*/ +asus_wmi_set_devstate (ASUS_WMI_DEVID_OOBE ,1 ,NULL ); + }if (asus_wmi_has_fnlock_key (asus))asus_wmi_fnlock_update (asus);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/20 platform/x86: ideapad-laptop: add support for some new buttons
In reply to Sasha LevinFrom: Gašper Nemgar <[email protected]>
[ Upstream commit 02c6e43397c39edd0c172859bf8c851b46be09a8 ]
Add entries to unsupported WMI codes in ideapad_keymap[] and one check for WMI code 0x13d to trigger platform_profile_cycle().
--- drivers/platform/x86/ideapad-laptop.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/platform/x86/ideapad-laptop.c +16 -0
@@ -1308,6 +1308,16 @@ static const struct key_entry ideapad_keymap[] = {/* Specific to some newer models */ { KE_KEY, 0x3e | IDEAPAD_WMI_KEY, { KEY_MICMUTE } }, { KE_KEY, 0x3f | IDEAPAD_WMI_KEY, { KEY_RFKILL } }, +/* Star- (User Assignable Key) */ + { KE_KEY, 0x44 | IDEAPAD_WMI_KEY, { KEY_PROG1 } }, +/* Eye */ + { KE_KEY, 0x45 | IDEAPAD_WMI_KEY, { KEY_PROG3 } }, +/* Performance toggle also Fn+Q, handled inside ideapad_wmi_notify() */ + { KE_KEY, 0x3d | IDEAPAD_WMI_KEY, { KEY_PROG4 } }, +/* shift + prtsc */ + { KE_KEY, 0x2d | IDEAPAD_WMI_KEY, { KEY_CUT } }, + { KE_KEY, 0x29 | IDEAPAD_WMI_KEY, { KEY_TOUCHPAD_TOGGLE } }, + { KE_KEY, 0x2a | IDEAPAD_WMI_KEY, { KEY_ROOT_MENU } }, { KE_END }, };
@@ -2094,6 +2104,12 @@ static void ideapad_wmi_notify(struct wmi_device *wdev, union acpi_object *data)dev_dbg (&wdev->dev,"WMI fn-key event: 0x%llx\n" , data->integer.value); +/* performance button triggered by 0x3d */ +if (data->integer.value ==0x3d && priv->dytc) { +platform_profile_cycle (); +break ; + } +/* 0x02 FnLock, 0x03 Esc */ if (data->integer.value ==0x02 || data->integer.value ==0x03 )ideapad_fn_lock_led_notify (priv, data->integer.value ==0x02 );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 8/20 ASoC: cs42l43: Disable headphone clamps during type detection
In reply to Sasha LevinFrom: Charles Keepax <[email protected]>
[ Upstream commit 70ad2e6bd180f94be030aef56e59693e36d945f3 ]
The headphone clamps cause fairly loud pops during type detect because they sink current from the detection process itself. Disable the clamps whilst the type detect runs, to improve the detection pop performance.
--- sound/soc/codecs/cs42l43-jack.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/codecs/cs42l43-jack.c +7 -0
@@ -654,6 +654,10 @@ static int cs42l43_run_type_detect(struct cs42l43_codec *priv)reinit_completion (&priv->type_detect); +regmap_update_bits (cs42l43->regmap,CS42L43_STEREO_MIC_CLAMP_CTRL , +CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_VAL_MASK , +CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_VAL_MASK ); +cs42l43_start_hs_bias (priv, true);regmap_update_bits (cs42l43->regmap,CS42L43_HS2 ,CS42L43_HSDET_MODE_MASK ,0x3 <<CS42L43_HSDET_MODE_SHIFT );
@@ -665,6 +669,9 @@ static int cs42l43_run_type_detect(struct cs42l43_codec *priv) CS42L43_HSDET_MODE_MASK, 0x2 << CS42L43_HSDET_MODE_SHIFT);cs42l43_stop_hs_bias (priv); +regmap_update_bits (cs42l43->regmap,CS42L43_STEREO_MIC_CLAMP_CTRL , +CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_VAL_MASK ,0 ); +if (!time_left)return -ETIMEDOUT ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 9/20 ASoC: Intel: bytcr_rt5640: Add DMI quirk for Acer Aspire SW3-013
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit a549b927ea3f5e50b1394209b64e6e17e31d4db8 ]
Acer Aspire SW3-013 requires the very same quirk as other Acer Aspire model for making it working.
--- sound/soc/intel/boards/bytcr_rt5640.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/soc/intel/boards/bytcr_rt5640.c +13 -0
@@ -576,6 +576,19 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {BYT_RT5640_SSP0_AIF2 | BYT_RT5640_MCLK_EN), }, + { /* Acer Aspire SW3-013 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Acer" ), + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW3-013"), + }, + .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | +BYT_RT5640_JD_SRC_JD2_IN4N | +BYT_RT5640_OVCD_TH_2000UA | +BYT_RT5640_OVCD_SF_0P75 | +BYT_RT5640_DIFF_MIC | +BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, { .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 10/20 ALSA: hda/realtek: Add quirk for HP Spectre x360 15-df1xxx
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit be0c40da888840fe91b45474cb70779e6cbaf7ca ]
HP Spectre x360 15-df1xxx with SSID 13c:863e requires similar workarounds that were applied to another HP Spectre x360 models; it has a mute LED only, no micmute LEDs, and needs the speaker GPIO seup.
--- sound/pci/hda/patch_realtek.c | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
sound/pci/hda/patch_realtek.c +42 -0
@@ -6962,6 +6962,41 @@ static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec, } } +/* GPIO1 = amplifier on/off */ +static void alc285_fixup_hp_spectre_x360_df1 (struct hda_codec *codec, +const struct hda_fixup *fix, +int action) +{ +struct alc_spec *spec = codec->spec; +static const hda_nid_t conn[] = {0x02 }; +static const struct hda_pintbl pincfgs[] = { + {0x14 ,0x90170110 },/* front/high speakers */ + {0x17 ,0x90170130 },/* back/bass speakers */ + { } + }; + +// enable mute led +alc285_fixup_hp_mute_led_coefbit (codec, fix, action); + +switch (action) { +case HDA_FIXUP_ACT_PRE_PROBE : +/* needed for amp of back speakers */ + spec->gpio_mask |=0x01 ; + spec->gpio_dir |=0x01 ; +snd_hda_apply_pincfgs (codec, pincfgs); +/* share DAC to have unified volume control */ +snd_hda_override_conn_list (codec,0x14 ,ARRAY_SIZE (conn), conn); +snd_hda_override_conn_list (codec,0x17 ,ARRAY_SIZE (conn), conn); +break ; +case HDA_FIXUP_ACT_INIT : +/* need to toggle GPIO to enable the amp of back speakers */ +alc_update_gpio_data (codec,0x01 , true); +msleep (100 ); +alc_update_gpio_data (codec,0x01 , false); +break ; + } +} +static void alc285_fixup_hp_spectre_x360 (struct hda_codec *codec,const struct hda_fixup *fix,int action) {
@@ -7718,6 +7753,7 @@ enum {ALC280_FIXUP_HP_9480M ,ALC245_FIXUP_HP_X360_AMP ,ALC285_FIXUP_HP_SPECTRE_X360_EB1 , +ALC285_FIXUP_HP_SPECTRE_X360_DF1 ,ALC285_FIXUP_HP_ENVY_X360 ,ALC288_FIXUP_DELL_HEADSET_MODE , ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
@@ -9786,6 +9822,10 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_spectre_x360_eb1 }, + [ALC285_FIXUP_HP_SPECTRE_X360_DF1] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_hp_spectre_x360_df1 + }, [ALC285_FIXUP_HP_ENVY_X360] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_envy_x360,
@@ -10509,6 +10549,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x86c1 ,"HP Laptop 15-da3001TU" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x86c7 ,"HP Envy AiO 32" ,ALC274_FIXUP_HP_ENVY_GPIO ),SND_PCI_QUIRK (0x103c ,0x86e7 ,"HP Spectre x360 15-eb0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360_EB1 ), +SND_PCI_QUIRK (0x103c ,0x863e ,"HP Spectre x360 15-df1xxx" ,ALC285_FIXUP_HP_SPECTRE_X360_DF1 ),SND_PCI_QUIRK (0x103c ,0x86e8 ,"HP Spectre x360 15-eb0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360_EB1 ),SND_PCI_QUIRK (0x103c ,0x86f9 ,"HP Spectre x360 13-aw0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED ), SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
@@ -11422,6 +11463,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"}, {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"}, {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"}, + {.id = ALC285_FIXUP_HP_SPECTRE_X360_DF1, .name = "alc285-hp-spectre-x360-df1"}, {.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"}, {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"}, {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 11/20 drm/ttm: fix the warning for hit_low and evict_low
In reply to Sasha LevinFrom: Sunil Khatri <[email protected]>
[ Upstream commit 76047483fe94414edf409dc498498abf346e22f1 ]
fix the below warning messages:ttm/ttm_bo.c:1098: warning: Function parameter or struct member 'hit_low' not described in 'ttm_bo_swapout_walk' ttm/ttm_bo.c:1098: warning: Function parameter or struct member 'evict_low' not described in 'ttm_bo_swapout_walk'
--- drivers/gpu/drm/ttm/ttm_bo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +2 -1
@@ -1092,7 +1092,8 @@ struct ttm_bo_swapout_walk {struct ttm_lru_walk walk;/** @gfp_flags: The gfp flags to use for ttm_tt_swapout() */ gfp_t gfp_flags; - +/** @hit_low: Whether we should attempt to swap BO's with low watermark threshold */ +/** @evict_low: If we cannot swap a bo when @try_low is false (first pass) */ bool hit_low, evict_low; };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 12/20 nvme-pci: add quirks for device 126f:1001
In reply to Sasha LevinFrom: Wentao Guan <[email protected]>
[ Upstream commit 5b960f92ac3e5b4d7f60a506a6b6735eead1da01 ]
This commit adds NVME_QUIRK_NO_DEEPEST_PS and NVME_QUIRK_BOGUS_NID for device [126f:1001].
It is similar to commit e89086c43f05 ("drivers/nvme: Add quirks for device 126f:2262")
Diff is according the dmesg, use NVME_QUIRK_IGNORE_DEV_SUBNQN.
dmesg | grep -i nvme0:
nvme nvme0: pci function 0000:01:00.0
nvme nvme0: missing or invalid SUBNQN field.
nvme nvme0: 12/0/0 default/read/poll queues
--- drivers/nvme/host/pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvme/host/pci.c +3 -0
@@ -3626,6 +3626,9 @@ static const struct pci_device_id nvme_id_table[] = { .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1217, 0x8760), /* O2 Micro 64GB Steam Deck */ .driver_data = NVME_QUIRK_DMAPOOL_ALIGN_512, }, + { PCI_DEVICE(0x126f, 0x1001), /* Silicon Motion generic */ + .driver_data = NVME_QUIRK_NO_DEEPEST_PS | + NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_DEVICE(0x126f, 0x2262), /* Silicon Motion generic */ .driver_data = NVME_QUIRK_NO_DEEPEST_PS | NVME_QUIRK_BOGUS_NID, },
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 13/20 nvme-pci: add quirks for WDC Blue SN550 15b7:5009
In reply to Sasha LevinFrom: Wentao Guan <[email protected]>
[ Upstream commit ab35ad950d439ec3409509835d229b3d93d3c7f9 ]
Add two quirks for the WDC Blue SN550 (PCI ID 15b7:5009) based on user reports and hardware analysis:
- NVME_QUIRK_NO_DEEPEST_PS:
liaozw talked to me the problem and solved with nvme_core.default_ps_max_latency_us=0, so add the quirk. I also found some reports in the following link.
- NVME_QUIRK_BROKEN_MSI:
after get the lspci from Jack Rio.
I think that the disk also have NVME_QUIRK_BROKEN_MSI. described in commit d5887dc6b6c0 ("nvme-pci: Add quirk for broken MSIs") as sean said in link which match the MSI 1/32 and MSI-X 17.
Log:
lspci -nn | grep -i memory
03:00.0 Non-Volatile memory controller [0108]: Sandisk Corp SanDisk Ultra 3D / WD PC SN530, IX SN530, Blue SN550 NVMe SSD (DRAM-less) [15b7:5009] (rev 01) lspci -v -d 15b7:5009
03:00.0 Non-Volatile memory controller: Sandisk Corp SanDisk Ultra 3D / WD PC SN530, IX SN530, Blue SN550 NVMe SSD (DRAM-less) (rev 01) (prog-if 02 [NVM Express])
Subsystem: Sandisk Corp WD Blue SN550 NVMe SSD
Flags: bus master, fast devsel, latency 0, IRQ 35, IOMMU group 10
Memory at fe800000 (64-bit, non-prefetchable) [size=16K]
Memory at fe804000 (64-bit, non-prefetchable) [size=256]
Capabilities: [80] Power Management version 3
Capabilities: [90] MSI: Enable- Count=1/32 Maskable- 64bit+
Capabilities: [b0] MSI-X: Enable+ Count=17 Masked-
Capabilities: [c0] Express Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [150] Device Serial Number 00-00-00-00-00-00-00-00
Capabilities: [1b8] Latency Tolerance Reporting
Capabilities: [300] Secondary PCI Express
Capabilities: [900] L1 PM Substates
Kernel driver in use: nvme
dmesg | grep nvme
[ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-6.12.20-amd64-desktop-rolling root=UUID= ro splash quiet nvme_core.default_ps_max_latency_us=0 DEEPIN_GFXMODE= [ 0.059301] Kernel command line: BOOT_IMAGE=/vmlinuz-6.12.20-amd64-desktop-rolling root=UUID= ro splash quiet nvme_core.default_ps_max_latency_us=0 DEEPIN_GFXMODE= [ 0.542430] nvme nvme0: pci function 0000:03:00.0 [ 0.560426] nvme nvme0: allocated 32 MiB host memory buffer. [ 0.562491] nvme nvme0: 16/0/0 default/read/poll queues [ 0.567764] nvme0n1: p1 p2 p3 p4 p5 p6 p7 p8 p9 [ 6.388726] EXT4-fs (nvme0n1p7): mounted filesystem ro with ordered data mode. Quota mode: none. [ 6.893421] EXT4-fs (nvme0n1p7): re-mounted r/w. Quota mode: none. [ 7.125419] Adding 16777212k swap on /dev/nvme0n1p8. Priority:-2 extents:1 across:16777212k SS [ 7.157588] EXT4-fs (nvme0n1p6): mounted filesystem r/w with ordered data mode. Quota mode: none. [ 7.165021] EXT4-fs (nvme0n1p9): mounted filesystem r/w with ordered data mode. Quota mode: none. [ 8.036932] nvme nvme0: using unchecked data buffer [ 8.096023] block nvme0n1: No UUID available providing old NGUID
--- drivers/nvme/host/pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvme/host/pci.c +3 -0
@@ -3652,6 +3652,9 @@ static const struct pci_device_id nvme_id_table[] = { NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_DEVICE(0x15b7, 0x5008), /* Sandisk SN530 */ .driver_data = NVME_QUIRK_BROKEN_MSI }, + { PCI_DEVICE(0x15b7, 0x5009), /* Sandisk SN550 */ + .driver_data =NVME_QUIRK_BROKEN_MSI | + NVME_QUIRK_NO_DEEPEST_PS }, { PCI_DEVICE(0x1987, 0x5012), /* Phison E12 */ .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1987, 0x5016), /* Phison E16 */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 14/20 ALSA: usb-audio: Fix duplicated name in MIDI substream names
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 0759e77a6d9bd34a874da73721ce4a7dc6665023 ]
The MIDI substream name string is constructed from the combination of the card shortname (which is taken from USB iProduct) and the USB iJack. The problem is that some devices put the product name to the iJack field, too. For example, aplaymidi -l output on the Lanchkey MK 49 are like:
% aplaymidi -l
Port Client name Port name 44:0 Launchkey MK4 49 Launchkey MK4 49 Launchkey MK4 44:1 Launchkey MK4 49 Launchkey MK4 49 Launchkey MK4
where the actual iJack name can't be seen because it's truncated due to the doubly words.
For resolving those situations, this patch compares the iJack string with the card shortname, and drops if both start with the same words. Then the result becomes like:
% aplaymidi -l
Port Client name Port name 40:0 Launchkey MK4 49 Launchkey MK4 49 MIDI In 40:1 Launchkey MK4 49 Launchkey MK4 49 DAW In
A caveat is that there are some pre-defined names for certain devices in the driver code, and this workaround shouldn't be applied to them. Similarly, when the iJack isn't specified, we should skip this check, too. The patch added those checks in addition to the string comparison.
--- sound/usb/midi.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
sound/usb/midi.c +12 -4
@@ -1885,10 +1885,18 @@ static void snd_usbmidi_init_substream(struct snd_usb_midi *umidi, } port_info =find_port_info (umidi, number); - name_format = port_info ? port_info->name : - (jack_name != default_jack_name ?"%s %s" :"%s %s %d" ); -snprintf (substream->name,sizeof (substream->name), - name_format, umidi->card->shortname, jack_name, number +1 ); +if (port_info || jack_name == default_jack_name || +strncmp (umidi->card->shortname, jack_name,strlen (umidi->card->shortname)) !=0 ) { + name_format = port_info ? port_info->name : + (jack_name != default_jack_name ?"%s %s" :"%s %s %d" ); +snprintf (substream->name,sizeof (substream->name), + name_format, umidi->card->shortname, jack_name, number +1 ); + }else { +/* The manufacturer included the iProduct name in the jack +* name, do not use both +*/ +strscpy (substream->name, jack_name); + } *rsubstream = substream; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 15/20 nvmet-tcp: don't restore null sk_state_change
In reply to Sasha LevinFrom: Alistair Francis <[email protected]>
[ Upstream commit 46d22b47df2741996af277a2838b95f130436c13 ]
queue->state_change is set as part of nvmet_tcp_set_queue_sock(), but if the TCP connection isn't established when nvmet_tcp_set_queue_sock() is called then queue->state_change isn't set and sock->sk->sk_state_change isn't replaced.
As such we don't need to restore sock->sk->sk_state_change if queue->state_change is NULL.
This avoids NULL pointer dereferences such as this:
[ 286.462026][ C0] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 286.462814][ C0] #PF: supervisor instruction fetch in kernel mode [ 286.463796][ C0] #PF: error_code(0x0010) - not-present page [ 286.464392][ C0] PGD 8000000140620067 P4D 8000000140620067 PUD 114201067 PMD 0 [ 286.465086][ C0] Oops: Oops: 0010 [#1] SMP KASAN PTI [ 286.465559][ C0] CPU: 0 UID: 0 PID: 1628 Comm: nvme Not tainted 6.15.0-rc2+ #11 PREEMPT(voluntary) [ 286.466393][ C0] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-3.fc41 04/01/2014 [ 286.467147][ C0] RIP: 0010:0x0 [ 286.467420][ C0] Code: Unable to access opcode bytes at 0xffffffffffffffd6. [ 286.467977][ C0] RSP: 0018:ffff8883ae008580 EFLAGS: 00010246 [ 286.468425][ C0] RAX: 0000000000000000 RBX: ffff88813fd34100 RCX: ffffffffa386cc43 [ 286.469019][ C0] RDX: 1ffff11027fa68b6 RSI: 0000000000000008 RDI: ffff88813fd34100 [ 286.469545][ C0] RBP: ffff88813fd34160 R08: 0000000000000000 R09: ffffed1027fa682c [ 286.470072][ C0] R10: ffff88813fd34167 R11: 0000000000000000 R12: ffff88813fd344c3 [ 286.470585][ C0] R13: ffff88813fd34112 R14: ffff88813fd34aec R15: ffff888132cdd268 [ 286.471070][ C0] FS: 00007fe3c04c7d80(0000) GS:ffff88840743f000(0000) knlGS:0000000000000000 [ 286.471644][ C0] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 286.472543][ C0] CR2: ffffffffffffffd6 CR3: 000000012daca000 CR4: 00000000000006f0 [ 286.473500][ C0] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 286.474467][ C0] DR3: 0000000000000000 DR6: 00000000ffff07f0 DR7: 0000000000000400 [ 286.475453][ C0] Call Trace: [ 286.476102][ C0] <IRQ> [ 286.476719][ C0] tcp_fin+0x2bb/0x440 [ 286.477429][ C0] tcp_data_queue+0x190f/0x4e60 [ 286.478174][ C0] ? __build_skb_around+0x234/0x330 [ 286.478940][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.479659][ C0] ? __pfx_tcp_data_queue+0x10/0x10 [ 286.480431][ C0] ? tcp_try_undo_loss+0x640/0x6c0 [ 286.481196][ C0] ? seqcount_lockdep_reader_access.constprop.0+0x82/0x90 [ 286.482046][ C0] ? kvm_clock_get_cycles+0x14/0x30 [ 286.482769][ C0] ? ktime_get+0x66/0x150 [ 286.483433][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.484146][ C0] tcp_rcv_established+0x6e4/0x2050 [ 286.484857][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.485523][ C0] ? ipv4_dst_check+0x160/0x2b0 [ 286.486203][ C0] ? __pfx_tcp_rcv_established+0x10/0x10 [ 286.486917][ C0] ? lock_release+0x217/0x2c0 [ 286.487595][ C0] tcp_v4_do_rcv+0x4d6/0x9b0 [ 286.488279][ C0] tcp_v4_rcv+0x2af8/0x3e30 [ 286.488904][ C0] ? raw_local_deliver+0x51b/0xad0 [ 286.489551][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.490198][ C0] ? __pfx_tcp_v4_rcv+0x10/0x10 [ 286.490813][ C0] ? __pfx_raw_local_deliver+0x10/0x10 [ 286.491487][ C0] ? __pfx_nf_confirm+0x10/0x10 [nf_conntrack] [ 286.492275][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.492900][ C0] ip_protocol_deliver_rcu+0x8f/0x370 [ 286.493579][ C0] ip_local_deliver_finish+0x297/0x420 [ 286.494268][ C0] ip_local_deliver+0x168/0x430 [ 286.494867][ C0] ? __pfx_ip_local_deliver+0x10/0x10 [ 286.495498][ C0] ? __pfx_ip_local_deliver_finish+0x10/0x10 [ 286.496204][ C0] ? ip_rcv_finish_core+0x19a/0x1f20 [ 286.496806][ C0] ? lock_release+0x217/0x2c0 [ 286.497414][ C0] ip_rcv+0x455/0x6e0 [ 286.497945][ C0] ? __pfx_ip_rcv+0x10/0x10 [ 286.498550][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.499137][ C0] ? __pfx_ip_rcv_finish+0x10/0x10 [ 286.499763][ C0] ? lock_release+0x217/0x2c0 [ 286.500327][ C0] ? dl_scaled_delta_exec+0xd1/0x2c0 [ 286.500922][ C0] ? __pfx_ip_rcv+0x10/0x10 [ 286.501480][ C0] __netif_receive_skb_one_core+0x166/0x1b0 [ 286.502173][ C0] ? __pfx___netif_receive_skb_one_core+0x10/0x10 [ 286.502903][ C0] ? lock_acquire+0x2b2/0x310 [ 286.503487][ C0] ? process_backlog+0x372/0x1350 [ 286.504087][ C0] ? lock_release+0x217/0x2c0 [ 286.504642][ C0] process_backlog+0x3b9/0x1350 [ 286.505214][ C0] ? process_backlog+0x372/0x1350 [ 286.505779][ C0] __napi_poll.constprop.0+0xa6/0x490 [ 286.506363][ C0] net_rx_action+0x92e/0xe10 [ 286.506889][ C0] ? __pfx_net_rx_action+0x10/0x10 [ 286.507437][ C0] ? timerqueue_add+0x1f0/0x320 [ 286.507977][ C0] ? sched_clock_cpu+0x68/0x540 [ 286.508492][ C0] ? lock_acquire+0x2b2/0x310 [ 286.509043][ C0] ? kvm_sched_clock_read+0xd/0x20 [ 286.509607][ C0] ? handle_softirqs+0x1aa/0x7d0 [ 286.510187][ C0] handle_softirqs+0x1f2/0x7d0 [ 286.510754][ C0] ? __pfx_handle_softirqs+0x10/0x10 [ 286.511348][ C0] ? irqtime_account_irq+0x181/0x290 [ 286.511937][ C0] ? __dev_queue_xmit+0x85d/0x3450 [ 286.512510][ C0] do_softirq.part.0+0x89/0xc0 [ 286.513100][ C0] </IRQ> [ 286.513548][ C0] <TASK> [ 286.513953][ C0] __local_bh_enable_ip+0x112/0x140 [ 286.514522][ C0] ? __dev_queue_xmit+0x85d/0x3450 [ 286.515072][ C0] __dev_queue_xmit+0x872/0x3450 [ 286.515619][ C0] ? nft_do_chain+0xe16/0x15b0 [nf_tables] [ 286.516252][ C0] ? __pfx___dev_queue_xmit+0x10/0x10 [ 286.516817][ C0] ? selinux_ip_postroute+0x43c/0xc50 [ 286.517433][ C0] ? __pfx_selinux_ip_postroute+0x10/0x10 [ 286.518061][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.518606][ C0] ? ip_output+0x164/0x4a0 [ 286.519149][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.519671][ C0] ? ip_finish_output2+0x17d5/0x1fb0 [ 286.520258][ C0] ip_finish_output2+0xb4b/0x1fb0 [ 286.520787][ C0] ? __pfx_ip_finish_output2+0x10/0x10 [ 286.521355][ C0] ? __ip_finish_output+0x15d/0x750 [ 286.521890][ C0] ip_output+0x164/0x4a0 [ 286.522372][ C0] ? __pfx_ip_output+0x10/0x10 [ 286.522872][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.523402][ C0] ? _raw_spin_unlock_irqrestore+0x4c/0x60 [ 286.524031][ C0] ? __pfx_ip_finish_output+0x10/0x10 [ 286.524605][ C0] ? __ip_queue_xmit+0x999/0x2260 [ 286.525200][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.525744][ C0] ? ipv4_dst_check+0x16a/0x2b0 [ 286.526279][ C0] ? lock_release+0x217/0x2c0 [ 286.526793][ C0] __ip_queue_xmit+0x1883/0x2260 [ 286.527324][ C0] ? __skb_clone+0x54c/0x730 [ 286.527827][ C0] __tcp_transmit_skb+0x209b/0x37a0 [ 286.528374][ C0] ? __pfx___tcp_transmit_skb+0x10/0x10 [ 286.528952][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.529472][ C0] ? seqcount_lockdep_reader_access.constprop.0+0x82/0x90 [ 286.530152][ C0] ? trace_hardirqs_on+0x12/0x120 [ 286.530691][ C0] tcp_write_xmit+0xb81/0x88b0 [ 286.531224][ C0] ? mod_memcg_state+0x4d/0x60 [ 286.531736][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.532253][ C0] __tcp_push_pending_frames+0x90/0x320 [ 286.532826][ C0] tcp_send_fin+0x141/0xb50 [ 286.533352][ C0] ? __pfx_tcp_send_fin+0x10/0x10 [ 286.533908][ C0] ? __local_bh_enable_ip+0xab/0x140 [ 286.534495][ C0] inet_shutdown+0x243/0x320 [ 286.535077][ C0] nvme_tcp_alloc_queue+0xb3b/0x2590 [nvme_tcp] [ 286.535709][ C0] ? do_raw_spin_lock+0x129/0x260 [ 286.536314][ C0] ? __pfx_nvme_tcp_alloc_queue+0x10/0x10 [nvme_tcp] [ 286.536996][ C0] ? do_raw_spin_unlock+0x54/0x1e0 [ 286.537550][ C0] ? _raw_spin_unlock+0x29/0x50 [ 286.538127][ C0] ? do_raw_spin_lock+0x129/0x260 [ 286.538664][ C0] ? __pfx_do_raw_spin_lock+0x10/0x10 [ 286.539249][ C0] ? nvme_tcp_alloc_admin_queue+0xd5/0x340 [nvme_tcp] [ 286.539892][ C0] ? __wake_up+0x40/0x60 [ 286.540392][ C0] nvme_tcp_alloc_admin_queue+0xd5/0x340 [nvme_tcp] [ 286.541047][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.541589][ C0] nvme_tcp_setup_ctrl+0x8b/0x7a0 [nvme_tcp] [ 286.542254][ C0] ? _raw_spin_unlock_irqrestore+0x4c/0x60 [ 286.542887][ C0] ? __pfx_nvme_tcp_setup_ctrl+0x10/0x10 [nvme_tcp] [ 286.543568][ C0] ? trace_hardirqs_on+0x12/0x120 [ 286.544166][ C0] ? _raw_spin_unlock_irqrestore+0x35/0x60 [ 286.544792][ C0] ? nvme_change_ctrl_state+0x196/0x2e0 [nvme_core] [ 286.545477][ C0] nvme_tcp_create_ctrl+0x839/0xb90 [nvme_tcp] [ 286.546126][ C0] nvmf_dev_write+0x3db/0x7e0 [nvme_fabrics] [ 286.546775][ C0] ? rw_verify_area+0x69/0x520 [ 286.547334][ C0] vfs_write+0x218/0xe90 [ 286.547854][ C0] ? do_syscall_64+0x9f/0x190 [ 286.548408][ C0] ? trace_hardirqs_on_prepare+0xdb/0x120 [ 286.549037][ C0] ? syscall_exit_to_user_mode+0x93/0x280 [ 286.549659][ C0] ? __pfx_vfs_write+0x10/0x10 [ 286.550259][ C0] ? do_syscall_64+0x9f/0x190 [ 286.550840][ C0] ? syscall_exit_to_user_mode+0x8e/0x280 [ 286.551516][ C0] ? trace_hardirqs_on_prepare+0xdb/0x120 [ 286.552180][ C0] ? syscall_exit_to_user_mode+0x93/0x280 [ 286.552834][ C0] ? ksys_read+0xf5/0x1c0 [ 286.553386][ C0] ? __pfx_ksys_read+0x10/0x10 [ 286.553964][ C0] ksys_write+0xf5/0x1c0 [ 286.554499][ C0] ? __pfx_ksys_write+0x10/0x10 [ 286.555072][ C0] ? trace_hardirqs_on_prepare+0xdb/0x120 [ 286.555698][ C0] ? syscall_exit_to_user_mode+0x93/0x280 [ 286.556319][ C0] ? do_syscall_64+0x54/0x190 [ 286.556866][ C0] do_syscall_64+0x93/0x190 [ 286.557420][ C0] ? rcu_read_unlock+0x17/0x60 [ 286.557986][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.558526][ C0] ? lock_release+0x217/0x2c0 [ 286.559087][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.559659][ C0] ? count_memcg_events.constprop.0+0x4a/0x60 [ 286.560476][ C0] ? exc_page_fault+0x7a/0x110 [ 286.561064][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.561647][ C0] ? lock_release+0x217/0x2c0 [ 286.562257][ C0] ? do_user_addr_fault+0x171/0xa00 [ 286.562839][ C0] ? do_user_addr_fault+0x4a2/0xa00 [ 286.563453][ C0] ? irqentry_exit_to_user_mode+0x84/0x270 [ 286.564112][ C0] ? rcu_is_watching+0x11/0xb0 [ 286.564677][ C0] ? irqentry_exit_to_user_mode+0x84/0x270 [ 286.565317][ C0] ? trace_hardirqs_on_prepare+0xdb/0x120 [ 286.565922][ C0] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 286.566542][ C0] RIP: 0033:0x7fe3c05e6504 [ 286.567102][ C0] Code: c7 00 16 00 00 00 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 80 3d c5 8b 10 00 00 74 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 55 48 89 e5 48 83 ec 20 48 89 [ 286.568931][ C0] RSP: 002b:00007fff76444f58 EFLAGS: 00000202 ORIG_RAX: 0000000000000001 [ 286.569807][ C0] RAX: ffffffffffffffda RBX: 000000003b40d930 RCX: 00007fe3c05e6504 [ 286.570621][ C0] RDX: 00000000000000cf RSI: 000000003b40d930 RDI: 0000000000000003 [ 286.571443][ C0] RBP: 0000000000000003 R08: 00000000000000cf R09: 000000003b40d930 [ 286.572246][ C0] R10: 0000000000000000 R11: 0000000000000202 R12: 000000003b40cd60 [ 286.573069][ C0] R13: 00000000000000cf R14: 00007fe3c07417f8 R15: 00007fe3c073502e [ 286.573886][ C0] </TASK>
--- drivers/nvme/target/tcp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvme/target/tcp.c +3 -0
@@ -1560,6 +1560,9 @@ static void nvmet_tcp_restore_socket_callbacks(struct nvmet_tcp_queue *queue) {struct socket *sock = queue->sock; +if (!queue->state_change) +return ; +write_lock_bh (&sock->sk->sk_callback_lock); sock->sk->sk_data_ready = queue->data_ready; sock->sk->sk_state_change = queue->state_change;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 16/20 io_uring/fdinfo: annotate racy sq/cq head/tail reads
In reply to Sasha LevinFrom: Jens Axboe <[email protected]>
[ Upstream commit f024d3a8ded0d8d2129ae123d7a5305c29ca44ce ]
syzbot complains about the cached sq head read, and it's totally right. But we don't need to care, it's just reading fdinfo, and reading the CQ or SQ tail/head entries are known racy in that they are just a view into that very instant and may of course be outdated by the time they are reported.
Annotate both the SQ head and CQ tail read with data_race() to avoid this syzbot complaint.
--- io_uring/fdinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
io_uring/fdinfo.c +2 -2
@@ -123,11 +123,11 @@ __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *file)seq_printf (m,"SqMask:\t0x%x\n" , sq_mask);seq_printf (m,"SqHead:\t%u\n" , sq_head);seq_printf (m,"SqTail:\t%u\n" , sq_tail); -seq_printf (m,"CachedSqHead:\t%u\n" , ctx->cached_sq_head); +seq_printf (m,"CachedSqHead:\t%u\n" ,data_race (ctx->cached_sq_head));seq_printf (m,"CqMask:\t0x%x\n" , cq_mask);seq_printf (m,"CqHead:\t%u\n" , cq_head);seq_printf (m,"CqTail:\t%u\n" , cq_tail); -seq_printf (m,"CachedCqTail:\t%u\n" , ctx->cached_cq_tail); +seq_printf (m,"CachedCqTail:\t%u\n" ,data_race (ctx->cached_cq_tail));seq_printf (m,"SQEs:\t%u\n" , sq_tail - sq_head); sq_entries =min (sq_tail - sq_head, ctx->sq_entries);for (i =0 ; i < sq_entries; i++) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 17/20 cifs: Fix and improve cifs_query_path_info() and cifs_query_file_info()
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit 1041c117a2c33cdffc4f695ac4b469e9124d24d5 ]
When CAP_NT_SMBS was not negotiated then do not issue CIFSSMBQPathInfo() and CIFSSMBQFileInfo() commands. CIFSSMBQPathInfo() is not supported by non-NT Win9x SMB server and CIFSSMBQFileInfo() returns from Win9x SMB server bogus data in Attributes field (for example lot of files are marked as reparse points, even Win9x does not support them and read-only bit is not marked for read-only files). Correct information is returned by CIFSFindFirst() or SMBQueryInformation() command.
So as a fallback in cifs_query_path_info() function use CIFSFindFirst() with SMB_FIND_FILE_FULL_DIRECTORY_INFO level which is supported by both NT and non-NT servers and as a last option use SMBQueryInformation() as it was before.
And in function cifs_query_file_info() immediately returns -EOPNOTSUPP when not communicating with NT server. Client then revalidate inode entry by the cifs_query_path_info() call, which is working fine. So fstat() syscall on already opened file will receive correct information.
Note that both fallback functions in non-UNICODE mode expands wildcards. Therefore those fallback functions cannot be used on paths which contain SMB wildcard characters (* ? " > <).
CIFSFindFirst() returns all 4 time attributes as opposite of SMBQueryInformation() which returns only one.
With this change it is possible to query all 4 times attributes from Win9x server and at the same time, client minimize sending of unsupported commands to server.
--- fs/smb/client/smb1ops.c | 103 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 95 insertions(+), 8 deletions(-)
fs/smb/client/smb1ops.c +95 -8
@@ -548,24 +548,104 @@ static int cifs_query_path_info(const unsigned int xid,const char *full_path, struct cifs_open_info_data *data) { - int rc; + int rc = -EOPNOTSUPP;FILE_ALL_INFO fi = {}; +struct cifs_search_info search_info = {}; +bool non_unicode_wildcard = false; data->reparse_point = false; data->adjust_tz = false; -/* could do find first instead but this returns more info */ - rc =CIFSSMBQPathInfo (xid, tcon, full_path, &fi,0 /* not legacy */ , cifs_sb->local_nls, -cifs_remap (cifs_sb));/* -* BB optimize code so we do not make the above call when server claims -* no NT SMB support and the above call failed at least once - set flag -* in tcon or mount. +* First try CIFSSMBQPathInfo() function which returns more info +* (NumberOfLinks) than CIFSFindFirst() fallback function. +* Some servers like Win9x do not support SMB_QUERY_FILE_ALL_INFO over +* TRANS2_QUERY_PATH_INFORMATION, but supports it with filehandle over +* TRANS2_QUERY_FILE_INFORMATION (function CIFSSMBQFileInfo(). But SMB +* Open command on non-NT servers works only for files, does not work +* for directories. And moreover Win9x SMB server returns bogus data in +* SMB_QUERY_FILE_ALL_INFO Attributes field. So for non-NT servers, +* do not even use CIFSSMBQPathInfo() or CIFSSMBQFileInfo() function. +*/ +if (tcon->ses->capabilities &CAP_NT_SMBS ) + rc =CIFSSMBQPathInfo (xid, tcon, full_path, &fi,0 /* not legacy */ , + cifs_sb->local_nls,cifs_remap (cifs_sb)); + +/* +* Non-UNICODE variant of fallback functions below expands wildcards, +* so they cannot be used for querying paths with wildcard characters. */ -if ((rc == -EOPNOTSUPP ) || (rc == -EINVAL )) { +if (rc && !(tcon->ses->capabilities &CAP_UNICODE ) &&strpbrk (full_path,"*?\"><" )) + non_unicode_wildcard = true; + +/* +* Then fallback to CIFSFindFirst() which works also with non-NT servers +* but does not does not provide NumberOfLinks. +*/ +if ((rc == -EOPNOTSUPP || rc == -EINVAL ) && + !non_unicode_wildcard) { +if (!(tcon->ses->capabilities & tcon->ses->server->vals->cap_nt_find)) + search_info.info_level =SMB_FIND_FILE_INFO_STANDARD ; +else + search_info.info_level =SMB_FIND_FILE_FULL_DIRECTORY_INFO ; + rc =CIFSFindFirst (xid, tcon, full_path, cifs_sb,NULL , +CIFS_SEARCH_CLOSE_ALWAYS |CIFS_SEARCH_CLOSE_AT_END , + &search_info, false); +if (rc ==0 ) { +if (!(tcon->ses->capabilities & tcon->ses->server->vals->cap_nt_find)) { +FIND_FILE_STANDARD_INFO *di; +int offset = tcon->ses->server->timeAdj; + + di = (FIND_FILE_STANDARD_INFO *)search_info.srch_entries_start; + fi.CreationTime =cpu_to_le64 (cifs_UnixTimeToNT (cnvrtDosUnixTm ( + di->CreationDate, di->CreationTime, offset))); + fi.LastAccessTime =cpu_to_le64 (cifs_UnixTimeToNT (cnvrtDosUnixTm ( + di->LastAccessDate, di->LastAccessTime, offset))); + fi.LastWriteTime =cpu_to_le64 (cifs_UnixTimeToNT (cnvrtDosUnixTm ( + di->LastWriteDate, di->LastWriteTime, offset))); + fi.ChangeTime = fi.LastWriteTime; + fi.Attributes =cpu_to_le32 (le16_to_cpu (di->Attributes)); + fi.AllocationSize =cpu_to_le64 (le32_to_cpu (di->AllocationSize)); + fi.EndOfFile =cpu_to_le64 (le32_to_cpu (di->DataSize)); + }else { +FILE_FULL_DIRECTORY_INFO *di; + + di = (FILE_FULL_DIRECTORY_INFO *)search_info.srch_entries_start; + fi.CreationTime = di->CreationTime; + fi.LastAccessTime = di->LastAccessTime; + fi.LastWriteTime = di->LastWriteTime; + fi.ChangeTime = di->ChangeTime; + fi.Attributes = di->ExtFileAttributes; + fi.AllocationSize = di->AllocationSize; + fi.EndOfFile = di->EndOfFile; + fi.EASize = di->EaSize; + } + fi.NumberOfLinks =cpu_to_le32 (1 ); + fi.DeletePending =0 ; + fi.Directory = !!(le32_to_cpu (fi.Attributes) &ATTR_DIRECTORY ); +cifs_buf_release (search_info.ntwrk_buf_start); + }else if (!full_path[0 ]) { +/* +* CIFSFindFirst() does not work on root path if the +* root path was exported on the server from the top +* level path (drive letter). +*/ + rc = -EOPNOTSUPP ; + } + } + +/* +* If everything failed then fallback to the legacy SMB command +* SMB_COM_QUERY_INFORMATION which works with all servers, but +* provide just few information. +*/ +if ((rc == -EOPNOTSUPP || rc == -EINVAL ) && !non_unicode_wildcard) { rc =SMBQueryInformation (xid, tcon, full_path, &fi, cifs_sb->local_nls,cifs_remap (cifs_sb)); data->adjust_tz = true; + }else if ((rc == -EOPNOTSUPP || rc == -EINVAL ) && non_unicode_wildcard) { +/* Path with non-UNICODE wildcard character cannot exist. */ + rc = -ENOENT ; }if (!rc) {
@@ -644,6 +724,13 @@ static int cifs_query_file_info(const unsigned int xid, struct cifs_tcon *tcon,int rc;FILE_ALL_INFO fi = {}; +/* +* CIFSSMBQFileInfo() for non-NT servers returns bogus data in +* Attributes fields. So do not use this command for non-NT servers. +*/ +if (!(tcon->ses->capabilities &CAP_NT_SMBS )) +return -EOPNOTSUPP ; +if (cfile->symlink_target) { data->symlink_target =kstrdup (cfile->symlink_target,GFP_KERNEL );if (!data->symlink_target)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 18/20 cifs: Fix changing times and read-only attr over SMB1 smb_set_file_info() function
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit f122121796f91168d0894c2710b8dd71330a34f8 ]
Function CIFSSMBSetPathInfo() is not supported by non-NT servers and returns error. Fallback code via open filehandle and CIFSSMBSetFileInfo() does not work neither because CIFS_open() works also only on NT server.
Therefore currently the whole smb_set_file_info() function as a SMB1 callback for the ->set_file_info() does not work with older non-NT SMB servers, like Win9x and others.
This change implements fallback code in smb_set_file_info() which will works with any server and allows to change time values and also to set or clear read-only attributes.
To make existing fallback code via CIFSSMBSetFileInfo() working with also non-NT servers, it is needed to change open function from CIFS_open() (which is NT specific) to cifs_open_file() which works with any server (this is just a open wrapper function which choose the correct open function supported by the server).
CIFSSMBSetFileInfo() is working also on non-NT servers, but zero time values are not treated specially. So first it is needed to fill all time values if some of them are missing, via cifs_query_path_info() call.
There is another issue, opening file in write-mode (needed for changing attributes) is not possible when the file has read-only attribute set. The only option how to clear read-only attribute is via SMB_COM_SETATTR command. And opening directory is not possible neither and here the SMB_COM_SETATTR command is the only option how to change attributes. And CIFSSMBSetFileInfo() does not honor setting read-only attribute, so for setting is also needed to use SMB_COM_SETATTR command.
Existing code in cifs_query_path_info() is already using SMB_COM_GETATTR as a fallback code path (function SMBQueryInformation()), so introduce a new function SMBSetInformation which will implement SMB_COM_SETATTR command.
My testing showed that Windows XP SMB1 client is also using SMB_COM_SETATTR command for setting or clearing read-only attribute against non-NT server. So this can prove that this is the correct way how to do it.
With this change it is possible set all 4 time values and all attributes, including clearing and setting read-only bit on non-NT SMB servers. Tested against Win98 SMB1 server.
This change fixes "touch" command which was failing when called on existing file. And fixes also "chmod +w" and "chmod -w" commands which were also failing (as they are changing read-only attribute).
Note that this change depends on following change "cifs: Improve cifs_query_path_info() and cifs_query_file_info()" as it require to query all 4 time attribute values.
--- fs/smb/client/cifspdu.h | 5 +- fs/smb/client/cifsproto.h | 4 ++ fs/smb/client/cifssmb.c | 57 +++++++++++++++++++ fs/smb/client/smb1ops.c | 112 +++++++++++++++++++++++++++++++++++--- 4 files changed, 166 insertions(+), 12 deletions(-)
fs/smb/client/cifspdu.h +2 -3
@@ -1266,10 +1266,9 @@ typedef struct smb_com_query_information_rsp {typedef struct smb_com_setattr_req {struct smb_hdr hdr;/* wct = 8 */ __le16 attr; -__le16 time_low; -__le16 time_high; +__le32 last_write_time;__le16 reserved[5 ];/* must be zero */ -__u16 ByteCount; +__le16 ByteCount;__u8 BufferFormat;/* 4 = ASCII */ unsigned char fileName[]; } __attribute__((packed))SETATTR_REQ ;
fs/smb/client/cifsproto.h +4 -0
@@ -392,6 +392,10 @@ extern int CIFSSMBQFSUnixInfo(const unsigned int xid, struct cifs_tcon *tcon);extern int CIFSSMBQFSPosixInfo (const unsigned int xid,struct cifs_tcon *tcon,struct kstatfs *FSData); +extern int SMBSetInformation (const unsigned int xid,struct cifs_tcon *tcon, +const char *fileName,__le32 attributes,__le64 write_time, +const struct nls_table *nls_codepage, +struct cifs_sb_info *cifs_sb); extern int CIFSSMBSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon, const char *fileName, const FILE_BASIC_INFO *data, const struct nls_table *nls_codepage,
fs/smb/client/cifssmb.c +57 -0
63 lines not on this page · raw message
fs/smb/client/smb1ops.c +103 -9
149 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 19/20 ASoC: intel/sdw_utils: Add volume limit to cs42l43 speakers
In reply to Sasha LevinFrom: Stefan Binding <[email protected]>
[ Upstream commit 02b44a2b2bdcee03cbb92484d31e9ca1b91b2a38 ]
The volume control for cs42l43 speakers has a maximum gain of +31.5 dB. However, for many use cases, this can cause distorted audio, depending various factors, such as other signal-processing elements in the chain, for example if the audio passes through a gain control before reaching the codec or the signal path has been tuned for a particular maximum gain in the codec.
In the case of systems which use the soc_sdw_cs42l43 driver, audio will likely be distorted in all cases above 0 dB, therefore add a volume limit of 128, which is 0 dB maximum volume inside this driver.
--- sound/soc/sdw_utils/soc_sdw_cs42l43.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/soc/sdw_utils/soc_sdw_cs42l43.c +10 -0
@@ -20,6 +20,8 @@#include <sound/soc-dapm.h> #include <sound/soc_sdw_utils.h> +#define CS42L43_SPK_VOLUME_0DB 128/* 0dB Max */ +static const struct snd_soc_dapm_route cs42l43_hs_map[] = { {"Headphone" ,NULL ,"cs42l43 AMP3_OUT" }, {"Headphone" ,NULL ,"cs42l43 AMP4_OUT" },
@@ -117,6 +119,14 @@ int asoc_sdw_cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soreturn -ENOMEM ; } + ret =snd_soc_limit_volume (card,"cs42l43 Speaker Digital Volume" , +CS42L43_SPK_VOLUME_0DB ); +if (ret) +dev_err (card->dev,"cs42l43 speaker volume limit failed: %d\n" , ret); +else +dev_info (card->dev,"Setting CS42L43 Speaker volume limit to %d\n" , +CS42L43_SPK_VOLUME_0DB ); + ret =snd_soc_dapm_add_routes (&card->dapm, cs42l43_spk_map,ARRAY_SIZE (cs42l43_spk_map));if (ret)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 20/20 ASoC: intel/sdw_utils: Add volume limit to cs35l56 speakers
In reply to Sasha LevinFrom: Stefan Binding <[email protected]>
[ Upstream commit d5463e531c128ff1b141fdba2e13345cd50028a4 ]
The volume control for cs35l56 speakers has a maximum gain of +12 dB. However, for many use cases, this can cause distorted audio, depending various factors, such as other signal-processing elements in the chain, for example if the audio passes through a gain control before reaching the amp or the signal path has been tuned for a particular maximum gain in the amp.
In the case of systems which use the soc_sdw_* driver, audio will likely be distorted in all cases above 0 dB, therefore add a volume limit of 400, which is 0 dB maximum volume inside this driver.
The volume limit should be applied to both soundwire and soundwire bridge configurations.
--- include/sound/soc_sdw_utils.h | 1 + sound/soc/sdw_utils/soc_sdw_bridge_cs35l56.c | 4 ++++ sound/soc/sdw_utils/soc_sdw_cs_amp.c | 24 ++++++++++++++++++++ 3 files changed, 29 insertions(+)
include/sound/soc_sdw_utils.h +1 -0
@@ -226,6 +226,7 @@ int asoc_sdw_cs_amp_init(struct snd_soc_card *card, bool playback);int asoc_sdw_cs_spk_feedback_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai); +int asoc_sdw_cs35l56_volume_limit (struct snd_soc_card *card,const char *name_prefix);/* MAXIM codec support */ int asoc_sdw_maxim_init(struct snd_soc_card *card,
sound/soc/sdw_utils/soc_sdw_bridge_cs35l56.c +4 -0
@@ -60,6 +60,10 @@ static int asoc_sdw_bridge_cs35l56_asp_init(struct snd_soc_pcm_runtime *rtd)/* 4 x 16-bit sample slots and FSYNC=48000, BCLK=3.072 MHz */ for_each_rtd_codec_dais (rtd, i, codec_dai) { + ret =asoc_sdw_cs35l56_volume_limit (card, codec_dai->component->name_prefix); +if (ret) +return ret; + ret =snd_soc_dai_set_tdm_slot (codec_dai, tx_mask, rx_mask,4 ,16 );if (ret <0 )return ret;
sound/soc/sdw_utils/soc_sdw_cs_amp.c +24 -0
@@ -16,6 +16,25 @@#define CODEC_NAME_SIZE 8#define CS_AMP_CHANNELS_PER_AMP 4 +#define CS35L56_SPK_VOLUME_0DB 400/* 0dB Max */ + +int asoc_sdw_cs35l56_volume_limit (struct snd_soc_card *card,const char *name_prefix) +{ +char *volume_ctl_name; +int ret; + + volume_ctl_name =kasprintf (GFP_KERNEL ,"%s Speaker Volume" , name_prefix); +if (!volume_ctl_name) +return -ENOMEM ; + + ret =snd_soc_limit_volume (card, volume_ctl_name,CS35L56_SPK_VOLUME_0DB ); +if (ret) +dev_err (card->dev,"%s limit set failed: %d\n" , volume_ctl_name, ret); + +kfree (volume_ctl_name); +return ret; +} +EXPORT_SYMBOL_NS (asoc_sdw_cs35l56_volume_limit,"SND_SOC_SDW_UTILS" );int asoc_sdw_cs_spk_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai) {
@@ -40,6 +59,11 @@ int asoc_sdw_cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_daisnprintf (widget_name,sizeof (widget_name),"%s SPK" , codec_dai->component->name_prefix); + + ret =asoc_sdw_cs35l56_volume_limit (card, codec_dai->component->name_prefix); +if (ret) +return ret; + ret =snd_soc_dapm_add_routes (&card->dapm, &route,1 );if (ret)return ret;
Signature · 1 line
2.39.5