stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Jan Luebbe <jlu@pengutronix.de>,
	Gregory CLEMENT <gregory.clement@free-electrons.com>
Subject: [PATCH 4.9 24/48] bus: mbus: fix window size calculation for 4GB windows
Date: Tue, 24 Oct 2017 15:03:37 +0200	[thread overview]
Message-ID: <20171024125728.856079440@linuxfoundation.org> (raw)
In-Reply-To: <20171024125727.668462013@linuxfoundation.org>

4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jan Luebbe <jlu@pengutronix.de>

commit 2bbbd96357ce76cc45ec722c00f654aa7b189112 upstream.

At least the Armada XP SoC supports 4GB on a single DRAM window. Because
the size register values contain the actual size - 1, the MSB is set in
that case. For example, the SDRAM window's control register's value is
0xffffffe1 for 4GB (bits 31 to 24 contain the size).

The MBUS driver reads back each window's size from registers and
calculates the actual size as (control_reg | ~DDR_SIZE_MASK) + 1, which
overflows for 32 bit values, resulting in other miscalculations further
on (a bad RAM window for the CESA crypto engine calculated by
mvebu_mbus_setup_cpu_target_nooverlap() in my case).

This patch changes the type in 'struct mbus_dram_window' from u32 to
u64, which allows us to keep using the same register calculation code in
most MBUS-using drivers (which calculate ->size - 1 again).

Fixes: fddddb52a6c4 ("bus: introduce an Marvell EBU MBus driver")
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/bus/mvebu-mbus.c |    2 +-
 include/linux/mbus.h     |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -720,7 +720,7 @@ mvebu_mbus_default_setup_cpu_target(stru
 			if (mbus->hw_io_coherency)
 				w->mbus_attr |= ATTR_HW_COHERENCY;
 			w->base = base & DDR_BASE_CS_LOW_MASK;
-			w->size = (size | ~DDR_SIZE_MASK) + 1;
+			w->size = (u64)(size | ~DDR_SIZE_MASK) + 1;
 		}
 	}
 	mvebu_mbus_dram_info.num_cs = cs;
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -31,8 +31,8 @@ struct mbus_dram_target_info
 	struct mbus_dram_window {
 		u8	cs_index;
 		u8	mbus_attr;
-		u32	base;
-		u32	size;
+		u64	base;
+		u64	size;
 	} cs[4];
 };
 

  parent reply	other threads:[~2017-10-24 13:04 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24 13:03 [PATCH 4.9 00/48] 4.9.59-stable review Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 01/48] USB: devio: Revert "USB: devio: Dont corrupt user memory" Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 02/48] USB: core: fix out-of-bounds access bug in usb_get_bos_descriptor() Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 03/48] USB: serial: metro-usb: add MS7820 device id Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 04/48] usb: cdc_acm: Add quirk for Elatec TWN3 Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 06/48] usb: hub: Allow reset retry for USB2 devices on connect bounce Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 07/48] ALSA: usb-audio: Add native DSD support for Pro-Ject Pre Box S2 Digital Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 08/48] can: gs_usb: fix busy loop if no more TX context is available Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 09/48] parisc: Fix double-word compare and exchange in LWS code on 32-bit kernels Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 10/48] iio: dummy: events: Add missing break Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 11/48] usb: musb: sunxi: Explicitly release USB PHY on exit Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 12/48] usb: musb: Check for host-mode using is_host_active() on reset interrupt Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 13/48] xhci: Identify USB 3.1 capable hosts by their port protocol capability Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 15/48] drm/nouveau/bsp/g92: disable by default Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 16/48] drm/nouveau/mmu: flush tlbs before deleting page tables Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 17/48] ALSA: seq: Enable use locking in all configurations Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 18/48] ALSA: hda: Remove superfluous - added by printk conversion Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 19/48] ALSA: hda: Abort capability probe at invalid register read Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 20/48] i2c: ismt: Separate I2C block read from SMBus block read Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 22/48] brcmfmac: Add check for short event packets Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 23/48] brcmsmac: make some local variables static const to reduce stack size Greg Kroah-Hartman
2017-10-24 13:03 ` Greg Kroah-Hartman [this message]
2017-10-24 13:03 ` [PATCH 4.9 25/48] clockevents/drivers/cs5535: Improve resilience to spurious interrupts Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 26/48] rtlwifi: rtl8821ae: Fix connection lost problem Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 27/48] x86/microcode/intel: Disable late loading on model 79 Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 28/48] KEYS: encrypted: fix dereference of NULL user_key_payload Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 29/48] lib/digsig: " Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 30/48] KEYS: dont let add_key() update an uninstantiated key Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 31/48] pkcs7: Prevent NULL pointer dereference, since sinfo is not always set Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 32/48] vmbus: fix missing signaling in hv_signal_on_read() Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 33/48] xfs: dont unconditionally clear the reflink flag on zero-block files Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 34/48] xfs: evict CoW fork extents when performing finsert/fcollapse Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 35/48] fs/xfs: Use %pS printk format for direct addresses Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 36/48] xfs: report zeroed or not correctly in xfs_zero_range() Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 37/48] xfs: update i_size after unwritten conversion in dio completion Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 38/48] xfs: perag initialization should only touch m_ag_max_usable for AG 0 Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 39/48] xfs: Capture state of the right inode in xfs_iflush_done Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 40/48] xfs: always swap the cow forks when swapping extents Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 41/48] xfs: handle racy AIO in xfs_reflink_end_cow Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 42/48] xfs: Dont log uninitialised fields in inode structures Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 43/48] xfs: move more RT specific code under CONFIG_XFS_RT Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 44/48] xfs: dont change inode mode if ACL update fails Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 45/48] xfs: reinit btree pointer on attr tree inactivation walk Greg Kroah-Hartman
2017-10-24 13:03 ` [PATCH 4.9 46/48] xfs: handle error if xfs_btree_get_bufs fails Greg Kroah-Hartman
2017-10-24 13:04 ` [PATCH 4.9 47/48] xfs: cancel dirty pages on invalidation Greg Kroah-Hartman
2017-10-24 13:04 ` [PATCH 4.9 48/48] xfs: trim writepage mapping to within eof Greg Kroah-Hartman
2017-10-24 21:28 ` [PATCH 4.9 00/48] 4.9.59-stable review Guenter Roeck
2017-10-24 22:26 ` Tom Gall
2017-10-25  7:02   ` Greg Kroah-Hartman

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=20171024125728.856079440@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=jlu@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.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).