linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sasha Levin <sashal@kernel.org>, Will Deacon <will@kernel.org>,
	James Morse <james.morse@arm.com>,
	Pavel Tatashin <pasha.tatashin@soleen.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 4.19 599/671] arm64: hibernate: check pgd table allocation
Date: Thu, 16 Jan 2020 12:03:57 -0500	[thread overview]
Message-ID: <20200116170509.12787-336-sashal@kernel.org> (raw)
In-Reply-To: <20200116170509.12787-1-sashal@kernel.org>

From: Pavel Tatashin <pasha.tatashin@soleen.com>

[ Upstream commit 8c551f919a73c1dfa690a70a691be1da394145e8 ]

There is a bug in create_safe_exec_page(), when page table is allocated
it is not checked that table is allocated successfully:

But it is dereferenced in: pgd_none(READ_ONCE(*pgdp)).  Check that
allocation was successful.

Fixes: 82869ac57b5d ("arm64: kernel: Add support for hibernate/suspend-to-disk")
Reviewed-by: James Morse <james.morse@arm.com>
Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/kernel/hibernate.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
index 9859e1178e6b..dbeeeffdb9c9 100644
--- a/arch/arm64/kernel/hibernate.c
+++ b/arch/arm64/kernel/hibernate.c
@@ -202,6 +202,7 @@ static int create_safe_exec_page(void *src_start, size_t length,
 				 gfp_t mask)
 {
 	int rc = 0;
+	pgd_t *trans_pgd;
 	pgd_t *pgdp;
 	pud_t *pudp;
 	pmd_t *pmdp;
@@ -216,7 +217,13 @@ static int create_safe_exec_page(void *src_start, size_t length,
 	memcpy((void *)dst, src_start, length);
 	__flush_icache_range(dst, dst + length);
 
-	pgdp = pgd_offset_raw(allocator(mask), dst_addr);
+	trans_pgd = allocator(mask);
+	if (!trans_pgd) {
+		rc = -ENOMEM;
+		goto out;
+	}
+
+	pgdp = pgd_offset_raw(trans_pgd, dst_addr);
 	if (pgd_none(READ_ONCE(*pgdp))) {
 		pudp = allocator(mask);
 		if (!pudp) {
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-01-16 17:42 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200116170509.12787-1-sashal@kernel.org>
2020-01-16 16:58 ` [PATCH AUTOSEL 4.19 273/671] soc/fsl/qe: Fix an error code in qe_pin_request() Sasha Levin
2020-01-16 16:58 ` [PATCH AUTOSEL 4.19 274/671] spi: bcm2835aux: fix driver to not allow 65535 (=-1) cs-gpios Sasha Levin
2020-01-16 16:58 ` [PATCH AUTOSEL 4.19 276/671] arm64/vdso: don't leak kernel addresses Sasha Levin
2020-01-16 16:58 ` [PATCH AUTOSEL 4.19 278/671] rtc: mt6397: Don't call irq_dispose_mapping Sasha Levin
2020-01-16 16:58 ` [PATCH AUTOSEL 4.19 287/671] firmware: arm_scmi: fix of_node leak in scmi_mailbox_check Sasha Levin
2020-01-16 16:58 ` [PATCH AUTOSEL 4.19 291/671] ARM: pxa: ssp: Fix "WARNING: invalid free of devm_ allocated data" Sasha Levin
2020-01-16 16:58 ` [PATCH AUTOSEL 4.19 292/671] PCI: rockchip: Fix rockchip_pcie_ep_assert_intx() bitwise operations Sasha Levin
2020-01-16 16:58 ` [PATCH AUTOSEL 4.19 298/671] soc: amlogic: meson-gx-pwrc-vpu: Fix power on/off register bitmask Sasha Levin
2020-01-16 16:59 ` [PATCH AUTOSEL 4.19 305/671] ARM: dts: ls1021: Fix SGMII PCS link remaining down after PHY disconnect Sasha Levin
2020-01-16 16:59 ` [PATCH AUTOSEL 4.19 313/671] coresight: catu: fix clang build warning Sasha Levin
2020-01-16 16:59 ` [PATCH AUTOSEL 4.19 321/671] PCI: iproc: Enable iProc config read for PAXBv2 Sasha Levin
2020-01-16 16:59 ` [PATCH AUTOSEL 4.19 350/671] pwm: meson: Consider 128 a valid pre-divider Sasha Levin
2020-01-16 16:59 ` [PATCH AUTOSEL 4.19 351/671] pwm: meson: Don't disable PWM when setting duty repeatedly Sasha Levin
2020-01-16 16:59 ` [PATCH AUTOSEL 4.19 352/671] ARM: riscpc: fix lack of keyboard interrupts after irq conversion Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 364/671] ARM: dts: sun8i-h3: Fix wifi in Beelink X2 DT Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 365/671] clk: meson: gxbb: no spread spectrum on mpll0 Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 366/671] clk: meson: axg: spread spectrum is on mpll2 Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 368/671] arm64: dts: meson: libretech-cc: set eMMC as removable Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 373/671] serial: stm32: fix word length configuration Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 374/671] serial: stm32: fix rx error handling Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 375/671] serial: stm32: fix rx data length when parity enabled Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 376/671] serial: stm32: fix transmit_chars when tx is stopped Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 377/671] serial: stm32: Add support of TC bit status check Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 378/671] serial: stm32: fix wakeup source initialization Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 394/671] cpufreq: brcmstb-avs-cpufreq: Fix initial command check Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 395/671] cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 396/671] clk: sunxi-ng: sun50i-h6-r: Fix incorrect W1 clock gate register Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 402/671] serial: stm32: fix a recursive locking in stm32_config_rs485 Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 403/671] arm64: dts: meson-gxm-khadas-vim2: fix gpio-keys-polled node Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 404/671] arm64: dts: meson-gxm-khadas-vim2: fix Bluetooth support Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 407/671] firmware: arm_scmi: fix bitfield definitions for SENSOR_DESC attributes Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 408/671] firmware: arm_scmi: update rate_discrete in clock_describe_rates_get Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 410/671] ASoC: meson: axg-tdmin: right_j is not supported Sasha Levin
2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 411/671] ASoC: meson: axg-tdmout: " Sasha Levin
2020-01-16 17:01 ` [PATCH AUTOSEL 4.19 429/671] arm64: dts: allwinner: h6: Pine H64: Add interrupt line for RTC Sasha Levin
2020-01-16 17:01 ` [PATCH AUTOSEL 4.19 435/671] nvmem: imx-ocotp: Ensure WAIT bits are preserved when setting timing Sasha Levin
2020-01-16 17:01 ` [PATCH AUTOSEL 4.19 436/671] nvmem: imx-ocotp: Change TIMING calculation to u-boot algorithm Sasha Levin
2020-01-16 17:01 ` [PATCH AUTOSEL 4.19 462/671] ARM: stm32: use "depends on" instead of "if" after prompt Sasha Levin
2020-01-16 17:01 ` [PATCH AUTOSEL 4.19 466/671] clk: sunxi-ng: v3s: add the missing PLL_DDR1 Sasha Levin
2020-01-16 17:01 ` [PATCH AUTOSEL 4.19 478/671] ARM: dts: stm32: add missing vdda-supply to adc on stm32h743i-eval Sasha Levin
2020-01-16 17:02 ` [PATCH AUTOSEL 4.19 500/671] ASoC: sun4i-i2s: RX and TX counter registers are swapped Sasha Levin
2020-01-16 17:02 ` [PATCH AUTOSEL 4.19 505/671] media: atmel: atmel-isi: fix timeout value for stop streaming Sasha Levin
2020-01-16 17:02 ` [PATCH AUTOSEL 4.19 506/671] ARM: 8896/1: VDSO: Don't leak kernel addresses Sasha Levin
2020-01-16 17:02 ` [PATCH AUTOSEL 4.19 510/671] iommu/mediatek: Fix iova_to_phys PA start for 4GB mode Sasha Levin
2020-01-16 17:02 ` [PATCH AUTOSEL 4.19 528/671] ARM: dts: aspeed-g5: Fixe gpio-ranges upper limit Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 546/671] pinctrl: iproc-gpio: Fix incorrect pinconf configurations Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 547/671] gpio/aspeed: Fix incorrect number of banks Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 556/671] clk: actions: Fix factor clk struct member access Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 567/671] net: stmmac: dwmac-meson8b: Fix signedness bug in probe Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 568/671] net: axienet: fix a " Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 571/671] net: ethernet: stmmac: Fix signedness bug in ipq806x_gmac_of_parse() Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 575/671] net: stmmac: gmac4+: Not all Unicast addresses may be available Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 583/671] net: stmmac: fix length of PTP clock's name string Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 584/671] net: stmmac: fix disabling flexible PPS output Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 597/671] dmaengine: imx-sdma: fix size check for sdma script_number Sasha Levin
2020-01-16 17:03 ` Sasha Levin [this message]
2020-01-16 17:04 ` [PATCH AUTOSEL 4.19 611/671] mt7601u: fix bbp version check in mt7601u_wait_bbp_ready Sasha Levin
2020-01-16 17:04 ` [PATCH AUTOSEL 4.19 617/671] hwrng: omap3-rom - Fix missing clock by probing with device tree Sasha Levin
2020-01-16 17:04 ` [PATCH AUTOSEL 4.19 619/671] arm64: dts: meson-gxl-s905x-khadas-vim: fix gpio-keys-polled node Sasha Levin
2020-01-16 17:04 ` [PATCH AUTOSEL 4.19 623/671] spi: atmel: fix handling of cs_change set on non-last xfer Sasha Levin
2020-01-16 17:04 ` [PATCH AUTOSEL 4.19 627/671] clk: samsung: exynos5420: Preserve CPU clocks configuration during suspend/resume Sasha Levin
2020-01-16 17:04 ` [PATCH AUTOSEL 4.19 634/671] media: exynos4-is: Fix recursive locking in isp_video_release() Sasha Levin
2020-01-16 17:04 ` [PATCH AUTOSEL 4.19 640/671] rtc: brcmstb-waketimer: add missed clk_disable_unprepare Sasha Levin
2020-01-16 17:04 ` [PATCH AUTOSEL 4.19 643/671] i2c: stm32f7: report dma error during probe Sasha Levin
2020-01-16 17:04 ` [PATCH AUTOSEL 4.19 645/671] tty: serial: imx: use the sg count from dma_map_sg Sasha Levin
2020-01-16 17:04 ` [PATCH AUTOSEL 4.19 658/671] crypto: sun4i-ss - fix big endian issues Sasha Levin
2020-01-16 17:04 ` [PATCH AUTOSEL 4.19 660/671] arm64: dts: juno: Fix UART frequency Sasha Levin
2020-01-16 17:05 ` [PATCH AUTOSEL 4.19 663/671] Revert "arm64: dts: juno: add dma-ranges property" Sasha Levin
2020-01-16 17:05 ` [PATCH AUTOSEL 4.19 667/671] soc: aspeed: Fix snoop_file_poll()'s return type Sasha Levin
2020-01-16 17:05 ` [PATCH AUTOSEL 4.19 670/671] serial: stm32: fix clearing interrupt error flags Sasha Levin
2020-01-16 17:05 ` [PATCH AUTOSEL 4.19 671/671] arm64: dts: meson-gxm-khadas-vim2: fix uart_A bluetooth node Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200116170509.12787-336-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=stable@vger.kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).