6.12.2-rc1 review
Subsystems (8)
Greg Kroah-Hartman
maintainerPATCH 616/826 drm/xe/ufence: Wake up waiters after setting ufence->signalled
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nirmoy Das <[email protected]>
[ Upstream commit 37a1cf288e4538eb39b38dbc745fe0da7ae53d94 ]
If a previous ufence is not signalled, vm_bind will return -EBUSY. Delaying the modification of ufence->signalled can cause issues if the UMD reuses the same ufence so update ufence->signalled before waking up waiters.
--- drivers/gpu/drm/xe/xe_sync.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_sync.c +5 -1
@@ -85,8 +85,12 @@ static void user_fence_worker(struct work_struct *w)mmput (ufence->mm); } -wake_up_all (&ufence->xe->ufence_wq); +/* +* Wake up waiters only after updating the ufence state, allowing the UMD +* to safely reuse the same ufence without encountering -EBUSY errors. +*/ WRITE_ONCE (ufence->signalled,1 ); +wake_up_all (&ufence->xe->ufence_wq);user_fence_put (ufence); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 617/826 apparmor: fix Do simple duplicate message elimination
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: chao liu <[email protected]>
[ Upstream commit 9b897132424fe76bf6c61f22f9cf12af7f1d1e6a ]
Multiple profiles shared 'ent->caps', so some logs missed.
--- security/apparmor/capability.c | 2 ++ 1 file changed, 2 insertions(+)
security/apparmor/capability.c +2 -0
@@ -96,6 +96,8 @@ static int audit_caps(struct apparmor_audit_data *ad, struct aa_profile *profilereturn error; }else {aa_put_profile (ent->profile); +if (profile != ent->profile) +cap_clear (ent->caps); ent->profile =aa_get_profile (profile);cap_raise (ent->caps, cap); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 618/826 ALSA: core: Fix possible NULL dereference caused by kunit_kzalloc()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zichen Xie <[email protected]>
[ Upstream commit 9ad467a2b2716d4ed12f003b041aa6c776a13ff5 ]
kunit_kzalloc() may return a NULL pointer, dereferencing it without NULL check may lead to NULL dereference.
Add NULL checks for all the kunit_kzalloc() in sound_kunit.c
--- sound/core/sound_kunit.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/core/sound_kunit.c +11 -0
@@ -172,6 +172,7 @@ static void test_format_fill_silence(struct kunit *test)u32 i, j; buffer =kunit_kzalloc (test,SILENCE_BUFFER_SIZE ,GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, buffer);for (i =0 ; i <ARRAY_SIZE (buf_samples); i++) {for (j =0 ; j <ARRAY_SIZE (valid_fmt); j++)
@@ -208,8 +209,12 @@ static void test_playback_avail(struct kunit *test)struct snd_pcm_runtime *r =kunit_kzalloc (test,sizeof (*r),GFP_KERNEL );u32 i; +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, r); + r->status =kunit_kzalloc (test,sizeof (*r->status),GFP_KERNEL ); r->control =kunit_kzalloc (test,sizeof (*r->control),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, r->status); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, r->control);for (i =0 ; i <ARRAY_SIZE (p_avail_data); i++) { r->buffer_size = p_avail_data[i].buffer_size;
@@ -232,8 +237,12 @@ static void test_capture_avail(struct kunit *test)struct snd_pcm_runtime *r =kunit_kzalloc (test,sizeof (*r),GFP_KERNEL );u32 i; +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, r); + r->status =kunit_kzalloc (test,sizeof (*r->status),GFP_KERNEL ); r->control =kunit_kzalloc (test,sizeof (*r->control),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, r->status); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, r->control);for (i =0 ; i <ARRAY_SIZE (c_avail_data); i++) { r->buffer_size = c_avail_data[i].buffer_size;
@@ -247,6 +256,7 @@ static void test_capture_avail(struct kunit *test)static void test_card_set_id (struct kunit *test) {struct snd_card *card =kunit_kzalloc (test,sizeof (*card),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, card);snd_card_set_id (card,VALID_NAME );KUNIT_EXPECT_STREQ (test, card->id,VALID_NAME );
@@ -280,6 +290,7 @@ static void test_pcm_format_name(struct kunit *test)static void test_card_add_component (struct kunit *test) {struct snd_card *card =kunit_kzalloc (test,sizeof (*card),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, card);snd_component_add (card,TEST_FIRST_COMPONENT );KUNIT_ASSERT_STREQ (test, card->components,TEST_FIRST_COMPONENT );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 619/826 ASoC: amd: yc: Fix for enabling DMIC on acp6x via _DSD entry
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Venkata Prasad Potturu <[email protected]>
[ Upstream commit 4095cf872084ecfdfdb0e681f3e9ff9745acfa75 ]
Add condition check to register ACP PDM sound card by reading _WOV acpi entry.
--- sound/soc/amd/yc/acp6x-mach.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
sound/soc/amd/yc/acp6x-mach.c +17 -1
@@ -537,8 +537,14 @@ static int acp6x_probe(struct platform_device *pdev)struct acp6x_pdm *machine =NULL ;struct snd_soc_card *card;struct acpi_device *adev; +acpi_handle handle; +acpi_integer dmic_status;int ret; +bool is_dmic_enable, wov_en; +/* IF WOV entry not found, enable dmic based on AcpDmicConnected entry*/ + is_dmic_enable = false; + wov_en = true;/* check the parent device's firmware node has _DSD or not */ adev =ACPI_COMPANION (pdev->dev.parent);if (adev) {
@@ -546,9 +552,19 @@ static int acp6x_probe(struct platform_device *pdev)if (!acpi_dev_get_property (adev,"AcpDmicConnected" ,ACPI_TYPE_INTEGER , &obj) && obj->integer.value ==1 ) -platform_set_drvdata (pdev, &acp6x_card); + is_dmic_enable = true; } + handle =ACPI_HANDLE (pdev->dev.parent); + ret =acpi_evaluate_integer (handle,"_WOV" ,NULL , &dmic_status); +if (!ACPI_FAILURE (ret)) + wov_en = dmic_status; + +if (is_dmic_enable && wov_en) +platform_set_drvdata (pdev, &acp6x_card); +else +return 0 ; +/* check for any DMI overrides */ dmi_id =dmi_first_match (yc_acp_quirk_table);if (dmi_id)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 620/826 ASoC: mediatek: Check num_codecs is not zero to avoid panic during probe
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 2f2020327cc8561d7c520d2f2d9acea84fa7b3a3 ]
Following commit 13f58267cda3 ("ASoC: soc.h: don't create dummy Component via COMP_DUMMY()"), COMP_DUMMY() became an array with zero length, and only gets populated with the dummy struct after the card is registered. Since the sound card driver's probe happens before the card registration, accessing any of the members of a dummy component during probe will result in undefined behavior.
This can be observed in the mt8188 and mt8195 machine sound drivers. By omitting a dai link subnode in the sound card's node in the Devicetree, the default uninitialized dummy codec is used, and when its dai_name pointer gets passed to strcmp() it results in a null pointer dereference and a kernel panic.
In addition to that, set_card_codec_info() in the generic helpers file, mtk-soundcard-driver.c, will populate a dai link with a dummy codec when a dai link node is present in DT but with no codec property.
The result is that at probe time, a dummy codec can either be uninitialized with num_codecs = 0, or be an initialized dummy codec, with num_codecs = 1 and dai_name = "snd-soc-dummy-dai". In order to accommodate for both situations, check that num_codecs is not zero before accessing the codecs' fields but still check for the codec's dai name against "snd-soc-dummy-dai" as needed.
While at it, also drop the check that dai_name is not null in the mt8192 driver, introduced in commit 4d4e1b6319e5 ("ASoC: mediatek: mt8192:
Check existence of dai_name before dereferencing"), as it is actually redundant given the preceding num_codecs != 0 check.
--- sound/soc/mediatek/mt8188/mt8188-mt6359.c | 9 +++++++-- sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c | 4 ++-- sound/soc/mediatek/mt8195/mt8195-mt6359.c | 9 +++++++-- 3 files changed, 16 insertions(+), 6 deletions(-)
sound/soc/mediatek/mt8188/mt8188-mt6359.c +7 -2
@@ -1279,10 +1279,12 @@ static int mt8188_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data,for_each_card_prelinks (card, i, dai_link) {if (strcmp (dai_link->name,"DPTX_BE" ) ==0 ) { -if (strcmp (dai_link->codecs->dai_name,"snd-soc-dummy-dai" )) +if (dai_link->num_codecs && +strcmp (dai_link->codecs->dai_name,"snd-soc-dummy-dai" )) dai_link->init = mt8188_dptx_codec_init; }else if (strcmp (dai_link->name,"ETDM3_OUT_BE" ) ==0 ) { -if (strcmp (dai_link->codecs->dai_name,"snd-soc-dummy-dai" )) +if (dai_link->num_codecs && +strcmp (dai_link->codecs->dai_name,"snd-soc-dummy-dai" )) dai_link->init = mt8188_hdmi_codec_init; }else if (strcmp (dai_link->name,"DL_SRC_BE" ) ==0 ||strcmp (dai_link->name,"UL_SRC_BE" ) ==0 ) {
@@ -1294,6 +1296,9 @@ static int mt8188_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data, strcmp(dai_link->name, "ETDM2_OUT_BE") == 0 || strcmp(dai_link->name, "ETDM1_IN_BE") == 0 || strcmp(dai_link->name, "ETDM2_IN_BE") == 0) { +if (!dai_link->num_codecs) +continue ; +if (!strcmp (dai_link->codecs->dai_name,MAX98390_CODEC_DAI )) {/* * The TDM protocol settings with fixed 4 slots are defined in
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +2 -2
@@ -1099,7 +1099,7 @@ static int mt8192_mt6359_legacy_probe(struct mtk_soc_card_data *soc_card_data) dai_link->ignore =0 ; } -if (dai_link->num_codecs && dai_link->codecs[0 ].dai_name && +if (dai_link->num_codecs &&strcmp (dai_link->codecs[0 ].dai_name,RT1015_CODEC_DAI ) ==0 ) dai_link->ops = &mt8192_rt1015_i2s_ops; }
@@ -1127,7 +1127,7 @@ static int mt8192_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data,int i;for_each_card_prelinks (card, i, dai_link) -if (dai_link->num_codecs && dai_link->codecs[0 ].dai_name && +if (dai_link->num_codecs &&strcmp (dai_link->codecs[0 ].dai_name,RT1015_CODEC_DAI ) ==0 ) dai_link->ops = &mt8192_rt1015_i2s_ops; }
sound/soc/mediatek/mt8195/mt8195-mt6359.c +7 -2
@@ -1380,10 +1380,12 @@ static int mt8195_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data,for_each_card_prelinks (card, i, dai_link) {if (strcmp (dai_link->name,"DPTX_BE" ) ==0 ) { -if (strcmp (dai_link->codecs->dai_name,"snd-soc-dummy-dai" )) +if (dai_link->num_codecs && +strcmp (dai_link->codecs->dai_name,"snd-soc-dummy-dai" )) dai_link->init = mt8195_dptx_codec_init; }else if (strcmp (dai_link->name,"ETDM3_OUT_BE" ) ==0 ) { -if (strcmp (dai_link->codecs->dai_name,"snd-soc-dummy-dai" )) +if (dai_link->num_codecs && +strcmp (dai_link->codecs->dai_name,"snd-soc-dummy-dai" )) dai_link->init = mt8195_hdmi_codec_init; } else if (strcmp(dai_link->name, "DL_SRC_BE") == 0 || strcmp(dai_link->name, "UL_SRC1_BE") == 0 ||
@@ -1396,6 +1398,9 @@ static int mt8195_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data, strcmp(dai_link->name, "ETDM2_OUT_BE") == 0 || strcmp(dai_link->name, "ETDM1_IN_BE") == 0 || strcmp(dai_link->name, "ETDM2_IN_BE") == 0) { +if (!dai_link->num_codecs) +continue ; +if (!strcmp (dai_link->codecs->dai_name,MAX98390_CODEC_DAI )) {if (!(codec_init &MAX98390_CODEC_INIT )) { dai_link->init = mt8195_max98390_init;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 621/826 s390/pci: Fix potential double remove of hotplug slot
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Schnelle <[email protected]>
[ Upstream commit c4a585e952ca403a370586d3f16e8331a7564901 ]
In commit 6ee600bfbe0f ("s390/pci: remove hotplug slot when releasing the device") the zpci_exit_slot() was moved from zpci_device_reserved() to zpci_release_device() with the intention of keeping the hotplug slot around until the device is actually removed.
Now zpci_release_device() is only called once all references are dropped. Since the zPCI subsystem only drops its reference once the device is in the reserved state it follows that zpci_release_device() must only deal with devices in the reserved state. Despite that it contains code to tear down from both configured and standby state. For the standby case this already includes the removal of the hotplug slot so would cause a double removal if a device was ever removed in either configured or standby state.
Instead of causing a potential double removal in a case that should never happen explicitly WARN_ON() if a device in non-reserved state is released and get rid of the dead code cases.
--- arch/s390/pci/pci.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-)
arch/s390/pci/pci.c +9 -25
@@ -917,10 +917,8 @@ void zpci_device_reserved(struct zpci_dev *zdev)void zpci_release_device (struct kref *kref) { struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref); -int ret; -if (zdev->has_hp_slot) -zpci_exit_slot (zdev); +WARN_ON (zdev->state !=ZPCI_FN_STATE_RESERVED );if (zdev->zbus->bus)zpci_bus_remove_device (zdev, false);
@@ -928,28 +926,14 @@ void zpci_release_device(struct kref *kref)if (zdev_enabled (zdev))zpci_disable_device (zdev); -switch (zdev->state) { -case ZPCI_FN_STATE_CONFIGURED : - ret =sclp_pci_deconfigure (zdev->fid); -zpci_dbg (3 ,"deconf fid:%x, rc:%d\n" , zdev->fid, ret); - fallthrough; -case ZPCI_FN_STATE_STANDBY : -if (zdev->has_hp_slot) -zpci_exit_slot (zdev); -spin_lock (&zpci_list_lock); -list_del (&zdev->entry); -spin_unlock (&zpci_list_lock); -zpci_dbg (3 ,"rsv fid:%x\n" , zdev->fid); - fallthrough; -case ZPCI_FN_STATE_RESERVED : -if (zdev->has_resources) -zpci_cleanup_bus_resources (zdev); -zpci_bus_device_unregister (zdev); -zpci_destroy_iommu (zdev); - fallthrough; -default : -break ; - } +if (zdev->has_hp_slot) +zpci_exit_slot (zdev); + +if (zdev->has_resources) +zpci_cleanup_bus_resources (zdev); + +zpci_bus_device_unregister (zdev); +zpci_destroy_iommu (zdev);zpci_dbg (3 ,"rem fid:%x\n" , zdev->fid);kfree_rcu (zdev, rcu); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 622/826 f2fs: fix fiemap failure issue when page size is 16KB
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiuhong Wang <[email protected]>
commit a7a7c1d423a6351a6541e95c797da5358e5ad1ea upstream.
After enable 16K page size, an infinite loop may occur in fiemap (fm_length=UINT64_MAX) on a file, such as the 16KB scratch.img during the remount operation in Android.
The condition for whether fiemap continues to map is to check whether the number of bytes corresponding to the next map.m_lblk exceeds blks_to_bytes(inode,max_inode_blocks(inode)) if there are HOLE. The latter does not take into account the maximum size of a file with 16KB page size, so the loop cannot be jumped out.
The following is the fail trace:
When f2fs_map_blocks reaches map.m_lblk=3936, it needs to go to the first direct node block, so the map is 3936 + 4090 = 8026, The next map is the second direct node block, that is, 8026 + 4090 = 12116,
The next map is the first indirect node block, that is, 12116 + 4090 * 4090 = 16740216,
The next map is the second indirect node block, that is, 16740216 + 4090 * 4090 = 33468316,
The next map is the first double indirect node block, that is, 33468316 + 4090 * 4090 * 4090 = 68451397316
Since map.m_lblk represents the address of a block, which is 32 bits, truncation will occur, that is, 68451397316 becomes 4026887876, and the number of bytes corresponding to the block number does not exceed blks_to_bytes(inode,max_inode_blocks(inode)), so the loop will not be jumped out.
The next time, it will be considered that it should still be a double indirect node block, that is,
4026887876 + 4090 * 4090 * 4090 = 72444816876, which will be truncated to 3725340140, and the loop will not be jumped out.
156.374871: f2fs_map_blocks: dev = (254,57), ino = 7449, file offset = 0, start blkaddr = 0x8e00, len = 0x200, flags = 2,seg_type = 8, may_create = 0, multidevice = 0, flag = 1, err = 0 156.374916: f2fs_map_blocks: dev = (254,57), ino = 7449, file offset = 512, start blkaddr = 0x0, len = 0x0, flags = 0 , seg_type = 8, may_create = 0, multidevice = 0, flag = 1, err = 0 156.374920: f2fs_map_blocks: dev = (254,57), ino = 7449, file offset = 513, start blkaddr = 0x0, len = 0x0, flags = 0, seg_type = 8, may_create = 0, multidevice = 0, flag = 1, err = 0
......
156.385747: f2fs_map_blocks: dev = (254,57), ino = 7449, file offset = 3935, start blkaddr = 0x0, len = 0x0, flags = 0, seg_type = 8, may_create = 0, multidevice = 0, flag = 1, err = 0 156.385752: f2fs_map_blocks: dev = (254,57), ino = 7449, file offset = 3936, start blkaddr = 0x0, len = 0x0, flags = 0, seg_type = 8, may_create = 0, multidevice = 0, flag = 1, err = 0 156.385755: f2fs_map_blocks: dev = (254,57), ino = 7449, file offset = 8026, start blkaddr = 0x0, len = 0x0, flags = 0, seg_type = 8, may_create = 0, multidevice = 0, flag = 1, err = 0 156.385758: f2fs_map_blocks: dev = (254,57), ino = 7449, file offset = 12116, start blkaddr = 0x0, len = 0x0, flags = 0, seg_type = 8, may_create = 0, multidevice = 0, flag = 1, err = 0 156.385761: f2fs_map_blocks: dev = (254,57), ino = 7449, file offset = 16740216, start blkaddr = 0x0, len = 0x0, flags = 0, seg_type = 8, may_create = 0, multidevice = 0, flag = 1, err = 0 156.385764: f2fs_map_blocks: dev = (254,57), ino = 7449, file offset = 33468316, start blkaddr = 0x0, len = 0x0, flags = 0, seg_type = 8, may_create = 0, multidevice = 0, flag = 1, err = 0 156.385767: f2fs_map_blocks: dev = (254,57), ino = 7449, file offset = 4026887876, start blkaddr = 0x0, len = 0x0, flags = 0, seg_type = 8, may_create = 0, multidevice = 0, flag = 1, err = 0 156.385770: f2fs_map_blocks: dev = (254,57), ino = 7449, file offset = 3725340140, start blkaddr = 0x0, len = 0x0, flags = 0, seg_type = 8, may_create = 0, multidevice = 0, flag = 1, err = 0 156.385772: f2fs_map_blocks: dev = (254,57), ino = 7449, file offset = 4026887876, start blkaddr = 0x0, len = 0x0, flags = 0, seg_type = 8, may_create = 0, multidevice = 0, flag = 1, err = 0 156.385775: f2fs_map_blocks: dev = (254,57), ino = 7449, file offset = 3725340140, start blkaddr = 0x0, len = 0x0, flags = 0, seg_type = 8, may_create = 0, multidevice = 0, flag = 1, err = 0
Commit a6a010f5def5 ("f2fs: Restrict max filesize for 16K f2fs") has set the maximum allowed file size to (U32_MAX + 1) * F2FS_BLKSIZE, so max_file_blocks should be used here to limit it, that is, maxbytes defined above. And the max_inode_blocks function is not called by other functions except here, so cleanup it.
--- fs/f2fs/data.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-)
fs/f2fs/data.c +1 -21
@@ -1902,25 +1902,6 @@ static int f2fs_xattr_fiemap(struct inodreturn (err <0 ? err :0 ); } -static loff_t max_inode_blocks (struct inode *inode) -{ -loff_t result =ADDRS_PER_INODE (inode); -loff_t leaf_count =ADDRS_PER_BLOCK (inode); - -/* two direct node blocks */ - result += (leaf_count *2 ); - -/* two indirect node blocks */ - leaf_count *=NIDS_PER_BLOCK ; - result += (leaf_count *2 ); - -/* one double indirect node block */ - leaf_count *=NIDS_PER_BLOCK ; - result += leaf_count; - -return result; -} -int f2fs_fiemap (struct inode *inode,struct fiemap_extent_info *fieinfo,u64 start,u64 len) {
@@ -1993,8 +1974,7 @@ next:if (!compr_cluster && !(map.m_flags &F2FS_MAP_FLAGS )) { start_blk = next_pgofs; -if (blks_to_bytes (inode, start_blk) <blks_to_bytes (inode, -max_inode_blocks (inode))) +if (blks_to_bytes (inode, start_blk) < maxbytes) goto prep_next; flags |=FIEMAP_EXTENT_LAST ;
Greg Kroah-Hartman
maintainerPATCH 623/826 net_sched: sch_fq: dont follow the fast path if Tx is behind now
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
commit 122aba8c80618eca904490b1733af27fb8f07528 upstream.
Recent kernels cause a lot of TCP retransmissions
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 2.24 GBytes 19.2 Gbits/sec 2767 442 KBytes
[ 5] 1.00-2.00 sec 2.23 GBytes 19.1 Gbits/sec 2312 350 KBytes
^^^^Replacing the qdisc with pfifo makes retransmissions go away.
It appears that a flow may have a delayed packet with a very near Tx time. Later, we may get busy processing Rx and the target Tx time will pass, but we won't service Tx since the CPU is busy with Rx. If Rx sees an ACK and we try to push more data for the delayed flow we may fastpath the skb, not realizing that there are already "ready to send" packets for this flow sitting in the qdisc.
Don't trust the fastpath if we are "behind" according to the projected Tx time for next flow waiting in the Qdisc. Because we consider anything within the offload window to be okay for fastpath we must consider the entire offload window as "now".
Qdisc config:
qdisc fq 8001: dev eth0 parent 1234:1 limit 10000p flow_limit 100p \
buckets 32768 orphan_mask 1023 bands 3 \
priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 \
weights 589824 196608 65536 quantum 3028b initial_quantum 15140b \
low_rate_threshold 550Kbit \
refill_delay 40ms timer_slack 10us horizon 10s horizon_drop
For iperf this change seems to do fine, the reordering is gone. The fastpath still gets used most of the time:
gc 0 highprio 0 fastpath 142614 throttled 418309 latency 19.1us
xx_behind 2731
where "xx_behind" counts how many times we hit the new "return false".
--- net/sched/sch_fq.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/sched/sch_fq.c +6 -0
@@ -331,6 +331,12 @@ static bool fq_fastpath_check(const stru*/ if (q->internal.qlen >=8 )return false; + +/* Ordering invariants fall apart if some delayed flows +* are ready but we haven't serviced them, yet. +*/ +if (q->time_next_delayed_flow <= now) +return false; } sk = skb->sk;
Greg Kroah-Hartman
maintainerPATCH 624/826 xen: Fix the issue of resource not being properly released in xenbus_dev_probe()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiu-ji Chen <[email protected]>
commit afc545da381ba0c651b2658966ac737032676f01 upstream.
This patch fixes an issue in the function xenbus_dev_probe(). In the xenbus_dev_probe() function, within the if (err) branch at line 313, the program incorrectly returns err directly without releasing the resources allocated by err = drv->probe(dev, id). As the return value is non-zero, the upper layers assume the processing logic has failed. However, the probe operation was performed earlier without a corresponding remove operation. Since the probe actually allocates resources, failing to perform the remove operation could lead to problems.
To fix this issue, we followed the resource release logic of the xenbus_dev_remove() function by adding a new block fail_remove before the fail_put block. After entering the branch if (err) at line 313, the function will use a goto statement to jump to the fail_remove block, ensuring that the previously acquired resources are correctly released, thus preventing the reference count leak.
This bug was identified by an experimental static analysis tool developed by our team. The tool specializes in analyzing reference count operations and detecting potential issues where resources are not properly managed. In this case, the tool flagged the missing release operation as a potential problem, which led to the development of this patch.
Message-ID: <[email protected]>
--- drivers/xen/xenbus/xenbus_probe.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/xen/xenbus/xenbus_probe.c +7 -1
@@ -313,7 +313,7 @@ int xenbus_dev_probe(struct device *_devif (err) {dev_warn (&dev->dev,"watch_otherend on %s failed.\n" , dev->nodename); -return err; + goto fail_remove; } dev->spurious_threshold =1 ;
@@ -322,6 +322,12 @@ int xenbus_dev_probe(struct device *_dev dev->nodename);return 0 ; +fail_remove: +if (drv->remove) { +down (&dev->reclaim_sem); + drv->remove (dev); +up (&dev->reclaim_sem); + } fail_put:module_put (drv->driver.owner); fail:
Greg Kroah-Hartman
maintainerPATCH 625/826 ALSA: usb-audio: Fix potential out-of-bound accesses for Extigy and Mbox devices
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benoît Sevens <[email protected]>
commit b909df18ce2a998afef81d58bbd1a05dc0788c40 upstream.
A bogus device can provide a bNumConfigurations value that exceeds the initial value used in usb_get_configuration for allocating dev->config.
This can lead to out-of-bounds accesses later, e.g. in usb_destroy_configuration.
--- sound/usb/quirks.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
sound/usb/quirks.c +21 -6
@@ -555,6 +555,7 @@ int snd_usb_create_quirk(struct snd_usb_static int snd_usb_extigy_boot_quirk (struct usb_device *dev,struct usb_interface *intf) {struct usb_host_config *config = dev->actconfig; +struct usb_device_descriptor new_device_descriptor;int err; if (le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_OLD ||
@@ -566,10 +567,14 @@ static int snd_usb_extigy_boot_quirk(strif (err <0 )dev_dbg (&dev->dev,"error sending boot message: %d\n" , err); err =usb_get_descriptor (dev,USB_DT_DEVICE ,0 , - &dev->descriptor,sizeof (dev->descriptor)); - config = dev->actconfig; + &new_device_descriptor,sizeof (new_device_descriptor));if (err <0 )dev_dbg (&dev->dev,"error usb_get_descriptor: %d\n" , err); +if (new_device_descriptor.bNumConfigurations > dev->descriptor.bNumConfigurations) +dev_dbg (&dev->dev,"error too large bNumConfigurations: %d\n" , + new_device_descriptor.bNumConfigurations); +else +memcpy (&dev->descriptor, &new_device_descriptor,sizeof (dev->descriptor)); err =usb_reset_configuration (dev);if (err <0 )dev_dbg (&dev->dev,"error usb_reset_configuration: %d\n" , err);
@@ -901,6 +906,7 @@ static void mbox2_setup_48_24_magic(strustatic int snd_usb_mbox2_boot_quirk (struct usb_device *dev) {struct usb_host_config *config = dev->actconfig; +struct usb_device_descriptor new_device_descriptor;int err;u8 bootresponse[0x12 ];int fwsize;
@@ -936,10 +942,14 @@ static int snd_usb_mbox2_boot_quirk(strudev_dbg (&dev->dev,"device initialised!\n" ); err =usb_get_descriptor (dev,USB_DT_DEVICE ,0 , - &dev->descriptor,sizeof (dev->descriptor)); - config = dev->actconfig; + &new_device_descriptor,sizeof (new_device_descriptor));if (err <0 )dev_dbg (&dev->dev,"error usb_get_descriptor: %d\n" , err); +if (new_device_descriptor.bNumConfigurations > dev->descriptor.bNumConfigurations) +dev_dbg (&dev->dev,"error too large bNumConfigurations: %d\n" , + new_device_descriptor.bNumConfigurations); +else +memcpy (&dev->descriptor, &new_device_descriptor,sizeof (dev->descriptor)); err =usb_reset_configuration (dev);if (err <0 )
@@ -1249,6 +1259,7 @@ static void mbox3_setup_defaults(structstatic int snd_usb_mbox3_boot_quirk (struct usb_device *dev) {struct usb_host_config *config = dev->actconfig; +struct usb_device_descriptor new_device_descriptor;int err;int descriptor_size;
@@ -1262,10 +1273,14 @@ static int snd_usb_mbox3_boot_quirk(strudev_dbg (&dev->dev,"MBOX3: device initialised!\n" ); err =usb_get_descriptor (dev,USB_DT_DEVICE ,0 , - &dev->descriptor,sizeof (dev->descriptor)); - config = dev->actconfig; + &new_device_descriptor,sizeof (new_device_descriptor));if (err <0 )dev_dbg (&dev->dev,"MBOX3: error usb_get_descriptor: %d\n" , err); +if (new_device_descriptor.bNumConfigurations > dev->descriptor.bNumConfigurations) +dev_dbg (&dev->dev,"MBOX3: error too large bNumConfigurations: %d\n" , + new_device_descriptor.bNumConfigurations); +else +memcpy (&dev->descriptor, &new_device_descriptor,sizeof (dev->descriptor)); err =usb_reset_configuration (dev);if (err <0 )
Greg Kroah-Hartman
maintainerPATCH 626/826 ALSA: usb-audio: Fix out of bounds reads when finding clock sources
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit a3dd4d63eeb452cfb064a13862fb376ab108f6a6 upstream.
The current USB-audio driver code doesn't check bLength of each descriptor at traversing for clock descriptors. That is, when a device provides a bogus descriptor with a shorter bLength, the driver might hit out-of-bounds reads.
For addressing it, this patch adds sanity checks to the validator functions for the clock descriptor traversal. When the descriptor length is shorter than expected, it's skipped in the loop.
For the clock source and clock multiplier descriptors, we can just check bLength against the sizeof() of each descriptor type. OTOH, the clock selector descriptor of UAC2 and UAC3 has an array of bNrInPins elements and two more fields at its tail, hence those have to be checked in addition to the sizeof() check.
--- sound/usb/clock.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
sound/usb/clock.c +23 -1
@@ -36,6 +36,12 @@ union uac23_clock_multiplier_desc {struct uac_clock_multiplier_descriptor v3; }; +/* check whether the descriptor bLength has the minimal length */ +#define DESC_LENGTH_CHECK (p, proto) \ + ((proto) == UAC_VERSION_3 ? \ + ((p)->v3.bLength >= sizeof((p)->v3)) : \ + ((p)->v2.bLength >= sizeof((p)->v2))) +#define GET_VAL (p, proto, field) \ ((proto) == UAC_VERSION_3 ? (p)->v3.field : (p)->v2.field)
@@ -58,6 +64,8 @@ static bool validate_clock_source(void * {union uac23_clock_source_desc *cs = p; +if (!DESC_LENGTH_CHECK (cs, proto)) +return false;return GET_VAL (cs, proto, bClockID) == id; }
@@ -65,13 +73,27 @@ static bool validate_clock_selector(void {union uac23_clock_selector_desc *cs = p; -return GET_VAL (cs, proto, bClockID) == id; +if (!DESC_LENGTH_CHECK (cs, proto)) +return false; +if (GET_VAL (cs, proto, bClockID) != id) +return false; +/* additional length check for baCSourceID array (in bNrInPins size) +* and two more fields (which sizes depend on the protocol) +*/ +if (proto ==UAC_VERSION_3 ) +return cs->v3.bLength >=sizeof (cs->v3) + cs->v3.bNrInPins + +4 /* bmControls */ +2 /* wCSelectorDescrStr */ ; +else +return cs->v2.bLength >=sizeof (cs->v2) + cs->v2.bNrInPins + +1 /* bmControls */ +1 /* iClockSelector */ ; }static bool validate_clock_multiplier (void *p,int id,int proto) {union uac23_clock_multiplier_desc *cs = p; +if (!DESC_LENGTH_CHECK (cs, proto)) +return false;return GET_VAL (cs, proto, bClockID) == id; }
Greg Kroah-Hartman
maintainerPATCH 627/826 usb: ehci-spear: fix call balance of sehci clk handling routines
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitalii Mordan <[email protected]>
commit 40c974826734836402abfd44efbf04f63a2cc1c1 upstream.
If the clock sehci->clk was not enabled in spear_ehci_hcd_drv_probe, it should not be disabled in any path.
Conversely, if it was enabled in spear_ehci_hcd_drv_probe, it must be disabled in all error paths to ensure proper cleanup.
Found by Linux Verification Center (linuxtesting.org) with Klever.
--- drivers/usb/host/ehci-spear.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-spear.c +4 -3
@@ -105,7 +105,9 @@ static int spear_ehci_hcd_drv_probe(stru/* registers start at offset 0x0 */ hcd_to_ehci (hcd)->caps = hcd->regs; -clk_prepare_enable (sehci->clk); + retval =clk_prepare_enable (sehci->clk); +if (retval) + goto err_put_hcd; retval =usb_add_hcd (hcd, irq,IRQF_SHARED );if (retval) goto err_stop_ehci;
@@ -130,8 +132,7 @@ static void spear_ehci_hcd_drv_remove(stusb_remove_hcd (hcd); -if (sehci->clk) -clk_disable_unprepare (sehci->clk); +clk_disable_unprepare (sehci->clk);usb_put_hcd (hcd); }
Greg Kroah-Hartman
maintainerPATCH 628/826 usb: typec: ucsi: glink: fix off-by-one in connector_status
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
commit 4a22918810980897393fa1776ea3877e4baf8cca upstream.
UCSI connector's indices start from 1 up to 3, PMIC_GLINK_MAX_PORTS. Correct the condition in the pmic_glink_ucsi_connector_status() callback, fixing Type-C orientation reporting for the third USB-C connector.
--- drivers/usb/typec/ucsi/ucsi_glink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi_glink.c +1 -1
@@ -185,7 +185,7 @@ static void pmic_glink_ucsi_connector_ststruct pmic_glink_ucsi *ucsi =ucsi_get_drvdata (con->ucsi);int orientation; -if (con->num >=PMIC_GLINK_MAX_PORTS || +if (con->num >PMIC_GLINK_MAX_PORTS || !ucsi->port_orientation[con->num -1 ])return ;
Greg Kroah-Hartman
maintainerPATCH 629/826 xfs: fix simplify extent lookup in xfs_can_free_eofblocks
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
commit 62027820eb4486f075b89ec31c1548c6cb1bb13f upstream.
In commit 11f4c3a53adde, we tried to simplify the extent lookup in xfs_can_free_eofblocks so that it doesn't incur the overhead of all the extra stuff that xfs_bmapi_read does around the iext lookup.
Unfortunately, this causes regressions on generic/603, xfs/108, generic/219, xfs/173, generic/694, xfs/052, generic/230, and xfs/441 when always_cow is turned on. In all cases, the regressions take the form of alwayscow files consuming rather more space than the golden output is expecting. I observed that in all these cases, the cause of the excess space usage was due to CoW fork delalloc reservations that go beyond EOF.
For alwayscow files we allow posteof delalloc CoW reservations because all writes go through the CoW fork. Recall that all extents in the CoW fork are accounted for via i_delayed_blks, which means that prior to this patch, we'd invoke xfs_free_eofblocks on first close if anything was in the CoW fork. Now we don't do that.
Fix the problem by reverting the removal of the i_delayed_blks check.
--- fs/xfs/xfs_bmap_util.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/xfs/xfs_bmap_util.c +6 -2
@@ -546,10 +546,14 @@ xfs_can_free_eofblocks(return false;/* -* Check if there is an post-EOF extent to free. +* Check if there is an post-EOF extent to free. If there are any +* delalloc blocks attached to the inode (data fork delalloc +* reservations or CoW extents of any kind), we need to free them so +* that inactivation doesn't fail to erase them. */ xfs_ilock (ip,XFS_ILOCK_SHARED ); -if (xfs_iext_lookup_extent (ip, &ip->i_df, end_fsb, &icur, &imap)) +if (ip->i_delayed_blks || +xfs_iext_lookup_extent (ip, &ip->i_df, end_fsb, &icur, &imap)) found_blocks = true;xfs_iunlock (ip,XFS_ILOCK_SHARED );return found_blocks;
Signature · 1 line
2.47.1
Greg Kroah-Hartman
maintainerPATCH 630/826 ext4: supress data-race warnings in ext4_free_inodes_{count,set}()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeongjun Park <[email protected]>
commit 902cc179c931a033cd7f4242353aa2733bf8524c upstream.
find_group_other() and find_group_orlov() read *_lo, *_hi with ext4_free_inodes_count without additional locking. This can cause data-race warning, but since the lock is held for most writes and free inodes value is generally not a problem even if it is incorrect, it is more appropriate to use READ_ONCE()/WRITE_ONCE() than to add locking.
==================================================================
BUG: KCSAN: data-race in ext4_free_inodes_count / ext4_free_inodes_set
write to 0xffff88810404300e of 2 bytes by task 6254 on cpu 1:
ext4_free_inodes_set+0x1f/0x80 fs/ext4/super.c:405 __ext4_new_inode+0x15ca/0x2200 fs/ext4/ialloc.c:1216 ext4_symlink+0x242/0x5a0 fs/ext4/namei.c:3391 vfs_symlink+0xca/0x1d0 fs/namei.c:4615 do_symlinkat+0xe3/0x340 fs/namei.c:4641 __do_sys_symlinkat fs/namei.c:4657 [inline] __se_sys_symlinkat fs/namei.c:4654 [inline] __x64_sys_symlinkat+0x5e/0x70 fs/namei.c:4654 x64_sys_call+0x1dda/0x2d60 arch/x86/include/generated/asm/syscalls_64.h:267 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x54/0x120 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x76/0x7e
read to 0xffff88810404300e of 2 bytes by task 6257 on cpu 0:
ext4_free_inodes_count+0x1c/0x80 fs/ext4/super.c:349 find_group_other fs/ext4/ialloc.c:594 [inline] __ext4_new_inode+0x6ec/0x2200 fs/ext4/ialloc.c:1017 ext4_symlink+0x242/0x5a0 fs/ext4/namei.c:3391 vfs_symlink+0xca/0x1d0 fs/namei.c:4615 do_symlinkat+0xe3/0x340 fs/namei.c:4641 __do_sys_symlinkat fs/namei.c:4657 [inline] __se_sys_symlinkat fs/namei.c:4654 [inline] __x64_sys_symlinkat+0x5e/0x70 fs/namei.c:4654 x64_sys_call+0x1dda/0x2d60 arch/x86/include/generated/asm/syscalls_64.h:267 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x54/0x120 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- fs/ext4/super.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/ext4/super.c +4 -4
@@ -353,9 +353,9 @@ __u32 ext4_free_group_clusters(struct su__u32 ext4_free_inodes_count (struct super_block *sb,struct ext4_group_desc *bg) { -return le16_to_cpu (bg->bg_free_inodes_count_lo) | +return le16_to_cpu (READ_ONCE (bg->bg_free_inodes_count_lo)) | (EXT4_DESC_SIZE (sb) >=EXT4_MIN_DESC_SIZE_64BIT ? - (__u32 )le16_to_cpu (bg->bg_free_inodes_count_hi) <<16 :0 ); + (__u32 )le16_to_cpu (READ_ONCE (bg->bg_free_inodes_count_hi)) <<16 :0 ); } __u32 ext4_used_dirs_count(struct super_block *sb,
@@ -409,9 +409,9 @@ void ext4_free_group_clusters_set(structvoid ext4_free_inodes_set (struct super_block *sb,struct ext4_group_desc *bg,__u32 count) { - bg->bg_free_inodes_count_lo =cpu_to_le16 ((__u16 )count); +WRITE_ONCE (bg->bg_free_inodes_count_lo,cpu_to_le16 ((__u16 )count));if (EXT4_DESC_SIZE (sb) >=EXT4_MIN_DESC_SIZE_64BIT ) - bg->bg_free_inodes_count_hi =cpu_to_le16 (count >>16 ); +WRITE_ONCE (bg->bg_free_inodes_count_hi,cpu_to_le16 (count >>16 )); } void ext4_used_dirs_set(struct super_block *sb,
Greg Kroah-Hartman
maintainerPATCH 631/826 ext4: fix FS_IOC_GETFSMAP handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 4a622e4d477bb12ad5ed4abbc7ad1365de1fa347 upstream.
The original implementation ext4's FS_IOC_GETFSMAP handling only worked when the range of queried blocks included at least one free (unallocated) block range. This is because how the metadata blocks were emitted was as a side effect of ext4_mballoc_query_range() calling ext4_getfsmap_datadev_helper(), and that function was only called when a free block range was identified. As a result, this caused generic/365 to fail.
Fix this by creating a new function ext4_getfsmap_meta_helper() which gets called so that blocks before the first free block range in a block group can get properly reported.
--- fs/ext4/fsmap.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- fs/ext4/mballoc.c | 18 ++++++++++++++---- fs/ext4/mballoc.h | 1 + 3 files changed, 68 insertions(+), 5 deletions(-)
fs/ext4/fsmap.c +53 -1
@@ -185,6 +185,56 @@ static inline ext4_fsblk_t ext4_fsmap_nereturn fmr->fmr_physical + fmr->fmr_length; } +static int ext4_getfsmap_meta_helper (struct super_block *sb, +ext4_group_t agno,ext4_grpblk_t start, +ext4_grpblk_t len,void *priv) +{ +struct ext4_getfsmap_info *info = priv; +struct ext4_fsmap *p; +struct ext4_fsmap *tmp; +struct ext4_sb_info *sbi =EXT4_SB (sb); +ext4_fsblk_t fsb, fs_start, fs_end; +int error; + + fs_start = fsb = (EXT4_C2B (sbi, start) + +ext4_group_first_block_no (sb, agno)); + fs_end = fs_start +EXT4_C2B (sbi, len); + +/* Return relevant extents from the meta_list */ +list_for_each_entry_safe (p, tmp, &info->gfi_meta_list, fmr_list) { +if (p->fmr_physical < info->gfi_next_fsblk) { +list_del (&p->fmr_list); +kfree (p); +continue ; + } +if (p->fmr_physical <= fs_start || + p->fmr_physical + p->fmr_length <= fs_end) { +/* Emit the retained free extent record if present */ +if (info->gfi_lastfree.fmr_owner) { + error =ext4_getfsmap_helper (sb, info, + &info->gfi_lastfree); +if (error) +return error; + info->gfi_lastfree.fmr_owner =0 ; + } + error =ext4_getfsmap_helper (sb, info, p); +if (error) +return error; + fsb = p->fmr_physical + p->fmr_length; +if (info->gfi_next_fsblk < fsb) + info->gfi_next_fsblk = fsb; +list_del (&p->fmr_list); +kfree (p); +continue ; + } + } +if (info->gfi_next_fsblk < fsb) + info->gfi_next_fsblk = fsb; + +return 0 ; +} + +/* Transform a blockgroup's free record into a fsmap */ static int ext4_getfsmap_datadev_helper(struct super_block *sb, ext4_group_t agno, ext4_grpblk_t start,
@@ -539,6 +589,7 @@ static int ext4_getfsmap_datadev(struct error =ext4_mballoc_query_range (sb, info->gfi_agno,EXT4_B2C (sbi, info->gfi_low.fmr_physical),EXT4_B2C (sbi, info->gfi_high.fmr_physical), + ext4_getfsmap_meta_helper, ext4_getfsmap_datadev_helper, info);if (error) goto err;
@@ -560,7 +611,8 @@ static int ext4_getfsmap_datadev(struct/* Report any gaps at the end of the bg */ info->gfi_last = true; - error =ext4_getfsmap_datadev_helper (sb, end_ag, last_cluster,0 , info); + error =ext4_getfsmap_datadev_helper (sb, end_ag, last_cluster +1 , +0 , info);if (error) goto err;
fs/ext4/mballoc.c +14 -4
@@ -6999,13 +6999,14 @@ intext4_mballoc_query_range ( struct super_block *sb, ext4_group_t group, - ext4_grpblk_t start, + ext4_grpblk_t first, ext4_grpblk_t end, + ext4_mballoc_query_range_fn meta_formatter, ext4_mballoc_query_range_fn formatter, void *priv) { void *bitmap; -ext4_grpblk_t next; +ext4_grpblk_t start, next;struct ext4_buddy e4b;int error;
@@ -7016,10 +7017,19 @@ ext4_mballoc_query_range(ext4_lock_group (sb, group); - start =max (e4b.bd_info->bb_first_free, start); + start =max (e4b.bd_info->bb_first_free, first);if (end >=EXT4_CLUSTERS_PER_GROUP (sb)) end =EXT4_CLUSTERS_PER_GROUP (sb) -1 ; - +if (meta_formatter && start != first) { +if (start > end) + start = end; +ext4_unlock_group (sb, group); + error =meta_formatter (sb, group, first, start - first, + priv); +if (error) + goto out_unload; +ext4_lock_group (sb, group); + }while (start <= end) { start =mb_find_next_zero_bit (bitmap, end +1 , start);if (start > end)
fs/ext4/mballoc.h +1 -0
@@ -259,6 +259,7 @@ ext4_mballoc_query_range(ext4_group_t agno, ext4_grpblk_t start, ext4_grpblk_t end, + ext4_mballoc_query_range_fn meta_formatter, ext4_mballoc_query_range_fn formatter, void *priv);
Greg Kroah-Hartman
maintainerPATCH 632/826 MAINTAINERS: update location of media main tree
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit dc51b3cc9d4d2a04bdbfe34f7746fc9122cc3f49 upstream.
There were some recent changes on the way we're handling media patches. Now, the official tree is located at:
https://git.linuxtv.org/media.git/
Update it at MAINTAINERS file.
--- MAINTAINERS | 332 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 166 insertions(+), 166 deletions(-)
MAINTAINERS +166 -166
@@ -701,7 +701,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-aimslab* AIO
@@ -809,7 +809,7 @@ ALLWINNER A10 CSI DRIVER M: Maxime Ripard <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml F: drivers/media/platform/sunxi/sun4i-csi/
@@ -818,7 +818,7 @@ M: Yong Deng <[email protected]> M: Paul Kocialkowski <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/allwinner,sun6i-a31-csi.yaml F: drivers/media/platform/sunxi/sun6i-csi/
@@ -826,7 +826,7 @@ ALLWINNER A31 ISP DRIVER M: Paul Kocialkowski <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/allwinner,sun6i-a31-isp.yaml F: drivers/staging/media/sunxi/sun6i-isp/ F: drivers/staging/media/sunxi/sun6i-isp/uapi/sun6i-isp-config.h
@@ -835,7 +835,7 @@ ALLWINNER A31 MIPI CSI-2 BRIDGE DRIVER M: Paul Kocialkowski <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/allwinner,sun6i-a31-mipi-csi2.yaml F: drivers/media/platform/sunxi/sun6i-mipi-csi2/
@@ -3348,7 +3348,7 @@ ASAHI KASEI AK7375 LENS VOICE COIL DRIVE M: Tianshu Qiu <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/asahi-kasei,ak7375.yaml F: drivers/media/i2c/ak7375.c
@@ -3765,7 +3765,7 @@ M: Mauro Carvalho Chehab <mchehab@kernel L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/usb/dvb-usb-v2/az6007.c AZTECH FM RADIO RECEIVER DRIVER
@@ -3773,7 +3773,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-aztech* B43 WIRELESS DRIVER
@@ -3857,7 +3857,7 @@ M: Fabien Dessenne <fabien.dessenne@foss L: [email protected] S: Supported W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/platform/st/sti/bdisp BECKHOFF CX5020 ETHERCAT MASTER DRIVER
@@ -4865,7 +4865,7 @@ M: Mauro Carvalho Chehab <mchehab@kernel L: [email protected] S: Odd fixes W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/driver-api/media/drivers/bttv* F: drivers/media/pci/bt8xx/bttv*
@@ -4979,13 +4979,13 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-cadet* CAFE CMOS INTEGRATED CAMERA CONTROLLER DRIVER L: [email protected] S: Orphan -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/admin-guide/media/cafe_ccic* F: drivers/media/platform/marvell/
@@ -5169,7 +5169,7 @@ M: Hans Verkuil <[email protected] L: [email protected] S: Supported W: http://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/ABI/testing/debugfs-cec-error-inj F: Documentation/devicetree/bindings/media/cec/cec-common.yaml F: Documentation/driver-api/media/cec-core.rst
@@ -5186,7 +5186,7 @@ M: Hans Verkuil <[email protected] L: [email protected] S: Supported W: http://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/cec/cec-gpio.yaml F: drivers/media/cec/platform/cec-gpio/
@@ -5393,7 +5393,7 @@ CHRONTEL CH7322 CEC DRIVER M: Joe Tessler <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/chrontel,ch7322.yaml F: drivers/media/cec/i2c/ch7322.c
@@ -5582,7 +5582,7 @@ M: Hans Verkuil <[email protected] L: [email protected] S: Supported W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/pci/cobalt/ COCCINELLE/Semantic Patches (SmPL)
@@ -6026,7 +6026,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Odd Fixes W: http://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/cs3308.c CS5535 Audio ALSA driver
@@ -6057,7 +6057,7 @@ M: Andy Walls <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/pci/cx18/ F: include/uapi/linux/ivtv*
@@ -6066,7 +6066,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/common/cx2341x* F: include/media/drv-intf/cx2341x.h
@@ -6084,7 +6084,7 @@ M: Mauro Carvalho Chehab <mchehab@kernel L: [email protected] S: Odd fixes W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/driver-api/media/drivers/cx88* F: drivers/media/pci/cx88/
@@ -6320,7 +6320,7 @@ DEINTERLACE DRIVERS FOR ALLWINNER H3 M: Jernej Skrabec <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/allwinner,sun8i-h3-deinterlace.yaml F: drivers/media/platform/sunxi/sun8i-di/
@@ -6447,7 +6447,7 @@ M: Hugues Fruchet <[email protected] L: [email protected] S: Supported W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/platform/st/sti/delta DENALI NAND DRIVER
@@ -6855,7 +6855,7 @@ DONGWOON DW9714 LENS VOICE COIL DRIVER M: Sakari Ailus <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9714.yaml F: drivers/media/i2c/dw9714.c
@@ -6863,13 +6863,13 @@ DONGWOON DW9719 LENS VOICE COIL DRIVER M: Daniel Scally <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/dw9719.c DONGWOON DW9768 LENS VOICE COIL DRIVER L: [email protected] S: Orphan -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.yaml F: drivers/media/i2c/dw9768.c
@@ -6877,7 +6877,7 @@ DONGWOON DW9807 LENS VOICE COIL DRIVER M: Sakari Ailus <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml F: drivers/media/i2c/dw9807-vcm.c
@@ -7860,7 +7860,7 @@ DSBR100 USB FM RADIO DRIVER M: Alexey Klimov <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/dsbr100.c DT3155 MEDIA DRIVER
@@ -7868,7 +7868,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Odd Fixes W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/pci/dt3155/ DVB_USB_AF9015 MEDIA DRIVER
@@ -7913,7 +7913,7 @@ S: Maintained W: https://linuxtv.org W: http://github.com/mkrufky Q: http://patchwork.linuxtv.org/project/linux-media/list/ -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/usb/dvb-usb/cxusb* DVB_USB_EC168 MEDIA DRIVER
@@ -8282,7 +8282,7 @@ M: Mauro Carvalho Chehab <mchehab@kernel L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/admin-guide/media/em28xx* F: drivers/media/usb/em28xx/
@@ -8578,7 +8578,7 @@ EXTRON DA HD 4K PLUS CEC DRIVER M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/cec/usb/extron-da-hd-4k-plus/ EXYNOS DP DRIVER
@@ -9400,7 +9400,7 @@ GALAXYCORE GC2145 SENSOR DRIVER M: Alain Volmat <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml F: drivers/media/i2c/gc2145.c
@@ -9448,7 +9448,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-gemtek* GENERIC ARCHITECTURE TOPOLOGY
@@ -9830,56 +9830,56 @@ GS1662 VIDEO SERIALIZER M: Charles-Antoine Couret <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/spi/gs1662.c GSPCA FINEPIX SUBDRIVER M: Frank Zago <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/usb/gspca/finepix.c GSPCA GL860 SUBDRIVER M: Olivier Lorin <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/usb/gspca/gl860/ GSPCA M5602 SUBDRIVER M: Erik Andren <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/usb/gspca/m5602/ GSPCA PAC207 SONIXB SUBDRIVER M: Hans Verkuil <[email protected]> L: [email protected] S: Odd Fixes -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/usb/gspca/pac207.c GSPCA SN9C20X SUBDRIVER M: Brian Johnson <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/usb/gspca/sn9c20x.c GSPCA T613 SUBDRIVER M: Leandro Costantino <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/usb/gspca/t613.c GSPCA USB WEBCAM DRIVER M: Hans Verkuil <[email protected]> L: [email protected] S: Odd Fixes -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/usb/gspca/ GTP (GPRS Tunneling Protocol)
@@ -9996,7 +9996,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Odd Fixes W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/usb/hdpvr/ HEWLETT PACKARD ENTERPRISE ILO CHIF DRIVER
@@ -10503,7 +10503,7 @@ M: Jean-Christophe Trotin <jean-christop L: [email protected] S: Supported W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/platform/st/sti/hva HWPOISON MEMORY FAILURE HANDLING
@@ -10531,7 +10531,7 @@ HYNIX HI556 SENSOR DRIVER M: Sakari Ailus <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/hi556.c HYNIX HI846 SENSOR DRIVER
@@ -11502,7 +11502,7 @@ M: Dan Scally <[email protected]> R: Tianshu Qiu <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/userspace-api/media/v4l/pixfmt-srggb10-ipu3.rst F: drivers/media/pci/intel/ipu3/
@@ -11523,7 +11523,7 @@ M: Bingbu Cao <[email protected]> R: Tianshu Qiu <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/admin-guide/media/ipu6-isys.rst F: drivers/media/pci/intel/ipu6/
@@ -12036,7 +12036,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-isa* ISAPNP
@@ -12138,7 +12138,7 @@ M: Andy Walls <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/admin-guide/media/ivtv* F: drivers/media/pci/ivtv/ F: include/uapi/linux/ivtv*
@@ -12286,7 +12286,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-keene* KERNEL AUTOMOUNTER
@@ -13573,7 +13573,7 @@ MA901 MASTERKIT USB FM RADIO DRIVER M: Alexey Klimov <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-ma901.c MAC80211
@@ -13868,7 +13868,7 @@ MAX2175 SDR TUNER DRIVER M: Ramesh Shanmugasundaram <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/max2175.txt F: Documentation/userspace-api/media/drivers/max2175.rst F: drivers/media/i2c/max2175*
@@ -14048,7 +14048,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-maxiradio* MAXLINEAR ETHERNET PHY DRIVER
@@ -14131,7 +14131,7 @@ M: Laurent Pinchart <laurent.pinchart@id L: [email protected] S: Supported W: https://www.linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/mc/ F: include/media/media-*.h F: include/uapi/linux/media.h
@@ -14140,7 +14140,7 @@ MEDIA DRIVER FOR FREESCALE IMX PXP M: Philipp Zabel <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/platform/nxp/imx-pxp.[ch] MEDIA DRIVERS FOR ASCOT2E
@@ -14149,7 +14149,7 @@ L: [email protected] S: Supported W: https://linuxtv.org W: http://netup.tv/ -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/dvb-frontends/ascot2e* MEDIA DRIVERS FOR CXD2099AR CI CONTROLLERS
@@ -14157,7 +14157,7 @@ M: Jasmin Jessich <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/dvb-frontends/cxd2099* MEDIA DRIVERS FOR CXD2841ER
@@ -14166,7 +14166,7 @@ L: [email protected] S: Supported W: https://linuxtv.org W: http://netup.tv/ -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/dvb-frontends/cxd2841er* MEDIA DRIVERS FOR CXD2880
@@ -14174,7 +14174,7 @@ M: Yasunari Takiguchi <Yasunari.Takiguch L: [email protected] S: Supported W: http://linuxtv.org/ -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/dvb-frontends/cxd2880/* F: drivers/media/spi/cxd2880*
@@ -14182,7 +14182,7 @@ MEDIA DRIVERS FOR DIGITAL DEVICES PCIE D L: [email protected] S: Orphan W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/pci/ddbridge/* MEDIA DRIVERS FOR FREESCALE IMX
@@ -14190,7 +14190,7 @@ M: Steve Longerbeam <[email protected] M: Philipp Zabel <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/admin-guide/media/imx.rst F: Documentation/devicetree/bindings/media/imx.txt F: drivers/staging/media/imx/
@@ -14204,7 +14204,7 @@ M: Martin Kepplinger <martin.kepplinger@ R: Purism Kernel Team <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/admin-guide/media/imx7.rst F: Documentation/devicetree/bindings/media/nxp,imx-mipi-csi2.yaml F: Documentation/devicetree/bindings/media/nxp,imx7-csi.yaml
@@ -14219,7 +14219,7 @@ L: [email protected] S: Supported W: https://linuxtv.org W: http://netup.tv/ -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/dvb-frontends/helene* MEDIA DRIVERS FOR HORUS3A
@@ -14228,7 +14228,7 @@ L: [email protected] S: Supported W: https://linuxtv.org W: http://netup.tv/ -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/dvb-frontends/horus3a* MEDIA DRIVERS FOR LNBH25
@@ -14237,14 +14237,14 @@ L: [email protected] S: Supported W: https://linuxtv.org W: http://netup.tv/ -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/dvb-frontends/lnbh25* MEDIA DRIVERS FOR MXL5XX TUNER DEMODULATORS L: [email protected] S: Orphan W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/dvb-frontends/mxl5xx* MEDIA DRIVERS FOR NETUP PCI UNIVERSAL DVB devices
@@ -14253,7 +14253,7 @@ L: [email protected] S: Supported W: https://linuxtv.org W: http://netup.tv/ -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/pci/netup_unidvb/* MEDIA DRIVERS FOR NVIDIA TEGRA - VDE
@@ -14261,7 +14261,7 @@ M: Dmitry Osipenko <[email protected]> L: [email protected] L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/nvidia,tegra-vde.yaml F: drivers/media/platform/nvidia/tegra-vde/
@@ -14270,7 +14270,7 @@ M: Jacopo Mondi <[email protected]> L: [email protected] L: [email protected] S: Supported -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/renesas,ceu.yaml F: drivers/media/platform/renesas/renesas-ceu.c F: include/media/drv-intf/renesas-ceu.h
@@ -14280,7 +14280,7 @@ M: Fabrizio Castro <fabrizio.castro.jz@r L: [email protected] L: [email protected] S: Supported -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/renesas,drif.yaml F: drivers/media/platform/renesas/rcar_drif.c
@@ -14289,7 +14289,7 @@ M: Laurent Pinchart <laurent.pinchart@id L: [email protected] L: [email protected] S: Supported -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/renesas,fcp.yaml F: drivers/media/platform/renesas/rcar-fcp.c F: include/media/rcar-fcp.h
@@ -14299,7 +14299,7 @@ M: Kieran Bingham <kieran.bingham+renesa L: [email protected] L: [email protected] S: Supported -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/renesas,fdp1.yaml F: drivers/media/platform/renesas/rcar_fdp1.c
@@ -14308,7 +14308,7 @@ M: Niklas Söderlund <niklas.soderlund@r L: [email protected] L: [email protected] S: Supported -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/renesas,csi2.yaml F: Documentation/devicetree/bindings/media/renesas,isp.yaml F: Documentation/devicetree/bindings/media/renesas,vin.yaml
@@ -14322,7 +14322,7 @@ M: Kieran Bingham <kieran.bingham+renesa L: [email protected] L: [email protected] S: Supported -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/renesas,vsp1.yaml F: drivers/media/platform/renesas/vsp1/
@@ -14330,14 +14330,14 @@ MEDIA DRIVERS FOR ST STV0910 DEMODULATOR L: [email protected] S: Orphan W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/dvb-frontends/stv0910* MEDIA DRIVERS FOR ST STV6111 TUNER ICs L: [email protected] S: Orphan W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/dvb-frontends/stv6111* MEDIA DRIVERS FOR STM32 - DCMI / DCMIPP
@@ -14345,7 +14345,7 @@ M: Hugues Fruchet <[email protected] M: Alain Volmat <[email protected]> L: [email protected] S: Supported -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml F: Documentation/devicetree/bindings/media/st,stm32-dcmipp.yaml F: drivers/media/platform/st/stm32/stm32-dcmi.c
@@ -14357,7 +14357,7 @@ L: [email protected] S: Maintained W: https://linuxtv.org Q: http://patchwork.kernel.org/project/linux-media/list/ -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/admin-guide/media/ F: Documentation/devicetree/bindings/media/ F: Documentation/driver-api/media/
@@ -14933,7 +14933,7 @@ L: [email protected] L: [email protected] S: Supported W: http://linux-meson.com/ -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/cec/amlogic,meson-gx-ao-cec.yaml F: drivers/media/cec/platform/meson/ao-cec-g12a.c F: drivers/media/cec/platform/meson/ao-cec.c
@@ -14943,7 +14943,7 @@ M: Neil Armstrong <neil.armstrong@linaro L: [email protected] L: [email protected] S: Supported -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/amlogic,axg-ge2d.yaml F: drivers/media/platform/amlogic/meson-ge2d/
@@ -14959,7 +14959,7 @@ M: Neil Armstrong <neil.armstrong@linaro L: [email protected] L: [email protected] S: Supported -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/amlogic,gx-vdec.yaml F: drivers/staging/media/meson/vdec/
@@ -15557,7 +15557,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Odd Fixes W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-miropcm20* MITSUMI MM8013 FG DRIVER
@@ -15709,7 +15709,7 @@ MR800 AVERMEDIA USB FM RADIO DRIVER M: Alexey Klimov <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-mr800.c MRF24J40 IEEE 802.15.4 RADIO DRIVER
@@ -15776,7 +15776,7 @@ MT9M114 ONSEMI SENSOR DRIVER M: Laurent Pinchart <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/onnn,mt9m114.yaml F: drivers/media/i2c/mt9m114.c
@@ -15784,7 +15784,7 @@ MT9P031 APTINA CAMERA SENSOR M: Laurent Pinchart <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/aptina,mt9p031.yaml F: drivers/media/i2c/mt9p031.c F: include/media/i2c/mt9p031.h
@@ -15793,7 +15793,7 @@ MT9T112 APTINA CAMERA SENSOR M: Jacopo Mondi <[email protected]> L: [email protected] S: Odd Fixes -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/mt9t112.c F: include/media/i2c/mt9t112.h
@@ -15801,7 +15801,7 @@ MT9V032 APTINA CAMERA SENSOR M: Laurent Pinchart <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/mt9v032.txt F: drivers/media/i2c/mt9v032.c F: include/media/i2c/mt9v032.h
@@ -15810,7 +15810,7 @@ MT9V111 APTINA CAMERA SENSOR M: Jacopo Mondi <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/aptina,mt9v111.yaml F: drivers/media/i2c/mt9v111.c
@@ -17005,13 +17005,13 @@ OMNIVISION OV01A10 SENSOR DRIVER M: Bingbu Cao <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/ov01a10.c OMNIVISION OV02A10 SENSOR DRIVER L: [email protected] S: Orphan -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov02a10.yaml F: drivers/media/i2c/ov02a10.c
@@ -17019,28 +17019,28 @@ OMNIVISION OV08D10 SENSOR DRIVER M: Jimmy Su <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/ov08d10.c OMNIVISION OV08X40 SENSOR DRIVER M: Jason Chen <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/ov08x40.c OMNIVISION OV13858 SENSOR DRIVER M: Sakari Ailus <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/ov13858.c OMNIVISION OV13B10 SENSOR DRIVER M: Arec Kao <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/ov13b10.c OMNIVISION OV2680 SENSOR DRIVER
@@ -17048,7 +17048,7 @@ M: Rui Miguel Silva <[email protected]> M: Hans de Goede <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov2680.yaml F: drivers/media/i2c/ov2680.c
@@ -17056,7 +17056,7 @@ OMNIVISION OV2685 SENSOR DRIVER M: Shunqian Zheng <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov2685.yaml F: drivers/media/i2c/ov2685.c
@@ -17066,14 +17066,14 @@ R: Sakari Ailus <[email protected] R: Bingbu Cao <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/ov2740.c OMNIVISION OV4689 SENSOR DRIVER M: Mikhail Rudenko <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov4689.yaml F: drivers/media/i2c/ov4689.c
@@ -17081,7 +17081,7 @@ OMNIVISION OV5640 SENSOR DRIVER M: Steve Longerbeam <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/ov5640.c OMNIVISION OV5647 SENSOR DRIVER
@@ -17089,7 +17089,7 @@ M: Dave Stevenson <dave.stevenson@raspbe M: Jacopo Mondi <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov5647.yaml F: drivers/media/i2c/ov5647.c
@@ -17097,7 +17097,7 @@ OMNIVISION OV5670 SENSOR DRIVER M: Sakari Ailus <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov5670.yaml F: drivers/media/i2c/ov5670.c
@@ -17105,7 +17105,7 @@ OMNIVISION OV5675 SENSOR DRIVER M: Sakari Ailus <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov5675.yaml F: drivers/media/i2c/ov5675.c
@@ -17113,7 +17113,7 @@ OMNIVISION OV5693 SENSOR DRIVER M: Daniel Scally <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov5693.yaml F: drivers/media/i2c/ov5693.c
@@ -17121,21 +17121,21 @@ OMNIVISION OV5695 SENSOR DRIVER M: Shunqian Zheng <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/ov5695.c OMNIVISION OV64A40 SENSOR DRIVER M: Jacopo Mondi <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov64a40.yaml F: drivers/media/i2c/ov64a40.c OMNIVISION OV7670 SENSOR DRIVER L: [email protected] S: Orphan -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ov7670.txt F: drivers/media/i2c/ov7670.c
@@ -17143,7 +17143,7 @@ OMNIVISION OV772x SENSOR DRIVER M: Jacopo Mondi <[email protected]> L: [email protected] S: Odd fixes -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov772x.yaml F: drivers/media/i2c/ov772x.c F: include/media/i2c/ov772x.h
@@ -17151,7 +17151,7 @@ F: include/media/i2c/ov772x.h OMNIVISION OV7740 SENSOR DRIVER L: [email protected] S: Orphan -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ov7740.txt F: drivers/media/i2c/ov7740.c
@@ -17159,7 +17159,7 @@ OMNIVISION OV8856 SENSOR DRIVER M: Sakari Ailus <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml F: drivers/media/i2c/ov8856.c
@@ -17168,7 +17168,7 @@ M: Jacopo Mondi <jacopo.mondi@ideasonboa M: Nicholas Roth <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov8858.yaml F: drivers/media/i2c/ov8858.c
@@ -17176,7 +17176,7 @@ OMNIVISION OV9282 SENSOR DRIVER M: Dave Stevenson <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml F: drivers/media/i2c/ov9282.c
@@ -17192,7 +17192,7 @@ R: Akinobu Mita <[email protected]> R: Sylwester Nawrocki <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ov9650.txt F: drivers/media/i2c/ov9650.c
@@ -17201,7 +17201,7 @@ M: Tianshu Qiu <[email protected]> R: Bingbu Cao <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/ov9734.c ONBOARD USB HUB DRIVER
@@ -18646,7 +18646,7 @@ PULSE8-CEC DRIVER M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/cec/usb/pulse8/ PURELIFI PLFXLC DRIVER
@@ -18661,7 +18661,7 @@ L: [email protected] (subscribers-only) L: [email protected] S: Maintained W: http://www.isely.net/pvrusb2/ -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/driver-api/media/drivers/pvrusb2* F: drivers/media/usb/pvrusb2/
@@ -18669,7 +18669,7 @@ PWC WEBCAM DRIVER M: Hans Verkuil <[email protected]> L: [email protected] S: Odd Fixes -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/usb/pwc/* F: include/trace/events/pwc.h
@@ -19173,7 +19173,7 @@ R: Bryan O'Donoghue <bryan.odonoghue@lin L: [email protected] L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/*venus* F: drivers/media/platform/qcom/venus/
@@ -19218,14 +19218,14 @@ RADIOSHARK RADIO DRIVER M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-shark.c RADIOSHARK2 RADIO DRIVER M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-shark2.c F: drivers/media/radio/radio-tea5777.c
@@ -19249,7 +19249,7 @@ RAINSHADOW-CEC DRIVER M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/cec/usb/rainshadow/ RALINK MIPS ARCHITECTURE
@@ -19333,7 +19333,7 @@ M: Sean Young <[email protected]> L: [email protected] S: Maintained W: http://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/driver-api/media/rc-core.rst F: Documentation/userspace-api/media/rc/ F: drivers/media/rc/
@@ -20077,7 +20077,7 @@ ROTATION DRIVER FOR ALLWINNER A83T M: Jernej Skrabec <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/allwinner,sun8i-a83t-de2-rotate.yaml F: drivers/media/platform/sunxi/sun8i-rotate/
@@ -20331,7 +20331,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Odd Fixes W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/saa6588* SAA7134 VIDEO4LINUX DRIVER
@@ -20339,7 +20339,7 @@ M: Mauro Carvalho Chehab <mchehab@kernel L: [email protected] S: Odd fixes W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/driver-api/media/drivers/saa7134* F: drivers/media/pci/saa7134/
@@ -20347,7 +20347,7 @@ SAA7146 VIDEO4LINUX-2 DRIVER M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/common/saa7146/ F: drivers/media/pci/saa7146/ F: include/media/drv-intf/saa7146*
@@ -20965,7 +20965,7 @@ SHARP RJ54N1CB0C SENSOR DRIVER M: Jacopo Mondi <[email protected]> L: [email protected] S: Odd fixes -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/rj54n1cb0c.c F: include/media/i2c/rj54n1cb0c.h
@@ -21015,7 +21015,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Odd Fixes W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/silabs,si470x.yaml F: drivers/media/radio/si470x/radio-si470x-i2c.c
@@ -21024,7 +21024,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/si470x/radio-si470x-common.c F: drivers/media/radio/si470x/radio-si470x-usb.c F: drivers/media/radio/si470x/radio-si470x.h
@@ -21034,7 +21034,7 @@ M: Eduardo Valentin <[email protected] L: [email protected] S: Odd Fixes W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/si4713/si4713.? SI4713 FM RADIO TRANSMITTER PLATFORM DRIVER
@@ -21042,7 +21042,7 @@ M: Eduardo Valentin <[email protected] L: [email protected] S: Odd Fixes W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/si4713/radio-platform-si4713.c SI4713 FM RADIO TRANSMITTER USB DRIVER
@@ -21050,7 +21050,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/si4713/radio-usb-si4713.c SIANO DVB DRIVER
@@ -21058,7 +21058,7 @@ M: Mauro Carvalho Chehab <mchehab@kernel L: [email protected] S: Odd fixes W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/common/siano/ F: drivers/media/mmc/siano/ F: drivers/media/usb/siano/
@@ -21434,14 +21434,14 @@ SONY IMX208 SENSOR DRIVER M: Sakari Ailus <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/imx208.c SONY IMX214 SENSOR DRIVER M: Ricardo Ribalda <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/sony,imx214.yaml F: drivers/media/i2c/imx214.c
@@ -21449,7 +21449,7 @@ SONY IMX219 SENSOR DRIVER M: Dave Stevenson <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/imx219.yaml F: drivers/media/i2c/imx219.c
@@ -21457,7 +21457,7 @@ SONY IMX258 SENSOR DRIVER M: Sakari Ailus <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/sony,imx258.yaml F: drivers/media/i2c/imx258.c
@@ -21465,7 +21465,7 @@ SONY IMX274 SENSOR DRIVER M: Leon Luo <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/sony,imx274.yaml F: drivers/media/i2c/imx274.c
@@ -21474,7 +21474,7 @@ M: Kieran Bingham <kieran.bingham@ideaso M: Umang Jain <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/sony,imx283.yaml F: drivers/media/i2c/imx283.c
@@ -21482,7 +21482,7 @@ SONY IMX290 SENSOR DRIVER M: Manivannan Sadhasivam <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/sony,imx290.yaml F: drivers/media/i2c/imx290.c
@@ -21491,7 +21491,7 @@ M: Laurent Pinchart <laurent.pinchart@id M: Manivannan Sadhasivam <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/sony,imx296.yaml F: drivers/media/i2c/imx296.c
@@ -21499,20 +21499,20 @@ SONY IMX319 SENSOR DRIVER M: Bingbu Cao <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/imx319.c SONY IMX334 SENSOR DRIVER L: [email protected] S: Orphan -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml F: drivers/media/i2c/imx334.c SONY IMX335 SENSOR DRIVER L: [email protected] S: Orphan -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml F: drivers/media/i2c/imx335.c
@@ -21520,13 +21520,13 @@ SONY IMX355 SENSOR DRIVER M: Tianshu Qiu <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/imx355.c SONY IMX412 SENSOR DRIVER L: [email protected] S: Orphan -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml F: drivers/media/i2c/imx412.c
@@ -21534,7 +21534,7 @@ SONY IMX415 SENSOR DRIVER M: Michael Riesch <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/sony,imx415.yaml F: drivers/media/i2c/imx415.c
@@ -21823,7 +21823,7 @@ M: Benjamin Mugnier <benjamin.mugnier@fo M: Sylvain Petinot <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/st,st-mipid02.yaml F: drivers/media/i2c/st-mipid02.c
@@ -21859,7 +21859,7 @@ M: Benjamin Mugnier <benjamin.mugnier@fo M: Sylvain Petinot <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/st,st-vgxy61.yaml F: Documentation/userspace-api/media/drivers/vgxy61.rst F: drivers/media/i2c/vgxy61.c
@@ -22149,7 +22149,7 @@ STK1160 USB VIDEO CAPTURE DRIVER M: Ezequiel Garcia <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/usb/stk1160/ STM32 AUDIO (ASoC) DRIVERS
@@ -22586,7 +22586,7 @@ L: [email protected] S: Maintained W: https://linuxtv.org Q: http://patchwork.linuxtv.org/project/linux-media/list/ -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/tuners/tda18250* TDA18271 MEDIA DRIVER
@@ -22632,7 +22632,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/tda9840* TEA5761 TUNER DRIVER
@@ -22640,7 +22640,7 @@ M: Mauro Carvalho Chehab <mchehab@kernel L: [email protected] S: Odd fixes W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/tuners/tea5761.* TEA5767 TUNER DRIVER
@@ -22648,7 +22648,7 @@ M: Mauro Carvalho Chehab <mchehab@kernel L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/tuners/tea5767.* TEA6415C MEDIA DRIVER
@@ -22656,7 +22656,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/tea6415c* TEA6420 MEDIA DRIVER
@@ -22664,7 +22664,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/i2c/tea6420* TEAM DRIVER
@@ -22952,7 +22952,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-raremono.c THERMAL
@@ -23028,7 +23028,7 @@ M: Laurent Pinchart <laurent.pinchart@id M: Paul Elder <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml F: Documentation/userspace-api/media/drivers/thp7312.rst F: drivers/media/i2c/thp7312.c
@@ -23615,7 +23615,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Odd Fixes W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/pci/tw68/ TW686X VIDEO4LINUX DRIVER
@@ -23623,7 +23623,7 @@ M: Ezequiel Garcia <ezequiel@vanguardias L: [email protected] S: Maintained W: http://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/pci/tw686x/ U-BOOT ENVIRONMENT VARIABLES
@@ -24106,7 +24106,7 @@ M: Laurent Pinchart <laurent.pinchart@id L: [email protected] S: Maintained W: http://www.ideasonboard.org/uvc/ -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/usb/uvc/ F: include/uapi/linux/uvcvideo.h
@@ -24212,7 +24212,7 @@ V4L2 ASYNC AND FWNODE FRAMEWORKS M: Sakari Ailus <[email protected]> L: [email protected] S: Maintained -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/v4l2-core/v4l2-async.c F: drivers/media/v4l2-core/v4l2-fwnode.c F: include/media/v4l2-async.h
@@ -24378,7 +24378,7 @@ M: Hans Verkuil <[email protected] L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/test-drivers/vicodec/* VIDEO I2C POLLING DRIVER
@@ -24406,7 +24406,7 @@ M: Daniel W. S. Almeida <dwlsalmeida@gma L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/test-drivers/vidtv/* VIMC VIRTUAL MEDIA CONTROLLER DRIVER
@@ -24415,7 +24415,7 @@ R: Kieran Bingham <kieran.bingham@ideaso L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/test-drivers/vimc/* VIRT LIB
@@ -24663,7 +24663,7 @@ M: Hans Verkuil <[email protected]> L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/test-drivers/vivid/* VM SOCKETS (AF_VSOCK)
@@ -25217,7 +25217,7 @@ M: Mauro Carvalho Chehab <mchehab@kernel L: [email protected] S: Maintained W: https://linuxtv.org -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: drivers/media/tuners/xc2028.* XDP (eXpress Data Path)
@@ -25440,7 +25440,7 @@ XILINX VIDEO IP CORES M: Laurent Pinchart <[email protected]> L: [email protected] S: Supported -T: git git://linuxtv.org/media_tree.git +T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/xilinx/ F: drivers/media/platform/xilinx/ F: include/uapi/linux/xilinx-v4l2-controls.h
Greg Kroah-Hartman
maintainerPATCH 633/826 docs: media: update location of the media patches
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 72ad4ff638047bbbdf3232178fea4bec1f429319 upstream.
Due to recent changes on the way we're maintaining media, the location of the main tree was updated.
Change docs accordingly.
--- Documentation/admin-guide/media/building.rst | 2 +- Documentation/admin-guide/media/saa7134.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/admin-guide/media/building.rst +1 -1
@@ -15,7 +15,7 @@ Please notice, however, that, if: you should use the main media development tree ``master`` branch: - https://git.linuxtv.org/media_tree.git/ + https://git.linuxtv.org/media.git/ In this case, you may find some useful information at the `LinuxTv wiki pages <https://linuxtv.org/wiki>`_:
Documentation/admin-guide/media/saa7134.rst +1 -1
@@ -67,7 +67,7 @@ Changes / Fixes Please mail to linux-media AT vger.kernel.org unified diffs against the linux media git tree: - https://git.linuxtv.org/media_tree.git/ + https://git.linuxtv.org/media.git/ This is done by committing a patch at a clone of the git tree and submitting the patch using ``git send-email``. Don't forget to
Greg Kroah-Hartman
maintainerPATCH 634/826 jfs: xattr: check invalid xattr size more strictly
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Sadovnikov <[email protected]>
commit d9f9d96136cba8fedd647d2c024342ce090133c2 upstream.
Commit 7c55b78818cf ("jfs: xattr: fix buffer overflow for invalid xattr") also addresses this issue but it only fixes it for positive values, while ea_size is an integer type and can take negative values, e.g. in case of a corrupted filesystem. This still breaks validation and would overflow because of implicit conversion from int to size_t in print_hex_dump().
Fix this issue by clamping the ea_size value instead.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- fs/jfs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/xattr.c +1 -1
@@ -559,7 +559,7 @@ static int ea_get(struct inode *inode, s size_check:if (EALIST_SIZE (ea_buf->xattr) != ea_size) { -int size =min_t (int,EALIST_SIZE (ea_buf->xattr), ea_size); +int size =clamp_t (int, ea_size,0 ,EALIST_SIZE (ea_buf->xattr));printk (KERN_ERR "ea_get: invalid extended attribute\n" ); print_hex_dump(KERN_ERR, "", DUMP_PREFIX_ADDRESS, 16, 1,
Greg Kroah-Hartman
maintainerPATCH 635/826 ASoC: amd: yc: Add a quirk for microfone on Lenovo ThinkPad P14s Gen 5 21MES00B00
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Zverev <[email protected]>
commit b682aa788e5f9f1ddacdfbb453e49fd3f4e83721 upstream.
New ThinkPads need new quirk entries. Ilya has tested this one. Laptop product id is 21MES00B00, though the shorthand 21ME works.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -245,6 +245,13 @@ static const struct dmi_system_id yc_acp .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "21ME"), + } + }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), DMI_MATCH(DMI_PRODUCT_NAME, "82QF"), } },
Greg Kroah-Hartman
maintainerPATCH 636/826 ASoC: codecs: Fix atomicity violation in snd_soc_component_get_drvdata()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiu-ji Chen <[email protected]>
commit 1157733344651ca505e259d6554591ff156922fa upstream.
An atomicity violation occurs when the validity of the variables da7219->clk_src and da7219->mclk_rate is being assessed. Since the entire assessment is not protected by a lock, the da7219 variable might still be in flux during the assessment, rendering this check invalid.
To fix this issue, we recommend adding a lock before the block if ((da7219->clk_src == clk_id) && (da7219->mclk_rate == freq)) so that the legitimacy check for da7219->clk_src and da7219->mclk_rate is protected by the lock, ensuring the validity of the check.
This possible bug is found by an experimental static analysis tool developed by our team. This tool analyzes the locking APIs to extract function pairs that can be concurrently executed, and then analyzes the instructions in the paired functions to identify possible concurrency bugs including data races and atomicity violations.
--- sound/soc/codecs/da7219.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
sound/soc/codecs/da7219.c +6 -3
@@ -1167,17 +1167,20 @@ static int da7219_set_dai_sysclk(structstruct da7219_priv *da7219 =snd_soc_component_get_drvdata (component);int ret =0 ; -if ((da7219->clk_src == clk_id) && (da7219->mclk_rate == freq)) +mutex_lock (&da7219->pll_lock); + +if ((da7219->clk_src == clk_id) && (da7219->mclk_rate == freq)) { +mutex_unlock (&da7219->pll_lock);return 0 ; + }if ((freq <2000000 ) || (freq >54000000 )) { +mutex_unlock (&da7219->pll_lock);dev_err (codec_dai->dev,"Unsupported MCLK value %d\n" , freq);return -EINVAL ; } -mutex_lock (&da7219->pll_lock); -switch (clk_id) {case DA7219_CLKSRC_MCLK_SQR : snd_soc_component_update_bits(component, DA7219_PLL_CTRL,
Greg Kroah-Hartman
maintainerPATCH 637/826 ASoC: da7213: Populate max_register to regmap_config
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit 9d4f9f6a7bb1afbde57d08c98f2db4ff019ee19d upstream.
On the Renesas RZ/G3S SMARC Carrier II board having a DA7212 codec (using da7213 driver) connected to one SSIF-2 available on the Renesas RZ/G3S SoC it has been discovered that using the runtime PM API for suspend/resume (as will be proposed in the following commits) leads to the codec not being propertly initialized after resume. This is because w/o max_register populated to regmap_config the regcache_rbtree_sync() breaks on base_reg > max condition and the regcache_sync_block() call is skipped.
--- sound/soc/codecs/da7213.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/da7213.c +1 -0
@@ -2136,6 +2136,7 @@ static const struct regmap_config da7213 .reg_bits = 8, .val_bits = 8, + .max_register = DA7213_TONE_GEN_OFF_PER, .reg_defaults = da7213_reg_defaults, .num_reg_defaults = ARRAY_SIZE(da7213_reg_defaults), .volatile_reg = da7213_volatile_register,
Greg Kroah-Hartman
maintainerPATCH 638/826 perf/x86/intel/pt: Fix buffer full but size is 0 case
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 5b590160d2cf776b304eb054afafea2bd55e3620 upstream.
If the trace data buffer becomes full, a truncated flag [T] is reported in PERF_RECORD_AUX. In some cases, the size reported is 0, even though data must have been added to make the buffer full.
That happens when the buffer fills up from empty to full before the Intel PT driver has updated the buffer position. Then the driver calculates the new buffer position before calculating the data size. If the old and new positions are the same, the data size is reported as 0, even though it is really the whole buffer size.
Fix by detecting when the buffer position is wrapped, and adjust the data size calculation accordingly.
Example
Use a very small buffer size (8K) and observe the size of truncated [T] data. Before the fix, it is possible to see records of 0 size.
Before:
$ perf record -m,8K -e intel_pt// uname
Linux
[ perf record: Woken up 2 times to write data ]
[ perf record: Captured and wrote 0.105 MB perf.data ]
$ perf script -D --no-itrace | grep AUX | grep -F '[T]'
Warning:
AUX data lost 2 times out of 3! 5 19462712368111 0x19710 [0x40]: PERF_RECORD_AUX offset: 0 size: 0 flags: 0x1 [T]
5 19462712700046 0x19ba8 [0x40]: PERF_RECORD_AUX offset: 0x170 size: 0xe90 flags: 0x1 [T]After:
$ perf record -m,8K -e intel_pt// uname
Linux
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 0.040 MB perf.data ]
$ perf script -D --no-itrace | grep AUX | grep -F '[T]'
Warning:
AUX data lost 2 times out of 3! 1 113720802995 0x4948 [0x40]: PERF_RECORD_AUX offset: 0 size: 0x2000 flags: 0x1 [T]
1 113720979812 0x6b10 [0x40]: PERF_RECORD_AUX offset: 0x2000 size: 0x2000 flags: 0x1 [T]--- arch/x86/events/intel/pt.c | 11 ++++++++--- arch/x86/events/intel/pt.h | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-)
arch/x86/events/intel/pt.c +8 -3
@@ -828,11 +828,13 @@ static void pt_buffer_advance(struct pt_ buf->cur_idx++;if (buf->cur_idx == buf->cur->last) { -if (buf->cur == buf->last) +if (buf->cur == buf->last) { buf->cur = buf->first; -else + buf->wrapped = true; + }else { buf->cur = list_entry(buf->cur->list.next, struct topa, list); + } buf->cur_idx =0 ; } }
@@ -846,8 +848,11 @@ static void pt_buffer_advance(struct pt_static void pt_update_head (struct pt *pt) {struct pt_buffer *buf =perf_get_aux (&pt->handle); +bool wrapped = buf->wrapped;u64 topa_idx, base, old; + buf->wrapped = false; +if (buf->single) {local_set (&buf->data_size, buf->output_off);return ;
@@ -865,7 +870,7 @@ static void pt_update_head(struct pt *pt }else { old = (local64_xchg (&buf->head, base) & ((buf->nr_pages <<PAGE_SHIFT ) -1 )); -if (base < old) +if (base < old || (base == old && wrapped)) base += buf->nr_pages <<PAGE_SHIFT ;local_add (base - old, &buf->data_size);
arch/x86/events/intel/pt.h +2 -0
@@ -65,6 +65,7 @@ struct pt_pmu {* @head: logical write offset inside the buffer * @snapshot: if this is for a snapshot/overwrite counter * @single: use Single Range Output instead of ToPA +* @wrapped: buffer advance wrapped back to the first topa table * @stop_pos: STOP topa entry index * @intr_pos: INT topa entry index * @stop_te: STOP topa entry pointer
@@ -82,6 +83,7 @@ struct pt_buffer {local64_t head;bool snapshot;bool single; +bool wrapped;long stop_pos, intr_pos;struct topa_entry *stop_te, *intr_te;void **data_pages;
Greg Kroah-Hartman
maintainerPATCH 639/826 crypto: x86/aegis128 - access 32-bit arguments as 32-bit
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 3b2f2d22fb424e9bebda4dbf6676cbfc7f9f62cd upstream.
Fix the AEGIS assembly code to access 'unsigned int' arguments as 32-bit values instead of 64-bit, since the upper bits of the corresponding 64-bit registers are not guaranteed to be zero.
Note: there haven't been any reports of this bug actually causing incorrect behavior. Neither gcc nor clang guarantee zero-extension to 64 bits, but zero-extension is likely to happen in practice because most instructions that operate on 32-bit registers zero-extend to 64 bits.
--- arch/x86/crypto/aegis128-aesni-asm.S | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)
arch/x86/crypto/aegis128-aesni-asm.S +15 -14
@@ -21,7 +21,7 @@ #define T1 %xmm7 #define STATEP %rdi -#define LEN %rsi +#define LEN %esi #define SRC %rdx #define DST %rcx
@@ -76,32 +76,32 @@ SYM_FUNC_START_LOCAL(__load_partial) xor %r9d, %r9d pxor MSG, MSG - mov LEN, %r8 + mov LEN, %r8d and $0x1, %r8 jz .Lld_partial_1 - mov LEN, %r8 + mov LEN, %r8d and $0x1E, %r8 add SRC, %r8 mov (%r8), %r9b .Lld_partial_1: - mov LEN, %r8 + mov LEN, %r8d and $0x2, %r8 jz .Lld_partial_2 - mov LEN, %r8 + mov LEN, %r8d and $0x1C, %r8 add SRC, %r8 shl $0x10, %r9 mov (%r8), %r9w .Lld_partial_2: - mov LEN, %r8 + mov LEN, %r8d and $0x4, %r8 jz .Lld_partial_4 - mov LEN, %r8 + mov LEN, %r8d and $0x18, %r8 add SRC, %r8 shl $32, %r9
@@ -111,11 +111,11 @@ SYM_FUNC_START_LOCAL(__load_partial) .Lld_partial_4: movq %r9, MSG - mov LEN, %r8 + mov LEN, %r8d and $0x8, %r8 jz .Lld_partial_8 - mov LEN, %r8 + mov LEN, %r8d and $0x10, %r8 add SRC, %r8 pslldq $8, MSG
@@ -139,7 +139,7 @@ SYM_FUNC_END(__load_partial) * %r10 */ SYM_FUNC_START_LOCAL(__store_partial) - mov LEN, %r8 + mov LEN, %r8d mov DST, %r9 movq T0, %r10
@@ -677,7 +677,7 @@ SYM_TYPED_FUNC_START(crypto_aegis128_aes call __store_partial /* mask with byte count: */ - movq LEN, T0 + movd LEN, T0 punpcklbw T0, T0 punpcklbw T0, T0 punpcklbw T0, T0
@@ -702,7 +702,8 @@ SYM_FUNC_END(crypto_aegis128_aesni_dec_t /* * void crypto_aegis128_aesni_final(void *state, void *tag_xor, - * u64 assoclen, u64 cryptlen); + * unsigned int assoclen, + * unsigned int cryptlen); */ SYM_FUNC_START(crypto_aegis128_aesni_final) FRAME_BEGIN
@@ -715,8 +716,8 @@ SYM_FUNC_START(crypto_aegis128_aesni_fin movdqu 0x40(STATEP), STATE4 /* prepare length block: */ - movq %rdx, MSG - movq %rcx, T0 + movd %edx, MSG + movd %ecx, T0 pslldq $8, T0 pxor T0, MSG psllq $3, MSG /* multiply by 8 (to get bit count) */
Greg Kroah-Hartman
maintainerPATCH 640/826 KVM: x86: switch hugepage recovery thread to vhost_task
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit d96c77bd4eeba469bddbbb14323d2191684da82a upstream.
kvm_vm_create_worker_thread() is meant to be used for kthreads that can consume significant amounts of CPU time on behalf of a VM or in response to how the VM behaves (for example how it accesses its memory). Therefore it wants to charge the CPU time consumed by that work to the VM's container.
However, because of these threads, cgroups which have kvm instances inside never complete freezing. This can be trivially reproduced:
root@test ~# mkdir /sys/fs/cgroup/test root@test ~# echo $$ > /sys/fs/cgroup/test/cgroup.procs root@test ~# qemu-system-x86_64 -nographic -enable-kvm
and in another terminal:
root@test ~# echo 1 > /sys/fs/cgroup/test/cgroup.freeze root@test ~# cat /sys/fs/cgroup/test/cgroup.events populated 1
frozen 0
The cgroup freezing happens in the signal delivery path but kvm_nx_huge_page_recovery_worker, while joining non-root cgroups, never calls into the signal delivery path and thus never gets frozen. Because the cgroup freezer determines whether a given cgroup is frozen by comparing the number of frozen threads to the total number of threads in the cgroup, the cgroup never becomes frozen and users waiting for the state transition may hang indefinitely.
Since the worker kthread is tied to a user process, it's better if it behaves similarly to user tasks as much as possible, including being able to send SIGSTOP and SIGCONT. In fact, vhost_task is all that kvm_vm_create_worker_thread() wanted to be and more: not only it inherits the userspace process's cgroups, it has other niceties like being parented properly in the process tree. Use it instead of the homegrown alternative.
Incidentally, the new code is also better behaved when you flip recovery back and forth to disabled and back to enabled. If your recovery period is 1 minute, it will run the next recovery after 1 minute independent of how many times you flipped the parameter.
(Commit message based on emails from Tejun).
--- arch/x86/include/asm/kvm_host.h | 4 + arch/x86/kvm/Kconfig | 1 arch/x86/kvm/mmu/mmu.c | 68 ++++++++++++-------------- include/linux/kvm_host.h | 6 -- virt/kvm/kvm_main.c | 103 ---------------------------------------- 5 files changed, 35 insertions(+), 147 deletions(-)
arch/x86/include/asm/kvm_host.h +3 -1
@@ -26,6 +26,7 @@#include <linux/irqbypass.h> #include <linux/hyperv.h> #include <linux/kfifo.h> +#include <linux/sched/vhost_task.h> #include <asm/apic.h> #include <asm/pvclock-abi.h>
@@ -1443,7 +1444,8 @@ struct kvm_arch {bool sgx_provisioning_allowed;struct kvm_x86_pmu_event_filter __rcu *pmu_event_filter; -struct task_struct *nx_huge_page_recovery_thread; +struct vhost_task *nx_huge_page_recovery_thread; +u64 nx_huge_page_last;#ifdef CONFIG_X86_64 /* The number of TDP MMU pages across all roots. */
arch/x86/kvm/Kconfig +1 -0
@@ -29,6 +29,7 @@ config KVM_X86 select HAVE_KVM_IRQ_BYPASS select HAVE_KVM_IRQ_ROUTING select HAVE_KVM_READONLY_MEM + select VHOST_TASK select KVM_ASYNC_PF select USER_RETURN_NOTIFIER select KVM_MMIO
arch/x86/kvm/mmu/mmu.c +31 -37
107 lines not on this page · raw message
include/linux/kvm_host.h +0 -6
@@ -2382,12 +2382,6 @@ static inline int kvm_arch_vcpu_run_pid_ }#endif /* CONFIG_HAVE_KVM_VCPU_RUN_PID_CHANGE */ -typedef int (*kvm_vm_thread_fn_t )(struct kvm *kvm,uintptr_t data); - -int kvm_vm_create_worker_thread (struct kvm *kvm,kvm_vm_thread_fn_t thread_fn, -uintptr_t data,const char *name, -struct task_struct **thread_ptr); -#ifdef CONFIG_KVM_XFER_TO_GUEST_WORK static inline void kvm_handle_signal_exit (struct kvm_vcpu *vcpu) {
virt/kvm/kvm_main.c +0 -103
106 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 641/826 KVM: x86/mmu: Skip the "try unsync" path iff the old SPTE was a leaf SPTE
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 2867eb782cf7f64c2ac427596133b6f9c3f64b7a upstream.
Apply make_spte()'s optimization to skip trying to unsync shadow pages if and only if the old SPTE was a leaf SPTE, as non-leaf SPTEs in direct MMUs are always writable, i.e. could trigger a false positive and incorrectly lead to KVM creating a SPTE without write-protecting or marking shadow pages unsync.
This bug only affects the TDP MMU, as the shadow MMU only overwrites a shadow-present SPTE when synchronizing SPTEs (and only 4KiB SPTEs can be unsync). Specifically, mmu_set_spte() drops any non-leaf SPTEs *before* calling make_spte(), whereas the TDP MMU can do a direct replacement of a page table with the leaf SPTE.
Opportunistically update the comment to explain why skipping the unsync stuff is safe, as opposed to simply saying "it's someone else's problem".
Message-ID: <[email protected]>
--- arch/x86/kvm/mmu/spte.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
arch/x86/kvm/mmu/spte.c +13 -5
@@ -226,12 +226,20 @@ bool make_spte(struct kvm_vcpu *vcpu, st spte |=PT_WRITABLE_MASK | shadow_mmu_writable_mask;/* -* Optimization: for pte sync, if spte was writable the hash -* lookup is unnecessary (and expensive). Write protection -* is responsibility of kvm_mmu_get_page / kvm_mmu_sync_roots. -* Same reasoning can be applied to dirty page accounting. +* When overwriting an existing leaf SPTE, and the old SPTE was +* writable, skip trying to unsync shadow pages as any relevant +* shadow pages must already be unsync, i.e. the hash lookup is +* unnecessary (and expensive). +* +* The same reasoning applies to dirty page/folio accounting; +* KVM will mark the folio dirty using the old SPTE, thus +* there's no need to immediately mark the new SPTE as dirty. +* +* Note, both cases rely on KVM not changing PFNs without first +* zapping the old SPTE, which is guaranteed by both the shadow +* MMU and the TDP MMU. */ -if (is_writable_pte (old_spte)) +if (is_last_spte (old_spte, level) &&is_writable_pte (old_spte)) goto out;/*
Greg Kroah-Hartman
maintainerPATCH 642/826 KVM: x86: add back X86_LOCAL_APIC dependency
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 1331343af6f502aecd274d522dd34bf7c965f484 upstream.
Enabling KVM now causes a build failure on x86-32 if X86_LOCAL_APIC is disabled:
arch/x86/kvm/svm/svm.c: In function 'svm_emergency_disable_virtualization_cpu':arch/x86/kvm/svm/svm.c:597:9: error: 'kvm_rebooting' undeclared (first use in this function); did you mean 'kvm_irq_routing'?
597 | kvm_rebooting = true;
| ^~~~~~~~~~~~~
| kvm_irq_routing
arch/x86/kvm/svm/svm.c:597:9: note: each undeclared identifier is reported only once for each function it appears in
make[6]: *** [scripts/Makefile.build:221: arch/x86/kvm/svm/svm.o] Error 1
In file included from include/linux/rculist.h:11,
from include/linux/hashtable.h:14,
from arch/x86/kvm/svm/avic.c:18:arch/x86/kvm/svm/avic.c: In function 'avic_pi_update_irte':arch/x86/kvm/svm/avic.c:909:38: error: 'struct kvm' has no member named 'irq_routing'
909 | irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
| ^~include/linux/rcupdate.h:538:17: note: in definition of macro '__rcu_dereference_check'
538 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
Move the dependency to the same place as before.
Message-ID: <[email protected]>
--- arch/x86/kvm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/Kconfig +1 -1
@@ -19,7 +19,6 @@ if VIRTUALIZATION config KVM_X86 def_tristate KVM if KVM_INTEL || KVM_AMD - depends on X86_LOCAL_APIC select KVM_COMMON select KVM_GENERIC_MMU_NOTIFIER select HAVE_KVM_IRQCHIP
@@ -50,6 +49,7 @@ config KVM_X86 config KVM tristate "Kernel-based Virtual Machine (KVM) support" + depends on X86_LOCAL_APIC help Support hosting fully virtualized guest machines using hardware virtualization extensions. You will need a fairly recent
Greg Kroah-Hartman
maintainerPATCH 643/826 KVM: x86: Break CONFIG_KVM_X86s direct dependency on KVM_INTEL || KVM_AMD
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 9ee62c33c0fe017ee02501a877f6f562363122fa upstream.
Rework CONFIG_KVM_X86's dependency to only check if KVM_INTEL or KVM_AMD is selected, i.e. not 'n'. Having KVM_X86 depend directly on the vendor modules results in KVM_X86 being set to 'm' if at least one of KVM_INTEL or KVM_AMD is enabled, but neither is 'y', regardless of the value of KVM itself.
The documentation for def_tristate doesn't explicitly state that this is the intended behavior, but it does clearly state that the "if" section is parsed as a dependency, i.e. the behavior is consistent with how tristate dependencies are handled in general.
Optionally dependencies for this default value can be added with "if".
Message-ID: <[email protected]>
--- arch/x86/kvm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/Kconfig +1 -1
@@ -18,7 +18,7 @@ menuconfig VIRTUALIZATION if VIRTUALIZATION config KVM_X86 - def_tristate KVM if KVM_INTEL || KVM_AMD + def_tristate KVM if (KVM_INTEL != n || KVM_AMD != n) select KVM_COMMON select KVM_GENERIC_MMU_NOTIFIER select HAVE_KVM_IRQCHIP
Greg Kroah-Hartman
maintainerPATCH 644/826 powerpc/pseries: Fix KVM guest detection for disabling hardlockup detector
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gautam Menghani <[email protected]>
commit 44e5d21e6d3fd2a1fed7f0327cf72e99397e2eaf upstream.
As per the kernel documentation[1], hardlockup detector should be disabled in KVM guests as it may give false positives. On PPC, hardlockup detector is enabled inside KVM guests because disable_hardlockup_detector() is marked as early_initcall and it relies on kvm_guest static key (is_kvm_guest()) which is initialized later during boot by check_kvm_guest(), which is a core_initcall. check_kvm_guest() is also called in pSeries_smp_probe(), which is called before initcalls, but it is skipped if KVM guest does not have doorbell support or if the guest is launched with SMT=1.
Call check_kvm_guest() in disable_hardlockup_detector() so that is_kvm_guest() check goes through fine and hardlockup detector can be disabled inside the KVM guest.
[1]: Documentation/admin-guide/sysctl/kernel.rst
--- arch/powerpc/kernel/setup_64.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kernel/setup_64.c +1 -0
@@ -920,6 +920,7 @@ static int __init disable_hardlockup_dethardlockup_detector_disable ();#else if (firmware_has_feature (FW_FEATURE_LPAR )) { +check_kvm_guest ();if (is_kvm_guest ())hardlockup_detector_disable (); }
Greg Kroah-Hartman
maintainerPATCH 645/826 KVM: arm64: vgic-v3: Sanitise guest writes to GICR_INVLPIR
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit d561491ba927cb5634094ff311795e9d618e9b86 upstream.
Make sure we filter out non-LPI invalidation when handling writes to GICR_INVLPIR.
--- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm64/kvm/vgic/vgic-mmio-v3.c +6 -1
@@ -530,6 +530,7 @@ static void vgic_mmio_write_invlpi(struc unsigned long val) {struct vgic_irq *irq; +u32 intid;/* * If the guest wrote only to the upper 32bit part of the
@@ -541,9 +542,13 @@ static void vgic_mmio_write_invlpi(strucif ((addr &4 ) || !vgic_lpis_enabled (vcpu))return ; + intid =lower_32_bits (val); +if (intid <VGIC_MIN_LPI ) +return ; +vgic_set_rdist_busy (vcpu, true); - irq =vgic_get_irq (vcpu->kvm,NULL ,lower_32_bits (val)); + irq =vgic_get_irq (vcpu->kvm,NULL , intid);if (irq) {vgic_its_inv_lpi (vcpu->kvm, irq);vgic_put_irq (vcpu->kvm, irq);
Greg Kroah-Hartman
maintainerPATCH 646/826 KVM: arm64: Ignore PMCNTENSET_EL0 while checking for overflow status
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Raghavendra Rao Ananta <[email protected]>
commit 54bbee190d42166209185d89070c58a343bf514b upstream.
DDI0487K.a D13.3.1 describes the PMU overflow condition, which evaluates to true if any counter's global enable (PMCR_EL0.E), overflow flag (PMOVSSET_EL0[n]), and interrupt enable (PMINTENSET_EL1[n]) are all 1. Of note, this does not require a counter to be enabled
(i.e. PMCNTENSET_EL0[n] = 1) to generate an overflow.
Align kvm_pmu_overflow_status() with the reality of the architecture and stop using PMCNTENSET_EL0 as part of the overflow condition. The bug was discovered while running an SBSA PMU test [*], which only sets PMCR.E, PMOVSSET<0>, PMINTENSET<0>, and expects an overflow interrupt.
--- arch/arm64/kvm/pmu-emul.c | 1 - 1 file changed, 1 deletion(-)
arch/arm64/kvm/pmu-emul.c +0 -1
@@ -342,7 +342,6 @@ static u64 kvm_pmu_overflow_status(strucif ((kvm_vcpu_read_pmcr (vcpu) &ARMV8_PMU_PMCR_E )) { reg =__vcpu_sys_reg (vcpu,PMOVSSET_EL0 ); - reg &=__vcpu_sys_reg (vcpu,PMCNTENSET_EL0 ); reg &=__vcpu_sys_reg (vcpu,PMINTENSET_EL1 ); }
Greg Kroah-Hartman
maintainerPATCH 647/826 Revert "KVM: VMX: Move LOAD_IA32_PERF_GLOBAL_CTRL errata handling out of setup_vmcs_config()"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 85434c3c73fcad58870016ddfe5eaa5036672675 upstream.
Revert back to clearing VM_{ENTRY,EXIT}_LOAD_IA32_PERF_GLOBAL_CTRL in KVM's golden VMCS config, as applying the workaround during vCPU creation is pointless and broken. KVM *unconditionally* clears the controls in the values returned by vmx_vmentry_ctrl() and vmx_vmexit_ctrl(), as KVM loads PERF_GLOBAL_CTRL if and only if its necessary to do so. E.g. if KVM wants to run the guest with the same PERF_GLOBAL_CTRL as the host, then there's no need to re-load the MSR on entry and exit.
Even worse, the buggy commit failed to apply the erratum where it's actually needed, add_atomic_switch_msr(). As a result, KVM completely ignores the erratum for all intents and purposes, i.e. uses the flawed VMCS controls to load PERF_GLOBAL_CTRL.
To top things off, the patch was intended to be dropped, as the premise of an L1 VMM being able to pivot on FMS is flawed, and KVM can (and now does) fully emulate the controls in software. Simply revert the commit, as all upstream supported kernels that have the buggy commit should also have commit f4c93d1a0e71 ("KVM: nVMX: Always emulate PERF_GLOBAL_CTRL VM-Entry/VM-Exit controls"), i.e. the (likely theoretical) live migration concern is a complete non-issue.
Opportunistically drop the manual "kvm: " scope from the warning about the erratum, as KVM now uses pr_fmt() to provide the correct scope (v6.1 kernels and earlier don't, but the erratum only applies to CPUs that are 15+ years old; it's not worth a separate patch).
This reverts commit 9d78d6fb186bc4aff41b5d6c4726b76649d3cb53.
Message-ID: <[email protected]>
--- arch/x86/kvm/vmx/vmx.c | 54 +++++++++++++++++++------------------------------ 1 file changed, 21 insertions(+), 33 deletions(-)
arch/x86/kvm/vmx/vmx.c +21 -33
@@ -2551,28 +2551,6 @@ static bool cpu_has_sgx(void)return cpuid_eax (0 ) >=0x12 && (cpuid_eax (0x12 ) &BIT (0 )); } -/* -* Some cpus support VM_{ENTRY,EXIT}_IA32_PERF_GLOBAL_CTRL but they -* can't be used due to errata where VM Exit may incorrectly clear -* IA32_PERF_GLOBAL_CTRL[34:32]. Work around the errata by using the -* MSR load mechanism to switch IA32_PERF_GLOBAL_CTRL. -*/ -static bool cpu_has_perf_global_ctrl_bug (void ) -{ -switch (boot_cpu_data.x86_vfm) { -case INTEL_NEHALEM_EP :/* AAK155 */ -case INTEL_NEHALEM :/* AAP115 */ -case INTEL_WESTMERE :/* AAT100 */ -case INTEL_WESTMERE_EP :/* BC86,AAY89,BD102 */ -case INTEL_NEHALEM_EX :/* BA97 */ -return true; -default : -break ; - } - -return false; -} -static int adjust_vmx_controls (u32 ctl_min,u32 ctl_opt,u32 msr,u32 *result) {u32 vmx_msr_low, vmx_msr_high;
@@ -2732,6 +2710,27 @@ static int setup_vmcs_config(struct vmcs _vmexit_control &= ~x_ctrl; } +/* +* Some cpus support VM_{ENTRY,EXIT}_IA32_PERF_GLOBAL_CTRL but they +* can't be used due to an errata where VM Exit may incorrectly clear +* IA32_PERF_GLOBAL_CTRL[34:32]. Workaround the errata by using the +* MSR load mechanism to switch IA32_PERF_GLOBAL_CTRL. +*/ +switch (boot_cpu_data.x86_vfm) { +case INTEL_NEHALEM_EP :/* AAK155 */ +case INTEL_NEHALEM :/* AAP115 */ +case INTEL_WESTMERE :/* AAT100 */ +case INTEL_WESTMERE_EP :/* BC86,AAY89,BD102 */ +case INTEL_NEHALEM_EX :/* BA97 */ + _vmentry_control &= ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL ; + _vmexit_control &= ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL ; +pr_warn_once ("VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL " +"does not work properly. Using workaround\n" ); +break ; +default : +break ; + } +rdmsrl (MSR_IA32_VMX_BASIC , basic_msr);/* IA-32 SDM Vol 3B: VMCS size is never greater than 4kB. */
@@ -4422,9 +4421,6 @@ static u32 vmx_vmentry_ctrl(void)VM_ENTRY_LOAD_IA32_EFER | VM_ENTRY_IA32E_MODE); -if (cpu_has_perf_global_ctrl_bug ()) - vmentry_ctrl &= ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL ; -return vmentry_ctrl; }
@@ -4442,10 +4438,6 @@ static u32 vmx_vmexit_ctrl(void)if (vmx_pt_mode_is_system ()) vmexit_ctrl &= ~(VM_EXIT_PT_CONCEAL_PIP |VM_EXIT_CLEAR_IA32_RTIT_CTL ); - -if (cpu_has_perf_global_ctrl_bug ()) - vmexit_ctrl &= ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL ; -/* Loading of EFER and PERF_GLOBAL_CTRL are toggled dynamically */ return vmexit_ctrl & ~(VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL |VM_EXIT_LOAD_IA32_EFER );
@@ -8400,10 +8392,6 @@ __init int vmx_hardware_setup(void)if (setup_vmcs_config (&vmcs_config, &vmx_capability) <0 )return -EIO ; -if (cpu_has_perf_global_ctrl_bug ()) -pr_warn_once ("VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL " -"does not work properly. Using workaround\n" ); -if (boot_cpu_has (X86_FEATURE_NX ))kvm_enable_efer_bits (EFER_NX );
Greg Kroah-Hartman
maintainerPATCH 648/826 KVM: arm64: Dont retire aborted MMIO instruction
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Upton <[email protected]>
commit e735a5da64420a86be370b216c269b5dd8e830e2 upstream.
Returning an abort to the guest for an unsupported MMIO access is a documented feature of the KVM UAPI. Nevertheless, it's clear that this plumbing has seen limited testing, since userspace can trivially cause a WARN in the MMIO return:
WARNING: CPU: 0 PID: 30558 at arch/arm64/include/asm/kvm_emulate.h:536 kvm_handle_mmio_return+0x46c/0x5c4 arch/arm64/include/asm/kvm_emulate.h:536 Call trace: kvm_handle_mmio_return+0x46c/0x5c4 arch/arm64/include/asm/kvm_emulate.h:536 kvm_arch_vcpu_ioctl_run+0x98/0x15b4 arch/arm64/kvm/arm.c:1133 kvm_vcpu_ioctl+0x75c/0xa78 virt/kvm/kvm_main.c:4487 __do_sys_ioctl fs/ioctl.c:51 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:893 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x1e0/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x38/0x68 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x90/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598
The splat is complaining that KVM is advancing PC while an exception is pending, i.e. that KVM is retiring the MMIO instruction despite a pending synchronous external abort. Womp womp.
Fix the glaring UAPI bug by skipping over all the MMIO emulation in case there is a pending synchronous exception. Note that while userspace is capable of pending an asynchronous exception (SError, IRQ, or FIQ), it is still safe to retire the MMIO instruction in this case as (1) they are by definition asynchronous, and (2) KVM relies on hardware support for pending/delivering these exceptions instead of the software state machine for advancing PC.
--- arch/arm64/kvm/mmio.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-)
arch/arm64/kvm/mmio.c +30 -2
@@ -72,6 +72,31 @@ unsigned long kvm_mmio_read_buf(const voreturn data; } +static bool kvm_pending_sync_exception (struct kvm_vcpu *vcpu) +{ +if (!vcpu_get_flag (vcpu,PENDING_EXCEPTION )) +return false; + +if (vcpu_el1_is_32bit (vcpu)) { +switch (vcpu_get_flag (vcpu,EXCEPT_MASK )) { +case unpack_vcpu_flag (EXCEPT_AA32_UND ): +case unpack_vcpu_flag (EXCEPT_AA32_IABT ): +case unpack_vcpu_flag (EXCEPT_AA32_DABT ): +return true; +default : +return false; + } + }else { +switch (vcpu_get_flag (vcpu,EXCEPT_MASK )) { +case unpack_vcpu_flag (EXCEPT_AA64_EL1_SYNC ): +case unpack_vcpu_flag (EXCEPT_AA64_EL2_SYNC ): +return true; +default : +return false; + } + } +} +/** * kvm_handle_mmio_return -- Handle MMIO loads after user space emulation * or in-kernel IO emulation
@@ -84,8 +109,11 @@ int kvm_handle_mmio_return(struct kvm_vcunsigned int len;int mask; -/* Detect an already handled MMIO return */ -if (unlikely (!vcpu->mmio_needed)) +/* +* Detect if the MMIO return was already handled or if userspace aborted +* the MMIO access. +*/ +if (unlikely (!vcpu->mmio_needed ||kvm_pending_sync_exception (vcpu)))return 1 ; vcpu->mmio_needed =0 ;
Greg Kroah-Hartman
maintainerPATCH 649/826 KVM: arm64: vgic-its: Clear ITE when DISCARD frees an ITE
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunkun Jiang <[email protected]>
commit 7602ffd1d5e8927fadd5187cb4aed2fdc9c47143 upstream.
When DISCARD frees an ITE, it does not invalidate the corresponding ITE. In the scenario of continuous saves and restores, there may be a situation where an ITE is not saved but is restored. This is unreasonable and may cause restore to fail. This patch clears the corresponding ITE when DISCARD frees an ITE.
--- arch/arm64/kvm/vgic/vgic-its.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/kvm/vgic/vgic-its.c +5 -1
@@ -782,6 +782,9 @@ static int vgic_its_cmd_handle_discard(s ite =find_ite (its, device_id, event_id);if (ite &&its_is_collection_mapped (ite->collection)) { +struct its_device *device =find_its_device (its, device_id); +int ite_esz =vgic_its_get_abi (its)->ite_esz; +gpa_t gpa = device->itt_addr + ite->event_id * ite_esz;/* * Though the spec talks about removing the pending state, we * don't bother here since we clear the ITTE anyway and the
@@ -790,7 +793,8 @@ static int vgic_its_cmd_handle_discard(svgic_its_invalidate_cache (its);its_free_ite (kvm, ite); -return 0 ; + +return vgic_its_write_entry_lock (its, gpa,0 , ite_esz); }return E_ITS_DISCARD_UNMAPPED_INTERRUPT ;
Greg Kroah-Hartman
maintainerPATCH 650/826 KVM: arm64: Get rid of userspace_irqchip_in_use
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Raghavendra Rao Ananta <[email protected]>
commit 38d7aacca09230fdb98a34194fec2af597e8e20d upstream.
Improper use of userspace_irqchip_in_use led to syzbot hitting the following WARN_ON() in kvm_timer_update_irq():
WARNING: CPU: 0 PID: 3281 at arch/arm64/kvm/arch_timer.c:459 kvm_timer_update_irq+0x21c/0x394 Call trace: kvm_timer_update_irq+0x21c/0x394 arch/arm64/kvm/arch_timer.c:459 kvm_timer_vcpu_reset+0x158/0x684 arch/arm64/kvm/arch_timer.c:968 kvm_reset_vcpu+0x3b4/0x560 arch/arm64/kvm/reset.c:264 kvm_vcpu_set_target arch/arm64/kvm/arm.c:1553 [inline] kvm_arch_vcpu_ioctl_vcpu_init arch/arm64/kvm/arm.c:1573 [inline] kvm_arch_vcpu_ioctl+0x112c/0x1b3c arch/arm64/kvm/arm.c:1695 kvm_vcpu_ioctl+0x4ec/0xf74 virt/kvm/kvm_main.c:4658 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __arm64_sys_ioctl+0x108/0x184 fs/ioctl.c:893 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x78/0x1b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0xe8/0x1b0 arch/arm64/kernel/syscall.c:132 do_el0_svc+0x40/0x50 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x14c arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598
The following sequence led to the scenario:
- Userspace creates a VM and a vCPU.
- The vCPU is initialized with KVM_ARM_VCPU_PMU_V3 during KVM_ARM_VCPU_INIT.
- Without any other setup, such as vGIC or vPMU, userspace issues KVM_RUN on the vCPU. Since the vPMU is requested, but not setup, kvm_arm_pmu_v3_enable() fails in kvm_arch_vcpu_run_pid_change(). As a result, KVM_RUN returns after enabling the timer, but before incrementing 'userspace_irqchip_in_use':
kvm_arch_vcpu_run_pid_change()
ret = kvm_arm_pmu_v3_enable()
if (!vcpu->arch.pmu.created)
return -EINVAL;
if (ret)
return ret;
[...]
if (!irqchip_in_kernel(kvm))
static_branch_inc(&userspace_irqchip_in_use);
- Userspace ignores the error and issues KVM_ARM_VCPU_INIT again.
Since the timer is already enabled, control moves through the
following flow, ultimately hitting the WARN_ON():
kvm_timer_vcpu_reset()
if (timer->enabled)
kvm_timer_update_irq()
if (!userspace_irqchip())
ret = kvm_vgic_inject_irq()
ret = vgic_lazy_init()
if (unlikely(!vgic_initialized(kvm)))
if (kvm->arch.vgic.vgic_model !=
KVM_DEV_TYPE_ARM_VGIC_V2)
return -EBUSY;
WARN_ON(ret);Theoretically, since userspace_irqchip_in_use's functionality can be simply replaced by '!irqchip_in_kernel()', get rid of the static key to avoid the mismanagement, which also helps with the syzbot issue.
--- arch/arm64/include/asm/kvm_host.h | 2 -- arch/arm64/kvm/arch_timer.c | 3 +-- arch/arm64/kvm/arm.c | 18 +++--------------- 3 files changed, 4 insertions(+), 19 deletions(-)
arch/arm64/include/asm/kvm_host.h +0 -2
@@ -74,8 +74,6 @@ enum kvm_mode kvm_get_mode(void);static inline enum kvm_mode kvm_get_mode (void ) {return KVM_MODE_NONE ; };#endif -DECLARE_STATIC_KEY_FALSE (userspace_irqchip_in_use); -extern unsigned int __ro_after_init kvm_sve_max_vl;extern unsigned int __ro_after_init kvm_host_sve_max_vl;int __init kvm_arm_init_sve (void );
arch/arm64/kvm/arch_timer.c +1 -2
@@ -206,8 +206,7 @@ void get_timer_map(struct kvm_vcpu *vcpustatic inline bool userspace_irqchip (struct kvm *kvm) { -return static_branch_unlikely (&userspace_irqchip_in_use) && -unlikely (!irqchip_in_kernel (kvm)); +return unlikely (!irqchip_in_kernel (kvm)); }static void soft_timer_start (struct hrtimer *hrt,u64 ns)
arch/arm64/kvm/arm.c +3 -15
@@ -69,7 +69,6 @@ DECLARE_KVM_NVHE_PER_CPU(struct kvm_cpu_static bool vgic_present, kvm_arm_initialised; static DEFINE_PER_CPU(unsigned char, kvm_hyp_initialized); -DEFINE_STATIC_KEY_FALSE (userspace_irqchip_in_use);bool is_kvm_arm_initialised (void ) {
@@ -503,9 +502,6 @@ void kvm_arch_vcpu_postcreate(struct kvmvoid kvm_arch_vcpu_destroy (struct kvm_vcpu *vcpu) { -if (vcpu_has_run_once (vcpu) &&unlikely (!irqchip_in_kernel (vcpu->kvm))) -static_branch_dec (&userspace_irqchip_in_use); -kvm_mmu_free_memory_cache (&vcpu->arch.mmu_page_cache);kvm_timer_vcpu_terminate (vcpu);kvm_pmu_vcpu_destroy (vcpu);
@@ -848,14 +844,6 @@ int kvm_arch_vcpu_run_pid_change(structreturn ret; } -if (!irqchip_in_kernel (kvm)) { -/* -* Tell the rest of the code that there are userspace irqchip -* VMs in the wild. -*/ -static_branch_inc (&userspace_irqchip_in_use); - } -/* * Initialize traps for protected VMs. * NOTE: Move to run in EL2 directly, rather than via a hypercall, once
@@ -1077,7 +1065,7 @@ static bool kvm_vcpu_exit_request(struct* state gets updated in kvm_timer_update_run and * kvm_pmu_update_run below). */ -if (static_branch_unlikely (&userspace_irqchip_in_use)) { +if (unlikely (!irqchip_in_kernel (vcpu->kvm))) {if (kvm_timer_should_notify_user (vcpu) ||kvm_pmu_should_notify_user (vcpu)) { *ret = -EINTR ;
@@ -1199,7 +1187,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_v vcpu->mode =OUTSIDE_GUEST_MODE ;isb ();/* Ensure work in x_flush_hwstate is committed */ kvm_pmu_sync_hwstate (vcpu); -if (static_branch_unlikely (&userspace_irqchip_in_use)) +if (unlikely (!irqchip_in_kernel (vcpu->kvm)))kvm_timer_sync_user (vcpu);kvm_vgic_sync_hwstate (vcpu);local_irq_enable ();
@@ -1245,7 +1233,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_v* we don't want vtimer interrupts to race with syncing the * timer virtual interrupt state. */ -if (static_branch_unlikely (&userspace_irqchip_in_use)) +if (unlikely (!irqchip_in_kernel (vcpu->kvm)))kvm_timer_sync_user (vcpu);kvm_arch_vcpu_ctxsync_fp (vcpu);
Greg Kroah-Hartman
maintainerPATCH 651/826 KVM: arm64: vgic-its: Add a data length check in vgic_its_save_*
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jing Zhang <[email protected]>
commit 7fe28d7e68f92cc3d0668b8f2fbdf5c303ac3022 upstream.
In all the vgic_its_save_*() functinos, they do not check whether the data length is 8 bytes before calling vgic_write_guest_lock. This patch adds the check. To prevent the kernel from being blown up when the fault occurs, KVM_BUG_ON() is used. And the other BUG_ON()s are replaced together.
--- arch/arm64/kvm/vgic/vgic-its.c | 20 ++++++++------------ arch/arm64/kvm/vgic/vgic.h | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 12 deletions(-)
arch/arm64/kvm/vgic/vgic-its.c +8 -12
@@ -2090,7 +2090,6 @@ static int scan_its_table(struct vgic_itstatic int vgic_its_save_ite (struct vgic_its *its,struct its_device *dev,struct its_ite *ite,gpa_t gpa,int ite_esz) { -struct kvm *kvm = its->dev->kvm;u32 next_offset;u64 val;
@@ -2099,7 +2098,8 @@ static int vgic_its_save_ite(struct vgic ((u64 )ite->irq->intid <<KVM_ITS_ITE_PINTID_SHIFT ) | ite->collection->collection_id; val =cpu_to_le64 (val); -return vgic_write_guest_lock (kvm, gpa, &val, ite_esz); + +return vgic_its_write_entry_lock (its, gpa, val, ite_esz); }/**
@@ -2243,7 +2243,6 @@ static int vgic_its_restore_itt(struct vstatic int vgic_its_save_dte (struct vgic_its *its,struct its_device *dev,gpa_t ptr,int dte_esz) { -struct kvm *kvm = its->dev->kvm;u64 val, itt_addr_field;u32 next_offset;
@@ -2254,7 +2253,8 @@ static int vgic_its_save_dte(struct vgic (itt_addr_field <<KVM_ITS_DTE_ITTADDR_SHIFT ) | (dev->num_eventid_bits - 1)); val =cpu_to_le64 (val); -return vgic_write_guest_lock (kvm, ptr, &val, dte_esz); + +return vgic_its_write_entry_lock (its, ptr, val, dte_esz); }/**
@@ -2441,7 +2441,8 @@ static int vgic_its_save_cte(struct vgic ((u64 )collection->target_addr <<KVM_ITS_CTE_RDBASE_SHIFT ) | collection->collection_id); val =cpu_to_le64 (val); -return vgic_write_guest_lock (its->dev->kvm, gpa, &val, esz); + +return vgic_its_write_entry_lock (its, gpa, val, esz); }/*
@@ -2457,8 +2458,7 @@ static int vgic_its_restore_cte(struct vu64 val;int ret; -BUG_ON (esz >sizeof (val)); - ret =kvm_read_guest_lock (kvm, gpa, &val, esz); + ret =vgic_its_read_entry_lock (its, gpa, &val, esz);if (ret)return ret; val =le64_to_cpu (val);
@@ -2496,7 +2496,6 @@ static int vgic_its_save_collection_tablu64 baser = its->baser_coll_table;gpa_t gpa =GITS_BASER_ADDR_48_to_52 (baser);struct its_collection *collection; -u64 val;size_t max_size, filled =0 ;int ret, cte_esz = abi->cte_esz;
@@ -2520,10 +2519,7 @@ static int vgic_its_save_collection_tabl* table is not fully filled, add a last dummy element * with valid bit unset */ - val =0 ; -BUG_ON (cte_esz >sizeof (val)); - ret =vgic_write_guest_lock (its->dev->kvm, gpa, &val, cte_esz); -return ret; +return vgic_its_write_entry_lock (its, gpa,0 , cte_esz); }/*
arch/arm64/kvm/vgic/vgic.h +23 -0
@@ -146,6 +146,29 @@ static inline int vgic_write_guest_lock(return ret; } +static inline int vgic_its_read_entry_lock (struct vgic_its *its,gpa_t eaddr, +u64 *eval,unsigned long esize) +{ +struct kvm *kvm = its->dev->kvm; + +if (KVM_BUG_ON (esize !=sizeof (*eval), kvm)) +return -EINVAL ; + +return kvm_read_guest_lock (kvm, eaddr, eval, esize); + +} + +static inline int vgic_its_write_entry_lock (struct vgic_its *its,gpa_t eaddr, +u64 eval,unsigned long esize) +{ +struct kvm *kvm = its->dev->kvm; + +if (KVM_BUG_ON (esize !=sizeof (eval), kvm)) +return -EINVAL ; + +return vgic_write_guest_lock (kvm, eaddr, &eval, esize); +} +/* * This struct provides an intermediate representation of the fields contained * in the GICH_VMCR and ICH_VMCR registers, such that code exporting the GIC
Greg Kroah-Hartman
maintainerPATCH 652/826 KVM: arm64: vgic-its: Clear DTE when MAPD unmaps a device
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunkun Jiang <[email protected]>
commit e9649129d33dca561305fc590a7c4ba8c3e5675a upstream.
vgic_its_save_device_tables will traverse its->device_list to save DTE for each device. vgic_its_restore_device_tables will traverse each entry of device table and check if it is valid. Restore if valid.
But when MAPD unmaps a device, it does not invalidate the corresponding DTE. In the scenario of continuous saves and restores, there may be a situation where a device's DTE is not saved but is restored. This is unreasonable and may cause restore to fail. This patch clears the corresponding DTE when MAPD unmaps a device.
--- arch/arm64/kvm/vgic/vgic-its.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/kvm/vgic/vgic-its.c +4 -2
@@ -1143,9 +1143,11 @@ static int vgic_its_cmd_handle_mapd(strubool valid =its_cmd_get_validbit (its_cmd);u8 num_eventid_bits =its_cmd_get_size (its_cmd);gpa_t itt_addr =its_cmd_get_ittaddr (its_cmd); +int dte_esz =vgic_its_get_abi (its)->dte_esz;struct its_device *device; +gpa_t gpa; -if (!vgic_its_check_id (its, its->baser_device_table, device_id,NULL )) +if (!vgic_its_check_id (its, its->baser_device_table, device_id, &gpa))return E_ITS_MAPD_DEVICE_OOR ;if (valid && num_eventid_bits >VITS_TYPER_IDBITS )
@@ -1166,7 +1168,7 @@ static int vgic_its_cmd_handle_mapd(stru* is an error, so we are done in any case. */ if (!valid) -return 0 ; +return vgic_its_write_entry_lock (its, gpa,0 , dte_esz); device =vgic_its_alloc_device (its, device_id, itt_addr, num_eventid_bits);
Greg Kroah-Hartman
maintainerPATCH 653/826 Compiler Attributes: disable __counted_by for clang < 19.1.3
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Hendrik Farr <[email protected]>
commit f06e108a3dc53c0f5234d18de0bd224753db5019 upstream.
This patch disables __counted_by for clang versions < 19.1.3 because of the two issues listed below. It does this by introducing CONFIG_CC_HAS_COUNTED_BY.
1. clang < 19.1.2 has a bug that can lead to __bdos returning 0:
https://github.com/llvm/llvm-project/pull/110497
2. clang < 19.1.3 has a bug that can lead to __bdos being off by 4:
https://github.com/llvm/llvm-project/pull/112636
--- drivers/misc/lkdtm/bugs.c | 2 +- include/linux/compiler_attributes.h | 13 ------------- include/linux/compiler_types.h | 19 +++++++++++++++++++ init/Kconfig | 9 +++++++++ lib/overflow_kunit.c | 2 +- 5 files changed, 30 insertions(+), 15 deletions(-)
drivers/misc/lkdtm/bugs.c +1 -1
@@ -445,7 +445,7 @@ static void lkdtm_FAM_BOUNDS(void)pr_err ("FAIL: survived access of invalid flexible array member index!\n" ); -if (!__has_attribute (__counted_by__)) +if (!IS_ENABLED (CONFIG_CC_HAS_COUNTED_BY ))pr_warn ("This is expected since this %s was built with a compiler that does not support __counted_by\n" , lkdtm_kernel_info);else if (IS_ENABLED (CONFIG_UBSAN_BOUNDS ))
include/linux/compiler_attributes.h +0 -13
@@ -95,19 +95,6 @@#endif /* -* Optional: only supported since gcc >= 15 -* Optional: only supported since clang >= 18 -* -* gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896 -* clang: https://github.com/llvm/llvm-project/pull/76348 -*/ -#if __has_attribute (__counted_by__) -# define __counted_by (member) __attribute__((__counted_by__(member))) -#else -# define __counted_by (member) -#endif - -/* * Optional: not supported by gcc * Optional: only supported since clang >= 14.0 *
include/linux/compiler_types.h +19 -0
@@ -324,6 +324,25 @@ struct ftrace_likely_data {#endif /* +* Optional: only supported since gcc >= 15 +* Optional: only supported since clang >= 18 +* +* gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896 +* clang: https://github.com/llvm/llvm-project/pull/76348 +* +* __bdos on clang < 19.1.2 can erroneously return 0: +* https://github.com/llvm/llvm-project/pull/110497 +* +* __bdos on clang < 19.1.3 can be off by 4: +* https://github.com/llvm/llvm-project/pull/112636 +*/ +#ifdef CONFIG_CC_HAS_COUNTED_BY +# define __counted_by (member) __attribute__((__counted_by__(member))) +#else +# define __counted_by (member) +#endif + +/* * Apply __counted_by() when the Endianness matches to increase test coverage. */ #ifdef __LITTLE_ENDIAN
init/Kconfig +9 -0
@@ -120,6 +120,15 @@ config CC_HAS_ASM_INLINE config CC_HAS_NO_PROFILE_FN_ATTR def_bool $(success,echo '__attribute__((no_profile_instrument_function)) int x();' | $(CC) -x c - -c -o /dev/null -Werror) +config CC_HAS_COUNTED_BY + # TODO: when gcc 15 is released remove the build test and add + # a gcc version check + def_bool $(success,echo 'struct flex { int count; int array[] __attribute__((__counted_by__(count))); };' | $(CC) $(CLANG_FLAGS) -x c - -c -o /dev/null -Werror) + # clang needs to be at least 19.1.3 to avoid __bdos miscalculations + # https://github.com/llvm/llvm-project/pull/110497 + # https://github.com/llvm/llvm-project/pull/112636 + depends on !(CC_IS_CLANG && CLANG_VERSION < 190103) + config PAHOLE_VERSION int default $(shell,$(srctree)/scripts/pahole-version.sh $(PAHOLE))
lib/overflow_kunit.c +1 -1
@@ -1187,7 +1187,7 @@ static void DEFINE_FLEX_test(struct kuni {/* Using _RAW_ on a __counted_by struct will initialize "counter" to zero */ DEFINE_RAW_FLEX(struct foo, two_but_zero, array, 2); -#if __has_attribute (__counted_by__) +#ifdef CONFIG_CC_HAS_COUNTED_BY int expected_raw_size =sizeof (struct foo );#else int expected_raw_size =sizeof (struct foo ) +2 *sizeof (s16);
Greg Kroah-Hartman
maintainerPATCH 654/826 PCI: Fix use-after-free of slot->bus on hot remove
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
commit c7acef99642b763ba585f4a43af999fcdbcc3dc4 upstream.
Dennis reports a boot crash on recent Lenovo laptops with a USB4 dock.
Since commit 0fc70886569c ("thunderbolt: Reset USB4 v2 host router") and commit 59a54c5f3dbd ("thunderbolt: Reset topology created by the boot firmware"), USB4 v2 and v1 Host Routers are reset on probe of the thunderbolt driver.
The reset clears the Presence Detect State and Data Link Layer Link Active bits at the USB4 Host Router's Root Port and thus causes hot removal of the dock.
The crash occurs when pciehp is unbound from one of the dock's Downstream
Ports: pciehp creates a pci_slot on bind and destroys it on unbind. The pci_slot contains a pointer to the pci_bus below the Downstream Port, but a reference on that pci_bus is never acquired. The pci_bus is destroyed before the pci_slot, so a use-after-free ensues when pci_slot_release() accesses slot->bus.
In principle this should not happen because pci_stop_bus_device() unbinds pciehp (and therefore destroys the pci_slot) before the pci_bus is destroyed by pci_remove_bus_device().
However the stacktrace provided by Dennis shows that pciehp is unbound from pci_remove_bus_device() instead of pci_stop_bus_device(). To understand the significance of this, one needs to know that the PCI core uses a two step process to remove a portion of the hierarchy: It first unbinds all drivers in the sub-hierarchy in pci_stop_bus_device() and then actually removes the devices in pci_remove_bus_device(). There is no precaution to prevent driver binding in-between pci_stop_bus_device() and pci_remove_bus_device().
In Dennis' case, it seems removal of the hierarchy by pciehp races with driver binding by pci_bus_add_devices(). pciehp is bound to the Downstream Port after pci_stop_bus_device() has run, so it is unbound by pci_remove_bus_device() instead of pci_stop_bus_device(). Because the pci_bus has already been destroyed at that point, accesses to it result in a use-after-free.
One might conclude that driver binding needs to be prevented after pci_stop_bus_device() has run. However it seems risky that pci_slot points to pci_bus without holding a reference. Solely relying on correct ordering of driver unbind versus pci_bus destruction is certainly not defensive programming.
If pci_slot has a need to access data in pci_bus, it ought to acquire a reference. Amend pci_create_slot() accordingly. Dennis reports that the crash is not reproducible with this change.
Abridged stacktrace:
pcieport 0000:00:07.0: PME: Signaling with IRQ 156
pcieport 0000:00:07.0: pciehp: Slot #12 AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug+ Surprise+ Interlock- NoCompl+ IbPresDis- LLActRep+ pci_bus 0000:20: dev 00, created physical slot 12
pcieport 0000:00:07.0: pciehp: Slot(12): Card not present
...
pcieport 0000:21:02.0: pciehp: pcie_disable_notification: SLOTCTRL d8 write cmd 0
Oops: general protection fault, probably for non-canonical address 0x6b6b6b6b6b6b6b6b: 0000 [#1] PREEMPT SMP NOPTI CPU: 13 UID: 0 PID: 134 Comm: irq/156-pciehp Not tainted 6.11.0-devel+ #1 RIP: 0010:dev_driver_string+0x12/0x40 pci_destroy_slot pciehp_remove pcie_port_remove_service device_release_driver_internal bus_remove_device device_del device_unregister remove_iter device_for_each_child pcie_portdrv_remove pci_device_remove device_release_driver_internal bus_remove_device device_del pci_remove_bus_device (recursive invocation) pci_remove_bus_device pciehp_unconfigure_device pciehp_disable_slot pciehp_handle_presence_or_link_change pciehp_ist
--- drivers/pci/slot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/slot.c +3 -1
@@ -79,6 +79,7 @@ static void pci_slot_release(struct kobjup_read (&pci_bus_sem);list_del (&slot->list); +pci_bus_put (slot->bus);kfree (slot); }
@@ -261,7 +262,7 @@ placeholder: goto err; } - slot->bus = parent; + slot->bus =pci_bus_get (parent); slot->number = slot_nr; slot->kobj.kset = pci_slots_kset;
@@ -269,6 +270,7 @@ placeholder: slot_name =make_slot_name (name);if (!slot_name) { err = -ENOMEM ; +pci_bus_put (slot->bus);kfree (slot); goto err; }
Greg Kroah-Hartman
maintainerPATCH 655/826 LoongArch: Explicitly specify code model in Makefile
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit e67e0eb6a98b261caf45048f9eb95fd7609289c0 upstream.
LoongArch's toolchain may change the default code model from normal to medium. This is unnecessary for kernel, and generates some relocations which cannot be handled by the module loader. So explicitly specify the code model to normal in Makefile (for Rust 'normal' is 'small').
--- arch/loongarch/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/Makefile +2 -2
@@ -59,7 +59,7 @@ endif ifdef CONFIG_64BIT ld-emul = $(64bit-emul) -cflags-y += -mabi=lp64s +cflags-y += -mabi=lp64s -mcmodel=normal endif cflags-y += -pipe $(CC_FLAGS_NO_FPU)
@@ -104,7 +104,7 @@ ifdef CONFIG_OBJTOOL KBUILD_CFLAGS += -fno-jump-tables endif -KBUILD_RUSTFLAGS += --target=loongarch64-unknown-none-softfloat +KBUILD_RUSTFLAGS += --target=loongarch64-unknown-none-softfloat -Ccode-model=small KBUILD_RUSTFLAGS_KERNEL += -Zdirect-access-external-data=yes KBUILD_RUSTFLAGS_MODULE += -Zdirect-access-external-data=no
Greg Kroah-Hartman
maintainerPATCH 656/826 clk: clk-loongson2: Fix memory corruption bug in struct loongson2_clk_provider
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit 6e4bf018bb040955da53dae9f8628ef8fcec2dbe upstream.
Some heap space is allocated for the flexible structure struct clk_hw_onecell_data and its flexible-array member hws through the composite structure struct loongson2_clk_provider in function loongson2_clk_probe(), as shown below:
289 struct loongson2_clk_provider *clp; ...
296 for (p = data; p->name; p++)
297 clks_num++;
298
299 clp = devm_kzalloc(dev, struct_size(clp, clk_data.hws, clks_num),
300 GFP_KERNEL);
Then some data is written into the flexible array:
350 clp->clk_data.hws[p->id] = hw;
This corrupts clk_lock, which is the spinlock variable immediately following the clk_data member in struct loongson2_clk_provider:
struct loongson2_clk_provider {
void __iomem *base;
struct device *dev;
struct clk_hw_onecell_data clk_data;
spinlock_t clk_lock; /* protect access to DIV registers */
};The problem is that the flexible structure is currently placed in the middle of struct loongson2_clk_provider instead of at the end.
Fix this by moving struct clk_hw_onecell_data clk_data; to the end of struct loongson2_clk_provider. Also, add a code comment to help prevent this from happening again in case new members are added to the structure in the future.
This change also fixes the following -Wflex-array-member-not-at-end warning:
drivers/clk/clk-loongson2.c:32:36: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
--- drivers/clk/clk-loongson2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/clk-loongson2.c +3 -1
@@ -29,8 +29,10 @@ enum loongson2_clk_type {struct loongson2_clk_provider {void __iomem *base;struct device *dev; -struct clk_hw_onecell_data clk_data;spinlock_t clk_lock;/* protect access to DIV registers */ + +/* Must be last --ends in a flexible-array member. */ +struct clk_hw_onecell_data clk_data; };struct loongson2_clk_data {
Greg Kroah-Hartman
maintainerPATCH 657/826 clk: clk-loongson2: Fix potential buffer overflow in flexible-array member access
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit 02fb4f0084331ef72c28d0c70fcb15d1bea369ec upstream.
Flexible-array member hws in struct clk_hw_onecell_data is annotated with the counted_by() attribute. This means that when memory is allocated for this array, the _counter_, which in this case is member num in the flexible structure, should be set to the maximum number of elements the flexible array can contain, or fewer.
In this case, the total number of elements for the flexible array is determined by variable clks_num when allocating heap space via devm_kzalloc(), as shown below:
289 struct loongson2_clk_provider *clp; ...
296 for (p = data; p->name; p++)
297 clks_num++;
298
299 clp = devm_kzalloc(dev, struct_size(clp, clk_data.hws, clks_num),
300 GFP_KERNEL);
So, clp->clk_data.num should be set to clks_num or less, and not exceed clks_num, as is currently the case. Otherwise, if data is written into clp->clk_data.hws[clks_num], the instrumentation provided by the compiler won't detect the overflow, leading to a memory corruption bug at runtime.
Fix this issue by setting clp->clk_data.num to clks_num.
--- drivers/clk/clk-loongson2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-loongson2.c +1 -1
@@ -306,7 +306,7 @@ static int loongson2_clk_probe(struct plreturn PTR_ERR (clp->base);spin_lock_init (&clp->clk_lock); - clp->clk_data.num = clks_num +1 ; + clp->clk_data.num = clks_num; clp->dev = dev;for (i =0 ; i < clks_num; i++) {
Greg Kroah-Hartman
maintainerPATCH 658/826 fsnotify: fix sending inotify event with unexpected filename
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
commit aa52c54da40d9eee3ba87c05cdcb0cd07c04fa13 upstream.
We got a report that adding a fanotify filsystem watch prevents tail -f from receiving events.
Reproducer:
1. Create 3 windows / login sessions. Become root in each session.
2. Choose a mounted filesystem that is pretty quiet; I picked /boot.
3. In the first window, run: fsnotifywait -S -m /boot
4. In the second window, run: echo data >> /boot/foo
5. In the third window, run: tail -f /boot/foo
6. Go back to the second window and run: echo more data >> /boot/foo
7. Observe that the tail command doesn't show the new data.
8. In the first window, hit control-C to interrupt fsnotifywait.
9. In the second window, run: echo still more data >> /boot/foo
10. Observe that the tail command in the third window has now printed the missing data.
When stracing tail, we observed that when fanotify filesystem mark is set, tail does get the inotify event, but the event is receieved with the filename:
read(4, "\1\0\0\0\2\0\0\0\0\0\0\0\20\0\0\0foo\0\0\0\0\0\0\0\0\0\0\0\0\0",
50) = 32
This is unexpected, because tail is watching the file itself and not its parent and is inconsistent with the inotify event received by tail when fanotify filesystem mark is not set:
read(4, "\1\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0", 50) = 16
The inteference between different fsnotify groups was caused by the fact that the mark on the sb requires the filename, so the filename is passed to fsnotify(). Later on, fsnotify_handle_event() tries to take care of not passing the filename to groups (such as inotify) that are interested in the filename only when the parent is watching.
But the logic was incorrect for the case that no group is watching the parent, some groups are watching the sb and some watching the inode.
--- fs/notify/fsnotify.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
fs/notify/fsnotify.c +13 -10
@@ -333,16 +333,19 @@ static int fsnotify_handle_event(structif (!inode_mark)return 0 ; -if (mask &FS_EVENT_ON_CHILD ) { -/* -* Some events can be sent on both parent dir and child marks -* (e.g. FS_ATTRIB). If both parent dir and child are -* watching, report the event once to parent dir with name (if -* interested) and once to child without name (if interested). -* The child watcher is expecting an event without a file name -* and without the FS_EVENT_ON_CHILD flag. -*/ - mask &= ~FS_EVENT_ON_CHILD ; +/* +* Some events can be sent on both parent dir and child marks (e.g. +* FS_ATTRIB). If both parent dir and child are watching, report the +* event once to parent dir with name (if interested) and once to child +* without name (if interested). +* +* In any case regardless whether the parent is watching or not, the +* child watcher is expecting an event without the FS_EVENT_ON_CHILD +* flag. The file name is expected if and only if this is a directory +* event. +*/ + mask &= ~FS_EVENT_ON_CHILD ; +if (!(mask &ALL_FSNOTIFY_DIRENT_EVENTS )) { dir =NULL ; name =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 659/826 fsnotify: Fix ordering of iput() and watched_objects decrement
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 21d1b618b6b9da46c5116c640ac4b1cc8d40d63a upstream.
Ensure the superblock is kept alive until we're done with iput(). Holding a reference to an inode is not allowed unless we ensure the superblock stays alive, which fsnotify does by keeping the watched_objects count elevated, so iput() must happen before the watched_objects decrement.
This can lead to a UAF of something like sb->s_fs_info in tmpfs, but the UAF is hard to hit because race orderings that oops are more likely, thanks to the CHECK_DATA_CORRUPTION() block in generic_shutdown_super().
Also, ensure that fsnotify_put_sb_watched_objects() doesn't call fsnotify_sb_watched_objects() on a superblock that may have already been freed, which would cause a UAF read of sb->s_fsnotify_info.
--- fs/notify/mark.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
fs/notify/mark.c +9 -3
@@ -138,8 +138,11 @@ static void fsnotify_get_sb_watched_objestatic void fsnotify_put_sb_watched_objects (struct super_block *sb) { -if (atomic_long_dec_and_test (fsnotify_sb_watched_objects (sb))) -wake_up_var (fsnotify_sb_watched_objects (sb)); +atomic_long_t *watched_objects =fsnotify_sb_watched_objects (sb); + +/* the superblock can go away after this decrement */ +if (atomic_long_dec_and_test (watched_objects)) +wake_up_var (watched_objects); }static void fsnotify_get_inode_ref (struct inode *inode)
@@ -150,8 +153,11 @@ static void fsnotify_get_inode_ref(strucstatic void fsnotify_put_inode_ref (struct inode *inode) { -fsnotify_put_sb_watched_objects (inode->i_sb); +/* read ->i_sb before the inode can go away */ +struct super_block *sb = inode->i_sb; +iput (inode); +fsnotify_put_sb_watched_objects (sb); }/*
Greg Kroah-Hartman
maintainerPATCH 660/826 comedi: Flush partial mappings in error case
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit ce8f9fb651fac95dd41f69afe54d935420b945bd upstream.
If some remap_pfn_range() calls succeeded before one failed, we still have buffer pages mapped into the userspace page tables when we drop the buffer reference with comedi_buf_map_put(bm). The userspace mappings are only cleaned up later in the mmap error path.
Fix it by explicitly flushing all mappings in our VMA on the error path.
See commit 79a61cc3fc04 ("mm: avoid leaving partial pfn mappings around in error case").
--- drivers/comedi/comedi_fops.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/comedi/comedi_fops.c +12 -0
@@ -2407,6 +2407,18 @@ static int comedi_mmap(struct file *file start +=PAGE_SIZE ; } + +#ifdef CONFIG_MMU +/* +* Leaving behind a partial mapping of a buffer we're about to +* drop is unsafe, see remap_pfn_range_notrack(). +* We need to zap the range here ourselves instead of relying +* on the automatic zapping in remap_pfn_range() because we call +* remap_pfn_range() in a loop. +*/ +if (retval) +zap_vma_ptes (vma, vma->vm_start, size); +#endif }if (retval ==0 ) {
Greg Kroah-Hartman
maintainerPATCH 661/826 apparmor: test: Fix memory leak for aa_unpack_strdup()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
commit 7290f59231910ccba427d441a6e8b8c6f6112448 upstream.
The string allocated by kmemdup() in aa_unpack_strdup() is not freed and cause following memory leaks, free them to fix it.
unreferenced object 0xffffff80c6af8a50 (size 8): comm "kunit_try_catch", pid 225, jiffies 4294894407 hex dump (first 8 bytes): 74 65 73 74 69 6e 67 00 testing. backtrace (crc 5eab668b): [<0000000001e3714d>] kmemleak_alloc+0x34/0x40 [<000000006e6c7776>] __kmalloc_node_track_caller_noprof+0x300/0x3e0 [<000000006870467c>] kmemdup_noprof+0x34/0x60 [<000000001176bb03>] aa_unpack_strdup+0xd0/0x18c [<000000008ecde918>] policy_unpack_test_unpack_strdup_with_null_name+0xf8/0x3ec [<0000000032ef8f77>] kunit_try_run_case+0x13c/0x3ac [<00000000f3edea23>] kunit_generic_run_threadfn_adapter+0x80/0xec [<00000000adf936cf>] kthread+0x2e8/0x374 [<0000000041bb1628>] ret_from_fork+0x10/0x20 unreferenced object 0xffffff80c2a29090 (size 8): comm "kunit_try_catch", pid 227, jiffies 4294894409 hex dump (first 8 bytes): 74 65 73 74 69 6e 67 00 testing. backtrace (crc 5eab668b): [<0000000001e3714d>] kmemleak_alloc+0x34/0x40 [<000000006e6c7776>] __kmalloc_node_track_caller_noprof+0x300/0x3e0 [<000000006870467c>] kmemdup_noprof+0x34/0x60 [<000000001176bb03>] aa_unpack_strdup+0xd0/0x18c [<0000000046a45c1a>] policy_unpack_test_unpack_strdup_with_name+0xd0/0x3c4 [<0000000032ef8f77>] kunit_try_run_case+0x13c/0x3ac [<00000000f3edea23>] kunit_generic_run_threadfn_adapter+0x80/0xec [<00000000adf936cf>] kthread+0x2e8/0x374 [<0000000041bb1628>] ret_from_fork+0x10/0x20
--- security/apparmor/policy_unpack_test.c | 6 ++++++ 1 file changed, 6 insertions(+)
security/apparmor/policy_unpack_test.c +6 -0
@@ -281,6 +281,8 @@ static void policy_unpack_test_unpack_st ((uintptr_t )puf->e->start <= (uintptr_t )string) && ((uintptr_t)string <= (uintptr_t)puf->e->end));KUNIT_EXPECT_STREQ (test, string,TEST_STRING_DATA ); + +kfree (string); }static void policy_unpack_test_unpack_strdup_with_name (struct kunit *test)
@@ -296,6 +298,8 @@ static void policy_unpack_test_unpack_st ((uintptr_t )puf->e->start <= (uintptr_t )string) && ((uintptr_t)string <= (uintptr_t)puf->e->end));KUNIT_EXPECT_STREQ (test, string,TEST_STRING_DATA ); + +kfree (string); }static void policy_unpack_test_unpack_strdup_out_of_bounds (struct kunit *test)
@@ -313,6 +317,8 @@ static void policy_unpack_test_unpack_stKUNIT_EXPECT_EQ (test, size,0 );KUNIT_EXPECT_NULL (test, string);KUNIT_EXPECT_PTR_EQ (test, puf->e->pos, start); + +kfree (string); }static void policy_unpack_test_unpack_nameX_with_null_name (struct kunit *test)
Greg Kroah-Hartman
maintainerPATCH 662/826 iio: dac: adi-axi-dac: fix wrong register bitfield
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Angelo Dureghello <[email protected]>
commit 70602f529e4d76798c95aeed5ce2a8d36263abe5 upstream.
Fix ADI_DAC_R1_MODE of AXI_DAC_REG_CNTRL_2.
Both generic DAC and ad3552r DAC IPs docs are reporting bit 5 for it.
--- drivers/iio/dac/adi-axi-dac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/adi-axi-dac.c +1 -1
@@ -46,7 +46,7 @@#define AXI_DAC_REG_CNTRL_1 0x0044#define AXI_DAC_SYNC BIT(0)#define AXI_DAC_REG_CNTRL_2 0x0048 -#define ADI_DAC_R1_MODE BIT(4) +#define ADI_DAC_R1_MODE BIT(5)#define AXI_DAC_DRP_STATUS 0x0074#define AXI_DAC_DRP_LOCKED BIT(17)/* DAC Channel controls */
Greg Kroah-Hartman
maintainerPATCH 663/826 tty: ldsic: fix tty_ldisc_autoload sysctls proc_handler
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Bouchinet <[email protected]>
commit 635a9fca54f4f4148be1ae1c7c6bd37af80f5773 upstream.
Commit 7c0cca7c847e ("tty: ldisc: add sysctl to prevent autoloading of ldiscs") introduces the tty_ldisc_autoload sysctl with the wrong proc_handler. .extra1 and .extra2 parameters are set to avoid other values thant SYSCTL_ZERO or SYSCTL_ONE to be set but proc_dointvec do not uses them.
This commit fixes this by using proc_dointvec_minmax instead of proc_dointvec.
--- drivers/tty/tty_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/tty_io.c +1 -1
@@ -3631,7 +3631,7 @@ static struct ctl_table tty_table[] = { .data = &tty_ldisc_autoload, .maxlen = sizeof(tty_ldisc_autoload), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_ONE, },
Greg Kroah-Hartman
maintainerPATCH 664/826 locking/lockdep: Avoid creating new name string literals in lockdep_set_subclass()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahmed Ehab <[email protected]>
commit d7fe143cb115076fed0126ad8cf5ba6c3e575e43 upstream.
Syzbot reports a problem that a warning will be triggered while searching a lock class in look_up_lock_class().
The cause of the issue is that a new name is created and used by lockdep_set_subclass() instead of using the existing one. This results in a lock instance has a different name pointer than previous registered one stored in lock class, and WARN_ONCE() is triggered because of that in look_up_lock_class().
To fix this, change lockdep_set_subclass() to use the existing name instead of a new one. Hence, no new name will be created by lockdep_set_subclass(). Hence, the warning is avoided.
[boqun: Reword the commit log to state the correct issue]
--- include/linux/lockdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/lockdep.h +1 -1
@@ -173,7 +173,7 @@ static inline void lockdep_init_map(stru (lock)->dep_map.lock_type)#define lockdep_set_subclass (lock, sub) \ - lockdep_init_map_type(&(lock)->dep_map, #lock, (lock)->dep_map.key, sub,\ + lockdep_init_map_type(&(lock)->dep_map, (lock)->dep_map.name, (lock)->dep_map.key, sub,\ (lock)->dep_map.wait_type_inner, \ (lock)->dep_map.wait_type_outer, \ (lock)->dep_map.lock_type)
Greg Kroah-Hartman
maintainerPATCH 665/826 tools/nolibc: s390: include std.h
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
commit 711b5875814b2a0e9a5aaf7a85ba7c80f5a389b1 upstream.
arch-s390.h uses types from std.h, but does not include it. Depending on the inclusion order the compilation can fail. Include std.h explicitly to avoid these errors.
--- tools/include/nolibc/arch-s390.h | 1 + 1 file changed, 1 insertion(+)
tools/include/nolibc/arch-s390.h +1 -0
@@ -10,6 +10,7 @@#include "compiler.h" #include "crt.h" +#include "std.h" /* Syscalls for s390: * - registers are 64-bit
Greg Kroah-Hartman
maintainerPATCH 666/826 fcntl: make F_DUPFD_QUERY associative
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
commit 2714b0d1f36999dbd99a3474a24e7301acbd74f1 upstream.
Currently when passing a closed file descriptor to fcntl(fd, F_DUPFD_QUERY, fd_dup) the order matters:
fd = open("/dev/null");
fd_dup = dup(fd);When we now close one of the file descriptors we get:
(1) fcntl(fd, fd_dup) // -EBADF
(2) fcntl(fd_dup, fd) // 0 aka not equal
depending on which file descriptor is passed first. That's not a huge deal but it gives the api I slightly weird feel. Make it so that the order doesn't matter by requiring that both file descriptors are valid:
(1') fcntl(fd, fd_dup) // -EBADF
(2') fcntl(fd_dup, fd) // -EBADF
--- fs/fcntl.c | 3 +++ 1 file changed, 3 insertions(+)
fs/fcntl.c +3 -0
@@ -397,6 +397,9 @@ static long f_dupfd_query(int fd, struct {CLASS (fd_raw, f)(fd); +if (fd_empty (f)) +return -EBADF ; +/* * We can do the 'fdput()' immediately, as the only thing that * matters is the pointer value which isn't changed by the fdput.
Greg Kroah-Hartman
maintainerPATCH 667/826 pinctrl: qcom: spmi: fix debugfs drive strength
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 6bc0ebfb1d920f13c522545f114cdabb49e9408a upstream.
Commit 723e8462a4fe ("pinctrl: qcom: spmi-gpio: Fix the GPIO strength mapping") fixed a long-standing issue in the Qualcomm SPMI PMIC gpio driver which had the 'low' and 'high' drive strength settings switched but failed to update the debugfs interface which still gets this wrong.
Fix the debugfs code so that the exported values match the hardware settings.
Note that this probably means that most devicetrees that try to describe the firmware settings got this wrong if the settings were derived from debugfs. Before the above mentioned commit the settings would have actually matched the firmware settings even if they were described incorrectly, but now they are inverted.
--- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +1 -1
@@ -667,7 +667,7 @@ static void pmic_gpio_config_dbg_show(st "push-pull", "open-drain", "open-source" };static const char *const strengths[] = { -"no" ,"high" ,"medium" ,"low" +"no" ,"low" ,"medium" ,"high" }; pad = pctldev->desc->pins[pin].drv_data;
Greg Kroah-Hartman
maintainerPATCH 668/826 dt-bindings: pinctrl: samsung: Fix interrupt constraint for variants with fallbacks
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit ffb30875172eabff727e2896f097ccd4bb68723f upstream.
Commit 904140fa4553 ("dt-bindings: pinctrl: samsung: use Exynos7 fallbacks for newer wake-up controllers") added samsung,exynos7-wakeup-eint fallback to some compatibles, so the intention in the if:then: conditions was to handle the cases:
1. Single Exynos7 compatible or Exynos5433+Exynos7 or Exynos7885+Exynos7: only one interrupt
2. Exynos850+Exynos7: no interrupts
This was not implemented properly however and if:then: block matches only single Exynos5433 or Exynos7885 compatibles, which do not exist in DTS anymore, so basically is a no-op and no enforcement on number of interrupts is made by the binding.
Fix the if:then: condition so interrupts in the Exynos5433 and Exynos7885 wake-up pin controller will be properly constrained.
--- Documentation/devicetree/bindings/pinctrl/samsung,pinctrl-wakeup-interrupt.yaml | 19 +++++----- 1 file changed, 11 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/pinctrl/samsung,pinctrl-wakeup-interrupt.yaml +11 -8
@@ -91,14 +91,17 @@ allOf: - if: properties: compatible: - # Match without "contains", to skip newer variants which are still - # compatible with samsung,exynos7-wakeup-eint - enum: - - samsung,s5pv210-wakeup-eint - - samsung,exynos4210-wakeup-eint - - samsung,exynos5433-wakeup-eint - - samsung,exynos7-wakeup-eint - - samsung,exynos7885-wakeup-eint + oneOf: + # Match without "contains", to skip newer variants which are still + # compatible with samsung,exynos7-wakeup-eint + - enum: + - samsung,exynos4210-wakeup-eint + - samsung,exynos7-wakeup-eint + - samsung,s5pv210-wakeup-eint + - contains: + enum: + - samsung,exynos5433-wakeup-eint + - samsung,exynos7885-wakeup-eint then: properties: interrupts:
Greg Kroah-Hartman
maintainerPATCH 669/826 dt-bindings: iio: dac: ad3552r: fix maximum spi speed
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Angelo Dureghello <[email protected]>
commit d1d1c117f39b2057d1e978f26a8bd9631ddb193b upstream.
Fix maximum SPI clock speed, as per datasheet (Rev. B, page 6).
--- Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml +1 -1
@@ -30,7 +30,7 @@ properties: maxItems: 1 spi-max-frequency: - maximum: 30000000 + maximum: 66000000 reset-gpios: maxItems: 1
Greg Kroah-Hartman
maintainerPATCH 670/826 exfat: fix uninit-value in __exfat_get_dentry_set
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
commit 02dffe9ab092fc4c8800aee68cb7eafd37a980c4 upstream.
There is no check if stream size and start_clu are invalid. If start_clu is EOF cluster and stream size is 4096, It will cause uninit value access. because ei->hint_femp.eidx could be 128(if cluster size is 4K) and wrong hint will allocate next cluster. and this cluster will be same with the cluster that is allocated by exfat_extend_valid_size(). The previous patch will check invalid start_clu, but for clarity, initialize hint_femp.eidx to zero.
--- fs/exfat/namei.c | 1 + 1 file changed, 1 insertion(+)
fs/exfat/namei.c +1 -0
@@ -345,6 +345,7 @@ static int exfat_find_empty_entry(structif (ei->start_clu ==EXFAT_EOF_CLUSTER ) { ei->start_clu = clu.dir; p_dir->dir = clu.dir; + hint_femp.eidx =0 ; }/* append to the FAT chain */
Greg Kroah-Hartman
maintainerPATCH 671/826 exfat: fix out-of-bounds access of directory entries
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuezhang Mo <[email protected]>
commit 184fa506e392eb78364d9283c961217ff2c0617b upstream.
In the case of the directory size is greater than or equal to the cluster size, if start_clu becomes an EOF cluster(an invalid cluster) due to file system corruption, then the directory entry where ei->hint_femp.eidx hint is outside the directory, resulting in an out-of-bounds access, which may cause further file system corruption.
This commit adds a check for start_clu, if it is an invalid cluster, the file or directory will be treated as empty.
--- fs/exfat/namei.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
fs/exfat/namei.c +16 -4
@@ -638,14 +638,26 @@ static int exfat_find(struct inode *dir, info->size =le64_to_cpu (ep2->dentry.stream.valid_size); info->valid_size =le64_to_cpu (ep2->dentry.stream.valid_size); info->size =le64_to_cpu (ep2->dentry.stream.size); + + info->start_clu =le32_to_cpu (ep2->dentry.stream.start_clu); +if (!is_valid_cluster (sbi, info->start_clu) && info->size) { +exfat_warn (sb,"start_clu is invalid cluster(0x%x)" , + info->start_clu); + info->size =0 ; + info->valid_size =0 ; + } + +if (info->valid_size > info->size) { +exfat_warn (sb,"valid_size(%lld) is greater than size(%lld)" , + info->valid_size, info->size); + info->valid_size = info->size; + } +if (info->size ==0 ) { info->flags =ALLOC_NO_FAT_CHAIN ; info->start_clu =EXFAT_EOF_CLUSTER ; - }else { + }else info->flags = ep2->dentry.stream.flags; - info->start_clu = -le32_to_cpu (ep2->dentry.stream.start_clu); - } exfat_get_entry_time(sbi, &info->crtime, ep->dentry.file.create_tz,
Greg Kroah-Hartman
maintainerPATCH 672/826 xhci: Fix control transfer error on Etron xHCI host
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuangyi Chiang <[email protected]>
commit 5e1c67abc9301d05130b7e267c204e7005503b33 upstream.
Performing a stability stress test on a USB3.0 2.5G ethernet adapter results in errors like this:
[ 91.441469] r8152 2-3:1.0 eth3: get_registers -71 [ 91.458659] r8152 2-3:1.0 eth3: get_registers -71 [ 91.475911] r8152 2-3:1.0 eth3: get_registers -71 [ 91.493203] r8152 2-3:1.0 eth3: get_registers -71 [ 91.510421] r8152 2-3:1.0 eth3: get_registers -71
The r8152 driver will periodically issue lots of control-IN requests to access the status of ethernet adapter hardware registers during the test.
This happens when the xHCI driver enqueue a control TD (which cross over the Link TRB between two ring segments, as shown) in the endpoint zero's transfer ring. Seems the Etron xHCI host can not perform this TD correctly, causing the USB transfer error occurred, maybe the upper driver retry that control-IN request can solve problem, but not all drivers do this.
| |
-------
| TRB | Setup Stage
-------
| TRB | Link
-------
-------
| TRB | Data Stage
-------
| TRB | Status Stage
-------
| |
To work around this, the xHCI driver should enqueue a No Op TRB if next available TRB is the Link TRB in the ring segment, this can prevent the Setup and Data Stage TRB to be breaked by the Link TRB.
Check if the XHCI_ETRON_HOST quirk flag is set before invoking the workaround in xhci_queue_ctrl_tx().
--- drivers/usb/host/xhci-ring.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/usb/host/xhci-ring.c +14 -0
@@ -3727,6 +3727,20 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *if (!urb->setup_packet)return -EINVAL ; +if ((xhci->quirks &XHCI_ETRON_HOST ) && + urb->dev->speed >=USB_SPEED_SUPER ) { +/* +* If next available TRB is the Link TRB in the ring segment then +* enqueue a No Op TRB, this can prevent the Setup and Data Stage +* TRB to be breaked by the Link TRB. +*/ +if (trb_is_link (ep_ring->enqueue +1 )) { + field =TRB_TYPE (TRB_TR_NOOP ) | ep_ring->cycle_state; +queue_trb (xhci, ep_ring, false,0 ,0 , +TRB_INTR_TARGET (0 ), field); + } + } +/* 1 TRB for setup, 1 for status */ num_trbs =2 ;/*
Greg Kroah-Hartman
maintainerPATCH 673/826 xhci: Combine two if statements for Etron xHCI host
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuangyi Chiang <[email protected]>
commit d7b11fe5790203fcc0db182249d7bfd945e44ccb upstream.
Combine two if statements, because these hosts have the same quirk flags applied.
[Mathias: has stable tag because other fixes in series depend on this]
--- drivers/usb/host/xhci-pci.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/usb/host/xhci-pci.c +2 -6
@@ -395,12 +395,8 @@ static void xhci_pci_quirks(struct devic xhci->quirks |=XHCI_DEFAULT_PM_RUNTIME_ALLOW ;if (pdev->vendor ==PCI_VENDOR_ID_ETRON && - pdev->device ==PCI_DEVICE_ID_EJ168 ) { - xhci->quirks |=XHCI_RESET_ON_RESUME ; - xhci->quirks |=XHCI_BROKEN_STREAMS ; - } -if (pdev->vendor ==PCI_VENDOR_ID_ETRON && - pdev->device ==PCI_DEVICE_ID_EJ188 ) { + (pdev->device ==PCI_DEVICE_ID_EJ168 || + pdev->device ==PCI_DEVICE_ID_EJ188 )) { xhci->quirks |=XHCI_RESET_ON_RESUME ; xhci->quirks |=XHCI_BROKEN_STREAMS ; }
Greg Kroah-Hartman
maintainerPATCH 674/826 xhci: Dont perform Soft Retry for Etron xHCI host
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuangyi Chiang <[email protected]>
commit e735e957f2b9cfe4be486e0304732ec36928591f upstream.
Since commit f8f80be501aa ("xhci: Use soft retry to recover faster from transaction errors"), unplugging USB device while enumeration results in errors like this:
[ 364.855321] xhci_hcd 0000:0b:00.0: ERROR Transfer event for disabled endpoint slot 5 ep 2 [ 364.864622] xhci_hcd 0000:0b:00.0: @0000002167656d70 67f03000 00000021 0c000000 05038001 [ 374.934793] xhci_hcd 0000:0b:00.0: Abort failed to stop command ring: -110 [ 374.958793] xhci_hcd 0000:0b:00.0: xHCI host controller not responding, assume dead [ 374.967590] xhci_hcd 0000:0b:00.0: HC died; cleaning up [ 374.973984] xhci_hcd 0000:0b:00.0: Timeout while waiting for configure endpoint command
Seems that Etorn xHCI host can not perform Soft Retry correctly, apply XHCI_NO_SOFT_RETRY quirk to disable Soft Retry and then issue is gone.
This patch depends on commit a4a251f8c235 ("usb: xhci: do not perform Soft Retry for some xHCI hosts").
--- drivers/usb/host/xhci-pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/xhci-pci.c +1 -0
@@ -399,6 +399,7 @@ static void xhci_pci_quirks(struct devic pdev->device == PCI_DEVICE_ID_EJ188)) { xhci->quirks |=XHCI_RESET_ON_RESUME ; xhci->quirks |=XHCI_BROKEN_STREAMS ; + xhci->quirks |=XHCI_NO_SOFT_RETRY ; } if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
Greg Kroah-Hartman
maintainerPATCH 675/826 xhci: Dont issue Reset Device command to Etron xHCI host
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuangyi Chiang <[email protected]>
commit 76d98856b1c6d06ce18f32c20527a4f9d283e660 upstream.
Sometimes the hub driver does not recognize the USB device connected to the external USB2.0 hub when the system resumes from S4.
After the SetPortFeature(PORT_RESET) request is completed, the hub driver calls the HCD reset_device callback, which will issue a Reset Device command and free all structures associated with endpoints that were disabled.
This happens when the xHCI driver issue a Reset Device command to inform the Etron xHCI host that the USB device associated with a device slot has been reset. Seems that the Etron xHCI host can not perform this command correctly, affecting the USB device.
To work around this, the xHCI driver should obtain a new device slot with reference to commit 651aaf36a7d7 ("usb: xhci: Handle USB transaction error on address command"), which is another way to inform the Etron xHCI host that the USB device has been reset.
Add a new XHCI_ETRON_HOST quirk flag to invoke the workaround in xhci_discover_or_reset_device().
--- drivers/usb/host/xhci-pci.c | 1 + drivers/usb/host/xhci.c | 19 +++++++++++++++++++ drivers/usb/host/xhci.h | 1 + 3 files changed, 21 insertions(+)
drivers/usb/host/xhci-pci.c +1 -0
@@ -397,6 +397,7 @@ static void xhci_pci_quirks(struct devicif (pdev->vendor ==PCI_VENDOR_ID_ETRON && (pdev->device ==PCI_DEVICE_ID_EJ168 || pdev->device ==PCI_DEVICE_ID_EJ188 )) { + xhci->quirks |=XHCI_ETRON_HOST ; xhci->quirks |=XHCI_RESET_ON_RESUME ; xhci->quirks |=XHCI_BROKEN_STREAMS ; xhci->quirks |=XHCI_NO_SOFT_RETRY ;
drivers/usb/host/xhci.c +19 -0
@@ -3692,6 +3692,8 @@ void xhci_free_device_endpoint_resources xhci->num_active_eps); } +static void xhci_free_dev (struct usb_hcd *hcd,struct usb_device *udev); +/* * This submits a Reset Device Command, which will set the device state to 0, * set the device address to 0, and disable all the endpoints except the default
@@ -3762,6 +3764,23 @@ static int xhci_discover_or_reset_device SLOT_STATE_DISABLED)return 0 ; +if (xhci->quirks &XHCI_ETRON_HOST ) { +/* +* Obtaining a new device slot to inform the xHCI host that +* the USB device has been reset. +*/ + ret =xhci_disable_slot (xhci, udev->slot_id); +xhci_free_virt_device (xhci, udev->slot_id); +if (!ret) { + ret =xhci_alloc_dev (hcd, udev); +if (ret ==1 ) + ret =0 ; +else + ret = -EINVAL ; + } +return ret; + } +trace_xhci_discover_or_reset_device (slot_ctx);xhci_dbg (xhci,"Resetting device with slot ID %u\n" , slot_id);
drivers/usb/host/xhci.h +1 -0
@@ -1624,6 +1624,7 @@ struct xhci_hcd {#define XHCI_ZHAOXIN_HOST BIT_ULL(46)#define XHCI_WRITE_64_HI_LO BIT_ULL(47)#define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) +#define XHCI_ETRON_HOST BIT_ULL(49)unsigned int num_active_eps;unsigned int limit_active_eps;
Greg Kroah-Hartman
maintainerPATCH 676/826 Bluetooth: Fix type of len in rfcomm_sock_getsockopt{,_old}()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrej Shadura <[email protected]>
commit 5fe6caa62b07fd39cd6a28acc8f92ba2955e11a6 upstream.
Commit 9bf4e919ccad worked around an issue introduced after an innocuous optimisation change in LLVM main:
Quoted 11 lines
len is defined as an 'int' because it is assigned from '
__userint *optlen'. However, it is clamped against the result ofsizeof(), which has a type of 'size_t' ('unsigned long' for 64-bit platforms). This is done withmin_t()becausemin()requires compatible types, which results in both len and the result ofsizeof()being casted to 'unsigned int', meaning len changes signs and the result ofsizeof()is truncated. From there, len is passed tocopy_to_user(), which has a third parameter type of 'unsigned long', so it is widened and changes signs again. This excessive casting in combination with the KCSAN instrumentation causes LLVM to fail to eliminate the__bad_copy_from()call, failing the build.
The same issue occurs in rfcomm in functions rfcomm_sock_getsockopt and rfcomm_sock_getsockopt_old.
Change the type of len to size_t in both rfcomm_sock_getsockopt and rfcomm_sock_getsockopt_old and replace min_t() with min().
Improves: 9bf4e919ccad ("Bluetooth: Fix type of len in {l2cap,sco}_sock_getsockopt_old()")
--- net/bluetooth/rfcomm/sock.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/bluetooth/rfcomm/sock.c +6 -4
@@ -729,7 +729,8 @@ static int rfcomm_sock_getsockopt_old(ststruct sock *l2cap_sk;struct l2cap_conn *conn;struct rfcomm_conninfo cinfo; -int len, err =0 ; +int err =0 ; +size_t len;u32 opt;BT_DBG ("sk %p" , sk);
@@ -783,7 +784,7 @@ static int rfcomm_sock_getsockopt_old(st cinfo.hci_handle = conn->hcon->handle;memcpy (cinfo.dev_class, conn->hcon->dev_class,3 ); - len = min_t(unsigned int, len, sizeof(cinfo)); + len =min (len,sizeof (cinfo));if (copy_to_user (optval, (char *) &cinfo, len)) err = -EFAULT ;
@@ -802,7 +803,8 @@ static int rfcomm_sock_getsockopt(struct {struct sock *sk = sock->sk;struct bt_security sec; -int len, err =0 ; +int err =0 ; +size_t len;BT_DBG ("sk %p" , sk);
@@ -827,7 +829,7 @@ static int rfcomm_sock_getsockopt(struct sec.level =rfcomm_pi (sk)->sec_level; sec.key_size =0 ; - len = min_t(unsigned int, len, sizeof(sec)); + len =min (len,sizeof (sec));if (copy_to_user (optval, (char *) &sec, len)) err = -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 677/826 usb: xhci: Limit Stop Endpoint retries
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
commit 42b7581376015c1bbcbe5831f043cd0ac119d028 upstream.
Some host controllers fail to atomically transition an endpoint to the Running state on a doorbell ring and enter a hidden "Restarting" state, which looks very much like Stopped, with the important difference that it will spontaneously transition to Running anytime soon.
A Stop Endpoint command queued in the Restarting state typically fails with Context State Error and the completion handler sees the Endpoint Context State as either still Stopped or already Running. Even a case of Halted was observed, when an error occurred right after the restart.
The Halted state is already recovered from by resetting the endpoint. The Running state is handled by retrying Stop Endpoint.
The Stopped state was recognized as a problem on NEC controllers and worked around also by retrying, because the endpoint soon restarts and then stops for good. But there is a risk: the command may fail if the endpoint is "stopped for good" already, and retries will fail forever.
The possibility of this was not realized at the time, but a number of cases were discovered later and reproduced. Some proved difficult to deal with, and it is outright impossible to predict if an endpoint may fail to ever start at all due to a hardware bug. One such bug (albeit on ASM3142, not on NEC) was found to be reliably triggered simply by toggling an AX88179 NIC up/down in a tight loop for a few seconds.
An endless retries storm is quite nasty. Besides putting needless load on the xHC and CPU, it causes URBs never to be given back, paralyzing the device and connection/disconnection logic for the whole bus if the device is unplugged. User processes waiting for URBs become unkillable, drivers and kworker threads lock up and xhci_hcd cannot be reloaded.
For peace of mind, impose a timeout on Stop Endpoint retries in this case. If they don't succeed in 100ms, consider the endpoint stopped permanently for some reason and just give back the unlinked URBs. This failure case is rare already and work is under way to make it rarer.
Start this work today by also handling one simple case of race with Reset Endpoint, because it costs just two lines to implement.
--- drivers/usb/host/xhci-ring.c | 28 ++++++++++++++++++++++++---- drivers/usb/host/xhci.c | 2 ++ drivers/usb/host/xhci.h | 1 + 3 files changed, 27 insertions(+), 4 deletions(-)
drivers/usb/host/xhci-ring.c +24 -4
@@ -52,6 +52,7 @@* endpoint rings; it generates events on the event ring for these. */ +#include <linux/jiffies.h> #include <linux/scatterlist.h> #include <linux/slab.h> #include <linux/dma-mapping.h>
@@ -1151,16 +1152,35 @@ static void xhci_handle_cmd_stop_ep(strureturn ;case EP_STATE_STOPPED :/* -* NEC uPD720200 sometimes sets this state and fails with -* Context Error while continuing to process TRBs. -* Be conservative and trust EP_CTX_STATE on other chips. +* Per xHCI 4.6.9, Stop Endpoint command on a Stopped +* EP is a Context State Error, and EP stays Stopped. +* +* But maybe it failed on Halted, and somebody ran Reset +* Endpoint later. EP state is now Stopped and EP_HALTED +* still set because Reset EP handler will run after us. +*/ +if (ep->ep_state &EP_HALTED ) +break ; +/* +* On some HCs EP state remains Stopped for some tens of +* us to a few ms or more after a doorbell ring, and any +* new Stop Endpoint fails without aborting the restart. +* This handler may run quickly enough to still see this +* Stopped state, but it will soon change to Running. +* +* Assume this bug on unexpected Stop Endpoint failures. +* Keep retrying until the EP starts and stops again, on +* chips where this is known to help. Wait for 100ms. */ if (!(xhci->quirks &XHCI_NEC_HOST ))break ; +if (time_is_before_jiffies (ep->stop_time +msecs_to_jiffies (100 ))) +break ; fallthrough;case EP_STATE_RUNNING :/* Race, HW handled stop ep cmd before ep was running */ -xhci_dbg (xhci,"Stop ep completion ctx error, ep is running\n" ); +xhci_dbg (xhci,"Stop ep completion ctx error, ctx_state %d\n" , +GET_EP_CTX_STATE (ep_ctx)); command =xhci_alloc_command (xhci, false,GFP_ATOMIC );if (!command) {
drivers/usb/host/xhci.c +2 -0
@@ -8,6 +8,7 @@* Some code borrowed from the Linux EHCI driver. */ +#include <linux/jiffies.h> #include <linux/pci.h> #include <linux/iommu.h> #include <linux/iopoll.h>
@@ -1777,6 +1778,7 @@ static int xhci_urb_dequeue(struct usb_h ret = -ENOMEM ; goto done; } + ep->stop_time = jiffies; ep->ep_state |=EP_STOP_CMD_PENDING ;xhci_queue_stop_endpoint (xhci, command, urb->dev->slot_id, ep_index,0 );
drivers/usb/host/xhci.h +1 -0
@@ -690,6 +690,7 @@ struct xhci_virt_ep {/* Bandwidth checking storage */ struct xhci_bw_info bw_info;struct list_head bw_endpoint_list; +unsigned long stop_time;/* Isoch Frame ID checking storage */ int next_frame_id;/* Use new Isoch TRB layout needed for extended TBC support */
Greg Kroah-Hartman
maintainerPATCH 678/826 usb: xhci: Fix TD invalidation under pending Set TR Dequeue
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
commit 484c3bab2d5dfa13ff659a51a06e9a393141eefc upstream.
xhci_invalidate_cancelled_tds() may not work correctly if the hardware is modifying endpoint or stream contexts at the same time by executing a Set TR Dequeue command. And even if it worked, it would be unable to queue Set TR Dequeue for the next stream, failing to clear xHC cache.
On stream endpoints, a chain of Set TR Dequeue commands may take some time to execute and we may want to cancel more TDs during this time. Currently this leads to Stop Endpoint completion handler calling this function without testing for SET_DEQ_PENDING, which will trigger the aforementioned problems when it happens.
On all endpoints, a halt condition causes Reset Endpoint to be queued and an error status given to the class driver, which may unlink more URBs in response. Stop Endpoint is queued and its handler may execute concurrently with Set TR Dequeue queued by Reset Endpoint handler.
(Reset Endpoint handler calls this function too, but there seems to be no possibility of it running concurrently with Set TR Dequeue).
Fix xhci_invalidate_cancelled_tds() to work correctly under a pending Set TR Dequeue. Bail out of the function when SET_DEQ_PENDING is set, then make the completion handler call the function again and also call xhci_giveback_invalidated_tds(), which needs to be called next.
This seems to fix another potential bug, where the handler would call xhci_invalidate_cancelled_tds(), which may clear some deferred TDs if a sanity check fails, and the TDs wouldn't be given back promptly.
Said sanity check seems to be wrong and prone to false positives when the endpoint halts, but fixing it is beyond the scope of this change, besides ensuring that cleared TDs are given back properly.
--- drivers/usb/host/xhci-ring.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-ring.c +13 -5
@@ -973,6 +973,13 @@ static int xhci_invalidate_cancelled_tdsunsigned int slot_id = ep->vdev->slot_id;int err; +/* +* This is not going to work if the hardware is changing its dequeue +* pointers as we look at them. Completion handler will call us later. +*/ +if (ep->ep_state &SET_DEQ_PENDING ) +return 0 ; + xhci = ep->xhci;list_for_each_entry_safe (td, tmp_td, &ep->cancelled_td_list, cancelled_td_list) {
@@ -1359,7 +1366,6 @@ static void xhci_handle_cmd_set_deq(strustruct xhci_ep_ctx *ep_ctx;struct xhci_slot_ctx *slot_ctx;struct xhci_td *td, *tmp_td; -bool deferred = false; ep_index =TRB_TO_EP_INDEX (le32_to_cpu (trb->generic.field[3 ])); stream_id =TRB_TO_STREAM_ID (le32_to_cpu (trb->generic.field[2 ]));
@@ -1460,8 +1466,6 @@ static void xhci_handle_cmd_set_deq(struxhci_dbg (ep->xhci,"%s: Giveback cancelled URB %p TD\n" , __func__, td->urb);xhci_td_cleanup (ep->xhci, td, ep_ring, td->status); - }else if (td->cancel_status ==TD_CLEARING_CACHE_DEFERRED ) { - deferred = true; }else {xhci_dbg (ep->xhci,"%s: Keep cancelled URB %p TD as cancel_status is %d\n" , __func__, td->urb, td->cancel_status);
@@ -1472,11 +1476,15 @@ cleanup: ep->queued_deq_seg =NULL ; ep->queued_deq_ptr =NULL ; -if (deferred) { -/* We have more streams to clear */ +/* Check for deferred or newly cancelled TDs */ +if (!list_empty (&ep->cancelled_td_list)) {xhci_dbg (ep->xhci,"%s: Pending TDs to clear, continuing with invalidation\n" , __func__);xhci_invalidate_cancelled_tds (ep); +/* Try to restart the endpoint if all is done */ +ring_doorbell_for_active_rings (xhci, slot_id, ep_index); +/* Start giving back any TDs invalidated above */ +xhci_giveback_invalidated_tds (ep); }else {/* Restart any rings with pending URBs */ xhci_dbg (ep->xhci,"%s: All TDs cleared, ring doorbell\n" , __func__);
Greg Kroah-Hartman
maintainerPATCH 679/826 usb: xhci: Avoid queuing redundant Stop Endpoint commands
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
commit 474538b8dd1cd9c666e56cfe8ef60fbb0fb513f4 upstream.
Stop Endpoint command on an already stopped endpoint fails and may be misinterpreted as a known hardware bug by the completion handler. This results in an unnecessary delay with repeated retries of the command.
Avoid queuing this command when endpoint state flags indicate that it's stopped or halted and the command will fail. If commands are pending on the endpoint, their completion handlers will process cancelled TDs so it's done. In case of waiting for external operations like clearing TT buffer, the endpoint is stopped and cancelled TDs can be processed now.
This eliminates practically all unnecessary retries because an endpoint with pending URBs is maintained in Running state by the driver, unless aforementioned commands or other operations are pending on it. This is guaranteed by xhci_ring_ep_doorbell() and by the fact that it is called every time any of those operations completes.
The only known exceptions are hardware bugs (the endpoint never starts at all) and Stream Protocol errors not associated with any TRB, which cause an endpoint reset not followed by restart. Sounds like a bug.
Generally, these retries are only expected to happen when the endpoint fails to start for unknown/no reason, which is a worse problem itself, and fixing the bug eliminates the retries too.
All cases were tested and found to work as expected. SET_DEQ_PENDING was produced by patching uvcvideo to unlink URBs in 100us intervals, which then runs into this case very often. EP_HALTED was produced by restarting 'cat /dev/ttyUSB0' on a serial dongle with broken cable. EP_CLEARING_TT by the same, with the dongle on an external hub.
--- drivers/usb/host/xhci-ring.c | 13 +++++++++++++ drivers/usb/host/xhci.c | 19 +++++++++++++++---- drivers/usb/host/xhci.h | 1 + 3 files changed, 29 insertions(+), 4 deletions(-)
drivers/usb/host/xhci-ring.c +13 -0
@@ -1070,6 +1070,19 @@ static int xhci_invalidate_cancelled_tds }/* +* Erase queued TDs from transfer ring(s) and give back those the xHC didn't +* stop on. If necessary, queue commands to move the xHC off cancelled TDs it +* stopped on. Those will be given back later when the commands complete. +* +* Call under xhci->lock on a stopped endpoint. +*/ +void xhci_process_cancelled_tds (struct xhci_virt_ep *ep) +{ +xhci_invalidate_cancelled_tds (ep); +xhci_giveback_invalidated_tds (ep); +} + +/* * Returns the TD the endpoint ring halted on. * Only call for non-running rings without streams. */
drivers/usb/host/xhci.c +15 -4
@@ -1769,10 +1769,21 @@ static int xhci_urb_dequeue(struct usb_h } } -/* Queue a stop endpoint command, but only if this is -* the first cancellation to be handled. -*/ -if (!(ep->ep_state &EP_STOP_CMD_PENDING )) { +/* These completion handlers will sort out cancelled TDs for us */ +if (ep->ep_state & (EP_STOP_CMD_PENDING |EP_HALTED |SET_DEQ_PENDING )) { +xhci_dbg (xhci,"Not queuing Stop Endpoint on slot %d ep %d in state 0x%x\n" , + urb->dev->slot_id, ep_index, ep->ep_state); + goto done; + } + +/* In this case no commands are pending but the endpoint is stopped */ +if (ep->ep_state &EP_CLEARING_TT ) { +/* and cancelled TDs can be given back right away */ +xhci_dbg (xhci,"Invalidating TDs instantly on slot %d ep %d in state 0x%x\n" , + urb->dev->slot_id, ep_index, ep->ep_state); +xhci_process_cancelled_tds (ep); + }else { +/* Otherwise, queue a new Stop Endpoint command */ command =xhci_alloc_command (xhci, false,GFP_ATOMIC );if (!command) { ret = -ENOMEM ;
drivers/usb/host/xhci.h +1 -0
@@ -1915,6 +1915,7 @@ void xhci_ring_doorbell_for_active_ringsvoid xhci_cleanup_command_queue (struct xhci_hcd *xhci);void inc_deq (struct xhci_hcd *xhci,struct xhci_ring *ring);unsigned int count_trbs (u64 addr,u64 len); +void xhci_process_cancelled_tds (struct xhci_virt_ep *ep);/* xHCI roothub code */ void xhci_set_link_state(struct xhci_hcd *xhci, struct xhci_port *port,
Greg Kroah-Hartman
maintainerPATCH 680/826 ARM: dts: omap36xx: declare 1GHz OPP as turbo again
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Kemnade <[email protected]>
commit 96a64e9730c2c76cfa5c510583a0fbf40d62886b upstream.
Operating stable without reduced chip life at 1Ghz needs several technologies working: The technologies involve
- SmartReflex
- DVFS
As this cannot directly specified in the OPP table as dependecies in the devicetree yet, use the turbo flag again to mark this OPP as something special to have some kind of opt-in.
So revert commit5f1bf7ae8481 ("ARM: dts: omap36xx: Remove turbo mode for 1GHz variants")
Practical reasoning:
At least the GTA04A5 (DM3730) has become unstable with that OPP enabled. Furthermore nothing enforces the availability of said technologies, even in the kernel configuration, so allow users to rather opt-in.
--- arch/arm/boot/dts/ti/omap/omap36xx.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/ti/omap/omap36xx.dtsi +1 -0
@@ -72,6 +72,7 @@ <1375000 1375000 1375000>; /* only on am/dm37x with speed-binned bit set */ opp-supported-hw = <0xffffffff 2>; + turbo-mode; }; };
Greg Kroah-Hartman
maintainerPATCH 681/826 wifi: ath12k: fix warning when unbinding
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jose Ignacio Tornos Martinez <[email protected]>
commit ca68ce0d9f4bcd032fd1334441175ae399642a06 upstream.
If there is an error during some initialization related to firmware, the buffers dp->tx_ring[i].tx_status are released.
However this is released again when the device is unbinded (ath12k_pci), and we get:
WARNING: CPU: 0 PID: 2098 at mm/slub.c:4689 free_large_kmalloc+0x4d/0x80 Call Trace:
free_large_kmallocath12k_dp_freeath12k_core_deinitath12k_pci_remove
...
The issue is always reproducible from a VM because the MSI addressing initialization is failing.
In order to fix the issue, just set the buffers to NULL after releasing in order to avoid the double free.
--- drivers/net/wireless/ath/ath12k/dp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/dp.c +3 -1
@@ -1282,8 +1282,10 @@ void ath12k_dp_free(struct ath12k_base *ath12k_dp_rx_reo_cmd_list_cleanup (ab); -for (i =0 ; i < ab->hw_params->max_tx_ring; i++) +for (i =0 ; i < ab->hw_params->max_tx_ring; i++) {kfree (dp->tx_ring[i].tx_status); + dp->tx_ring[i].tx_status =NULL ; + }ath12k_dp_rx_free (ab);/* Deinit any SOC level resource */
Greg Kroah-Hartman
maintainerPATCH 682/826 wifi: rtlwifi: Drastically reduce the attempts to read efuse in case of failures
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guilherme G. Piccoli <[email protected]>
commit 5c1b544563005a00591a3aa86ecff62ed4d11be3 upstream.
Syzkaller reported a hung task with uevent_show() on stack trace. That specific issue was addressed by another commit [0], but even with that fix applied (for example, running v6.12-rc5) we face another type of hung task that comes from the same reproducer [1]. By investigating that, we could narrow it to the following path:
(a) Syzkaller emulates a Realtek USB WiFi adapter using raw-gadget and dummy_hcd infrastructure.
(b) During the probe of rtl8192cu, the driver ends-up performing an efuse read procedure (which is related to EEPROM load IIUC), and here lies the
issue: the function read_efuse() calls read_efuse_byte() many times, as loop iterations depending on the efuse size (in our example, 512 in total).
This procedure for reading efuse bytes relies in a loop that performs an I/O read up to *10k* times in case of failures. We measured the time of the loop inside read_efuse_byte() alone, and in this reproducer (which involves the dummy_hcd emulation layer), it takes 15 seconds each. As a consequence, we have the driver stuck in its probe routine for big time, exposing a stack trace like below if we attempt to reboot the system, for example:
task:kworker/0:3 state:D stack:0 pid:662 tgid:662 ppid:2 flags:0x00004000
Workqueue: usb_hub_wq hub_event Call Trace: __schedule+0xe22/0xeb6 schedule_timeout+0xe7/0x132 __wait_for_common+0xb5/0x12e usb_start_wait_urb+0xc5/0x1ef ? usb_alloc_urb+0x95/0xa4 usb_control_msg+0xff/0x184 _usbctrl_vendorreq_sync+0xa0/0x161 _usb_read_sync+0xb3/0xc5 read_efuse_byte+0x13c/0x146 read_efuse+0x351/0x5f0 efuse_read_all_map+0x42/0x52 rtl_efuse_shadow_map_update+0x60/0xef rtl_get_hwinfo+0x5d/0x1c2 rtl92cu_read_eeprom_info+0x10a/0x8d5 ? rtl92c_read_chip_version+0x14f/0x17e rtl_usb_probe+0x323/0x851 usb_probe_interface+0x278/0x34b really_probe+0x202/0x4a4 __driver_probe_device+0x166/0x1b2 driver_probe_device+0x2f/0xd8 [...]
We propose hereby to drastically reduce the attempts of doing the I/O reads in case of failures, restricted to USB devices (given that they're inherently slower than PCIe ones). By retrying up to 10 times (instead of 10000), we got reponsiveness in the reproducer, while seems reasonable to believe that there's no sane USB device implementation in the field requiring this amount of retries at every I/O read in order to properly work. Based on that assumption, it'd be good to have it backported to stable but maybe not since driver implementation (the 10k number comes from day 0), perhaps up to 6.x series makes sense.
[0] Commit 15fffc6a5624 ("driver core: Fix uevent_show() vs driver detach race")
[1] A note about that: this syzkaller report presents multiple reproducers that differs by the type of emulated USB device. For this specific case, check the entry from 2024/08/08 06:23 in the list of crashes; the C repro is available at https://syzkaller.appspot.com/text?tag=ReproC&x=1521fc83980000.
--- drivers/net/wireless/realtek/rtlwifi/efuse.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/efuse.c +10 -1
@@ -162,10 +162,19 @@ void efuse_write_1byte(struct ieee80211_void read_efuse_byte (struct ieee80211_hw *hw,u16 _offset,u8 *pbuf) {struct rtl_priv *rtlpriv =rtl_priv (hw); +u16 max_attempts =10000 ;u32 value32;u8 readbyte;u16 retry; +/* +* In case of USB devices, transfer speeds are limited, hence +* efuse I/O reads could be (way) slower. So, decrease (a lot) +* the read attempts in case of failures. +*/ +if (rtlpriv->rtlhal.interface ==INTF_USB ) + max_attempts =10 ; +rtl_write_byte (rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL ] +1 , (_offset &0xff )); readbyte =rtl_read_byte (rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL ] +2 );
@@ -178,7 +187,7 @@ void read_efuse_byte(struct ieee80211_hw retry =0 ; value32 =rtl_read_dword (rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL ]); -while (!(((value32 >>24 ) &0xff ) &0x80 ) && (retry <10000 )) { +while (!(((value32 >>24 ) &0xff ) &0x80 ) && (retry < max_attempts)) { value32 =rtl_read_dword (rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL ]); retry++;
Greg Kroah-Hartman
maintainerPATCH 683/826 wifi: nl80211: fix bounds checker error in nl80211_parse_sched_scan
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksei Vetrov <[email protected]>
commit 9c46a3a5b394d6d123866aa44436fc2cd342eb0d upstream.
The channels array in the cfg80211_scan_request has a __counted_by attribute attached to it, which points to the n_channels variable. This attribute is used in bounds checking, and if it is not set before the array is filled, then the bounds sanitizer will issue a warning or a kernel panic if CONFIG_UBSAN_TRAP is set.
This patch sets the size of allocated memory as the initial value for n_channels. It is updated with the actual number of added elements after the array is filled.
--- net/wireless/nl80211.c | 1 + 1 file changed, 1 insertion(+)
net/wireless/nl80211.c +1 -0
@@ -9776,6 +9776,7 @@ nl80211_parse_sched_scan(struct wiphy *w request =kzalloc (size,GFP_KERNEL );if (!request)return ERR_PTR (-ENOMEM ); + request->n_channels = n_channels;if (n_ssids) request->ssids = (void *)request +
Greg Kroah-Hartman
maintainerPATCH 684/826 wifi: ath12k: fix crash when unbinding
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jose Ignacio Tornos Martinez <[email protected]>
commit 1304446f67863385dc4c914b6e0194f6664ee764 upstream.
If there is an error during some initialization related to firmware, the function ath12k_dp_cc_cleanup is called to release resources. However this is released again when the device is unbinded (ath12k_pci), and we get:
BUG: kernel NULL pointer dereference, address: 0000000000000020 at RIP: 0010:ath12k_dp_cc_cleanup.part.0+0xb6/0x500 [ath12k] Call Trace:
ath12k_dp_cc_cleanupath12k_dp_freeath12k_core_deinitath12k_pci_remove
...
The issue is always reproducible from a VM because the MSI addressing initialization is failing.
In order to fix the issue, just set to NULL the released structure in ath12k_dp_cc_cleanup at the end.
--- drivers/net/wireless/ath/ath12k/dp.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath12k/dp.c +1 -0
@@ -1247,6 +1247,7 @@ static void ath12k_dp_cc_cleanup(struct }kfree (dp->spt_info); + dp->spt_info =NULL ; }static void ath12k_dp_reoq_lut_cleanup (struct ath12k_base *ab)
Greg Kroah-Hartman
maintainerPATCH 685/826 wifi: brcmfmac: release root node in all execution paths
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 2e19a3b590ebf2e351fc9d0e7c323430e65b6b6d upstream.
The fixed patch introduced an additional condition to enter the scope where the 'root' device_node is released (!settings->board_type, currently 'err'), which avoid decrementing the refcount with a call to of_node_put() if that second condition is not satisfied.
Move the call to of_node_put() to the point where 'root' is no longer required to avoid leaking the resource if err is not zero.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +1 -2
@@ -110,9 +110,8 @@ void brcmf_of_probe(struct device *dev, }strreplace (board_type,'/' ,'-' ); settings->board_type = board_type; - -of_node_put (root); } +of_node_put (root);if (!np || !of_device_is_compatible (np,"brcm,bcm4329-fmac" ))return ;
Greg Kroah-Hartman
maintainerPATCH 686/826 Revert "fs: dont block i_writecount during exec"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
commit 3b832035387ff508fdcf0fba66701afc78f79e3d upstream.
This reverts commit 2a010c41285345da60cece35575b4e0af7e7bf44.
Quoted 23 lines · Rui Ueyama
I'm the creator and the maintainer of the mold linker
(https://github.com/rui314/mold). Recently, we discovered that mold started causing process crashes in certain situations due to a change in the Linux kernel. Here are the details:- In general, overwriting an existing file is much faster than creating an empty file and writing to it on Linux, so mold attempts to reuse an existing executable file if it exists.
- If a program is running, opening the executable file for writing previously failed with ETXTBSY. If that happens, mold falls back to creating a new file.
- However, the Linux kernel recently changed the behavior so that writing to an executable file is now always permitted
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2a010c412853).That caused mold to write to an executable file even if there's a process running that file. Since changes to mmap'ed files are immediately visible to other processes, any processes running that file would almost certainly crash in a very mysterious way. Identifying the cause of these random crashes took us a few days.
Quoted 4 lines
Rejecting writes to an executable file that is currently running is a well-known behavior, and Linux had operated that way for a very long time. So, I don’t believe relying on this behavior was our mistake; rather, I see this as a regression in the Linux kernel.
Quoting myself from commit 2a010c412853 ("fs: don't block i_writecount during exec")
Quoted 3 lines
Yes, someone in userspace could potentially be relying on this. It's not completely out of the realm of possibility but let's find out if that's actually the case and not guess.
It seems we found out that someone is relying on this obscure behavior. So revert the change.
--- fs/binfmt_elf.c | 2 ++ fs/binfmt_elf_fdpic.c | 5 ++++- fs/binfmt_misc.c | 7 +++++-- fs/exec.c | 23 +++++++++++++++-------- kernel/fork.c | 26 +++++++++++++++++++++++--- 5 files changed, 49 insertions(+), 14 deletions(-)
fs/binfmt_elf.c +2 -0
@@ -1251,6 +1251,7 @@ out_free_interp: } reloc_func_desc = interp_load_addr; +allow_write_access (interpreter);fput (interpreter);kfree (interp_elf_ex);
@@ -1347,6 +1348,7 @@ out_free_dentry:kfree (interp_elf_ex);kfree (interp_elf_phdata); out_free_file: +allow_write_access (interpreter);if (interpreter)fput (interpreter); out_free_ph:
fs/binfmt_elf_fdpic.c +4 -1
@@ -394,6 +394,7 @@ static int load_elf_fdpic_binary(struct goto error; } +allow_write_access (interpreter);fput (interpreter); interpreter =NULL ; }
@@ -465,8 +466,10 @@ static int load_elf_fdpic_binary(struct retval =0 ; error: -if (interpreter) +if (interpreter) { +allow_write_access (interpreter);fput (interpreter); + }kfree (interpreter_name);kfree (exec_params.phdrs);kfree (exec_params.loadmap);
fs/binfmt_misc.c +5 -2
@@ -247,10 +247,13 @@ static int load_misc_binary(struct linuxif (retval <0 ) goto ret; -if (fmt->flags &MISC_FMT_OPEN_FILE ) +if (fmt->flags &MISC_FMT_OPEN_FILE ) { interp_file =file_clone_open (fmt->interp_file); -else +if (!IS_ERR (interp_file)) +deny_write_access (interp_file); + }else { interp_file =open_exec (fmt->interpreter); + } retval =PTR_ERR (interp_file);if (IS_ERR (interp_file)) goto ret;
fs/exec.c +15 -8
@@ -883,7 +883,8 @@ EXPORT_SYMBOL(transfer_args_to_stack);*/ static struct file *do_open_execat (int fd,struct filename *name,int flags) { -struct file *file; +int err; + struct file *file __free(fput) = NULL;struct open_flags open_exec_flags = { .open_flag =O_LARGEFILE |O_RDONLY | __FMODE_EXEC, .acc_mode =MAY_EXEC ,
@@ -908,12 +909,14 @@ static struct file *do_open_execat(int f* an invariant that all non-regular files error out before we get here. */ if (WARN_ON_ONCE (!S_ISREG (file_inode (file)->i_mode)) || -path_noexec (&file->f_path)) { -fput (file); +path_noexec (&file->f_path))return ERR_PTR (-EACCES ); - } -return file; + err =deny_write_access (file); +if (err) +return ERR_PTR (err); + +return no_free_ptr (file); }/**
@@ -923,7 +926,8 @@ static struct file *do_open_execat(int f* * Returns ERR_PTR on failure or allocated struct file on success. * -* As this is a wrapper for the internal do_open_execat(). Also see +* As this is a wrapper for the internal do_open_execat(), callers +* must call allow_write_access() before fput() on release. Also see * do_close_execat(). */ struct file *open_exec (const char *name)
@@ -1475,8 +1479,10 @@ static int prepare_bprm_creds(struct lin/* Matches do_open_execat() */ static void do_close_execat (struct file *file) { -if (file) -fput (file); +if (!file) +return ; +allow_write_access (file); +fput (file); }static void free_bprm (struct linux_binprm *bprm)
@@ -1801,6 +1807,7 @@ static int exec_binprm(struct linux_binp bprm->file = bprm->interpreter; bprm->interpreter =NULL ; +allow_write_access (exec);if (unlikely (bprm->have_execfd)) {if (bprm->executable) {fput (exec);
kernel/fork.c +23 -3
@@ -622,6 +622,12 @@ static void dup_mm_exe_file(struct mm_st exe_file =get_mm_exe_file (oldmm);RCU_INIT_POINTER (mm->exe_file, exe_file); +/* +* We depend on the oldmm having properly denied write access to the +* exe_file already. +*/ +if (exe_file &&deny_write_access (exe_file)) +pr_warn_once ("deny_write_access() failed in %s\n" , __func__); }#ifdef CONFIG_MMU
@@ -1414,11 +1420,20 @@ int set_mm_exe_file(struct mm_struct *mm*/ old_exe_file =rcu_dereference_raw (mm->exe_file); -if (new_exe_file) +if (new_exe_file) { +/* +* We expect the caller (i.e., sys_execve) to already denied +* write access, so this is unlikely to fail. +*/ +if (unlikely (deny_write_access (new_exe_file))) +return -EACCES ;get_file (new_exe_file); + }rcu_assign_pointer (mm->exe_file, new_exe_file); -if (old_exe_file) +if (old_exe_file) { +allow_write_access (old_exe_file);fput (old_exe_file); + }return 0 ; }
@@ -1457,6 +1472,9 @@ int replace_mm_exe_file(struct mm_structreturn ret; } + ret =deny_write_access (new_exe_file); +if (ret) +return -EACCES ;get_file (new_exe_file);/* set the new file */
@@ -1465,8 +1483,10 @@ int replace_mm_exe_file(struct mm_structrcu_assign_pointer (mm->exe_file, new_exe_file);mmap_write_unlock (mm); -if (old_exe_file) +if (old_exe_file) { +allow_write_access (old_exe_file);fput (old_exe_file); + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 687/826 Revert "f2fs: remove unreachable lazytime mount option parsing"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaegeuk Kim <[email protected]>
commit acff9409dd40beaca2bd982678d222e2740ad84b upstream.
This reverts commit 54f43a10fa257ad4af02a1d157fefef6ebcfa7dc.
The above commit broke the lazytime mount, given
mount("/dev/vdb", "/mnt/test", "f2fs", 0, "lazytime");
--- fs/f2fs/super.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/f2fs/super.c +10 -0
@@ -150,6 +150,8 @@ enum { Opt_mode, Opt_fault_injection, Opt_fault_type, + Opt_lazytime, + Opt_nolazytime, Opt_quota, Opt_noquota, Opt_usrquota,
@@ -226,6 +228,8 @@ static match_table_t f2fs_tokens = { {Opt_mode, "mode=%s"}, {Opt_fault_injection, "fault_injection=%u"}, {Opt_fault_type, "fault_type=%u"}, + {Opt_lazytime, "lazytime"}, + {Opt_nolazytime, "nolazytime"}, {Opt_quota, "quota"}, {Opt_noquota, "noquota"}, {Opt_usrquota, "usrquota"},
@@ -918,6 +922,12 @@ static int parse_options(struct super_blf2fs_info (sbi,"fault_type options not supported" );break ;#endif +case Opt_lazytime: + sb->s_flags |=SB_LAZYTIME ; +break ; +case Opt_nolazytime: + sb->s_flags &= ~SB_LAZYTIME ; +break ;#ifdef CONFIG_QUOTA case Opt_quota:case Opt_usrquota:
Greg Kroah-Hartman
maintainerPATCH 688/826 Revert "usb: gadget: composite: fix OS descriptors w_value logic"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Vrastil <[email protected]>
commit 51cdd69d6a857f527d6d0697a2e1f0fa8bca1005 upstream.
This reverts commit ec6ce7075ef879b91a8710829016005dc8170f17.
Fix installation of WinUSB driver using OS descriptors. Without the fix the drivers are not installed correctly and the property 'DeviceInterfaceGUID' is missing on host side.
The original change was based on the assumption that the interface number is in the high byte of wValue but it is in the low byte, instead. Unfortunately, the fix is based on MS documentation which is also wrong.
The actual USB request for OS descriptors (using USB analyzer) looks like:
Offset 0 1 2 3 4 5 6 7 0x000 C1 A1 02 00 05 00 0A 00
C1: bmRequestType (device to host, vendor, interface)
A1: nas magic number
0002: wValue (2: nas interface)
0005: wIndex (5: get extended property i.e. nas interface GUID) 008E: wLength (142)
The fix was tested on Windows 10 and Windows 11.
--- drivers/usb/gadget/composite.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/usb/gadget/composite.c +15 -3
@@ -2111,8 +2111,20 @@ unknown:memset (buf,0 , w_length); buf[5 ] =0x01 ;switch (ctrl->bRequestType &USB_RECIP_MASK ) { +/* +* The Microsoft CompatID OS Descriptor Spec(w_index = 0x4) and +* Extended Prop OS Desc Spec(w_index = 0x5) state that the +* HighByte of wValue is the InterfaceNumber and the LowByte is +* the PageNumber. This high/low byte ordering is incorrectly +* documented in the Spec. USB analyzer output on the below +* request packets show the high/low byte inverted i.e LowByte +* is the InterfaceNumber and the HighByte is the PageNumber. +* Since we dont support >64KB CompatID/ExtendedProp descriptors, +* PageNumber is set to 0. Hence verify that the HighByte is 0 +* for below two cases. +*/ case USB_RECIP_DEVICE : -if (w_index !=0x4 || (w_value &0xff )) +if (w_index !=0x4 || (w_value >>8 ))break ; buf[6 ] = w_index;/* Number of ext compat interfaces */
@@ -2128,9 +2140,9 @@ unknown: }break ;case USB_RECIP_INTERFACE : -if (w_index !=0x5 || (w_value &0xff )) +if (w_index !=0x5 || (w_value >>8 ))break ; - interface = w_value >>8 ; + interface = w_value &0xFF ;if (interface >=MAX_CONFIG_INTERFACES || !os_desc_cfg->interface[interface])break ;
Greg Kroah-Hartman
maintainerPATCH 689/826 serial: sh-sci: Clean sci_ports[0] after at earlycon exit
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit 3791ea69a4858b81e0277f695ca40f5aae40f312 upstream.
The early_console_setup() function initializes the sci_ports[0].port with an object of type struct uart_port obtained from the object of type struct earlycon_device received as argument by the early_console_setup().
It may happen that later, when the rest of the serial ports are probed, the serial port that was used as earlycon (e.g., port A) to be mapped to a different position in sci_ports[] and the slot 0 to be used by a different serial port (e.g., port B), as follows:
sci_ports[0] = port A
sci_ports[X] = port B
In this case, the new port mapped at index zero will have associated data that was used for earlycon.
In case this happens, after Linux boot, any access to the serial port that maps on sci_ports[0] (port A) will block the serial port that was used as earlycon (port B).
To fix this, add early_console_exit() that clean the sci_ports[0] at earlycon exit time.
--- drivers/tty/serial/sh-sci.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/tty/serial/sh-sci.c +28 -0
@@ -3535,6 +3535,32 @@ sh_early_platform_init_buffer("earlyprin#ifdef CONFIG_SERIAL_SH_SCI_EARLYCON static struct plat_sci_port port_cfg__initdata ; +static int early_console_exit (struct console *co) +{ +struct sci_port *sci_port = &sci_ports[0 ]; +struct uart_port *port = &sci_port->port; +unsigned long flags; +int locked =1 ; + +if (port->sysrq) + locked =0 ; +else if (oops_in_progress) + locked =uart_port_trylock_irqsave (port, &flags); +else +uart_port_lock_irqsave (port, &flags); + +/* +* Clean the slot used by earlycon. A new SCI device might +* map to this slot. +*/ +memset (sci_ports,0 ,sizeof (*sci_port)); + +if (locked) +uart_port_unlock_irqrestore (port, flags); + +return 0 ; +} +static int __init early_console_setup (struct earlycon_device *device,int type) {
@@ -3551,6 +3577,8 @@ static int __init early_console_setup(st SCSCR_RE | SCSCR_TE | port_cfg.scscr); device->con->write = serial_console_write; + device->con->exit = early_console_exit; +return 0 ; } static int __init sci_early_console_setup(struct earlycon_device *device,
Greg Kroah-Hartman
maintainerPATCH 690/826 Revert "serial: sh-sci: Clean sci_ports[0] after at earlycon exit"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 718632467d88e98816fa01ab12681ef1c2aa56f8 upstream.
This reverts commit 3791ea69a4858b81e0277f695ca40f5aae40f312.
It was reported to cause boot-time issues, so revert it for now.
--- drivers/tty/serial/sh-sci.c | 28 ---------------------------- 1 file changed, 28 deletions(-)
drivers/tty/serial/sh-sci.c +0 -28
@@ -3535,32 +3535,6 @@ sh_early_platform_init_buffer("earlyprin#ifdef CONFIG_SERIAL_SH_SCI_EARLYCON static struct plat_sci_port port_cfg__initdata ; -static int early_console_exit (struct console *co) -{ -struct sci_port *sci_port = &sci_ports[0 ]; -struct uart_port *port = &sci_port->port; -unsigned long flags; -int locked =1 ; - -if (port->sysrq) - locked =0 ; -else if (oops_in_progress) - locked =uart_port_trylock_irqsave (port, &flags); -else -uart_port_lock_irqsave (port, &flags); - -/* -* Clean the slot used by earlycon. A new SCI device might -* map to this slot. -*/ -memset (sci_ports,0 ,sizeof (*sci_port)); - -if (locked) -uart_port_unlock_irqrestore (port, flags); - -return 0 ; -} -static int __init early_console_setup (struct earlycon_device *device,int type) {
@@ -3577,8 +3551,6 @@ static int __init early_console_setup(st SCSCR_RE | SCSCR_TE | port_cfg.scscr); device->con->write = serial_console_write; - device->con->exit = early_console_exit; -return 0 ; } static int __init sci_early_console_setup(struct earlycon_device *device,
Greg Kroah-Hartman
maintainerPATCH 691/826 io_uring: fix corner case forgetting to vunmap
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
commit 43eef70e7e2ac74e7767731dd806720c7fb5e010 upstream.
io_pages_unmap() is a bit tricky in trying to figure whether the pages were previously vmap'ed or not. In particular If there is juts one page it belives there is no need to vunmap. Paired io_pages_map(), however, could've failed io_mem_alloc_compound() and attempted to io_mem_alloc_single(), which does vmap, and that leads to unpaired vmap.
The solution is to fail if io_mem_alloc_compound() can't allocate a single page. That's the easiest way to deal with it, and those two functions are getting removed soon, so no need to overcomplicate it.
--- io_uring/memmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
io_uring/memmap.c +3 -1
@@ -72,6 +72,8 @@ void *io_pages_map(struct page ***out_pa ret =io_mem_alloc_compound (pages, nr_pages, size, gfp);if (!IS_ERR (ret)) goto done; +if (nr_pages ==1 ) + goto fail; ret =io_mem_alloc_single (pages, nr_pages, size, gfp);if (!IS_ERR (ret)) {
@@ -80,7 +82,7 @@ done: *npages = nr_pages;return ret; } - +fail:kvfree (pages); *out_pages =NULL ; *npages =0 ;
Greg Kroah-Hartman
maintainerPATCH 692/826 io_uring: check for overflows in io_pin_pages
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
commit 0c0a4eae26ac78379d0c1db053de168a8febc6c9 upstream.
WARNING: CPU: 0 PID: 5834 at io_uring/memmap.c:144 io_pin_pages+0x149/0x180 io_uring/memmap.c:144 CPU: 0 UID: 0 PID: 5834 Comm: syz-executor825 Not tainted 6.12.0-next-20241118-syzkaller #0 Call Trace: <TASK> __io_uaddr_map+0xfb/0x2d0 io_uring/memmap.c:183 io_rings_map io_uring/io_uring.c:2611 [inline] io_allocate_scq_urings+0x1c0/0x650 io_uring/io_uring.c:3470 io_uring_create+0x5b5/0xc00 io_uring/io_uring.c:3692 io_uring_setup io_uring/io_uring.c:3781 [inline] ... </TASK>
io_pin_pages()'s uaddr parameter came directly from the user and can be garbage. Don't just add size to it as it can overflow.
--- io_uring/memmap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
io_uring/memmap.c +6 -1
@@ -137,7 +137,12 @@ struct page **io_pin_pages(unsigned longstruct page **pages;int ret; - end = (uaddr + len +PAGE_SIZE -1 ) >>PAGE_SHIFT ; +if (check_add_overflow (uaddr, len, &end)) +return ERR_PTR (-EOVERFLOW ); +if (check_add_overflow (end,PAGE_SIZE -1 , &end)) +return ERR_PTR (-EOVERFLOW ); + + end = end >>PAGE_SHIFT ; start = uaddr >>PAGE_SHIFT ; nr_pages = end - start;if (WARN_ON_ONCE (!nr_pages))
Greg Kroah-Hartman
maintainerPATCH 693/826 blk-settings: round down io_opt to physical_block_size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 9c0ba14828d64744ccd195c610594ba254a1a9ab upstream.
There was a bug report [1] where the user got a warning alignment inconsistency. The user has optimal I/O 16776704 (0xFFFE00) and physical block size 4096. Note that the optimal I/O size may be set by the DMA engines or SCSI controllers and they have no knowledge about the disks attached to them, so the situation with optimal I/O not aligned to physical block size may happen.
This commit makes blk_validate_limits round down optimal I/O size to the physical block size of the block device.
--- block/blk-settings.c | 7 +++++++ 1 file changed, 7 insertions(+)
block/blk-settings.c +7 -0
@@ -250,6 +250,13 @@ static int blk_validate_limits(struct qu lim->io_min = lim->physical_block_size;/* +* The optimal I/O size may not be aligned to physical block size +* (because it may be limited by dma engines which have no clue about +* block size of the disks attached to them), so we round it down here. +*/ + lim->io_opt =round_down (lim->io_opt, lim->physical_block_size); + +/* * max_hw_sectors has a somewhat weird default for historical reason, * but driver really should set their own instead of relying on this * value.
Greg Kroah-Hartman
maintainerPATCH 694/826 gpio: exar: set value when external pull-up or pull-down is present
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sai Kumar Cholleti <[email protected]>
commit 72cef64180de04a7b055b4773c138d78f4ebdb77 upstream.
Setting GPIO direction = high, sometimes results in GPIO value = 0.
If a GPIO is pulled high, the following construction results in the value being 0 when the desired value is 1:
$ echo "high" > /sys/class/gpio/gpio336/direction $ cat /sys/class/gpio/gpio336/value 0
Before the GPIO direction is changed from an input to an output, exar_set_value() is called with value = 1, but since the GPIO is an input when exar_set_value() is called, _regmap_update_bits() reads a 1 due to an external pull-up. regmap_set_bits() sets force_write = false, so the value (1) is not written. When the direction is then changed, the GPIO becomes an output with the value of 0 (the hardware default).
regmap_write_bits() sets force_write = true, so the value is always written by exar_set_value() and an external pull-up doesn't affect the outcome of setting direction = high.
The same can happen when a GPIO is pulled low, but the scenario is a little more complicated.
$ echo high > /sys/class/gpio/gpio351/direction $ cat /sys/class/gpio/gpio351/value 1
$ echo in > /sys/class/gpio/gpio351/direction $ cat /sys/class/gpio/gpio351/value 0
$ echo low > /sys/class/gpio/gpio351/direction $ cat /sys/class/gpio/gpio351/value 1
--- drivers/gpio/gpio-exar.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpio/gpio-exar.c +6 -4
@@ -99,11 +99,13 @@ static void exar_set_value(struct gpio_cstruct exar_gpio_chip *exar_gpio =gpiochip_get_data (chip);unsigned int addr =exar_offset_to_lvl_addr (exar_gpio, offset);unsigned int bit =exar_offset_to_bit (exar_gpio, offset); +unsigned int bit_value = value ?BIT (bit) :0 ; -if (value) -regmap_set_bits (exar_gpio->regmap, addr,BIT (bit)); -else -regmap_clear_bits (exar_gpio->regmap, addr,BIT (bit)); +/* +* regmap_write_bits() forces value to be written when an external +* pull up/down might otherwise indicate value was already set. +*/ +regmap_write_bits (exar_gpio->regmap, addr,BIT (bit), bit_value); } static int exar_direction_output(struct gpio_chip *chip, unsigned int offset,
Greg Kroah-Hartman
maintainerPATCH 695/826 netfilter: ipset: add missing range check in bitmap_ip_uadt
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeongjun Park <[email protected]>
commit 35f56c554eb1b56b77b3cf197a6b00922d49033d upstream.
When tb[IPSET_ATTR_IP_TO] is not present but tb[IPSET_ATTR_CIDR] exists, the values of ip and ip_to are slightly swapped. Therefore, the range check for ip should be done later, but this part is missing and it seems that the vulnerability occurs.
So we should add missing range checks and remove unnecessary range checks.
--- net/netfilter/ipset/ip_set_bitmap_ip.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/netfilter/ipset/ip_set_bitmap_ip.c +2 -5
@@ -163,11 +163,8 @@ bitmap_ip_uadt(struct ip_set *set, struc ret =ip_set_get_hostipaddr4 (tb[IPSET_ATTR_IP_TO ], &ip_to);if (ret)return ret; -if (ip > ip_to) { +if (ip > ip_to)swap (ip, ip_to); -if (ip < map->first_ip) -return -IPSET_ERR_BITMAP_RANGE ; - } }else if (tb[IPSET_ATTR_CIDR ]) {u8 cidr =nla_get_u8 (tb[IPSET_ATTR_CIDR ]);
@@ -178,7 +175,7 @@ bitmap_ip_uadt(struct ip_set *set, struc ip_to = ip; } -if (ip_to > map->last_ip) +if (ip < map->first_ip || ip_to > map->last_ip)return -IPSET_ERR_BITMAP_RANGE ;for (; !before (ip_to, ip); ip += map->hosts) {
Greg Kroah-Hartman
maintainerPATCH 696/826 spi: Fix acpi deferred irq probe
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit d24cfee7f63d6b44d45a67c5662bd1cc48e8b3ca upstream.
When probing spi device take care of deferred probe of ACPI irq gpio similar like for OF/DT case.
Quoted 1 line
From practical standpoint this fixes issue with vsc-tp driver on
Dell XP 9340 laptop, which try to request interrupt with spi->irq equal to -EPROBE_DEFER and fail to probe with the following error:
vsc-tp spi-INTC10D0:00: probe with driver vsc-tp failed with error -22
--- drivers/spi/spi.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/spi/spi.c +10 -3
@@ -424,6 +424,16 @@ static int spi_probe(struct device *dev) spi->irq =0 ; } +if (has_acpi_companion (dev) && spi->irq <0 ) { +struct acpi_device *adev =to_acpi_device_node (dev->fwnode); + + spi->irq =acpi_dev_gpio_irq_get (adev,0 ); +if (spi->irq == -EPROBE_DEFER ) +return -EPROBE_DEFER ; +if (spi->irq <0 ) + spi->irq =0 ; + } + ret =dev_pm_domain_attach (dev, true);if (ret)return ret;
@@ -2869,9 +2879,6 @@ static acpi_status acpi_register_spi_devacpi_set_modalias (adev,acpi_device_hid (adev), spi->modalias,sizeof (spi->modalias)); -if (spi->irq <0 ) - spi->irq =acpi_dev_gpio_irq_get (adev,0 ); -acpi_device_set_enumerated (adev); adev->power.flags.ignore_parent = true;
Greg Kroah-Hartman
maintainerPATCH 697/826 mtd: spi-nor: core: replace dummy buswidth from addr to data
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Ming Lin <[email protected]>
commit 98d1fb94ce75f39febd456d6d3cbbe58b6678795 upstream.
The default dummy cycle for Macronix SPI NOR flash in Octal Output Read Mode(1-1-8) is 20.
Currently, the dummy buswidth is set according to the address bus width. In the 1-1-8 mode, this means the dummy buswidth is 1. When converting dummy cycles to bytes, this results in 20 x 1 / 8 = 2 bytes, causing the host to read data 4 cycles too early.
Since the protocol data buswidth is always greater than or equal to the address buswidth. Setting the dummy buswidth to match the data buswidth increases the likelihood that the dummy cycle-to-byte conversion will be divisible, preventing the host from reading data prematurely.
--- drivers/mtd/spi-nor/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi-nor/core.c +1 -1
@@ -89,7 +89,7 @@ void spi_nor_spimem_setup_op(const struc op->addr.buswidth =spi_nor_get_protocol_addr_nbits (proto);if (op->dummy.nbytes) - op->dummy.buswidth =spi_nor_get_protocol_addr_nbits (proto); + op->dummy.buswidth =spi_nor_get_protocol_data_nbits (proto);if (op->data.nbytes) op->data.buswidth =spi_nor_get_protocol_data_nbits (proto);
Greg Kroah-Hartman
maintainerPATCH 698/826 cpufreq: mediatek-hw: Fix wrong return value in mtk_cpufreq_get_cpu_power()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
commit 172bf5ed04cb6c9e66d58de003938ed5c8756570 upstream.
mtk_cpufreq_get_cpu_power() return 0 if the policy is NULL. Then in em_create_perf_table(), the later zero check for power is not invalid as power is uninitialized. As Lukasz suggested, it must return -EINVAL when the 'policy' is not found. So return -EINVAL to fix it.
--- drivers/cpufreq/mediatek-cpufreq-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/mediatek-cpufreq-hw.c +1 -1
@@ -62,7 +62,7 @@ mtk_cpufreq_get_cpu_power(struct device policy =cpufreq_cpu_get_raw (cpu_dev->id);if (!policy) -return 0 ; +return -EINVAL ; data = policy->driver_data;
Greg Kroah-Hartman
maintainerPATCH 699/826 cifs: support mounting with alternate password to allow password rotation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Meetakshi Setiya <[email protected]>
commit b9aef1b13a0a92aa7058ba235afb24b5b89153ca upstream.
Fixes the case for example where the password specified on mount is a recently expired password, but password2 is valid. Without this patch this mount scenario would fail.
This patch introduces the following changes to support password rotation on mount:
1. If an existing session is not found and the new session setup results in EACCES, EKEYEXPIRED or EKEYREVOKED, swap password and password2 (if available), and retry the mount.
2. To match the new mount with an existing session, add conditions to check if a) password and password2 of the new mount and the existing session are the same, or b) password of the new mount is the same as the password2 of the existing session, and password2 of the new mount is the same as the password of the existing session.
3. If an existing session is found, but needs reconnect, retry the session setup after swapping password and password2 (if available), in case the previous attempt results in EACCES, EKEYEXPIRED or EKEYREVOKED.
--- fs/smb/client/connect.c | 57 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 7 deletions(-)
fs/smb/client/connect.c +50 -7
@@ -1897,11 +1897,35 @@ static int match_session(struct cifs_ses CIFS_MAX_USERNAME_LEN))return 0 ;if ((ctx->username &&strlen (ctx->username) !=0 ) && - ses->password !=NULL && -strncmp (ses->password, - ctx->password ? ctx->password :"" , -CIFS_MAX_PASSWORD_LEN )) -return 0 ; + ses->password !=NULL ) { + +/* New mount can only share sessions with an existing mount if: +* 1. Both password and password2 match, or +* 2. password2 of the old mount matches password of the new mount +* and password of the old mount matches password2 of the new +* mount +*/ +if (ses->password2 !=NULL && ctx->password2 !=NULL ) { +if (!((strncmp (ses->password, ctx->password ? + ctx->password :"" ,CIFS_MAX_PASSWORD_LEN ) ==0 && +strncmp (ses->password2, ctx->password2, +CIFS_MAX_PASSWORD_LEN ) ==0 ) || + (strncmp (ses->password, ctx->password2, +CIFS_MAX_PASSWORD_LEN ) ==0 && +strncmp (ses->password2, ctx->password ? + ctx->password :"" ,CIFS_MAX_PASSWORD_LEN ) ==0 ))) +return 0 ; + + }else if ((ses->password2 ==NULL && ctx->password2 !=NULL ) || + (ses->password2 !=NULL && ctx->password2 ==NULL )) { +return 0 ; + + }else { +if (strncmp (ses->password, ctx->password ? + ctx->password :"" ,CIFS_MAX_PASSWORD_LEN )) +return 0 ; + } + } }if (strcmp (ctx->local_nls->charset, ses->local_nls->charset))
@@ -2244,6 +2268,7 @@ struct cifs_ses * cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx) { int rc = 0; +int retries =0 ;unsigned int xid;struct cifs_ses *ses;struct sockaddr_in *addr = (struct sockaddr_in *)&server->dstaddr;
@@ -2262,6 +2287,8 @@ cifs_get_smb_ses(struct TCP_Server_Infocifs_dbg (FYI ,"Session needs reconnect\n" );mutex_lock (&ses->session_mutex); + +retry_old_session: rc =cifs_negotiate_protocol (xid, ses, server);if (rc) {mutex_unlock (&ses->session_mutex);
@@ -2274,6 +2301,13 @@ cifs_get_smb_ses(struct TCP_Server_Info rc =cifs_setup_session (xid, ses, server, ctx->local_nls);if (rc) { +if (((rc == -EACCES ) || (rc == -EKEYEXPIRED ) || + (rc == -EKEYREVOKED )) && !retries && ses->password2) { + retries++; +cifs_dbg (FYI ,"Session reconnect failed, retrying with alternate password\n" ); +swap (ses->password, ses->password2); + goto retry_old_session; + }mutex_unlock (&ses->session_mutex);/* problem -- put our reference */ cifs_put_smb_ses (ses);
@@ -2349,6 +2383,7 @@ cifs_get_smb_ses(struct TCP_Server_Info ses->chans_need_reconnect =1 ;spin_unlock (&ses->chan_lock); +retry_new_session:mutex_lock (&ses->session_mutex); rc =cifs_negotiate_protocol (xid, ses, server);if (!rc)
@@ -2361,8 +2396,16 @@ cifs_get_smb_ses(struct TCP_Server_Info sizeof(ses->smb3signingkey));spin_unlock (&ses->chan_lock); -if (rc) - goto get_ses_fail; +if (rc) { +if (((rc == -EACCES ) || (rc == -EKEYEXPIRED ) || + (rc == -EKEYREVOKED )) && !retries && ses->password2) { + retries++; +cifs_dbg (FYI ,"Session setup failed, retrying with alternate password\n" ); +swap (ses->password, ses->password2); + goto retry_new_session; + }else + goto get_ses_fail; + }/* * success, put it on the list and add it as first channel
Greg Kroah-Hartman
maintainerPATCH 700/826 parisc/ftrace: Fix function graph tracing disablement
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit a5f05a138a8cac035bf9da9b6ed0e532bc7942c8 upstream.
Due to an apparent copy-paste bug, the parisc implementation of ftrace_disable_ftrace_graph_caller() doesn't actually do anything. It enables the (already-enabled) static key rather than disabling it.
The result is that after function graph tracing has been "disabled", any subsequent (non-graph) function tracing will inadvertently also enable the slow fgraph return address hijacking.
--- arch/parisc/kernel/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/kernel/ftrace.c +1 -1
@@ -87,7 +87,7 @@ int ftrace_enable_ftrace_graph_caller(voint ftrace_disable_ftrace_graph_caller (void ) { -static_key_enable (&ftrace_graph_enable.key); +static_key_disable (&ftrace_graph_enable.key);return 0 ; }#endif
Greg Kroah-Hartman
maintainerPATCH 701/826 RISC-V: Scalar unaligned access emulated on hotplug CPUs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Taube <[email protected]>
commit 9c528b5f7927b857b40f3c46afbc869827af3c94 upstream.
The check_unaligned_access_emulated() function should have been called during CPU hotplug to ensure that if all CPUs had emulated unaligned accesses, the new CPU also does.
This patch adds the call to check_unaligned_access_emulated() in the hotplug path.
--- arch/riscv/kernel/unaligned_access_speed.c | 1 + 1 file changed, 1 insertion(+)
arch/riscv/kernel/unaligned_access_speed.c +1 -0
@@ -191,6 +191,7 @@ static int riscv_online_cpu(unsigned intif (per_cpu (misaligned_access_speed, cpu) !=RISCV_HWPROBE_MISALIGNED_SCALAR_UNKNOWN ) goto exit; +check_unaligned_access_emulated (NULL ); buf =alloc_pages (GFP_KERNEL ,MISALIGNED_BUFFER_ORDER );if (!buf) {pr_warn ("Allocation failure, not measuring misaligned performance\n" );
Greg Kroah-Hartman
maintainerPATCH 702/826 RISC-V: Check scalar unaligned access on all CPUs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Taube <[email protected]>
commit 8d20a739f17a2de9e269db72330f5655d6545dd4 upstream.
Originally, the check_unaligned_access_emulated_all_cpus function only checked the boot hart. This fixes the function to check all harts.
--- arch/riscv/include/asm/cpufeature.h | 2 ++ arch/riscv/kernel/traps_misaligned.c | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-)
arch/riscv/include/asm/cpufeature.h +2 -0
@@ -8,6 +8,7 @@#include <linux/bitmap.h> #include <linux/jump_label.h> +#include <linux/workqueue.h> #include <asm/hwcap.h> #include <asm/alternative-macros.h> #include <asm/errno.h>
@@ -60,6 +61,7 @@ void riscv_user_isa_enable(void);#if defined(CONFIG_RISCV_MISALIGNED )bool check_unaligned_access_emulated_all_cpus (void ); +void check_unaligned_access_emulated (struct work_struct *work__always_unused );void unaligned_emulation_finish (void );bool unaligned_ctl_available (void );DECLARE_PER_CPU (long, misaligned_access_speed);
arch/riscv/kernel/traps_misaligned.c +7 -7
@@ -524,11 +524,11 @@ int handle_misaligned_store(struct pt_rereturn 0 ; } -static bool check_unaligned_access_emulated (int cpu) +void check_unaligned_access_emulated (struct work_struct *work__always_unused ) { +int cpu =smp_processor_id ();long *mas_ptr =per_cpu_ptr (&misaligned_access_speed, cpu);unsigned long tmp_var, tmp_val; -bool misaligned_emu_detected; *mas_ptr =RISCV_HWPROBE_MISALIGNED_SCALAR_UNKNOWN ;
@@ -536,19 +536,16 @@ static bool check_unaligned_access_emula" " REG_L " %[tmp], 1(%[ptr])\n" : [tmp] "=r" (tmp_val) : [ptr] "r" (&tmp_var) : "memory"); - misaligned_emu_detected = (*mas_ptr == RISCV_HWPROBE_MISALIGNED_SCALAR_EMULATED);/* * If unaligned_ctl is already set, this means that we detected that all * CPUS uses emulated misaligned access at boot time. If that changed * when hotplugging the new cpu, this is something we don't handle. */ -if (unlikely (unaligned_ctl && !misaligned_emu_detected)) { + if (unlikely(unaligned_ctl && (*mas_ptr != RISCV_HWPROBE_MISALIGNED_SCALAR_EMULATED))) {pr_crit ("CPU misaligned accesses non homogeneous (expected all emulated)\n" );while (true)cpu_relax (); } - -return misaligned_emu_detected; }bool check_unaligned_access_emulated_all_cpus (void )
@@ -560,8 +557,11 @@ bool check_unaligned_access_emulated_all* accesses emulated since tasks requesting such control can run on any * CPU. */ +schedule_on_each_cpu (check_unaligned_access_emulated); +for_each_online_cpu (cpu) -if (!check_unaligned_access_emulated (cpu)) +if (per_cpu (misaligned_access_speed, cpu) + !=RISCV_HWPROBE_MISALIGNED_SCALAR_EMULATED )return false; unaligned_ctl = true;
Greg Kroah-Hartman
maintainerPATCH 703/826 ksmbd: fix use-after-free in SMB request handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yunseong Kim <[email protected]>
commit 9a8c5d89d327ff58e9b2517f8a6afb4181d32c6e upstream.
A race condition exists between SMB request handling in ksmbd_conn_handler_loop() and the freeing of ksmbd_conn in the workqueue handler handle_ksmbd_work(). This leads to a UAF.
- KASAN: slab-use-after-free Read in handle_ksmbd_work
- KASAN: slab-use-after-free in rtlock_slowlock_locked
This race condition arises as follows:
- ksmbd_conn_handler_loop() waits for conn->r_count to reach zero:
wait_event(conn->r_count_q, atomic_read(&conn->r_count) == 0);
- Meanwhile, handle_ksmbd_work() decrements conn->r_count using atomic_dec_return(&conn->r_count), and if it reaches zero, calls ksmbd_conn_free(), which frees conn.
- However, after handle_ksmbd_work() decrements conn->r_count, it may still access conn->r_count_q in the following line:
waitqueue_active(&conn->r_count_q) or wake_up(&conn->r_count_q) This results in a UAF, as conn has already been freed.
The discovery of this UAF can be referenced in the following PR for syzkaller's support for SMB requests.
--- fs/smb/server/server.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/smb/server/server.c +4 -0
@@ -276,8 +276,12 @@ static void handle_ksmbd_work(struct wor* disconnection. waitqueue_active is safe because it * uses atomic operation for condition. */ +atomic_inc (&conn->refcnt);if (!atomic_dec_return (&conn->r_count) &&waitqueue_active (&conn->r_count_q))wake_up (&conn->r_count_q); + +if (atomic_dec_and_test (&conn->refcnt)) +kfree (conn); }/**
Greg Kroah-Hartman
maintainerPATCH 704/826 smb: client: fix NULL ptr deref in crypto_aead_setkey()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
commit 4bdec0d1f658f7c98749bd2c5a486e6cfa8565d2 upstream.
Neither SMB3.0 or SMB3.02 supports encryption negotiate context, so when SMB2_GLOBAL_CAP_ENCRYPTION flag is set in the negotiate response, the client uses AES-128-CCM as the default cipher. See MS-SMB2 3.3.5.4.
Commit b0abcd65ec54 ("smb: client: fix UAF in async decryption") added a @server->cipher_type check to conditionally call smb3_crypto_aead_allocate(), but that check would always be false as @server->cipher_type is unset for SMB3.02.
Fix the following KASAN splat by setting @server->cipher_type for SMB3.02 as well.
mount.cifs //srv/share /mnt -o vers=3.02,seal,...
BUG: KASAN: null-ptr-deref in crypto_aead_setkey+0x2c/0x130 Read of size 8 at addr 0000000000000020 by task mount.cifs/1095 CPU: 1 UID: 0 PID: 1095 Comm: mount.cifs Not tainted 6.12.0 #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-3.fc41 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x5d/0x80 ? crypto_aead_setkey+0x2c/0x130 kasan_report+0xda/0x110 ? crypto_aead_setkey+0x2c/0x130 crypto_aead_setkey+0x2c/0x130 crypt_message+0x258/0xec0 [cifs] ? __asan_memset+0x23/0x50 ? __pfx_crypt_message+0x10/0x10 [cifs] ? mark_lock+0xb0/0x6a0 ? hlock_class+0x32/0xb0 ? mark_lock+0xb0/0x6a0 smb3_init_transform_rq+0x352/0x3f0 [cifs] ? lock_acquire.part.0+0xf4/0x2a0 smb_send_rqst+0x144/0x230 [cifs] ? __pfx_smb_send_rqst+0x10/0x10 [cifs] ? hlock_class+0x32/0xb0 ? smb2_setup_request+0x225/0x3a0 [cifs] ? __pfx_cifs_compound_last_callback+0x10/0x10 [cifs] compound_send_recv+0x59b/0x1140 [cifs] ? __pfx_compound_send_recv+0x10/0x10 [cifs] ? __create_object+0x5e/0x90 ? hlock_class+0x32/0xb0 ? do_raw_spin_unlock+0x9a/0xf0 cifs_send_recv+0x23/0x30 [cifs] SMB2_tcon+0x3ec/0xb30 [cifs] ? __pfx_SMB2_tcon+0x10/0x10 [cifs] ? lock_acquire.part.0+0xf4/0x2a0 ? __pfx_lock_release+0x10/0x10 ? do_raw_spin_trylock+0xc6/0x120 ? lock_acquire+0x3f/0x90 ? _get_xid+0x16/0xd0 [cifs] ? __pfx_SMB2_tcon+0x10/0x10 [cifs] ? cifs_get_smb_ses+0xcdd/0x10a0 [cifs] cifs_get_smb_ses+0xcdd/0x10a0 [cifs] ? __pfx_cifs_get_smb_ses+0x10/0x10 [cifs] ? cifs_get_tcp_session+0xaa0/0xca0 [cifs] cifs_mount_get_session+0x8a/0x210 [cifs] dfs_mount_share+0x1b0/0x11d0 [cifs] ? __pfx___lock_acquire+0x10/0x10 ? __pfx_dfs_mount_share+0x10/0x10 [cifs] ? lock_acquire.part.0+0xf4/0x2a0 ? find_held_lock+0x8a/0xa0 ? hlock_class+0x32/0xb0 ? lock_release+0x203/0x5d0 cifs_mount+0xb3/0x3d0 [cifs] ? do_raw_spin_trylock+0xc6/0x120 ? __pfx_cifs_mount+0x10/0x10 [cifs] ? lock_acquire+0x3f/0x90 ? find_nls+0x16/0xa0 ? smb3_update_mnt_flags+0x372/0x3b0 [cifs] cifs_smb3_do_mount+0x1e2/0xc80 [cifs] ? __pfx_vfs_parse_fs_string+0x10/0x10 ? __pfx_cifs_smb3_do_mount+0x10/0x10 [cifs] smb3_get_tree+0x1bf/0x330 [cifs] vfs_get_tree+0x4a/0x160 path_mount+0x3c1/0xfb0 ? kasan_quarantine_put+0xc7/0x1d0 ? __pfx_path_mount+0x10/0x10 ? kmem_cache_free+0x118/0x3e0 ? user_path_at+0x74/0xa0 __x64_sys_mount+0x1a6/0x1e0 ? __pfx___x64_sys_mount+0x10/0x10 ? mark_held_locks+0x1a/0x90 do_syscall_64+0xbb/0x1d0 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- fs/smb/client/smb2pdu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/smb/client/smb2pdu.c +3 -1
@@ -1231,7 +1231,9 @@ SMB2_negotiate(const unsigned int xid,* SMB3.0 supports only 1 cipher and doesn't have a encryption neg context * Set the cipher type manually. */ -if (server->dialect ==SMB30_PROT_ID && (server->capabilities &SMB2_GLOBAL_CAP_ENCRYPTION )) +if ((server->dialect ==SMB30_PROT_ID || + server->dialect ==SMB302_PROT_ID ) && + (server->capabilities &SMB2_GLOBAL_CAP_ENCRYPTION )) server->cipher_type =SMB2_ENCRYPTION_AES128_CCM ; security_blob = smb2_get_data_area_len(&blob_offset, &blob_length,
Greg Kroah-Hartman
maintainerPATCH 705/826 platform/chrome: cros_ec_typec: fix missing fwnode reference decrement
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 9c41f371457bd9a24874e3c7934d9745e87fbc58 upstream.
The device_for_each_child_node() macro requires explicit calls to fwnode_handle_put() upon early exits (return, break, goto) to decrement the fwnode's refcount, and avoid levaing a node reference behind.
Add the missing fwnode_handle_put() after the common label for all error paths.
--- drivers/platform/chrome/cros_ec_typec.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/chrome/cros_ec_typec.c +1 -0
@@ -409,6 +409,7 @@ static int cros_typec_init_ports(structreturn 0 ; unregister_ports: +fwnode_handle_put (fwnode);cros_unregister_ports (typec);return ret; }
Greg Kroah-Hartman
maintainerPATCH 706/826 irqchip/irq-mvebu-sei: Move misplaced select() callback to SEI CP domain
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King (Oracle) <[email protected]>
commit 12aaf67584cf19dc84615b7aba272fe642c35b8b upstream.
Commit fbdf14e90ce4 ("irqchip/irq-mvebu-sei: Switch to MSI parent") introduced in v6.11-rc1 broke Mavell Armada platforms (and possibly others) by incorrectly switching irq-mvebu-sei to MSI parent.
In the above commit, msi_parent_ops is set for the sei->cp_domain, but rather than adding a .select method to mvebu_sei_cp_domain_ops (which is associated with sei->cp_domain), it was added to mvebu_sei_domain_ops which is associated with sei->sei_domain, which doesn't have any msi_parent_ops. This makes the call to msi_lib_irq_domain_select() always fail.
This bug manifests itself with the following kernel messages on Armada 8040 based systems:
platform f21e0000.interrupt-controller:interrupt-controller@50: deferred probe pending: (reason unknown) platform f41e0000.interrupt-controller:interrupt-controller@50: deferred probe pending: (reason unknown)
Move the select callback to mvebu_sei_cp_domain_ops to cure it.
--- drivers/irqchip/irq-mvebu-sei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-mvebu-sei.c +1 -1
@@ -192,7 +192,6 @@ static void mvebu_sei_domain_free(struct }static const struct irq_domain_ops mvebu_sei_domain_ops = { - .select = msi_lib_irq_domain_select, .alloc = mvebu_sei_domain_alloc, .free = mvebu_sei_domain_free, };
@@ -306,6 +305,7 @@ static void mvebu_sei_cp_domain_free(str }static const struct irq_domain_ops mvebu_sei_cp_domain_ops = { + .select = msi_lib_irq_domain_select, .alloc = mvebu_sei_cp_domain_alloc, .free = mvebu_sei_cp_domain_free, };
Greg Kroah-Hartman
maintainerPATCH 707/826 x86/CPU/AMD: Terminate the erratum_1386_microcode array
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
commit ff6cdc407f4179748f4673c39b0921503199a0ad upstream.
The erratum_1386_microcode array requires an empty entry at the end. Otherwise x86_match_cpu_with_stepping() will continue iterate the array after it ended.
Add an empty entry to erratum_1386_microcode to its end.
--- arch/x86/kernel/cpu/amd.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/cpu/amd.c +1 -0
@@ -798,6 +798,7 @@ static void init_amd_bd(struct cpuinfo_xstatic const struct x86_cpu_desc erratum_1386_microcode[] = {AMD_CPU_DESC (0x17 ,0x1 ,0x2 ,0x0800126e ),AMD_CPU_DESC (0x17 ,0x31 ,0x0 ,0x08301052 ), + {}, };static void fix_erratum_1386 (struct cpuinfo_x86 *c)
Greg Kroah-Hartman
maintainerPATCH 708/826 ubi: wl: Put source PEB into correct list if trying locking LEB failed
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhihao Cheng <[email protected]>
commit d610020f030bec819f42de327c2bd5437d2766b3 upstream.
During wear-leveing work, the source PEB will be moved into scrub list when source LEB cannot be locked in ubi_eba_copy_leb(), which is wrong for non-scrub type source PEB. The problem could bring extra and ineffective wear-leveing jobs, which makes more or less negative effects for the life time of flash. Specifically, the process is divided 2 steps:
1. wear_leveling_worker // generate false scrub type PEB ubi_eba_copy_leb // MOVE_RETRY is returned leb_write_trylock // trylock failed
scrubbing = 1;
e1 is put into ubi->scrub
2. wear_leveling_worker // schedule false scrub type PEB for wl scrubbing = 1
e1 = rb_entry(rb_first(&ubi->scrub))
The problem can be reproduced easily by running fsstress on a small UBIFS partition(<64M, simulated by nandsim) for 5~10mins (CONFIG_MTD_UBI_FASTMAP=y,CONFIG_MTD_UBI_WL_THRESHOLD=50). Following message is shown:
ubi0: scrubbed PEB 66 (LEB 0:10), data moved to PEB 165
Since scrub type source PEB has set variable scrubbing as '1', and variable scrubbing is checked before variable keep, so the problem can be fixed by setting keep variable as 1 directly if the source LEB cannot be locked.
--- drivers/mtd/ubi/wl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/mtd/ubi/wl.c +8 -1
@@ -846,7 +846,14 @@ static int wear_leveling_worker(struct u goto out_not_moved; }if (err ==MOVE_RETRY ) { - scrubbing =1 ; +/* +* For source PEB: +* 1. The scrubbing is set for scrub type PEB, it will +* be put back into ubi->scrub list. +* 2. Non-scrub type PEB will be put back into ubi->used +* list. +*/ + keep =1 ; dst_leb_clean =1 ; goto out_not_moved; }
Greg Kroah-Hartman
maintainerPATCH 709/826 um: ubd: Do not use drvdata in release
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
commit 5bee35e5389f450a7eea7318deb9073e9414d3b1 upstream.
The drvdata is not available in release. Let's just use container_of() to get the ubd instance. Otherwise, removing a ubd device will result in a crash:
RIP: 0033:blk_mq_free_tag_set+0x1f/0xba RSP: 00000000e2083bf0 EFLAGS: 00010246 RAX: 000000006021463a RBX: 0000000000000348 RCX: 0000000062604d00 RDX: 0000000004208060 RSI: 00000000605241a0 RDI: 0000000000000348 RBP: 00000000e2083c10 R08: 0000000062414010 R09: 00000000601603f7 R10: 000000000000133a R11: 000000006038c4bd R12: 0000000000000000 R13: 0000000060213a5c R14: 0000000062405d20 R15: 00000000604f7aa0 Kernel panic - not syncing: Segfault with no mm CPU: 0 PID: 17 Comm: kworker/0:1 Not tainted 6.8.0-rc3-00107-gba3f67c11638 #1 Workqueue: events mc_work_proc Stack: 00000000 604f7ef0 62c5d000 62405d20 e2083c30 6002c776 6002c755 600e47ff e2083c60 6025ffe3 04208060 603d36e0 Call Trace: [<6002c776>] ubd_device_release+0x21/0x55 [<6002c755>] ? ubd_device_release+0x0/0x55 [<600e47ff>] ? kfree+0x0/0x100 [<6025ffe3>] device_release+0x70/0xba [<60381d6a>] kobject_put+0xb5/0xe2 [<6026027b>] put_device+0x19/0x1c [<6026a036>] platform_device_put+0x26/0x29 [<6026ac5a>] platform_device_unregister+0x2c/0x2e [<6002c52e>] ubd_remove+0xb8/0xd6 [<6002bb74>] ? mconsole_reply+0x0/0x50 [<6002b926>] mconsole_remove+0x160/0x1cc [<6002bbbc>] ? mconsole_reply+0x48/0x50 [<6003379c>] ? um_set_signals+0x3b/0x43 [<60061c55>] ? update_min_vruntime+0x14/0x70 [<6006251f>] ? dequeue_task_fair+0x164/0x235 [<600620aa>] ? update_cfs_group+0x0/0x40 [<603a0e77>] ? __schedule+0x0/0x3ed [<60033761>] ? um_set_signals+0x0/0x43 [<6002af6a>] mc_work_proc+0x77/0x91 [<600520b4>] process_scheduled_works+0x1af/0x2c3 [<6004ede3>] ? assign_work+0x0/0x58 [<600527a1>] worker_thread+0x2f7/0x37a [<6004ee3b>] ? set_pf_worker+0x0/0x64 [<6005765d>] ? arch_local_irq_save+0x0/0x2d [<60058e07>] ? kthread_exit+0x0/0x3a [<600524aa>] ? worker_thread+0x0/0x37a [<60058f9f>] kthread+0x130/0x135 [<6002068e>] new_thread_handler+0x85/0xb6
--- arch/um/drivers/ubd_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/ubd_kern.c +1 -1
@@ -779,7 +779,7 @@ static int ubd_open_dev(struct ubd *ubd_static void ubd_device_release (struct device *dev) { -struct ubd *ubd_dev =dev_get_drvdata (dev); + struct ubd *ubd_dev = container_of(dev, struct ubd, pdev.dev);blk_mq_free_tag_set (&ubd_dev->tag_set); *ubd_dev = ((struct ubd )DEFAULT_UBD );
Greg Kroah-Hartman
maintainerPATCH 710/826 um: net: Do not use drvdata in release
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
commit d1db692a9be3b4bd3473b64fcae996afaffe8438 upstream.
The drvdata is not available in release. Let's just use container_of() to get the uml_net instance. Otherwise, removing a network device will result in a crash:
RIP: 0033:net_device_release+0x10/0x6f RSP: 00000000e20c7c40 EFLAGS: 00010206 RAX: 000000006002e4e7 RBX: 00000000600f1baf RCX: 00000000624074e0 RDX: 0000000062778000 RSI: 0000000060551c80 RDI: 00000000627af028 RBP: 00000000e20c7c50 R08: 00000000603ad594 R09: 00000000e20c7b70 R10: 000000000000135a R11: 00000000603ad422 R12: 0000000000000000 R13: 0000000062c7af00 R14: 0000000062406d60 R15: 00000000627700b6 Kernel panic - not syncing: Segfault with no mm CPU: 0 UID: 0 PID: 29 Comm: kworker/0:2 Not tainted 6.12.0-rc6-g59b723cd2adb #1 Workqueue: events mc_work_proc Stack: 627af028 62c7af00 e20c7c80 60276fcd 62778000 603f5820 627af028 00000000 e20c7cb0 603a2bcd 627af000 62770010 Call Trace: [<60276fcd>] device_release+0x70/0xba [<603a2bcd>] kobject_put+0xba/0xe7 [<60277265>] put_device+0x19/0x1c [<60281266>] platform_device_put+0x26/0x29 [<60281e5f>] platform_device_unregister+0x2c/0x2e [<6002ec9c>] net_remove+0x63/0x69 [<60031316>] ? mconsole_reply+0x0/0x50 [<600310c8>] mconsole_remove+0x160/0x1cc [<60087d40>] ? __remove_hrtimer+0x38/0x74 [<60087ff8>] ? hrtimer_try_to_cancel+0x8c/0x98 [<6006b3cf>] ? dl_server_stop+0x3f/0x48 [<6006b390>] ? dl_server_stop+0x0/0x48 [<600672e8>] ? dequeue_entities+0x327/0x390 [<60038fa6>] ? um_set_signals+0x0/0x43 [<6003070c>] mc_work_proc+0x77/0x91 [<60057664>] process_scheduled_works+0x1b3/0x2dd [<60055f32>] ? assign_work+0x0/0x58 [<60057f0a>] worker_thread+0x1e9/0x293 [<6005406f>] ? set_pf_worker+0x0/0x64 [<6005d65d>] ? arch_local_irq_save+0x0/0x2d [<6005d748>] ? kthread_exit+0x0/0x3a [<60057d21>] ? worker_thread+0x0/0x293 [<6005dbf1>] kthread+0x126/0x12b [<600219c5>] new_thread_handler+0x85/0xb6
--- arch/um/drivers/net_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/net_kern.c +1 -1
@@ -336,7 +336,7 @@ static struct platform_driver uml_net_drstatic void net_device_release (struct device *dev) { -struct uml_net *device =dev_get_drvdata (dev); + struct uml_net *device = container_of(dev, struct uml_net, pdev.dev);struct net_device *netdev = device->dev;struct uml_net_private *lp =netdev_priv (netdev);
Greg Kroah-Hartman
maintainerPATCH 711/826 dt-bindings: serial: rs485: Fix rs485-rts-delay property
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Simek <[email protected]>
commit 12b3642b6c242061d3ba84e6e3050c3141ded14c upstream.
Code expects array only with 2 items which should be checked. But also item checking is not working as it should likely because of incorrect items description.
--- Documentation/devicetree/bindings/serial/rs485.yaml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/serial/rs485.yaml +9 -10
@@ -18,16 +18,15 @@ properties: description: prop-encoded-array <a b> $ref: /schemas/types.yaml#/definitions/uint32-array items: - items: - - description: Delay between rts signal and beginning of data sent in - milliseconds. It corresponds to the delay before sending data. - default: 0 - maximum: 100 - - description: Delay between end of data sent and rts signal in milliseconds. - It corresponds to the delay after sending data and actual release - of the line. - default: 0 - maximum: 100 + - description: Delay between rts signal and beginning of data sent in + milliseconds. It corresponds to the delay before sending data. + default: 0 + maximum: 100 + - description: Delay between end of data sent and rts signal in milliseconds. + It corresponds to the delay after sending data and actual release + of the line. + default: 0 + maximum: 100 rs485-rts-active-high: description: drive RTS high when sending (this is the default).
Greg Kroah-Hartman
maintainerPATCH 712/826 serial: 8250_fintek: Add support for F81216E
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filip Brozovic <[email protected]>
commit 166105c9030a30ba08574a9998afc7b60bc72dd7 upstream.
The F81216E is a LPC/eSPI to 4 UART Super I/O and is mostly compatible with the F81216H, but does not support RS-485 auto-direction delays on any port.
--- drivers/tty/serial/8250/8250_fintek.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_fintek.c +13 -1
@@ -21,6 +21,7 @@#define CHIP_ID_F81866 0x1010#define CHIP_ID_F81966 0x0215#define CHIP_ID_F81216AD 0x1602 +#define CHIP_ID_F81216E 0x1617#define CHIP_ID_F81216H 0x0501#define CHIP_ID_F81216 0x0802#define VENDOR_ID1 0x23
@@ -158,6 +159,7 @@ static int fintek_8250_check_id(struct fcase CHIP_ID_F81866 :case CHIP_ID_F81966 :case CHIP_ID_F81216AD : +case CHIP_ID_F81216E :case CHIP_ID_F81216H :case CHIP_ID_F81216 :break ;
@@ -181,6 +183,7 @@ static int fintek_8250_get_ldn_range(strreturn 0 ;case CHIP_ID_F81216AD : +case CHIP_ID_F81216E :case CHIP_ID_F81216H :case CHIP_ID_F81216 : *min =F81216_LDN_LOW ;
@@ -250,6 +253,7 @@ static void fintek_8250_set_irq_mode(strbreak ;case CHIP_ID_F81216AD : +case CHIP_ID_F81216E :case CHIP_ID_F81216H :case CHIP_ID_F81216 : sio_write_mask_reg(pdata, FINTEK_IRQ_MODE, IRQ_SHARE,
@@ -263,7 +267,8 @@ static void fintek_8250_set_irq_mode(strstatic void fintek_8250_set_max_fifo (struct fintek_8250 *pdata) {switch (pdata->pid) { -case CHIP_ID_F81216H :/* 128Bytes FIFO */ +case CHIP_ID_F81216E :/* 128Bytes FIFO */ +case CHIP_ID_F81216H :case CHIP_ID_F81966 :case CHIP_ID_F81866 : sio_write_mask_reg(pdata, FIFO_CTRL,
@@ -297,6 +302,7 @@ static void fintek_8250_set_termios(stru goto exit;switch (pdata->pid) { +case CHIP_ID_F81216E :case CHIP_ID_F81216H : reg =RS485 ;break ;
@@ -346,6 +352,7 @@ static void fintek_8250_set_termios_handstruct fintek_8250 *pdata = uart->port.private_data;switch (pdata->pid) { +case CHIP_ID_F81216E :case CHIP_ID_F81216H :case CHIP_ID_F81966 :case CHIP_ID_F81866 :
@@ -438,6 +445,11 @@ static void fintek_8250_set_rs485_handle uart->port.rs485_supported = fintek_8250_rs485_supported;break ; +case CHIP_ID_F81216E :/* F81216E does not support RS485 delays */ + uart->port.rs485_config = fintek_8250_rs485_config; + uart->port.rs485_supported = fintek_8250_rs485_supported; +break ; +default :/* No RS485 Auto direction functional */ break ; }
Greg Kroah-Hartman
maintainerPATCH 713/826 serial: 8250: omap: Move pm_runtime_get_sync
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bin Liu <[email protected]>
commit bcc7ba668818dcadd2f1db66b39ed860a63ecf97 upstream.
Currently in omap_8250_shutdown, the dma->rx_running flag is set to zero in omap_8250_rx_dma_flush. Next pm_runtime_get_sync is called, which is a runtime resume call stack which can re-set the flag. When the call omap_8250_shutdown returns, the flag is expected to be UN-SET, but this is not the case. This is causing issues the next time UART is re-opened and omap_8250_rx_dma is called. Fix by moving pm_runtime_get_sync before the omap_8250_rx_dma_flush.
--- drivers/tty/serial/8250/8250_omap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_omap.c +2 -2
@@ -776,12 +776,12 @@ static void omap_8250_shutdown(struct uastruct uart_8250_port *up =up_to_u8250p (port);struct omap8250_priv *priv = port->private_data; +pm_runtime_get_sync (port->dev); +flush_work (&priv->qos_work);if (up->dma)omap_8250_rx_dma_flush (up); -pm_runtime_get_sync (port->dev); -serial_out (up,UART_OMAP_WER ,0 );if (priv->habit &UART_HAS_EFR2 )serial_out (up,UART_OMAP_EFR2 ,0x0 );
Greg Kroah-Hartman
maintainerPATCH 714/826 serial: amba-pl011: Fix RX stall when DMA is used
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kartik Rajput <[email protected]>
commit 2bcacc1c87acf9a8ebc17de18cb2b3cfeca547cf upstream.
Function pl011_throttle_rx() calls pl011_stop_rx() to disable RX, which also disables the RX DMA by clearing the RXDMAE bit of the DMACR register. However, to properly unthrottle RX when DMA is used, the function pl011_unthrottle_rx() is expected to set the RXDMAE bit of the DMACR register, which it currently lacks. This causes RX to stall after the throttle API is called.
Set RXDMAE bit in the DMACR register while unthrottling RX if RX DMA is used.
--- drivers/tty/serial/amba-pl011.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/tty/serial/amba-pl011.c +5 -0
@@ -1819,6 +1819,11 @@ static void pl011_unthrottle_rx(struct upl011_write (uap->im, uap,REG_IMSC ); +if (uap->using_rx_dma) { + uap->dmacr |=UART011_RXDMAE ; +pl011_write (uap->dmacr, uap,REG_DMACR ); + } +uart_port_unlock_irqrestore (&uap->port, flags); }
Greg Kroah-Hartman
maintainerPATCH 715/826 serial: amba-pl011: fix build regression
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit b5a23a60e8ab5711f4952912424347bf3864ce8d upstream.
When CONFIG_DMA_ENGINE is disabled, the driver now fails to build:
drivers/tty/serial/amba-pl011.c: In function 'pl011_unthrottle_rx':drivers/tty/serial/amba-pl011.c:1822:16: error: 'struct uart_amba_port' has no member named 'using_rx_dma'
1822 | if (uap->using_rx_dma) {
| ^~drivers/tty/serial/amba-pl011.c:1823:20: error: 'struct uart_amba_port' has no member named 'dmacr'
1823 | uap->dmacr |= UART011_RXDMAE;
| ^~drivers/tty/serial/amba-pl011.c:1824:32: error: 'struct uart_amba_port' has no member named 'dmacr'
1824 | pl011_write(uap->dmacr, uap, REG_DMACR);
| ^~
Add the missing #ifdef check around these field accesses, matching what other parts of this driver do.
--- drivers/tty/serial/amba-pl011.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/amba-pl011.c +2 -0
@@ -1819,10 +1819,12 @@ static void pl011_unthrottle_rx(struct upl011_write (uap->im, uap,REG_IMSC ); +#ifdef CONFIG_DMA_ENGINE if (uap->using_rx_dma) { uap->dmacr |=UART011_RXDMAE ;pl011_write (uap->dmacr, uap,REG_DMACR ); } +#endif uart_port_unlock_irqrestore (&uap->port, flags); }
Greg Kroah-Hartman
maintainerPATCH 716/826 Revert "block, bfq: merge bfq_release_process_ref() into bfq_put_cooperator()"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zach Wade <[email protected]>
commit cf5a60d971c7b59efb89927919404be655a9e35a upstream.
This reverts commit bc3b1e9e7c50e1de0f573eea3871db61dd4787de.
The bic is associated with sync_bfqq, and bfq_release_process_ref cannot be put into bfq_put_cooperator.
kasan report:
[ 400.347277] ==================================================================
[ 400.347287] BUG: KASAN: slab-use-after-free in bic_set_bfqq+0x200/0x230
[ 400.347420] Read of size 8 at addr ffff88881cab7d60 by task dockerd/5800
[ 400.347430]
[ 400.347436] CPU: 24 UID: 0 PID: 5800 Comm: dockerd Kdump: loaded Tainted: G E 6.12.0 #32
[ 400.347450] Tainted: [E]=UNSIGNED_MODULE
[ 400.347454] Hardware name: VMware, Inc. VMware20,1/440BX Desktop Reference Platform, BIOS VMW201.00V.20192059.B64.2207280713 07/28/2022
[ 400.347460] Call Trace:
[ 400.347464] <TASK>
[ 400.347468] dump_stack_lvl+0x5d/0x80
[ 400.347490] print_report+0x174/0x505
[ 400.347521] kasan_report+0xe0/0x160
[ 400.347541] bic_set_bfqq+0x200/0x230
[ 400.347549] bfq_bic_update_cgroup+0x419/0x740
[ 400.347560] bfq_bio_merge+0x133/0x320
[ 400.347584] blk_mq_submit_bio+0x1761/0x1e20
[ 400.347625] __submit_bio+0x28b/0x7b0
[ 400.347664] submit_bio_noacct_nocheck+0x6b2/0xd30
[ 400.347690] iomap_readahead+0x50c/0x680
[ 400.347731] read_pages+0x17f/0x9c0
[ 400.347785] page_cache_ra_unbounded+0x366/0x4a0
[ 400.347795] filemap_fault+0x83d/0x2340
[ 400.347819] __xfs_filemap_fault+0x11a/0x7d0 [xfs]
[ 400.349256] __do_fault+0xf1/0x610
[ 400.349270] do_fault+0x977/0x11a0
[ 400.349281] __handle_mm_fault+0x5d1/0x850
[ 400.349314] handle_mm_fault+0x1f8/0x560
[ 400.349324] do_user_addr_fault+0x324/0x970
[ 400.349337] exc_page_fault+0x76/0xf0
[ 400.349350] asm_exc_page_fault+0x26/0x30
[ 400.349360] RIP: 0033:0x55a480d77375
[ 400.349384] Code: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc 49 3b 66 10 0f 86 ae 02 00 00 55 48 89 e5 48 83 ec 58 48 8b 10 <83> 7a 10 00 0f 84 27 02 00 00 44 0f b6 42 28 44 0f b6 4a 29 41 80
[ 400.349392] RSP: 002b:00007f18c37fd8b8 EFLAGS: 00010216
[ 400.349401] RAX: 00007f18c37fd9d0 RBX: 0000000000000000 RCX: 0000000000000000
[ 400.349407] RDX: 000055a484407d38 RSI: 000000c000e8b0c0 RDI: 0000000000000000
[ 400.349412] RBP: 00007f18c37fd910 R08: 000055a484017f60 R09: 000055a484066f80
[ 400.349417] R10: 0000000000194000 R11: 0000000000000005 R12: 0000000000000008
[ 400.349422] R13: 0000000000000000 R14: 000000c000476a80 R15: 0000000000000000
[ 400.349430] </TASK>
[ 400.349452]
[ 400.349454] Allocated by task 5800:
[ 400.349459] kasan_save_stack+0x30/0x50
[ 400.349469] kasan_save_track+0x14/0x30
[ 400.349475] __kasan_slab_alloc+0x89/0x90
[ 400.349482] kmem_cache_alloc_node_noprof+0xdc/0x2a0
[ 400.349492] bfq_get_queue+0x1ef/0x1100
[ 400.349502] __bfq_get_bfqq_handle_split+0x11a/0x510
[ 400.349511] bfq_insert_requests+0xf55/0x9030
[ 400.349519] blk_mq_flush_plug_list+0x446/0x14c0
[ 400.349527] __blk_flush_plug+0x27c/0x4e0
[ 400.349534] blk_finish_plug+0x52/0xa0
[ 400.349540] _xfs_buf_ioapply+0x739/0xc30 [xfs]
[ 400.350246] __xfs_buf_submit+0x1b2/0x640 [xfs]
[ 400.350967] xfs_buf_read_map+0x306/0xa20 [xfs]
[ 400.351672] xfs_trans_read_buf_map+0x285/0x7d0 [xfs]
[ 400.352386] xfs_imap_to_bp+0x107/0x270 [xfs]
[ 400.353077] xfs_iget+0x70d/0x1eb0 [xfs]
[ 400.353786] xfs_lookup+0x2ca/0x3a0 [xfs]
[ 400.354506] xfs_vn_lookup+0x14e/0x1a0 [xfs]
[ 400.355197] __lookup_slow+0x19c/0x340
[ 400.355204] lookup_one_unlocked+0xfc/0x120
[ 400.355211] ovl_lookup_single+0x1b3/0xcf0 [overlay]
[ 400.355255] ovl_lookup_layer+0x316/0x490 [overlay]
[ 400.355295] ovl_lookup+0x844/0x1fd0 [overlay]
[ 400.355351] lookup_one_qstr_excl+0xef/0x150
[ 400.355357] do_unlinkat+0x22a/0x620
[ 400.355366] __x64_sys_unlinkat+0x109/0x1e0
[ 400.355375] do_syscall_64+0x82/0x160
[ 400.355384] entry_SYSCALL_64_after_hwframe+0x76/0x7e
[ 400.355393]
[ 400.355395] Freed by task 5800:
[ 400.355400] kasan_save_stack+0x30/0x50
[ 400.355407] kasan_save_track+0x14/0x30
[ 400.355413] kasan_save_free_info+0x3b/0x70
[ 400.355422] __kasan_slab_free+0x4f/0x70
[ 400.355429] kmem_cache_free+0x176/0x520
[ 400.355438] bfq_put_queue+0x67e/0x980
[ 400.355447] bfq_bic_update_cgroup+0x407/0x740
[ 400.355454] bfq_bio_merge+0x133/0x320
[ 400.355460] blk_mq_submit_bio+0x1761/0x1e20
[ 400.355467] __submit_bio+0x28b/0x7b0
[ 400.355473] submit_bio_noacct_nocheck+0x6b2/0xd30
[ 400.355480] iomap_readahead+0x50c/0x680
[ 400.355490] read_pages+0x17f/0x9c0
[ 400.355498] page_cache_ra_unbounded+0x366/0x4a0
[ 400.355505] filemap_fault+0x83d/0x2340
[ 400.355514] __xfs_filemap_fault+0x11a/0x7d0 [xfs]
[ 400.356204] __do_fault+0xf1/0x610
[ 400.356213] do_fault+0x977/0x11a0
[ 400.356221] __handle_mm_fault+0x5d1/0x850
[ 400.356230] handle_mm_fault+0x1f8/0x560
[ 400.356238] do_user_addr_fault+0x324/0x970
[ 400.356248] exc_page_fault+0x76/0xf0
[ 400.356258] asm_exc_page_fault+0x26/0x30
[ 400.356266]
[ 400.356269] The buggy address belongs to the object at ffff88881cab7bc0
which belongs to the cache bfq_queue of size 576
[ 400.356276] The buggy address is located 416 bytes inside of
freed 576-byte region [ffff88881cab7bc0, ffff88881cab7e00)
[ 400.356285]
[ 400.356287] The buggy address belongs to the physical page:
[ 400.356292] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88881cab0b00 pfn:0x81cab0
[ 400.356300] head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
[ 400.356323] flags: 0x50000000000040(head|node=1|zone=2)
[ 400.356331] page_type: f5(slab)
[ 400.356340] raw: 0050000000000040 ffff88880a00c280 dead000000000122 0000000000000000
[ 400.356347] raw: ffff88881cab0b00 00000000802e0025 00000001f5000000 0000000000000000
[ 400.356354] head: 0050000000000040 ffff88880a00c280 dead000000000122 0000000000000000
[ 400.356359] head: ffff88881cab0b00 00000000802e0025 00000001f5000000 0000000000000000
[ 400.356365] head: 0050000000000003 ffffea002072ac01 ffffffffffffffff 0000000000000000
[ 400.356370] head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
[ 400.356378] page dumped because: kasan: bad access detected
[ 400.356381]
[ 400.356383] Memory state around the buggy address:
[ 400.356387] ffff88881cab7c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[ 400.356392] ffff88881cab7c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[ 400.356397] >ffff88881cab7d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[ 400.356400] ^
[ 400.356405] ffff88881cab7d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[ 400.356409] ffff88881cab7e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[ 400.356413] ==================================================================--- block/bfq-cgroup.c | 1 + block/bfq-iosched.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-)
block/bfq-cgroup.c +1 -0
@@ -736,6 +736,7 @@ static void bfq_sync_bfqq_move(struct bfq_data *bfqd,*/ bfq_put_cooperator (sync_bfqq);bic_set_bfqq (bic,NULL , true, act_idx); +bfq_release_process_ref (bfqd, sync_bfqq); } }
block/bfq-iosched.c +4 -2
@@ -5434,8 +5434,6 @@ void bfq_put_cooperator(struct bfq_queue *bfqq)bfq_put_queue (__bfqq); __bfqq = next; } - -bfq_release_process_ref (bfqq->bfqd, bfqq); }static void bfq_exit_bfqq (struct bfq_data *bfqd,struct bfq_queue *bfqq)
@@ -5448,6 +5446,8 @@ static void bfq_exit_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq)bfq_log_bfqq (bfqd, bfqq,"exit_bfqq: %p, %d" , bfqq, bfqq->ref);bfq_put_cooperator (bfqq); + +bfq_release_process_ref (bfqd, bfqq); } static void bfq_exit_icq_bfqq(struct bfq_io_cq *bic, bool is_sync,
@@ -6734,6 +6734,8 @@ bfq_split_bfqq(struct bfq_io_cq *bic, struct bfq_queue *bfqq)bic_set_bfqq (bic,NULL , true, bfqq->actuator_idx);bfq_put_cooperator (bfqq); + +bfq_release_process_ref (bfqq->bfqd, bfqq);return NULL ; }
Signature · 1 line
2.47.1
Greg Kroah-Hartman
maintainerPATCH 717/826 mtd: ubi: fix unreleased fwnode_handle in find_volume_fwnode()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 07593293ffabba14125c8998525adde5a832bfa3 upstream.
The 'fw_vols' fwnode_handle initialized via device_get_named_child_node() requires explicit calls to fwnode_handle_put() when the variable is no longer required.
Add the missing calls to fwnode_handle_put() before the function returns.
--- drivers/mtd/ubi/vmt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/ubi/vmt.c +2 -0
@@ -143,8 +143,10 @@ static struct fwnode_handle *find_volume vol->vol_id != volid)continue ; +fwnode_handle_put (fw_vols);return fw_vol; } +fwnode_handle_put (fw_vols);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 718/826 block: Prevent potential deadlock in blk_revalidate_disk_zones()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit 0b83c86b444ab467134b0e618f45ad2216a4973c upstream.
The function blk_revalidate_disk_zones() calls the function disk_update_zone_resources() after freezing the device queue. In turn, disk_update_zone_resources() calls queue_limits_start_update() which takes a queue limits mutex lock, resulting in the ordering:q->q_usage_counter check -> q->limits_lock. However, the usual ordering is to always take a queue limit lock before freezing the queue to commit the limits updates, e.g., the code pattern:
lim = queue_limits_start_update(q);
...blk_mq_freeze_queue(q);
ret = queue_limits_commit_update(q, &lim);blk_mq_unfreeze_queue(q);
Thus, blk_revalidate_disk_zones() introduces a potential circular locking dependency deadlock that lockdep sometimes catches with the splat:
[ 51.934109] ======================================================
[ 51.935916] WARNING: possible circular locking dependency detected
[ 51.937561] 6.12.0+ #2107 Not tainted
[ 51.938648] ------------------------------------------------------
[ 51.940351] kworker/u16:4/157 is trying to acquire lock:
[ 51.941805] ffff9fff0aa0bea8 (&q->limits_lock){+.+.}-{4:4}, at: disk_update_zone_resources+0x86/0x170
[ 51.944314]
but task is already holding lock:
[ 51.945688] ffff9fff0aa0b890 (&q->q_usage_counter(queue)#3){++++}-{0:0}, at: blk_revalidate_disk_zones+0x15f/0x340
[ 51.948527]
which lock already depends on the new lock.[ 51.951296]
the existing dependency chain (in reverse order) is:
[ 51.953708]
-> #1 (&q->q_usage_counter(queue)#3){++++}-{0:0}:
[ 51.956131] blk_queue_enter+0x1c9/0x1e0
[ 51.957290] blk_mq_alloc_request+0x187/0x2a0
[ 51.958365] scsi_execute_cmd+0x78/0x490 [scsi_mod]
[ 51.959514] read_capacity_16+0x111/0x410 [sd_mod]
[ 51.960693] sd_revalidate_disk.isra.0+0x872/0x3240 [sd_mod]
[ 51.962004] sd_probe+0x2d7/0x520 [sd_mod]
[ 51.962993] really_probe+0xd5/0x330
[ 51.963898] __driver_probe_device+0x78/0x110
[ 51.964925] driver_probe_device+0x1f/0xa0
[ 51.965916] __driver_attach_async_helper+0x60/0xe0
[ 51.967017] async_run_entry_fn+0x2e/0x140
[ 51.968004] process_one_work+0x21f/0x5a0
[ 51.968987] worker_thread+0x1dc/0x3c0
[ 51.969868] kthread+0xe0/0x110
[ 51.970377] ret_from_fork+0x31/0x50
[ 51.970983] ret_from_fork_asm+0x11/0x20
[ 51.971587]
-> #0 (&q->limits_lock){+.+.}-{4:4}:
[ 51.972479] __lock_acquire+0x1337/0x2130
[ 51.973133] lock_acquire+0xc5/0x2d0
[ 51.973691] __mutex_lock+0xda/0xcf0
[ 51.974300] disk_update_zone_resources+0x86/0x170
[ 51.975032] blk_revalidate_disk_zones+0x16c/0x340
[ 51.975740] sd_zbc_revalidate_zones+0x73/0x160 [sd_mod]
[ 51.976524] sd_revalidate_disk.isra.0+0x465/0x3240 [sd_mod]
[ 51.977824] sd_probe+0x2d7/0x520 [sd_mod]
[ 51.978917] really_probe+0xd5/0x330
[ 51.979915] __driver_probe_device+0x78/0x110
[ 51.981047] driver_probe_device+0x1f/0xa0
[ 51.982143] __driver_attach_async_helper+0x60/0xe0
[ 51.983282] async_run_entry_fn+0x2e/0x140
[ 51.984319] process_one_work+0x21f/0x5a0
[ 51.985873] worker_thread+0x1dc/0x3c0
[ 51.987289] kthread+0xe0/0x110
[ 51.988546] ret_from_fork+0x31/0x50
[ 51.989926] ret_from_fork_asm+0x11/0x20
[ 51.991376]
other info that might help us debug this:[ 51.994127] Possible unsafe locking scenario:
[ 51.995651] CPU0 CPU1
[ 51.996694] ---- ----
[ 51.997716] lock(&q->q_usage_counter(queue)#3);
[ 51.998817] lock(&q->limits_lock);
[ 52.000043] lock(&q->q_usage_counter(queue)#3);
[ 52.001638] lock(&q->limits_lock);
[ 52.002485]
*** DEADLOCK ***Prevent this issue by moving the calls to blk_mq_freeze_queue() and blk_mq_unfreeze_queue() around the call to queue_limits_commit_update() in disk_update_zone_resources(). In case of revalidation failure, the call to disk_free_zone_resources() in blk_revalidate_disk_zones() is still done with the queue frozen as before.
--- block/blk-zoned.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
block/blk-zoned.c +10 -4
@@ -1541,6 +1541,7 @@ static int disk_update_zone_resources(stunsigned int nr_seq_zones, nr_conv_zones =0 ;unsigned int pool_size;struct queue_limits lim; +int ret; disk->nr_zones = args->nr_zones; disk->zone_capacity = args->zone_capacity;
@@ -1593,7 +1594,11 @@ static int disk_update_zone_resources(st } commit: -return queue_limits_commit_update (q, &lim); +blk_mq_freeze_queue (q); + ret =queue_limits_commit_update (q, &lim); +blk_mq_unfreeze_queue (q); + +return ret; } static int blk_revalidate_conv_zone(struct blk_zone *zone, unsigned int idx,
@@ -1814,14 +1819,15 @@ int blk_revalidate_disk_zones(struct gen* Set the new disk zone parameters only once the queue is frozen and * all I/Os are completed. */ -blk_mq_freeze_queue (q);if (ret >0 ) ret =disk_update_zone_resources (disk, &args);else pr_warn ("%s: failed to revalidate zones\n" , disk->disk_name); -if (ret) +if (ret) { +blk_mq_freeze_queue (q);disk_free_zone_resources (disk); -blk_mq_unfreeze_queue (q); +blk_mq_unfreeze_queue (q); + }kfree (args.conv_zones_bitmap);
Greg Kroah-Hartman
maintainerPATCH 719/826 um: vector: Do not use drvdata in release
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
commit 51b39d741970742a5c41136241a9c48ac607cf82 upstream.
The drvdata is not available in release. Let's just use container_of() to get the vector_device instance. Otherwise, removing a vector device will result in a crash:
RIP: 0033:vector_device_release+0xf/0x50 RSP: 00000000e187bc40 EFLAGS: 00010202 RAX: 0000000060028f61 RBX: 00000000600f1baf RCX: 00000000620074e0 RDX: 000000006220b9c0 RSI: 0000000060551c80 RDI: 0000000000000000 RBP: 00000000e187bc50 R08: 00000000603ad594 R09: 00000000e187bb70 R10: 000000000000135a R11: 00000000603ad422 R12: 00000000623ae028 R13: 000000006287a200 R14: 0000000062006d30 R15: 00000000623700b6 Kernel panic - not syncing: Segfault with no mm CPU: 0 UID: 0 PID: 16 Comm: kworker/0:1 Not tainted 6.12.0-rc6-g59b723cd2adb #1 Workqueue: events mc_work_proc Stack: 60028f61 623ae028 e187bc80 60276fcd 6220b9c0 603f5820 623ae028 00000000 e187bcb0 603a2bcd 623ae000 62370010 Call Trace: [<60028f61>] ? vector_device_release+0x0/0x50 [<60276fcd>] device_release+0x70/0xba [<603a2bcd>] kobject_put+0xba/0xe7 [<60277265>] put_device+0x19/0x1c [<60281266>] platform_device_put+0x26/0x29 [<60281e5f>] platform_device_unregister+0x2c/0x2e [<60029422>] vector_remove+0x52/0x58 [<60031316>] ? mconsole_reply+0x0/0x50 [<600310c8>] mconsole_remove+0x160/0x1cc [<603b19f4>] ? strlen+0x0/0x15 [<60066611>] ? __dequeue_entity+0x1a9/0x206 [<600666a7>] ? set_next_entity+0x39/0x63 [<6006666e>] ? set_next_entity+0x0/0x63 [<60038fa6>] ? um_set_signals+0x0/0x43 [<6003070c>] mc_work_proc+0x77/0x91 [<60057664>] process_scheduled_works+0x1b3/0x2dd [<60055f32>] ? assign_work+0x0/0x58 [<60057f0a>] worker_thread+0x1e9/0x293 [<6005406f>] ? set_pf_worker+0x0/0x64 [<6005d65d>] ? arch_local_irq_save+0x0/0x2d [<6005d748>] ? kthread_exit+0x0/0x3a [<60057d21>] ? worker_thread+0x0/0x293 [<6005dbf1>] kthread+0x126/0x12b [<600219c5>] new_thread_handler+0x85/0xb6
--- arch/um/drivers/vector_kern.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/um/drivers/vector_kern.c +2 -1
@@ -815,7 +815,8 @@ static struct platform_driver uml_net_drstatic void vector_device_release (struct device *dev) { -struct vector_device *device =dev_get_drvdata (dev); +struct vector_device *device = + container_of(dev, struct vector_device, pdev.dev);struct net_device *netdev = device->dev;list_del (&device->list);
Greg Kroah-Hartman
maintainerPATCH 720/826 sh: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 3c891f7c6a4e90bb1199497552f24b26e46383bc upstream.
When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS are selected, cpu_max_bits_warn() generates a runtime warning similar as below when showing /proc/cpuinfo. Fix this by using nr_cpu_ids (the runtime limit) instead of NR_CPUS to iterate CPUs.
[ 3.052463] ------------[ cut here ]------------ [ 3.059679] WARNING: CPU: 3 PID: 1 at include/linux/cpumask.h:108 show_cpuinfo+0x5e8/0x5f0 [ 3.070072] Modules linked in: efivarfs autofs4 [ 3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052 [ 3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf846c 9000000100154000 [ 3.109127] 9000000100157a50 0000000000000000 9000000100157a58 9000000000ef7430 [ 3.118774] 90000001001578e8 0000000000000040 0000000000000020 ffffffffffffffff [ 3.128412] 0000000000aaaaaa 1ab25f00eec96a37 900000010021de80 900000000101c890 [ 3.138056] 0000000000000000 0000000000000000 0000000000000000 0000000000aaaaaa [ 3.147711] ffff8000339dc220 0000000000000001 0000000006ab4000 0000000000000000 [ 3.157364] 900000000101c998 0000000000000004 9000000000ef7430 0000000000000000 [ 3.167012] 0000000000000009 000000000000006c 0000000000000000 0000000000000000 [ 3.176641] 9000000000d3de08 9000000001639390 90000000002086d8 00007ffff0080286 [ 3.186260] 00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c [ 3.195868] ... [ 3.199917] Call Trace: [ 3.203941] [<90000000002086d8>] show_stack+0x38/0x14c [ 3.210666] [<9000000000cf846c>] dump_stack_lvl+0x60/0x88 [ 3.217625] [<900000000023d268>] __warn+0xd0/0x100 [ 3.223958] [<9000000000cf3c90>] warn_slowpath_fmt+0x7c/0xcc [ 3.231150] [<9000000000210220>] show_cpuinfo+0x5e8/0x5f0 [ 3.238080] [<90000000004f578c>] seq_read_iter+0x354/0x4b4 [ 3.245098] [<90000000004c2e90>] new_sync_read+0x17c/0x1c4 [ 3.252114] [<90000000004c5174>] vfs_read+0x138/0x1d0 [ 3.258694] [<90000000004c55f8>] ksys_read+0x70/0x100 [ 3.265265] [<9000000000cfde9c>] do_syscall+0x7c/0x94 [ 3.271820] [<9000000000202fe4>] handle_syscall+0xc4/0x160 [ 3.281824] ---[ end trace 8b484262b4b8c24c ]---
--- arch/sh/kernel/cpu/proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/kernel/cpu/proc.c +1 -1
@@ -132,7 +132,7 @@ static int show_cpuinfo(struct seq_filestatic void *c_start (struct seq_file *m,loff_t *pos) { -return *pos <NR_CPUS ? cpu_data + *pos :NULL ; +return *pos < nr_cpu_ids ? cpu_data + *pos :NULL ; }static void *c_next (struct seq_file *m,void *v,loff_t *pos) {
Greg Kroah-Hartman
maintainerPATCH 721/826 iio: gts: Fix uninitialized symbol ret
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zicheng Qu <[email protected]>
commit e2fb2f89faf87b681038475d093214f4cbe12ebb upstream.
Initialize the variable ret at the time of declaration to prevent it from being returned without a defined value. Fixes smatch warning:drivers/iio/industrialio-gts-helper.c:256 gain_to_scaletables() error:
uninitialized symbol 'ret'.
--- drivers/iio/industrialio-gts-helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/industrialio-gts-helper.c +1 -1
@@ -167,7 +167,7 @@ static int iio_gts_gain_cmp(const void *static int gain_to_scaletables (struct iio_gts *gts,int **gains,int **scales) { -int ret, i, j, new_idx, time_idx; +int i, j, new_idx, time_idx, ret =0 ;int *all_gains;size_t gain_bytes;
Greg Kroah-Hartman
maintainerPATCH 722/826 ublk: fix ublk_ch_mmap() for 64K page size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
commit d369735e02ef122d19d4c3d093028da0eb400636 upstream.
In ublk_ch_mmap(), queue id is calculated in the following way:
(vma->vm_pgoff << PAGE_SHIFT) / `max_cmd_buf_size`
'max_cmd_buf_size' is equal to
UBLK_MAX_QUEUE_DEPTH * sizeof(struct ublksrv_io_desc)
and UBLK_MAX_QUEUE_DEPTH is 4096 and part of UAPI, so 'max_cmd_buf_size' is always page aligned in 4K page size kernel. However, it isn't true in 64K page size kernel.
Fixes the issue by always rounding up 'max_cmd_buf_size' with PAGE_SIZE.
--- drivers/block/ublk_drv.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/block/ublk_drv.c +12 -3
@@ -664,12 +664,21 @@ static inline char *ublk_queue_cmd_buf(sreturn ublk_get_queue (ub, q_id)->io_cmd_buf; } +static inline int __ublk_queue_cmd_buf_size (int depth) +{ +return round_up (depth *sizeof (struct ublksrv_io_desc ),PAGE_SIZE ); +} +static inline int ublk_queue_cmd_buf_size (struct ublk_device *ub,int q_id) {struct ublk_queue *ubq =ublk_get_queue (ub, q_id); -return round_up (ubq->q_depth *sizeof (struct ublksrv_io_desc ), -PAGE_SIZE ); +return __ublk_queue_cmd_buf_size (ubq->q_depth); +} + +static int ublk_max_cmd_buf_size (void ) +{ +return __ublk_queue_cmd_buf_size (UBLK_MAX_QUEUE_DEPTH ); } static inline bool ublk_queue_can_use_recovery_reissue(
@@ -1322,7 +1331,7 @@ static int ublk_ch_mmap(struct file *fil {struct ublk_device *ub = filp->private_data;size_t sz = vma->vm_end - vma->vm_start; -unsigned max_sz =UBLK_MAX_QUEUE_DEPTH *sizeof (struct ublksrv_io_desc ); +unsigned max_sz =ublk_max_cmd_buf_size ();unsigned long pfn, end, phys_off = vma->vm_pgoff <<PAGE_SHIFT ;int q_id, ret =0 ;
Greg Kroah-Hartman
maintainerPATCH 723/826 arm64: tls: Fix context-switching of tpidrro_el0 when kpti is enabled
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 67ab51cbdfee02ef07fb9d7d14cc0bf6cb5a5e5c upstream.
Commit 18011eac28c7 ("arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native tasks") tried to optimise the context switching of tpidrro_el0 by eliding the clearing of the register when switching to a native task with kpti enabled, on the erroneous assumption that the kpti trampoline entry code would already have taken care of the write.
Although the kpti trampoline does zero the register on entry from a native task, the check in tls_thread_switch() is on the *next* task and so we can end up leaving a stale, non-zero value in the register if the previous task was 32-bit.
Drop the broken optimisation and zero tpidrro_el0 unconditionally when switching to a native 64-bit task.
--- arch/arm64/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/process.c +1 -1
@@ -442,7 +442,7 @@ static void tls_thread_switch(struct tasif (is_compat_thread (task_thread_info (next)))write_sysreg (next->thread.uw.tp_value, tpidrro_el0); -else if (!arm64_kernel_unmapped_at_el0 ()) +else write_sysreg (0 , tpidrro_el0);write_sysreg (*task_user_tls (next), tpidr_el0);
Greg Kroah-Hartman
maintainerPATCH 724/826 block: fix missing dispatching request when queue is started or unquiesced
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muchun Song <[email protected]>
commit 2003ee8a9aa14d766b06088156978d53c2e9be3d upstream.
Supposing the following scenario with a virtio_blk driver.
CPU0 CPU1 CPU2
blk_mq_try_issue_directly()
__blk_mq_issue_directly()
q->mq_ops->queue_rq()
virtio_queue_rq()
blk_mq_stop_hw_queue()
virtblk_done()
blk_mq_try_issue_directly()
if (blk_mq_hctx_stopped()) blk_mq_request_bypass_insert() blk_mq_run_hw_queue()
blk_mq_run_hw_queue() blk_mq_run_hw_queue()
blk_mq_insert_request() return
After CPU0 has marked the queue as stopped, CPU1 will see the queue is stopped. But before CPU1 puts the request on the dispatch list, CPU2 receives the interrupt of completion of request, so it will run the hardware queue and marks the queue as non-stopped. Meanwhile, CPU1 also runs the same hardware queue. After both CPU1 and CPU2 complete blk_mq_run_hw_queue(), CPU1 just puts the request to the same hardware queue and returns. It misses dispatching a request. Fix it by running the hardware queue explicitly. And blk_mq_request_issue_directly() should handle a similar situation. Fix it as well.
--- block/blk-mq.c | 2 ++ 1 file changed, 2 insertions(+)
block/blk-mq.c +2 -0
@@ -2620,6 +2620,7 @@ static void blk_mq_try_issue_directly(stif (blk_mq_hctx_stopped (hctx) ||blk_queue_quiesced (rq->q)) {blk_mq_insert_request (rq,0 ); +blk_mq_run_hw_queue (hctx, false);return ; }
@@ -2650,6 +2651,7 @@ static blk_status_t blk_mq_request_issueif (blk_mq_hctx_stopped (hctx) ||blk_queue_quiesced (rq->q)) {blk_mq_insert_request (rq,0 ); +blk_mq_run_hw_queue (hctx, false);return BLK_STS_OK ; }
Greg Kroah-Hartman
maintainerPATCH 725/826 block: fix ordering between checking QUEUE_FLAG_QUIESCED request adding
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muchun Song <[email protected]>
commit 6bda857bcbb86fb9d0e54fbef93a093d51172acc upstream.
Supposing the following scenario.
CPU0 CPU1
blk_mq_insert_request() 1) store
blk_mq_unquiesce_queue()
blk_queue_flag_clear() 3) store
blk_mq_run_hw_queues()
blk_mq_run_hw_queue()
if (!blk_mq_hctx_has_pending()) 4) load
returnblk_mq_run_hw_queue()
if (blk_queue_quiesced()) 2) load
return
blk_mq_sched_dispatch_requests()
The full memory barrier should be inserted between 1) and 2), as well as between 3) and 4) to make sure that either CPU0 sees QUEUE_FLAG_QUIESCED is cleared or CPU1 sees dispatch list or setting of bitmap of software queue. Otherwise, either CPU will not rerun the hardware queue causing starvation.
So the first solution is to 1) add a pair of memory barrier to fix the problem, another solution is to 2) use hctx->queue->queue_lock to synchronize QUEUE_FLAG_QUIESCED. Here, we chose 2) to fix it since memory barrier is not easy to be maintained.
--- block/blk-mq.c | 49 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-)
block/blk-mq.c +35 -14
@@ -2200,6 +2200,24 @@ void blk_mq_delay_run_hw_queue(struct bl }EXPORT_SYMBOL (blk_mq_delay_run_hw_queue); +static inline bool blk_mq_hw_queue_need_run (struct blk_mq_hw_ctx *hctx) +{ +bool need_run; + +/* +* When queue is quiesced, we may be switching io scheduler, or +* updating nr_hw_queues, or other things, and we can't run queue +* any more, even blk_mq_hctx_has_pending() can't be called safely. +* +* And queue will be rerun in blk_mq_unquiesce_queue() if it is +* quiesced. +*/ +__blk_mq_run_dispatch_ops (hctx->queue, false, + need_run = !blk_queue_quiesced (hctx->queue) && +blk_mq_hctx_has_pending (hctx)); +return need_run; +} +/** * blk_mq_run_hw_queue - Start to run a hardware queue. * @hctx: Pointer to the hardware queue to run.
@@ -2220,20 +2238,23 @@ void blk_mq_run_hw_queue(struct blk_mq_hmight_sleep_if (!async && hctx->flags &BLK_MQ_F_BLOCKING ); -/* -* When queue is quiesced, we may be switching io scheduler, or -* updating nr_hw_queues, or other things, and we can't run queue -* any more, even __blk_mq_hctx_has_pending() can't be called safely. -* -* And queue will be rerun in blk_mq_unquiesce_queue() if it is -* quiesced. -*/ -__blk_mq_run_dispatch_ops (hctx->queue, false, - need_run = !blk_queue_quiesced (hctx->queue) && -blk_mq_hctx_has_pending (hctx)); - -if (!need_run) -return ; + need_run =blk_mq_hw_queue_need_run (hctx); +if (!need_run) { +unsigned long flags; + +/* +* Synchronize with blk_mq_unquiesce_queue(), because we check +* if hw queue is quiesced locklessly above, we need the use +* ->queue_lock to make sure we see the up-to-date status to +* not miss rerunning the hw queue. +*/ +spin_lock_irqsave (&hctx->queue->queue_lock, flags); + need_run =blk_mq_hw_queue_need_run (hctx); +spin_unlock_irqrestore (&hctx->queue->queue_lock, flags); + +if (!need_run) +return ; + }if (async || !cpumask_test_cpu (raw_smp_processor_id (), hctx->cpumask)) {blk_mq_delay_run_hw_queue (hctx,0 );
Greg Kroah-Hartman
maintainerPATCH 726/826 block: fix ordering between checking BLK_MQ_S_STOPPED request adding
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muchun Song <[email protected]>
commit 96a9fe64bfd486ebeeacf1e6011801ffe89dae18 upstream.
Supposing first scenario with a virtio_blk driver.
CPU0 CPU1
blk_mq_try_issue_directly()
__blk_mq_issue_directly()
q->mq_ops->queue_rq()
virtio_queue_rq()
blk_mq_stop_hw_queue()
virtblk_done()
blk_mq_request_bypass_insert() 1) store
blk_mq_start_stopped_hw_queue()
clear_bit(BLK_MQ_S_STOPPED) 3) store
blk_mq_run_hw_queue()
if (!blk_mq_hctx_has_pending()) 4) load
return
blk_mq_sched_dispatch_requests()
blk_mq_run_hw_queue()
if (!blk_mq_hctx_has_pending())
return
blk_mq_sched_dispatch_requests()
if (blk_mq_hctx_stopped()) 2) load
return
__blk_mq_sched_dispatch_requests()Supposing another scenario.
CPU0 CPU1
blk_mq_requeue_work()
blk_mq_insert_request() 1) store
virtblk_done()
blk_mq_start_stopped_hw_queue()
blk_mq_run_hw_queues() clear_bit(BLK_MQ_S_STOPPED) 3) store
blk_mq_run_hw_queue()
if (!blk_mq_hctx_has_pending()) 4) load
return
blk_mq_sched_dispatch_requests()
if (blk_mq_hctx_stopped()) 2) load
continue
blk_mq_run_hw_queue()Both scenarios are similar, the full memory barrier should be inserted between 1) and 2), as well as between 3) and 4) to make sure that either CPU0 sees BLK_MQ_S_STOPPED is cleared or CPU1 sees dispatch list. Otherwise, either CPU will not rerun the hardware queue causing starvation of the request.
The easy way to fix it is to add the essential full memory barrier into helper of blk_mq_hctx_stopped(). In order to not affect the fast path (hardware queue is not stopped most of the time), we only insert the barrier into the slow path. Actually, only slow path needs to care about missing of dispatching the request to the low-level device driver.
--- block/blk-mq.c | 6 ++++++ block/blk-mq.h | 13 +++++++++++++ 2 files changed, 19 insertions(+)
block/blk-mq.c +6 -0
@@ -2411,6 +2411,12 @@ void blk_mq_start_stopped_hw_queue(strucreturn ;clear_bit (BLK_MQ_S_STOPPED , &hctx->state); +/* +* Pairs with the smp_mb() in blk_mq_hctx_stopped() to order the +* clearing of BLK_MQ_S_STOPPED above and the checking of dispatch +* list in the subsequent routine. +*/ +smp_mb__after_atomic ();blk_mq_run_hw_queue (hctx, async); }EXPORT_SYMBOL_GPL (blk_mq_start_stopped_hw_queue);
block/blk-mq.h +13 -0
@@ -230,6 +230,19 @@ static inline struct blk_mq_tags *blk_mqstatic inline bool blk_mq_hctx_stopped (struct blk_mq_hw_ctx *hctx) { +/* Fast path: hardware queue is not stopped most of the time. */ +if (likely (!test_bit (BLK_MQ_S_STOPPED , &hctx->state))) +return false; + +/* +* This barrier is used to order adding of dispatch list before and +* the test of BLK_MQ_S_STOPPED below. Pairs with the memory barrier +* in blk_mq_start_stopped_hw_queue() so that dispatch code could +* either see BLK_MQ_S_STOPPED is cleared or dispatch list is not +* empty to avoid missing dispatching requests. +*/ +smp_mb (); +return test_bit (BLK_MQ_S_STOPPED , &hctx->state); }
Greg Kroah-Hartman
maintainerPATCH 727/826 blk-mq: Make blk_mq_quiesce_tagset() hold the tag list mutex less long
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit ccd9e252c515ac5a3ed04a414c95d1307d17f159 upstream.
Make sure that the tag_list_lock mutex is not held any longer than necessary. This change reduces latency if e.g. blk_mq_quiesce_tagset() is called concurrently from more than one thread. This function is used by the NVMe core and also by the UFS driver.
--- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-mq.c +2 -1
@@ -283,8 +283,9 @@ void blk_mq_quiesce_tagset(struct blk_mqif (!blk_queue_skip_tagset_quiesce (q))blk_mq_quiesce_queue_nowait (q); } -blk_mq_wait_quiesce_done (set);mutex_unlock (&set->tag_list_lock); + +blk_mq_wait_quiesce_done (set); }EXPORT_SYMBOL_GPL (blk_mq_quiesce_tagset);
Greg Kroah-Hartman
maintainerPATCH 728/826 gve: Flow steering trigger reset only for timeout error
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ziwei Xiao <[email protected]>
commit 8ffade77b6337a8767fae9820d57d7a6413dd1a1 upstream.
When configuring flow steering rules, the driver is currently going through a reset for all errors from the device. Instead, the driver should only reset when there's a timeout error from the device.
--- drivers/net/ethernet/google/gve/gve_adminq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/google/gve/gve_adminq.c +2 -2
@@ -1248,10 +1248,10 @@ gve_adminq_configure_flow_rule(struct gvsizeof (struct gve_adminq_configure_flow_rule ), flow_rule_cmd); -if (err) { +if (err == -ETIME ) {dev_err (&priv->pdev->dev,"Timeout to configure the flow rule, trigger reset" );gve_reset (priv, true); - }else { + }else if (!err) { priv->flow_rules_cache.rules_cache_synced = false; }
Greg Kroah-Hartman
maintainerPATCH 729/826 HID: wacom: Interpret tilt data from Intuos Pro BT as signed values
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gerecke <[email protected]>
commit 49a397ad24ee5e2c53a59dada2780d7e71bd3f77 upstream.
The tilt data contained in the Bluetooth packets of an Intuos Pro are supposed to be interpreted as signed values. Simply casting the values to type char is not guaranteed to work since it is implementation- defined whether it is signed or unsigned. At least one user has noticed the data being reported incorrectly on their system. To ensure that the data is interpreted properly, we specifically cast to signed char instead.
--- drivers/hid/wacom_wac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/wacom_wac.c +2 -2
@@ -1353,9 +1353,9 @@ static void wacom_intuos_pro2_bt_pen(str rotation -=1800 ;input_report_abs (pen_input,ABS_TILT_X , - (char )frame[7 ]); + (signed char )frame[7 ]);input_report_abs (pen_input,ABS_TILT_Y , - (char )frame[8 ]); + (signed char )frame[8 ]);input_report_abs (pen_input,ABS_Z , rotation);input_report_abs (pen_input,ABS_WHEEL ,get_unaligned_le16 (&frame[11 ]));
Greg Kroah-Hartman
maintainerPATCH 730/826 i40e: Fix handling changed priv flags
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Große <[email protected]>
commit ea301aec8bb718b02b68761d2229fc12c9fefa29 upstream.
After assembling the new private flags on a PF, the operation to determine the changed flags uses the wrong bitmaps. Instead of xor-ing orig_flags with new_flags, it uses the still unchanged pf->flags, thus changed_flags is always 0.
Fix it by using the correct bitmaps.
The issue was discovered while debugging why disabling source pruning stopped working with release 6.7. Although the new flags will be copied to pf->flags later on in that function, disabling source pruning requires a reset of the PF, which was skipped due to this bug.
Disabling source pruning:
$ sudo ethtool --set-priv-flags eno1 disable-source-pruning on $ sudo ethtool --show-priv-flags eno1 Private flags for eno1: MFP : off total-port-shutdown : off LinkPolling : off flow-director-atr : on veb-stats : off hw-atr-eviction : off link-down-on-close : off legacy-rx : off disable-source-pruning: on disable-fw-lldp : off rs-fec : off base-r-fec : off vf-vlan-pruning : off
Regarding reproducing:
I observed the issue with a rather complicated lab setup, where
* two VLAN interfaces are created on eno1
* each with a different MAC address assigned
* each moved into a separate namespace
* both VLANs are bridged externally, so they form a single layer 2 network
The external bridge is done via a channel emulator adding packet loss and delay and the application in the namespaces tries to send/receive traffic and measure the performance. Sender and receiver are separated by namespaces, yet the network card "sees its own traffic" send back to it. To make that work, source pruning has to be disabled.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 -1
@@ -5299,7 +5299,7 @@ static int i40e_set_priv_flags(struct ne } flags_complete: -bitmap_xor (changed_flags, pf->flags, orig_flags,I40E_PF_FLAGS_NBITS ); +bitmap_xor (changed_flags, new_flags, orig_flags,I40E_PF_FLAGS_NBITS );if (test_bit (I40E_FLAG_FW_LLDP_DIS , changed_flags)) reset_needed =I40E_PF_RESET_AND_REBUILD_FLAG ;
Greg Kroah-Hartman
maintainerPATCH 731/826 media: wl128x: Fix atomicity violation in fmc_send_cmd()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiu-ji Chen <[email protected]>
commit ca59f9956d4519ab18ab2270be47c6b8c6ced091 upstream.
Atomicity violation occurs when the fmc_send_cmd() function is executed simultaneously with the modification of the fmdev->resp_skb value. Consider a scenario where, after passing the validity check within the function, a non-null fmdev->resp_skb variable is assigned a null value. This results in an invalid fmdev->resp_skb variable passing the validity check. As seen in the later part of the function, skb = fmdev->resp_skb; when the invalid fmdev->resp_skb passes the check, a null pointer dereference error may occur at line 478, evt_hdr = (void *)skb->data;
To address this issue, it is recommended to include the validity check of fmdev->resp_skb within the locked section of the function. This modification ensures that the value of fmdev->resp_skb does not change during the validation process, thereby maintaining its validity.
This possible bug is found by an experimental static analysis tool developed by our team. This tool analyzes the locking APIs to extract function pairs that can be concurrently executed, and then analyzes the instructions in the paired functions to identify possible concurrency bugs including data races and atomicity violations.
--- drivers/media/radio/wl128x/fmdrv_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/radio/wl128x/fmdrv_common.c +2 -1
@@ -466,11 +466,12 @@ int fmc_send_cmd(struct fmdev *fmdev, u8 jiffies_to_msecs(FM_DRV_TX_TIMEOUT) / 1000);return -ETIMEDOUT ; } +spin_lock_irqsave (&fmdev->resp_skb_lock, flags);if (!fmdev->resp_skb) { +spin_unlock_irqrestore (&fmdev->resp_skb_lock, flags);fmerr ("Response SKB is missing\n" );return -EFAULT ; } -spin_lock_irqsave (&fmdev->resp_skb_lock, flags); skb = fmdev->resp_skb; fmdev->resp_skb =NULL ;spin_unlock_irqrestore (&fmdev->resp_skb_lock, flags);
Greg Kroah-Hartman
maintainerPATCH 732/826 media: intel/ipu6: do not handle interrupts when device is disabled
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit 1429826883bb18847092b2e04c6598ef34bae1d4 upstream.
Some IPU6 devices have shared interrupts. We need to handle properly case when interrupt is triggered from other device on shared irq line and IPU6 itself disabled. In such case we get 0xffffffff from ISR_STATUS register and handle all irq's cases, for what we are not not prepared and usually hang the whole system.
To avoid the issue use pm_runtime_get_if_active() to check if the device is enabled and prevent suspending it when we handle irq until the end of irq. Additionally use synchronize_irq() in suspend
--- drivers/media/pci/intel/ipu6/ipu6-buttress.c | 13 +++++++++---- drivers/media/pci/intel/ipu6/ipu6.c | 3 +++ 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-buttress.c +9 -4
@@ -346,12 +346,16 @@ irqreturn_t ipu6_buttress_isr(int irq, vu32 disable_irqs =0 ;u32 irq_status;u32 i, count =0 ; +int active; -pm_runtime_get_noresume (&isp->pdev->dev); + active =pm_runtime_get_if_active (&isp->pdev->dev); +if (!active) +return IRQ_NONE ; irq_status =readl (isp->base + reg_irq_sts); -if (!irq_status) { -pm_runtime_put_noidle (&isp->pdev->dev); +if (irq_status ==0 ||WARN_ON_ONCE (irq_status ==0xffffffffu )) { +if (active >0 ) +pm_runtime_put_noidle (&isp->pdev->dev);return IRQ_NONE ; }
@@ -427,7 +431,8 @@ irqreturn_t ipu6_buttress_isr(int irq, vwritel (BUTTRESS_IRQS & ~disable_irqs, isp->base +BUTTRESS_REG_ISR_ENABLE ); -pm_runtime_put (&isp->pdev->dev); +if (active >0 ) +pm_runtime_put (&isp->pdev->dev);return ret; }
drivers/media/pci/intel/ipu6/ipu6.c +3 -0
@@ -752,6 +752,9 @@ static void ipu6_pci_reset_done(struct p*/ static int ipu6_suspend (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev); + +synchronize_irq (pdev->irq);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 733/826 arm64: dts: mediatek: mt8186-corsola-voltorb: Merge speaker codec nodes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 26ea2459d1724406bf0b342df6b4b1f002d7f8e3 upstream.
The Voltorb device uses a speaker codec different from the original Corsola device. When the Voltorb device tree was first added, the new codec was added as a separate node when it should have just replaced the existing one.
Merge the two nodes. The only differences are the compatible string and the GPIO line property name. This keeps the device node path for the speaker codec the same across the MT8186 Chromebook line. Also rename the related labels and node names from having rt1019p to speaker codec.
--- arch/arm64/boot/dts/mediatek/mt8186-corsola-voltorb.dtsi | 21 +++------------ arch/arm64/boot/dts/mediatek/mt8186-corsola.dtsi | 8 ++--- 2 files changed, 9 insertions(+), 20 deletions(-)
arch/arm64/boot/dts/mediatek/mt8186-corsola-voltorb.dtsi +5 -16
@@ -10,12 +10,6 @@ / { chassis-type = "laptop"; - - max98360a: max98360a { - compatible = "maxim,max98360a"; - sdmode-gpios = <&pio 150 GPIO_ACTIVE_HIGH>; - #sound-dai-cells = <0>; - }; }; &cpu6 {
@@ -59,19 +53,14 @@ opp-hz = /bits/ 64 <2200000000>; }; -&rt1019p{ - status = "disabled"; -}; - &sound { compatible = "mediatek,mt8186-mt6366-rt5682s-max98360-sound"; - status = "okay"; +}; - spk-hdmi-playback-dai-link { - codec { - sound-dai = <&it6505dptx>, <&max98360a>; - }; - }; +&speaker_codec { + compatible = "maxim,max98360a"; + sdmode-gpios = <&pio 150 GPIO_ACTIVE_HIGH>; + /delete-property/ sdb-gpios; }; &spmi {
arch/arm64/boot/dts/mediatek/mt8186-corsola.dtsi +4 -4
@@ -259,15 +259,15 @@ mediatek,clk-provider = "cpu"; /* RT1019P and IT6505 connected to the same I2S line */ codec { - sound-dai = <&it6505dptx>, <&rt1019p>; + sound-dai = <&it6505dptx>, <&speaker_codec>; }; }; }; - rt1019p: speaker-codec { + speaker_codec: speaker-codec { compatible = "realtek,rt1019p"; pinctrl-names = "default"; - pinctrl-0 = <&rt1019p_pins_default>; + pinctrl-0 = <&speaker_codec_pins_default>; #sound-dai-cells = <0>; sdb-gpios = <&pio 150 GPIO_ACTIVE_HIGH>; };
@@ -1179,7 +1179,7 @@ }; }; - rt1019p_pins_default: rt1019p-default-pins { + speaker_codec_pins_default: speaker-codec-default-pins { pins-sdb { pinmux = <PINMUX_GPIO150__FUNC_GPIO150>; output-low;
Greg Kroah-Hartman
maintainerPATCH 734/826 netdev-genl: Hold rcu_read_lock in napi_get
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Damato <[email protected]>
commit c53bf100f68619acf6cedcf4cf5249a1ca2db0b4 upstream.
Hold rcu_read_lock in netdev_nl_napi_get_doit, which calls napi_by_id and is required to be called under rcu_read_lock.
--- net/core/netdev-genl.c | 2 ++ 1 file changed, 2 insertions(+)
net/core/netdev-genl.c +2 -0
@@ -215,6 +215,7 @@ int netdev_nl_napi_get_doit(struct sk_bureturn -ENOMEM ;rtnl_lock (); +rcu_read_lock (); napi =napi_by_id (napi_id);if (napi) {
@@ -224,6 +225,7 @@ int netdev_nl_napi_get_doit(struct sk_bu err = -ENOENT ; } +rcu_read_unlock ();rtnl_unlock ();if (err)
Greg Kroah-Hartman
maintainerPATCH 735/826 soc: fsl: cpm1: qmc: Set the ret error code on platform_get_irq() failure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herve Codina <[email protected]>
commit cb3daa51db819a172e9524e96e2ed96b4237e51a upstream.
A kernel test robot detected a missing error code:
qmc.c:1942 qmc_probe() warn: missing error code 'ret'
Indeed, the error returned by platform_get_irq() is checked and the operation is aborted in case of failure but the ret error code is not set in that case.
Set the ret error code.
--- drivers/soc/fsl/qe/qmc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/soc/fsl/qe/qmc.c +3 -1
@@ -2004,8 +2004,10 @@ static int qmc_probe(struct platform_dev/* Set the irq handler */ irq =platform_get_irq (pdev,0 ); -if (irq <0 ) +if (irq <0 ) { + ret = irq; goto err_exit_xcc; + } ret =devm_request_irq (qmc->dev, irq, qmc_irq_handler,0 ,"qmc" , qmc);if (ret <0 ) goto err_exit_xcc;
Greg Kroah-Hartman
maintainerPATCH 736/826 soc: fsl: rcpm: fix missing of_node_put() in copy_ippdexpcr1_setting()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit c9f1efabf8e3b3ff886a42669f7093789dbeca94 upstream.
of_find_compatible_node() requires a call to of_node_put() when the pointer to the node is not required anymore to decrement its refcount and avoid leaking memory.
Add the missing call to of_node_put() after the node has been used.
--- drivers/soc/fsl/rcpm.c | 1 + 1 file changed, 1 insertion(+)
drivers/soc/fsl/rcpm.c +1 -0
@@ -36,6 +36,7 @@ static void copy_ippdexpcr1_setting(u32return ; regs =of_iomap (np,0 ); +of_node_put (np);if (!regs)return ;
Greg Kroah-Hartman
maintainerPATCH 737/826 media: v4l2-core: v4l2-dv-timings: check cvt/gtf result
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit 9f070b1862f3411b8bcdfd51a8eaad25286f9deb upstream.
The v4l2_detect_cvt/gtf functions should check the result against the timing capabilities: these functions calculate the timings, so if they are out of bounds, they should be rejected.
To do this, add the struct v4l2_dv_timings_cap as argument to those functions.
This required updates to the adv7604 and adv7842 drivers since the prototype of these functions has now changed. The timings struct that is passed to v4l2_detect_cvt/gtf in those two drivers is filled with the timings detected by the hardware.
The vivid driver was also updated, but an additional check was added:
the width and height specified by VIDIOC_S_DV_TIMINGS has to match the calculated result, otherwise something went wrong. Note that vivid *emulates* hardware, so all the values passed to the v4l2_detect_cvt/gtf functions came from the timings struct that was filled by userspace and passed on to the driver via VIDIOC_S_DV_TIMINGS. So these fields can contain random data. Both the constraints check via struct v4l2_dv_timings_cap and the additional width/height check ensure that the resulting timings are sane and not messed up by the v4l2_detect_cvt/gtf calculations.
--- drivers/media/i2c/adv7604.c | 5 drivers/media/i2c/adv7842.c | 13 +- drivers/media/test-drivers/vivid/vivid-vid-cap.c | 15 ++ drivers/media/v4l2-core/v4l2-dv-timings.c | 132 ++++++++++++----------- include/media/v4l2-dv-timings.h | 18 ++- 5 files changed, 107 insertions(+), 76 deletions(-)
drivers/media/i2c/adv7604.c +3 -2
@@ -1405,12 +1405,13 @@ static int stdi2dv_timings(struct v4l2_sif (v4l2_detect_cvt (stdi->lcf +1 , hfreq, stdi->lcvs,0 , (stdi->hs_pol =='+' ?V4L2_DV_HSYNC_POS_POL :0 ) | (stdi->vs_pol =='+' ?V4L2_DV_VSYNC_POS_POL :0 ), - false, timings)) + false,adv76xx_get_dv_timings_cap (sd,-1 ), timings))return 0 ;if (v4l2_detect_gtf (stdi->lcf +1 , hfreq, stdi->lcvs, (stdi->hs_pol =='+' ?V4L2_DV_HSYNC_POS_POL :0 ) | (stdi->vs_pol =='+' ?V4L2_DV_VSYNC_POS_POL :0 ), - false, state->aspect_ratio, timings)) + false, state->aspect_ratio, +adv76xx_get_dv_timings_cap (sd,-1 ), timings))return 0 ; v4l2_dbg(2, debug, sd,
drivers/media/i2c/adv7842.c +7 -6
@@ -1431,14 +1431,15 @@ static int stdi2dv_timings(struct v4l2_s }if (v4l2_detect_cvt (stdi->lcf +1 , hfreq, stdi->lcvs,0 , - (stdi->hs_pol =='+' ?V4L2_DV_HSYNC_POS_POL :0 ) | - (stdi->vs_pol =='+' ?V4L2_DV_VSYNC_POS_POL :0 ), - false, timings)) + (stdi->hs_pol =='+' ?V4L2_DV_HSYNC_POS_POL :0 ) | + (stdi->vs_pol =='+' ?V4L2_DV_VSYNC_POS_POL :0 ), + false,adv7842_get_dv_timings_cap (sd), timings))return 0 ;if (v4l2_detect_gtf (stdi->lcf +1 , hfreq, stdi->lcvs, - (stdi->hs_pol =='+' ?V4L2_DV_HSYNC_POS_POL :0 ) | - (stdi->vs_pol =='+' ?V4L2_DV_VSYNC_POS_POL :0 ), - false, state->aspect_ratio, timings)) + (stdi->hs_pol =='+' ?V4L2_DV_HSYNC_POS_POL :0 ) | + (stdi->vs_pol =='+' ?V4L2_DV_VSYNC_POS_POL :0 ), + false, state->aspect_ratio, +adv7842_get_dv_timings_cap (sd), timings))return 0 ; v4l2_dbg(2, debug, sd,
drivers/media/test-drivers/vivid/vivid-vid-cap.c +13 -2
@@ -1459,12 +1459,19 @@ static bool valid_cvt_gtf_timings(struct h_freq = (u32 )bt->pixelclock / total_h_pixel;if (bt->standards ==0 || (bt->standards &V4L2_DV_BT_STD_CVT )) { +struct v4l2_dv_timings cvt = {}; +if (v4l2_detect_cvt (total_v_lines, h_freq, bt->vsync, bt->width, - bt->polarities, bt->interlaced, timings)) + bt->polarities, bt->interlaced, + &vivid_dv_timings_cap, &cvt) && + cvt.bt.width == bt->width && cvt.bt.height == bt->height) { + *timings = cvt;return true; + } }if (bt->standards ==0 || (bt->standards &V4L2_DV_BT_STD_GTF )) { +struct v4l2_dv_timings gtf = {};struct v4l2_fract aspect_ratio; find_aspect_ratio(bt->width, bt->height,
@@ -1472,8 +1479,12 @@ static bool valid_cvt_gtf_timings(struct &aspect_ratio.denominator);if (v4l2_detect_gtf (total_v_lines, h_freq, bt->vsync, bt->polarities, bt->interlaced, - aspect_ratio, timings)) + aspect_ratio, &vivid_dv_timings_cap, + >f) && + gtf.bt.width == bt->width && gtf.bt.height == bt->height) { + *timings = gtf;return true; + } }return false; }
drivers/media/v4l2-core/v4l2-dv-timings.c +72 -60
191 lines not on this page · raw message
include/media/v4l2-dv-timings.h +12 -6
@@ -146,15 +146,18 @@ void v4l2_print_dv_timings(const char *d* @polarities: the horizontal and vertical polarities (same as struct * v4l2_bt_timings polarities). * @interlaced: if this flag is true, it indicates interlaced format +* @cap: the v4l2_dv_timings_cap capabilities. * @fmt: the resulting timings. * * This function will attempt to detect if the given values correspond to a * valid CVT format. If so, then it will return true, and fmt will be filled * in with the found CVT timings. */ -bool v4l2_detect_cvt (unsigned frame_height,unsigned hfreq,unsigned vsync, -unsigned active_width,u32 polarities,bool interlaced, -struct v4l2_dv_timings *fmt); +bool v4l2_detect_cvt (unsigned int frame_height,unsigned int hfreq, +unsigned int vsync,unsigned int active_width, +u32 polarities,bool interlaced, +const struct v4l2_dv_timings_cap *cap, +struct v4l2_dv_timings *fmt);/** * v4l2_detect_gtf - detect if the given timings follow the GTF standard
@@ -170,15 +173,18 @@ bool v4l2_detect_cvt(unsigned frame_heig* image height, so it has to be passed explicitly. Usually * the native screen aspect ratio is used for this. If it * is not filled in correctly, then 16:9 will be assumed. +* @cap: the v4l2_dv_timings_cap capabilities. * @fmt: the resulting timings. * * This function will attempt to detect if the given values correspond to a * valid GTF format. If so, then it will return true, and fmt will be filled * in with the found GTF timings. */ -bool v4l2_detect_gtf (unsigned frame_height,unsigned hfreq,unsigned vsync, -u32 polarities,bool interlaced,struct v4l2_fract aspect, -struct v4l2_dv_timings *fmt); +bool v4l2_detect_gtf (unsigned int frame_height,unsigned int hfreq, +unsigned int vsync,u32 polarities,bool interlaced, +struct v4l2_fract aspect, +const struct v4l2_dv_timings_cap *cap, +struct v4l2_dv_timings *fmt);/** * v4l2_calc_aspect_ratio - calculate the aspect ratio based on bytes
Greg Kroah-Hartman
maintainerPATCH 738/826 x86/mm: Carve out INVLPG inline asm for use by others
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov (AMD) <[email protected]>
commit f1d84b59cbb9547c243d93991acf187fdbe9fbe9 upstream.
No functional changes.
--- arch/x86/include/asm/tlb.h | 4 ++++ arch/x86/mm/tlb.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-)
arch/x86/include/asm/tlb.h +4 -0
@@ -34,4 +34,8 @@ static inline void __tlb_remove_table(vo free_page_and_swap_cache(table); } +static inline void invlpg (unsigned long addr) +{ + asmvolatile ("invlpg (%0)" ::"r" (addr) :"memory" ); +}#endif /* _ASM_X86_TLB_H */
arch/x86/mm/tlb.c +2 -1
@@ -20,6 +20,7 @@#include <asm/cacheflush.h> #include <asm/apic.h> #include <asm/perf_event.h> +#include <asm/tlb.h> #include "mm_internal.h"
@@ -1140,7 +1141,7 @@ STATIC_NOPV void native_flush_tlb_one_usbool cpu_pcide;/* Flush 'addr' from the kernel PCID: */ - asmvolatile ("invlpg (%0)" ::"r" (addr) :"memory" ); +invlpg (addr);/* If PTI is off there is no user PCID and nothing to flush. */ if (!static_cpu_has (X86_FEATURE_PTI ))
Greg Kroah-Hartman
maintainerPATCH 739/826 x86/microcode/AMD: Flush patch buffer mapping after application
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov (AMD) <[email protected]>
commit c809b0d0e52d01c30066367b2952c4c4186b1047 upstream.
Due to specific requirements while applying microcode patches on Zen1 and 2, the patch buffer mapping needs to be flushed from the TLB after application. Do so.
If not, unnecessary and unnatural delays happen in the boot process.
--- arch/x86/kernel/cpu/microcode/amd.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
arch/x86/kernel/cpu/microcode/amd.c +20 -5
@@ -34,6 +34,7 @@#include <asm/setup.h> #include <asm/cpu.h> #include <asm/msr.h> +#include <asm/tlb.h> #include "internal.h"
@@ -483,11 +484,25 @@ static void scan_containers(u8 *ucode, s } } -static int __apply_microcode_amd (struct microcode_amd *mc) +static int __apply_microcode_amd (struct microcode_amd *mc,unsigned int psize) { +unsigned long p_addr = (unsigned long )&mc->hdr.data_code;u32 rev, dummy; -native_wrmsrl (MSR_AMD64_PATCH_LOADER , (u64)(long)&mc->hdr.data_code); +native_wrmsrl (MSR_AMD64_PATCH_LOADER , p_addr); + +if (x86_family (bsp_cpuid_1_eax) ==0x17 ) { +unsigned long p_addr_end = p_addr + psize -1 ; + +invlpg (p_addr); + +/* +* Flush next page too if patch image is crossing a page +* boundary. +*/ +if (p_addr >>PAGE_SHIFT != p_addr_end >>PAGE_SHIFT ) +invlpg (p_addr_end); + }/* verify patch application was successful */ native_rdmsr (MSR_AMD64_PATCH_LEVEL , rev, dummy);
@@ -529,7 +544,7 @@ static bool early_apply_microcode(u32 olif (old_rev > mc->hdr.patch_id)return ret; -return !__apply_microcode_amd (mc); +return !__apply_microcode_amd (mc, desc.psize); }static bool get_builtin_microcode (struct cpio_data *cp)
@@ -745,7 +760,7 @@ void reload_ucode_amd(unsigned int cpu)rdmsr (MSR_AMD64_PATCH_LEVEL , rev, dummy);if (rev < mc->hdr.patch_id) { -if (!__apply_microcode_amd (mc)) +if (!__apply_microcode_amd (mc, p->size))pr_info_once ("reload revision: 0x%08x\n" , mc->hdr.patch_id); } }
@@ -798,7 +813,7 @@ static enum ucode_state apply_microcode_ goto out; } -if (__apply_microcode_amd (mc_amd)) { +if (__apply_microcode_amd (mc_amd, p->size)) {pr_err ("CPU%d: update failed for patch_level=0x%08x\n" , cpu, mc_amd->hdr.patch_id);return UCODE_ERROR ;
Greg Kroah-Hartman
maintainerPATCH 740/826 ALSA: rawmidi: Fix kvfree() call in spinlock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 20c0c49720dc4e205d4c1d64add56a5043c5ec5f upstream.
At the conversion of locking with guard(), I overlooked that kvfree() must not be called inside the spinlock unlike kfree(), and this was caught by syzkaller now.
This patch reverts the conversion partially for restoring the kvfree() call outside the spinlock. It's not trivial to use guard() in this context, unfortunately.
--- sound/core/rawmidi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/core/rawmidi.c +3 -1
@@ -724,8 +724,9 @@ static int resize_runtime_buffer(struct newbuf =kvzalloc (params->buffer_size,GFP_KERNEL );if (!newbuf)return -ENOMEM ; -guard (spinlock_irq)(&substream->lock); +spin_lock_irq (&substream->lock);if (runtime->buffer_ref) { +spin_unlock_irq (&substream->lock);kvfree (newbuf);return -EBUSY ; }
@@ -733,6 +734,7 @@ static int resize_runtime_buffer(struct runtime->buffer = newbuf; runtime->buffer_size = params->buffer_size;__reset_runtime_ptrs (runtime, is_input); +spin_unlock_irq (&substream->lock);kvfree (oldbuf); } runtime->avail_min = params->avail_min;
Greg Kroah-Hartman
maintainerPATCH 741/826 ALSA: ump: Fix evaluation of MIDI 1.0 FB info
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 7be34f6feedd60e418de1c2c48e661d70416635f upstream.
The m1.0 field of UMP Function Block info specifies whether the given FB is a MIDI 1.0 port or not. When implementing the UMP support on Linux, I somehow interpreted as if it were bit flags, but the field is actually an enumeration from 0 to 2, where 2 means MIDI 1.0 *and* low speed.
This patch corrects the interpretation and sets the right bit flags depending on the m1.0 field of FB Info. This effectively fixes the missing detection of MIDI 1.0 FB when m1.0 is 2.
--- sound/core/ump.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/core/ump.c +4 -1
@@ -788,7 +788,10 @@ static void fill_fb_info(struct snd_ump_ info->ui_hint = buf->fb_info.ui_hint; info->first_group = buf->fb_info.first_group; info->num_groups = buf->fb_info.num_groups; - info->flags = buf->fb_info.midi_10; +if (buf->fb_info.midi_10 <2 ) + info->flags = buf->fb_info.midi_10; +else + info->flags =SNDRV_UMP_BLOCK_IS_MIDI1 |SNDRV_UMP_BLOCK_IS_LOWSPEED ; info->active = buf->fb_info.active; info->midi_ci_version = buf->fb_info.midi_ci_version; info->sysex8_streams = buf->fb_info.sysex8_streams;
Greg Kroah-Hartman
maintainerPATCH 742/826 ALSA: pcm: Add sanity NULL check for the default mmap fault handler
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit d2913a07d9037fe7aed4b7e680684163eaed6bc4 upstream.
A driver might allow the mmap access before initializing its runtime->dma_area properly. Add a proper NULL check before passing to virt_to_page() for avoiding a panic.
--- sound/core/pcm_native.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/core/pcm_native.c +4 -2
@@ -3793,9 +3793,11 @@ static vm_fault_t snd_pcm_mmap_data_faulreturn VM_FAULT_SIGBUS ;if (substream->ops->page) page = substream->ops->page (substream, offset); -else if (!snd_pcm_get_dma_buf (substream)) +else if (!snd_pcm_get_dma_buf (substream)) { +if (WARN_ON_ONCE (!runtime->dma_area)) +return VM_FAULT_SIGBUS ; page =virt_to_page (runtime->dma_area + offset); -else + }else page =snd_sgbuf_get_page (snd_pcm_get_dma_buf (substream), offset);if (!page)return VM_FAULT_SIGBUS ;
Greg Kroah-Hartman
maintainerPATCH 743/826 ALSA: hda/realtek: Update ALC225 depop procedure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
commit 1fd50509fe14a9adc9329e0454b986157a4c155a upstream.
Old procedure has a chance to meet Headphone no output.
--- sound/pci/hda/patch_realtek.c | 95 +++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 52 deletions(-)
sound/pci/hda/patch_realtek.c +43 -52
@@ -3768,33 +3768,28 @@ static void alc225_init(struct hda_codec hp1_pin_sense =snd_hda_jack_detect (codec, hp_pin); hp2_pin_sense =snd_hda_jack_detect (codec,0x16 ); -if (hp1_pin_sense || hp2_pin_sense) +if (hp1_pin_sense || hp2_pin_sense) {msleep (2 ); +alc_update_coefex_idx (codec,0x57 ,0x04 ,0x0007 ,0x1 );/* Low power */ -alc_update_coefex_idx (codec,0x57 ,0x04 ,0x0007 ,0x1 );/* Low power */ +if (hp1_pin_sense) +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_OUT ); +if (hp2_pin_sense) +snd_hda_codec_write (codec,0x16 ,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_OUT ); +msleep (75 ); + +if (hp1_pin_sense) +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_UNMUTE ); +if (hp2_pin_sense) +snd_hda_codec_write (codec,0x16 ,0 , +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_UNMUTE ); -if (hp1_pin_sense || spec->ultra_low_power) -snd_hda_codec_write (codec, hp_pin,0 , -AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); -if (hp2_pin_sense) -snd_hda_codec_write (codec,0x16 ,0 , -AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); - -if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) -msleep (85 ); - -if (hp1_pin_sense || spec->ultra_low_power) -snd_hda_codec_write (codec, hp_pin,0 , -AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_OUT ); -if (hp2_pin_sense) -snd_hda_codec_write (codec,0x16 ,0 , -AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_OUT ); - -if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) -msleep (100 ); - -alc_update_coef_idx (codec,0x4a ,3 <<10 ,0 ); -alc_update_coefex_idx (codec,0x57 ,0x04 ,0x0007 ,0x4 );/* Hight power */ +msleep (75 ); +alc_update_coefex_idx (codec,0x57 ,0x04 ,0x0007 ,0x4 );/* Hight power */ + } }static void alc225_shutup (struct hda_codec *codec)
@@ -3806,36 +3801,35 @@ static void alc225_shutup(struct hda_codif (!hp_pin) hp_pin =0x21 ; -alc_disable_headset_jack_key (codec); -/* 3k pull low control for Headset jack. */ -alc_update_coef_idx (codec,0x4a ,0 ,3 <<10 ); - hp1_pin_sense =snd_hda_jack_detect (codec, hp_pin); hp2_pin_sense =snd_hda_jack_detect (codec,0x16 ); -if (hp1_pin_sense || hp2_pin_sense) +if (hp1_pin_sense || hp2_pin_sense) { +alc_disable_headset_jack_key (codec); +/* 3k pull low control for Headset jack. */ +alc_update_coef_idx (codec,0x4a ,0 ,3 <<10 );msleep (2 ); -if (hp1_pin_sense || spec->ultra_low_power) -snd_hda_codec_write (codec, hp_pin,0 , -AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); -if (hp2_pin_sense) -snd_hda_codec_write (codec,0x16 ,0 , -AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); - -if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) -msleep (85 ); - -if (hp1_pin_sense || spec->ultra_low_power) -snd_hda_codec_write (codec, hp_pin,0 , -AC_VERB_SET_PIN_WIDGET_CONTROL ,0x0 ); -if (hp2_pin_sense) -snd_hda_codec_write (codec,0x16 ,0 , -AC_VERB_SET_PIN_WIDGET_CONTROL ,0x0 ); - -if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) -msleep (100 ); - +if (hp1_pin_sense) +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); +if (hp2_pin_sense) +snd_hda_codec_write (codec,0x16 ,0 , +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); + +msleep (75 ); + +if (hp1_pin_sense) +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,0x0 ); +if (hp2_pin_sense) +snd_hda_codec_write (codec,0x16 ,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,0x0 ); + +msleep (75 ); +alc_update_coef_idx (codec,0x4a ,3 <<10 ,0 ); +alc_enable_headset_jack_key (codec); + }alc_auto_setup_eapd (codec, false);alc_shutup_pins (codec);if (spec->ultra_low_power) {
@@ -3846,9 +3840,6 @@ static void alc225_shutup(struct hda_codalc_update_coef_idx (codec,0x4a ,3 <<4 ,2 <<4 );msleep (30 ); } - -alc_update_coef_idx (codec,0x4a ,3 <<10 ,0 ); -alc_enable_headset_jack_key (codec); }static void alc_default_init (struct hda_codec *codec)