Skip to contentSkip to conversation

vfio-ccw: one bugfix for 4.12

GIT PULL Applied Cornelia Huck 2 participants 4 messages Jul 24, 2017 – Jul 26, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

The following changes since commit 97ca7bfc19605bc08e9183441b8b8545e84032d6:

s390/mm: set change and reference bit on lazy key enablement (2017-07-13 11:28:29 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/vfio-ccw.git tags/vfio-ccw-20170724

for you to fetch changes up to c389377c01bf2d6e2a178e86aef8535931bfbd75:

vfio: ccw: fix bad ptr math for TIC cda translation (2017-07-24 09:54:37 +0200)

----------------------------------------------------------------
A bugfix in the ccw translation code.

----------------------------------------------------------------
Jason J. Herne (1):
vfio: ccw: fix bad ptr math for TIC cda translation

 drivers/s390/cio/vfio_ccw_cp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Jason J. Herne (1):
vfio: ccw: fix bad ptr math for TIC cda translation

 drivers/s390/cio/vfio_ccw_cp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.13.3
#1 lore raw

[PULL 1/1] vfio: ccw: fix bad ptr math for TIC cda translation

From: "Jason J. Herne" <[email protected]>

When we are translating channel data addresses from guest to host address space for TIC instructions we are getting incorrect addresses because of a pointer arithmetic error.

We currently calculate the offset of the TIC's cda from the start of the channel program chain (ccw->cda - ccw_head). We then add that to the address of the ccw chain in host memory (iter->ch_ccw). The problem is that iter->ch_ccw is a pointer to struct ccw1 so when we increment it we are actually incrementing by the size of struct ccw1 which is 8 bytes. The intent was to increment by n-bytes, not n*8.

The fix: cast iter->ch_ccw to char* so it will be incremented by n*1.

Message-Id: <[email protected]>

---
 drivers/s390/cio/vfio_ccw_cp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/cio/vfio_ccw_cp.c +1 -1
index ba6ac83a6c25..5ccfdc80d0ec 100644
@@ -481,7 +481,7 @@ static int ccwchain_fetch_tic(struct ccwchain *chain,
 		ccw_tail = ccw_head + (iter->ch_len - 1) * sizeof(struct ccw1);
 
 		if ((ccw_head <= ccw->cda) && (ccw->cda <= ccw_tail)) {
-			ccw->cda = (__u32) (addr_t) (iter->ch_ccw +
+			ccw->cda = (__u32) (addr_t) (((char *)iter->ch_ccw) +
 						     (ccw->cda - ccw_head));
 			return 0;
 		}
Signature · 1 line
2.13.3
#2 lore raw
In reply to Cornelia Huck
Quoted 8 lines · On Mon, 24 Jul 2017 18:47:00 +0200 Cornelia Huck <[email protected]> wrote:

The following changes since commit 97ca7bfc19605bc08e9183441b8b8545e84032d6:

s390/mm: set change and reference bit on lazy key enablement (2017-07-13 11:28:29 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/vfio-ccw.git tags/vfio-ccw-20170724

Quoted 8 lines

for you to fetch changes up to c389377c01bf2d6e2a178e86aef8535931bfbd75:

vfio: ccw: fix bad ptr math for TIC cda translation (2017-07-24 09:54:37 +0200)

----------------------------------------------------------------
A bugfix in the ccw translation code.

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

Applied to s390/linux:features. Thanks.

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#3 lore raw
Quoted 13 lines · On Wed, 26 Jul 2017 08:28:53 +0200 Martin Schwidefsky <[email protected]>…
Quoted 10 lines · On Mon, 24 Jul 2017 18:47:00 +0200 Cornelia Huck <[email protected]> wrote:

The following changes since commit 97ca7bfc19605bc08e9183441b8b8545e84032d6:

s390/mm: set change and reference bit on lazy key enablement (2017-07-13 11:28:29 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/vfio-ccw.git tags/vfio-ccw-20170724

for you to fetch changes up to c389377c01bf2d6e2a178e86aef8535931bfbd75:

Quoted 9 lines
Quoted 6 lines

vfio: ccw: fix bad ptr math for TIC cda translation (2017-07-24 09:54:37 +0200)

----------------------------------------------------------------
A bugfix in the ccw translation code.

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

Applied to s390/linux:features. Thanks.

Thanks. Would you consider to push this out as a bugfix if you have anything else queued up as well?