Linux-RDMA Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] RDMA/siw: Fix page address mapping in TX path
@ 2019-09-06 14:21 Bernard Metzler
  2019-09-09 10:03 ` Leon Romanovsky
  2019-09-09 12:41 ` Bernard Metzler
  0 siblings, 2 replies; 5+ messages in thread
From: Bernard Metzler @ 2019-09-06 14:21 UTC (permalink / raw)
  To: linux-rdma; +Cc: krishna2, dledford, Bernard Metzler

Use the correct kmap()/kunmap() flow to determine page
address used for CRC computation. Using page_address()
is wrong, since page might be in highmem.

Reported-by: Krishnamraju Eraparaju <krishna2@chelsio.com>
Fixes: b9be6f18cf9e ("rdma/siw: transmit path")
Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
---
 drivers/infiniband/sw/siw/siw_qp_tx.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c
index 438a2917a47c..8e72f955921d 100644
--- a/drivers/infiniband/sw/siw/siw_qp_tx.c
+++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
@@ -518,11 +518,12 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s)
 							c_tx->mpa_crc_hd,
 							iov[seg].iov_base,
 							plen);
-				} else if (do_crc)
-					crypto_shash_update(
-						c_tx->mpa_crc_hd,
-						page_address(p) + fp_off,
-						plen);
+				} else if (do_crc) {
+					crypto_shash_update(c_tx->mpa_crc_hd,
+							    kmap(p) + fp_off,
+							    plen);
+					kunmap(p);
+				}
 			} else {
 				u64 va = sge->laddr + sge_off;
 
-- 
2.17.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RDMA/siw: Fix page address mapping in TX path
  2019-09-06 14:21 [PATCH] RDMA/siw: Fix page address mapping in TX path Bernard Metzler
@ 2019-09-09 10:03 ` Leon Romanovsky
  2019-09-09 12:41 ` Bernard Metzler
  1 sibling, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2019-09-09 10:03 UTC (permalink / raw)
  To: Bernard Metzler; +Cc: linux-rdma, krishna2, dledford

On Fri, Sep 06, 2019 at 04:21:49PM +0200, Bernard Metzler wrote:
> Use the correct kmap()/kunmap() flow to determine page
> address used for CRC computation. Using page_address()
> is wrong, since page might be in highmem.
>
> Reported-by: Krishnamraju Eraparaju <krishna2@chelsio.com>
> Fixes: b9be6f18cf9e ("rdma/siw: transmit path")
> Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
> ---
>  drivers/infiniband/sw/siw/siw_qp_tx.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)

Bernard,

You need to write version and target in your title [PATCH v100 rdma-next] ...
And changelog.

Thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH] RDMA/siw: Fix page address mapping in TX path
  2019-09-06 14:21 [PATCH] RDMA/siw: Fix page address mapping in TX path Bernard Metzler
  2019-09-09 10:03 ` Leon Romanovsky
@ 2019-09-09 12:41 ` Bernard Metzler
  1 sibling, 0 replies; 5+ messages in thread
From: Bernard Metzler @ 2019-09-09 12:41 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-rdma, krishna2, dledford

-----"Leon Romanovsky" <leon@kernel.org> wrote: -----

>To: "Bernard Metzler" <bmt@zurich.ibm.com>
>From: "Leon Romanovsky" <leon@kernel.org>
>Date: 09/09/2019 12:03PM
>Cc: linux-rdma@vger.kernel.org, krishna2@chelsio.com,
>dledford@redhat.com
>Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Fix page address mapping in
>TX path
>
>On Fri, Sep 06, 2019 at 04:21:49PM +0200, Bernard Metzler wrote:
>> Use the correct kmap()/kunmap() flow to determine page
>> address used for CRC computation. Using page_address()
>> is wrong, since page might be in highmem.
>>
>> Reported-by: Krishnamraju Eraparaju <krishna2@chelsio.com>
>> Fixes: b9be6f18cf9e ("rdma/siw: transmit path")
>> Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
>> ---
>>  drivers/infiniband/sw/siw/siw_qp_tx.c | 11 ++++++-----
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>
>Bernard,
>
>You need to write version and target in your title [PATCH v100
>rdma-next] ...
>And changelog.

Thanks Leon,
will do. I'd like to have that accepted asap,
since it is a code fix. The driver would crash if it
tries CRC on data in highmem. So let me mark it
'for-rc'. Or would 'rdma-rc' be better? Just see
these two variants on the list...


Thanks!
Bernard.
>
>Thanks
>
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RDMA/siw: Fix page address mapping in TX path
  2019-09-06  8:45 Bernard Metzler
@ 2019-09-06 14:04 ` Gal Pressman
  0 siblings, 0 replies; 5+ messages in thread
From: Gal Pressman @ 2019-09-06 14:04 UTC (permalink / raw)
  To: Bernard Metzler; +Cc: linux-rdma, krishna2, dledford

On 06/09/2019 11:45, Bernard Metzler wrote:
> Use the correct kmap()/kunmap() flow to determine page
> address used for CRC computation. Using page_address()
> is wrong, since page might be in highmem.
> 
> Reported-by: Krishnamraju Eraparaju <krishna2@chelsio.com>
> Fixes: b9be6f18cf9e rdma/siw: transmit path

Hi Bernard,
The format of the fixes line should be:
Fixes: b9be6f18cf9e ("rdma/siw: transmit path")

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] RDMA/siw: Fix page address mapping in TX path
@ 2019-09-06  8:45 Bernard Metzler
  2019-09-06 14:04 ` Gal Pressman
  0 siblings, 1 reply; 5+ messages in thread
From: Bernard Metzler @ 2019-09-06  8:45 UTC (permalink / raw)
  To: linux-rdma; +Cc: krishna2, dledford, Bernard Metzler

Use the correct kmap()/kunmap() flow to determine page
address used for CRC computation. Using page_address()
is wrong, since page might be in highmem.

Reported-by: Krishnamraju Eraparaju <krishna2@chelsio.com>
Fixes: b9be6f18cf9e rdma/siw: transmit path
Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
---
 drivers/infiniband/sw/siw/siw_qp_tx.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c
index 438a2917a47c..8e72f955921d 100644
--- a/drivers/infiniband/sw/siw/siw_qp_tx.c
+++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
@@ -518,11 +518,12 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s)
 							c_tx->mpa_crc_hd,
 							iov[seg].iov_base,
 							plen);
-				} else if (do_crc)
-					crypto_shash_update(
-						c_tx->mpa_crc_hd,
-						page_address(p) + fp_off,
-						plen);
+				} else if (do_crc) {
+					crypto_shash_update(c_tx->mpa_crc_hd,
+							    kmap(p) + fp_off,
+							    plen);
+					kunmap(p);
+				}
 			} else {
 				u64 va = sge->laddr + sge_off;
 
-- 
2.17.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 14:21 [PATCH] RDMA/siw: Fix page address mapping in TX path Bernard Metzler
2019-09-09 10:03 ` Leon Romanovsky
2019-09-09 12:41 ` Bernard Metzler
  -- strict thread matches above, loose matches on Subject: below --
2019-09-06  8:45 Bernard Metzler
2019-09-06 14:04 ` Gal Pressman

Linux-RDMA Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rdma/0 linux-rdma/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rdma linux-rdma/ https://lore.kernel.org/linux-rdma \
		linux-rdma@vger.kernel.org linux-rdma@archiver.kernel.org
	public-inbox-index linux-rdma


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rdma


AGPL code for this site: git clone https://public-inbox.org/ public-inbox