netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ursula Braun <ubraun@linux.ibm.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	raspl@linux.ibm.com, ubraun@linux.ibm.com
Subject: [PATCH net 9/9] net/smc: fix use of variable in cleared area
Date: Wed, 30 Jan 2019 18:51:08 +0100	[thread overview]
Message-ID: <20190130175108.103221-10-ubraun@linux.ibm.com> (raw)
In-Reply-To: <20190130175108.103221-1-ubraun@linux.ibm.com>

From: Karsten Graul <kgraul@linux.ibm.com>

Do not use pend->idx as index for the arrays because its value is
located in the cleared area. Use the existing local variable instead.
Without this fix the wrong area might be cleared.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
---
 net/smc/smc_wr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/smc/smc_wr.c b/net/smc/smc_wr.c
index c2694750a6a8..1dc88c32d6bb 100644
--- a/net/smc/smc_wr.c
+++ b/net/smc/smc_wr.c
@@ -218,10 +218,10 @@ int smc_wr_tx_put_slot(struct smc_link *link,
 		u32 idx = pend->idx;
 
 		/* clear the full struct smc_wr_tx_pend including .priv */
-		memset(&link->wr_tx_pends[pend->idx], 0,
-		       sizeof(link->wr_tx_pends[pend->idx]));
-		memset(&link->wr_tx_bufs[pend->idx], 0,
-		       sizeof(link->wr_tx_bufs[pend->idx]));
+		memset(&link->wr_tx_pends[idx], 0,
+		       sizeof(link->wr_tx_pends[idx]));
+		memset(&link->wr_tx_bufs[idx], 0,
+		       sizeof(link->wr_tx_bufs[idx]));
 		test_and_clear_bit(idx, link->wr_tx_mask);
 		return 1;
 	}
-- 
2.16.4


  parent reply	other threads:[~2019-01-30 17:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 17:50 [PATCH net 0/9] net/smc: fixes 2019-01-30 Ursula Braun
2019-01-30 17:51 ` [PATCH net 1/9] net/smc: fix another sizeof to int comparison Ursula Braun
2019-01-30 17:51 ` [PATCH net 2/9] net/smc: allow 16 byte pnetids in netlink policy Ursula Braun
2019-01-30 17:51 ` [PATCH net 3/9] net/smc: prevent races between smc_lgr_terminate() and smc_conn_free() Ursula Braun
2019-01-30 17:51 ` [PATCH net 4/9] net/smc: don't wait for send buffer space when data was already sent Ursula Braun
2019-01-30 17:51 ` [PATCH net 5/9] net/smc: recvmsg and splice_read should return 0 after shutdown Ursula Braun
2019-01-30 17:51 ` [PATCH net 6/9] net/smc: do not wait under send_lock Ursula Braun
2019-01-30 17:51 ` [PATCH net 7/9] net/smc: call smc_cdc_msg_send() " Ursula Braun
2019-01-30 17:51 ` [PATCH net 8/9] net/smc: use device link provided in qp_context Ursula Braun
2019-01-30 17:51 ` Ursula Braun [this message]
2019-02-01 22:48 ` [PATCH net 0/9] net/smc: fixes 2019-01-30 David Miller

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=20190130175108.103221-10-ubraun@linux.ibm.com \
    --to=ubraun@linux.ibm.com \
    --cc=davem@davemloft.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=raspl@linux.ibm.com \
    --cc=schwidefsky@de.ibm.com \
    /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).