mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 14:30:06 -04:00
Merge tag 'x86-urgent-2026-07-11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: - Fix resctrl resource leak (Tony Luck) - Fix resctrl umount race (Tony Luck) - Fix resctrl double-free (Reinette Chatre) - Fix x86 VGA display fallback logic during bootup on certain multi-GPU systems (Mario Limonciello) - Re-add a WBINVD call to the SNP bootstrap path to fix an SNP regression (Tycho Andersen) * tag 'x86-urgent-2026-07-11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/virt/sev: Revert "Drop WBINVD before setting MSR_AMD64_SYSCFG_SNP_EN" x86/video: Only fall back to vga_default_device() without screen info fs/resctrl: Fix double-add of pseudo-locked region's RMID to free list fs/resctrl: Fix use-after-free during unmount fs/resctrl: Free mon_data structures on rdt_get_tree() failure
This commit is contained in:
@@ -43,21 +43,26 @@ bool video_is_primary_device(struct device *dev)
|
||||
if (!pci_is_display(pdev))
|
||||
return false;
|
||||
|
||||
if (pdev == vga_default_device())
|
||||
return true;
|
||||
|
||||
#ifdef CONFIG_SCREEN_INFO
|
||||
numres = screen_info_resources(si, res, ARRAY_SIZE(res));
|
||||
for (i = 0; i < numres; ++i) {
|
||||
if (!(res[i].flags & IORESOURCE_MEM))
|
||||
continue;
|
||||
if (numres > 0) {
|
||||
for (i = 0; i < numres; ++i) {
|
||||
if (!(res[i].flags & IORESOURCE_MEM))
|
||||
continue;
|
||||
|
||||
if (pci_find_resource(pdev, &res[i]))
|
||||
return true;
|
||||
if (pci_find_resource(pdev, &res[i]))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
/*
|
||||
* No framebuffer was set up by the firmware/bootloader, so fall back
|
||||
* to the default VGA device.
|
||||
*/
|
||||
return pdev == vga_default_device();
|
||||
}
|
||||
EXPORT_SYMBOL(video_is_primary_device);
|
||||
|
||||
|
||||
@@ -536,6 +536,8 @@ int snp_prepare(void)
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
wbinvd_on_all_cpus();
|
||||
|
||||
/*
|
||||
* MtrrFixDramModEn is not shared between threads on a core,
|
||||
* therefore it must be set on all CPUs prior to enabling SNP.
|
||||
|
||||
@@ -74,6 +74,8 @@ static int rdtgroup_setup_root(struct rdt_fs_context *ctx);
|
||||
|
||||
static void rdtgroup_destroy_root(void);
|
||||
|
||||
static void mon_put_kn_priv(void);
|
||||
|
||||
struct dentry *debugfs_resctrl;
|
||||
|
||||
/*
|
||||
@@ -585,14 +587,20 @@ static ssize_t rdtgroup_cpus_write(struct kernfs_open_file *of,
|
||||
*
|
||||
* On resource group creation via a mkdir, an extra kernfs_node reference is
|
||||
* taken to ensure that the rdtgroup structure remains accessible for the
|
||||
* rdtgroup_kn_unlock() calls where it is removed.
|
||||
* rdtgroup_kn_unlock() calls where it is removed. The default group is
|
||||
* statically allocated: it does not have an extra reference but will have
|
||||
* RDT_DELETED set on unmount to support safe access to its associated files
|
||||
* via rdtgroup_kn_lock_live/rdtgroup_kn_unlock().
|
||||
*
|
||||
* Drop the extra reference here, then free the rdtgroup structure.
|
||||
* For all but the default group: drop the extra reference, then free the
|
||||
* rdtgroup structure.
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
static void rdtgroup_remove(struct rdtgroup *rdtgrp)
|
||||
{
|
||||
if (rdtgrp == &rdtgroup_default)
|
||||
return;
|
||||
kernfs_put(rdtgrp->kn);
|
||||
kfree(rdtgrp);
|
||||
}
|
||||
@@ -2812,6 +2820,12 @@ static int rdt_get_tree(struct fs_context *fc)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Avoid races from pending operations from a previous mount */
|
||||
if (atomic_read(&rdtgroup_default.waitcount) != 0) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = setup_rmid_lru_list();
|
||||
if (ret)
|
||||
goto out;
|
||||
@@ -2893,6 +2907,7 @@ static int rdt_get_tree(struct fs_context *fc)
|
||||
kernfs_remove(kn_mondata);
|
||||
out_mongrp:
|
||||
if (resctrl_arch_mon_capable()) {
|
||||
mon_put_kn_priv();
|
||||
rdtgroup_unassign_cntrs(&rdtgroup_default);
|
||||
kernfs_remove(kn_mongrp);
|
||||
}
|
||||
@@ -3069,10 +3084,6 @@ static void rmdir_all_sub(void)
|
||||
if (rdtgrp == &rdtgroup_default)
|
||||
continue;
|
||||
|
||||
if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP ||
|
||||
rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED)
|
||||
rdtgroup_pseudo_lock_remove(rdtgrp);
|
||||
|
||||
/*
|
||||
* Give any CPUs back to the default group. We cannot copy
|
||||
* cpu_online_mask because a CPU might have executed the
|
||||
@@ -3083,7 +3094,13 @@ static void rmdir_all_sub(void)
|
||||
|
||||
rdtgroup_unassign_cntrs(rdtgrp);
|
||||
|
||||
free_rmid(rdtgrp->closid, rdtgrp->mon.rmid);
|
||||
if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP ||
|
||||
rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) {
|
||||
rdtgroup_pseudo_lock_remove(rdtgrp);
|
||||
} else {
|
||||
/* Pseudo-locked group's RMID is freed during setup. */
|
||||
free_rmid(rdtgrp->closid, rdtgrp->mon.rmid);
|
||||
}
|
||||
|
||||
kernfs_remove(rdtgrp->kn);
|
||||
list_del(&rdtgrp->rdtgroup_list);
|
||||
@@ -3174,6 +3191,7 @@ static void resctrl_fs_teardown(void)
|
||||
mon_put_kn_priv();
|
||||
rdt_pseudo_lock_release();
|
||||
rdtgroup_default.mode = RDT_MODE_SHAREABLE;
|
||||
rdtgroup_default.flags = RDT_DELETED;
|
||||
closid_exit();
|
||||
schemata_list_destroy();
|
||||
rdtgroup_destroy_root();
|
||||
@@ -4274,6 +4292,7 @@ static int rdtgroup_setup_root(struct rdt_fs_context *ctx)
|
||||
|
||||
ctx->kfc.root = rdt_root;
|
||||
rdtgroup_default.kn = kernfs_root_to_node(rdt_root);
|
||||
rdtgroup_default.flags = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user