* [PATCH AUTOSEL 5.2 154/185] x86/platform/uv: Fix kmalloc() NULL check routine [not found] <20190922184924.32534-1-sashal@kernel.org> @ 2019-09-22 18:48 ` Sasha Levin 2019-09-22 20:26 ` Greg KH 2019-09-22 18:48 ` [PATCH AUTOSEL 5.2 156/185] platform/x86: intel_pmc_core: Do not ioremap RAM Sasha Levin 1 sibling, 1 reply; 3+ messages in thread From: Sasha Levin @ 2019-09-22 18:48 UTC (permalink / raw) To: linux-kernel, stable Cc: Austin Kim, Dimitri Sivanich, Hedi Berriche, Linus Torvalds, Mike Travis, Peter Zijlstra, Russ Anderson, Steve Wahl, Thomas Gleixner, allison, andy, armijn, bp, dvhart, gregkh, hpa, kjlu, platform-driver-x86, Ingo Molnar, Sasha Levin From: Austin Kim <austindh.kim@gmail.com> [ Upstream commit 864b23f0169d5bff677e8443a7a90dfd6b090afc ] The result of kmalloc() should have been checked ahead of below statement: pqp = (struct bau_pq_entry *)vp; Move BUG_ON(!vp) before above statement. Signed-off-by: Austin Kim <austindh.kim@gmail.com> Cc: Dimitri Sivanich <dimitri.sivanich@hpe.com> Cc: Hedi Berriche <hedi.berriche@hpe.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Travis <mike.travis@hpe.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russ Anderson <russ.anderson@hpe.com> Cc: Steve Wahl <steve.wahl@hpe.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: allison@lohutok.net Cc: andy@infradead.org Cc: armijn@tjaldur.nl Cc: bp@alien8.de Cc: dvhart@infradead.org Cc: gregkh@linuxfoundation.org Cc: hpa@zytor.com Cc: kjlu@umn.edu Cc: platform-driver-x86@vger.kernel.org Link: https://lkml.kernel.org/r/20190905232951.GA28779@LGEARND20B15 Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> --- arch/x86/platform/uv/tlb_uv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c index 0c7dfec4acac8..5a66d73620ce4 100644 --- a/arch/x86/platform/uv/tlb_uv.c +++ b/arch/x86/platform/uv/tlb_uv.c @@ -1815,9 +1815,9 @@ static void pq_init(int node, int pnode) plsize = (DEST_Q_SIZE + 1) * sizeof(struct bau_pq_entry); vp = kmalloc_node(plsize, GFP_KERNEL, node); - pqp = (struct bau_pq_entry *)vp; - BUG_ON(!pqp); + BUG_ON(!vp); + pqp = (struct bau_pq_entry *)vp; cp = (char *)pqp + 31; pqp = (struct bau_pq_entry *)(((unsigned long)cp >> 5) << 5); -- 2.20.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH AUTOSEL 5.2 154/185] x86/platform/uv: Fix kmalloc() NULL check routine 2019-09-22 18:48 ` [PATCH AUTOSEL 5.2 154/185] x86/platform/uv: Fix kmalloc() NULL check routine Sasha Levin @ 2019-09-22 20:26 ` Greg KH 0 siblings, 0 replies; 3+ messages in thread From: Greg KH @ 2019-09-22 20:26 UTC (permalink / raw) To: Sasha Levin Cc: linux-kernel, stable, Austin Kim, Dimitri Sivanich, Hedi Berriche, Linus Torvalds, Mike Travis, Peter Zijlstra, Russ Anderson, Steve Wahl, Thomas Gleixner, allison, andy, armijn, bp, dvhart, hpa, kjlu, platform-driver-x86, Ingo Molnar On Sun, Sep 22, 2019 at 02:48:52PM -0400, Sasha Levin wrote: > From: Austin Kim <austindh.kim@gmail.com> > > [ Upstream commit 864b23f0169d5bff677e8443a7a90dfd6b090afc ] > > The result of kmalloc() should have been checked ahead of below statement: > > pqp = (struct bau_pq_entry *)vp; > > Move BUG_ON(!vp) before above statement. > > Signed-off-by: Austin Kim <austindh.kim@gmail.com> > Cc: Dimitri Sivanich <dimitri.sivanich@hpe.com> > Cc: Hedi Berriche <hedi.berriche@hpe.com> > Cc: Linus Torvalds <torvalds@linux-foundation.org> > Cc: Mike Travis <mike.travis@hpe.com> > Cc: Peter Zijlstra <peterz@infradead.org> > Cc: Russ Anderson <russ.anderson@hpe.com> > Cc: Steve Wahl <steve.wahl@hpe.com> > Cc: Thomas Gleixner <tglx@linutronix.de> > Cc: allison@lohutok.net > Cc: andy@infradead.org > Cc: armijn@tjaldur.nl > Cc: bp@alien8.de > Cc: dvhart@infradead.org > Cc: gregkh@linuxfoundation.org > Cc: hpa@zytor.com > Cc: kjlu@umn.edu > Cc: platform-driver-x86@vger.kernel.org > Link: https://lkml.kernel.org/r/20190905232951.GA28779@LGEARND20B15 > Signed-off-by: Ingo Molnar <mingo@kernel.org> > Signed-off-by: Sasha Levin <sashal@kernel.org> > --- > arch/x86/platform/uv/tlb_uv.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c > index 0c7dfec4acac8..5a66d73620ce4 100644 > --- a/arch/x86/platform/uv/tlb_uv.c > +++ b/arch/x86/platform/uv/tlb_uv.c > @@ -1815,9 +1815,9 @@ static void pq_init(int node, int pnode) > > plsize = (DEST_Q_SIZE + 1) * sizeof(struct bau_pq_entry); > vp = kmalloc_node(plsize, GFP_KERNEL, node); > - pqp = (struct bau_pq_entry *)vp; > - BUG_ON(!pqp); > + BUG_ON(!vp); > > + pqp = (struct bau_pq_entry *)vp; > cp = (char *)pqp + 31; > pqp = (struct bau_pq_entry *)(((unsigned long)cp >> 5) << 5); > Please drop from everywhere. thanks, greg k-h ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH AUTOSEL 5.2 156/185] platform/x86: intel_pmc_core: Do not ioremap RAM [not found] <20190922184924.32534-1-sashal@kernel.org> 2019-09-22 18:48 ` [PATCH AUTOSEL 5.2 154/185] x86/platform/uv: Fix kmalloc() NULL check routine Sasha Levin @ 2019-09-22 18:48 ` Sasha Levin 1 sibling, 0 replies; 3+ messages in thread From: Sasha Levin @ 2019-09-22 18:48 UTC (permalink / raw) To: linux-kernel, stable Cc: M. Vefa Bicakci, Andy Shevchenko, Sasha Levin, platform-driver-x86 From: "M. Vefa Bicakci" <m.v.b@runbox.com> [ Upstream commit 7d505758b1e556cdf65a5e451744fe0ae8063d17 ] On a Xen-based PVH virtual machine with more than 4 GiB of RAM, intel_pmc_core fails initialization with the following warning message from the kernel, indicating that the driver is attempting to ioremap RAM: ioremap on RAM at 0x00000000fe000000 - 0x00000000fe001fff WARNING: CPU: 1 PID: 434 at arch/x86/mm/ioremap.c:186 __ioremap_caller.constprop.0+0x2aa/0x2c0 ... Call Trace: ? pmc_core_probe+0x87/0x2d0 [intel_pmc_core] pmc_core_probe+0x87/0x2d0 [intel_pmc_core] This issue appears to manifest itself because of the following fallback mechanism in the driver: if (lpit_read_residency_count_address(&slp_s0_addr)) pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT; The validity of address PMC_BASE_ADDR_DEFAULT (i.e., 0xFE000000) is not verified by the driver, which is what this patch introduces. With this patch, if address PMC_BASE_ADDR_DEFAULT is in RAM, then the driver will not attempt to ioremap the aforementioned address. Signed-off-by: M. Vefa Bicakci <m.v.b@runbox.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/platform/x86/intel_pmc_core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c index be6cda89dcf5b..01a530e2f8017 100644 --- a/drivers/platform/x86/intel_pmc_core.c +++ b/drivers/platform/x86/intel_pmc_core.c @@ -882,10 +882,14 @@ static int pmc_core_probe(struct platform_device *pdev) if (pmcdev->map == &spt_reg_map && !pci_dev_present(pmc_pci_ids)) pmcdev->map = &cnp_reg_map; - if (lpit_read_residency_count_address(&slp_s0_addr)) + if (lpit_read_residency_count_address(&slp_s0_addr)) { pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT; - else + + if (page_is_ram(PHYS_PFN(pmcdev->base_addr))) + return -ENODEV; + } else { pmcdev->base_addr = slp_s0_addr - pmcdev->map->slp_s0_offset; + } pmcdev->regbase = ioremap(pmcdev->base_addr, pmcdev->map->regmap_length); -- 2.20.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-22 20:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190922184924.32534-1-sashal@kernel.org>
2019-09-22 18:48 ` [PATCH AUTOSEL 5.2 154/185] x86/platform/uv: Fix kmalloc() NULL check routine Sasha Levin
2019-09-22 20:26 ` Greg KH
2019-09-22 18:48 ` [PATCH AUTOSEL 5.2 156/185] platform/x86: intel_pmc_core: Do not ioremap RAM Sasha Levin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox