From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753326AbdBKBi4 (ORCPT ); Fri, 10 Feb 2017 20:38:56 -0500 Received: from mail-pg0-f42.google.com ([74.125.83.42]:34535 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751775AbdBKBiy (ORCPT ); Fri, 10 Feb 2017 20:38:54 -0500 From: Jess Frazelle To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), Jess Frazelle , Kees Cook , linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Cc: kernel-hardening@lists.openwall.com Subject: [PATCH v2 5/5] x86: set msi_domain_ops as __ro_after_init Date: Fri, 10 Feb 2017 17:37:58 -0800 Message-Id: <20170211013758.3288-5-me@jessfraz.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170211013758.3288-1-me@jessfraz.com> References: <20170211013758.3288-1-me@jessfraz.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Marked msi_domain_ops structs as __ro_after_init when called only during init. This protects the data structure from accidental corruption. Suggested-by: Kees Cook Signed-off-by: Jess Frazelle --- arch/x86/kernel/apic/msi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c index 015bbf30e3e3..27783a1e7166 100644 --- a/arch/x86/kernel/apic/msi.c +++ b/arch/x86/kernel/apic/msi.c @@ -121,7 +121,7 @@ void pci_msi_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc) } EXPORT_SYMBOL_GPL(pci_msi_set_desc); -static struct msi_domain_ops pci_msi_domain_ops = { +static struct msi_domain_ops pci_msi_domain_ops __ro_after_init = { .get_hwirq = pci_msi_get_hwirq, .msi_prepare = pci_msi_prepare, .set_desc = pci_msi_set_desc, @@ -207,7 +207,7 @@ static int dmar_msi_init(struct irq_domain *domain, return 0; } -static struct msi_domain_ops dmar_msi_domain_ops = { +static struct msi_domain_ops dmar_msi_domain_ops __ro_after_init = { .get_hwirq = dmar_msi_get_hwirq, .msi_init = dmar_msi_init, }; @@ -304,7 +304,7 @@ static void hpet_msi_free(struct irq_domain *domain, irq_clear_status_flags(virq, IRQ_MOVE_PCNTXT); } -static struct msi_domain_ops hpet_msi_domain_ops = { +static struct msi_domain_ops hpet_msi_domain_ops __ro_after_init = { .get_hwirq = hpet_msi_get_hwirq, .msi_init = hpet_msi_init, .msi_free = hpet_msi_free, -- 2.11.0