Skip to content

Commit bb169f8

Browse files
NunoDasNevesliuw
authored andcommitted
x86/hyperv: Fix usage of cpu_online_mask to get valid cpu
Accessing cpu_online_mask here is problematic because the cpus read lock is not held in this context. However, cpu_online_mask isn't needed here since the effective affinity mask is guaranteed to be valid in this callback. So, just use cpumask_first() to get the cpu instead of ANDing it with cpus_online_mask unnecessarily. Fixes: e39397d ("x86/hyperv: implement an MSI domain for root partition") Reported-by: Michael Kelley <[email protected]> Closes: https://lore.kernel.org/linux-hyperv/SN6PR02MB4157639630F8AD2D8FD8F52FD475A@SN6PR02MB4157.namprd02.prod.outlook.com/ Suggested-by: Thomas Gleixner <[email protected]> Signed-off-by: Nuno Das Neves <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Link: https://lore.kernel.org/r/1751582677-30930-4-git-send-email-nunodasneves@linux.microsoft.com Signed-off-by: Wei Liu <[email protected]> Message-ID: <1751582677-30930-4-git-send-email-nunodasneves@linux.microsoft.com>
1 parent f84b21d commit bb169f8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

arch/x86/hyperv/irqdomain.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ static void hv_irq_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
193193
struct pci_dev *dev;
194194
struct hv_interrupt_entry out_entry, *stored_entry;
195195
struct irq_cfg *cfg = irqd_cfg(data);
196-
const cpumask_t *affinity;
197196
int cpu;
198197
u64 status;
199198

@@ -205,8 +204,7 @@ static void hv_irq_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
205204
return;
206205
}
207206

208-
affinity = irq_data_get_effective_affinity_mask(data);
209-
cpu = cpumask_first_and(affinity, cpu_online_mask);
207+
cpu = cpumask_first(irq_data_get_effective_affinity_mask(data));
210208

211209
if (data->chip_data) {
212210
/*

0 commit comments

Comments
 (0)