lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181204155122.6327-4-douliyangs@gmail.com>
Date:   Tue,  4 Dec 2018 23:51:22 +0800
From:   Dou Liyang <douliyangs@...il.com>
To:     linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org
Cc:     tglx@...utronix.de, kashyap.desai@...adcom.com,
        shivasharan.srikanteshwara@...adcom.com, sumit.saxena@...adcom.com,
        ming.lei@...hat.com, hch@....de, bhelgaas@...gle.com,
        douliyang1@...wei.com, Dou Liyang <douliyangs@...il.com>
Subject: [PATCH 3/3] irq/affinity: Fix a possible breakage

In case of irq_default_affinity != cpu_possible_mask, setting the affinity
for the pre/post vectors to irq_default_affinity is a breakage.

Just set the pre/post vectors to cpu_possible_mask and be done with it.

Suggested-by: Thomas Gleixner <tglx@...utronix.de>
Signed-off-by: Dou Liyang <douliyangs@...il.com>
---
 kernel/irq/affinity.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index d122575ba1b4..aaa1dd82c3df 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -257,7 +257,7 @@ irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd)
 
 	/* Fill out vectors at the beginning that don't need affinity */
 	for (curvec = 0; curvec < affd->pre_vectors; curvec++)
-		cpumask_copy(&masks[curvec].mask, irq_default_affinity);
+		cpumask_copy(&masks[curvec].mask, cpu_possible_mask);
 	/*
 	 * Spread on present CPUs starting from affd->pre_vectors. If we
 	 * have multiple sets, build each sets affinity mask separately.
@@ -282,12 +282,15 @@ irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd)
 	}
 
 	/* Fill out vectors at the end that don't need affinity */
-	if (usedvecs >= affvecs)
+	if (usedvecs >= affvecs) {
 		curvec = affd->pre_vectors + affvecs;
-	else
+	} else {
 		curvec = affd->pre_vectors + usedvecs;
+		for (; curvec < affd->pre_vectors + affvecs; curvec++)
+			cpumask_copy(&masks[curvec].mask, irq_default_affinity);
+	}
 	for (; curvec < nvecs; curvec++)
-		cpumask_copy(&masks[curvec].mask, irq_default_affinity);
+		cpumask_copy(&masks[curvec].mask, cpu_possible_mask);
 
 	/*  Setup complementary information */
 	for (i = 0; i < nvecs; i++) {
-- 
2.17.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ