* [PATCH net-next 0/2] net/smc: fix typo and clc-bug
@ 2017-01-12 13:57 Ursula Braun
2017-01-12 13:57 ` [PATCH net-next 1/2] net: fix AF_SMC related typo Ursula Braun
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ursula Braun @ 2017-01-12 13:57 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, ubraun
Dave,
I received 2 bug reports for my new AF_SMC-code. Here are the fixes for them.
Thanks,
Ursula
Ursula Braun (2):
smc-typo-in-core-sock
smc-macaddr-len
net/core/sock.c | 2 +-
net/smc/smc_clc.c | 10 ++++------
net/smc/smc_ib.h | 4 +++-
3 files changed, 8 insertions(+), 8 deletions(-)
--
2.8.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 1/2] net: fix AF_SMC related typo
2017-01-12 13:57 [PATCH net-next 0/2] net/smc: fix typo and clc-bug Ursula Braun
@ 2017-01-12 13:57 ` Ursula Braun
2017-01-12 13:57 ` [PATCH net-next 2/2] smc: ETH_ALEN as memcpy length for mac addresses Ursula Braun
2017-01-12 14:47 ` [PATCH net-next 0/2] net/smc: fix typo and clc-bug David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Ursula Braun @ 2017-01-12 13:57 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, ubraun
When introducing the new socket family AF_SMC in
commit ac7138746e14 ("smc: establish new socket family"),
a typo in af_family_clock_key_strings has slipped in.
This patch repairs it.
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Fixes: ac7138746e14 ("smc: establish new socket family")
Reported-by: Andrew Morton <akpm@linux-foundation.org>
---
net/core/sock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index dbbdc4f..8b35debf 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -256,7 +256,7 @@ static const char *const af_family_clock_key_strings[AF_MAX+1] = {
"clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET" ,
"clock-AF_IEEE802154", "clock-AF_CAIF" , "clock-AF_ALG" ,
"clock-AF_NFC" , "clock-AF_VSOCK" , "clock-AF_KCM" ,
- "clock-AF_QIPCRTR", "closck-AF_smc" , "clock-AF_MAX"
+ "clock-AF_QIPCRTR", "clock-AF_SMC" , "clock-AF_MAX"
};
/*
--
2.8.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] smc: ETH_ALEN as memcpy length for mac addresses
2017-01-12 13:57 [PATCH net-next 0/2] net/smc: fix typo and clc-bug Ursula Braun
2017-01-12 13:57 ` [PATCH net-next 1/2] net: fix AF_SMC related typo Ursula Braun
@ 2017-01-12 13:57 ` Ursula Braun
2017-01-12 14:47 ` [PATCH net-next 0/2] net/smc: fix typo and clc-bug David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Ursula Braun @ 2017-01-12 13:57 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, ubraun
When creating an SMC connection, there is a CLC (connection layer control)
handshake to prepare for RDMA traffic. The corresponding code is part of
commit 0cfdd8f92cac ("smc: connection and link group creation").
Mac addresses to be exchanged in the handshake are copied with a wrong
length of 12 instead of 6 bytes. Following code overwrites the wrongly
copied code, but nevertheless the correct length should already be used for
the preceding mac address copying. Use ETH_ALEN for the memcpy length with
mac addresses.
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Fixes: 0cfdd8f92cac ("smc: connection and link group creation")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
net/smc/smc_clc.c | 10 ++++------
net/smc/smc_ib.h | 4 +++-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
index e1e684c..cc6b6f8 100644
--- a/net/smc/smc_clc.c
+++ b/net/smc/smc_clc.c
@@ -10,6 +10,7 @@
*/
#include <linux/in.h>
+#include <linux/if_ether.h>
#include <net/sock.h>
#include <net/tcp.h>
@@ -151,8 +152,7 @@ int smc_clc_send_proposal(struct smc_sock *smc,
pclc.hdr.version = SMC_CLC_V1; /* SMC version */
memcpy(pclc.lcl.id_for_peer, local_systemid, sizeof(local_systemid));
memcpy(&pclc.lcl.gid, &smcibdev->gid[ibport - 1], SMC_GID_SIZE);
- memcpy(&pclc.lcl.mac, &smcibdev->mac[ibport - 1],
- sizeof(smcibdev->mac[ibport - 1]));
+ memcpy(&pclc.lcl.mac, &smcibdev->mac[ibport - 1], ETH_ALEN);
/* determine subnet and mask from internal TCP socket */
rc = smc_netinfo_by_tcpsk(smc->clcsock, &pclc.outgoing_subnet,
@@ -199,8 +199,7 @@ int smc_clc_send_confirm(struct smc_sock *smc)
memcpy(cclc.lcl.id_for_peer, local_systemid, sizeof(local_systemid));
memcpy(&cclc.lcl.gid, &link->smcibdev->gid[link->ibport - 1],
SMC_GID_SIZE);
- memcpy(&cclc.lcl.mac, &link->smcibdev->mac[link->ibport - 1],
- sizeof(link->smcibdev->mac));
+ memcpy(&cclc.lcl.mac, &link->smcibdev->mac[link->ibport - 1], ETH_ALEN);
hton24(cclc.qpn, link->roce_qp->qp_num);
cclc.rmb_rkey =
htonl(conn->rmb_desc->mr_rx[SMC_SINGLE_LINK]->rkey);
@@ -252,8 +251,7 @@ int smc_clc_send_accept(struct smc_sock *new_smc, int srv_first_contact)
memcpy(aclc.lcl.id_for_peer, local_systemid, sizeof(local_systemid));
memcpy(&aclc.lcl.gid, &link->smcibdev->gid[link->ibport - 1],
SMC_GID_SIZE);
- memcpy(&aclc.lcl.mac, link->smcibdev->mac[link->ibport - 1],
- sizeof(link->smcibdev->mac[link->ibport - 1]));
+ memcpy(&aclc.lcl.mac, link->smcibdev->mac[link->ibport - 1], ETH_ALEN);
hton24(aclc.qpn, link->roce_qp->qp_num);
aclc.rmb_rkey =
htonl(conn->rmb_desc->mr_rx[SMC_SINGLE_LINK]->rkey);
diff --git a/net/smc/smc_ib.h b/net/smc/smc_ib.h
index 3fe2d55..a95f74b 100644
--- a/net/smc/smc_ib.h
+++ b/net/smc/smc_ib.h
@@ -11,6 +11,7 @@
#ifndef _SMC_IB_H
#define _SMC_IB_H
+#include <linux/if_ether.h>
#include <rdma/ib_verbs.h>
#define SMC_MAX_PORTS 2 /* Max # of ports */
@@ -34,7 +35,8 @@ struct smc_ib_device { /* ib-device infos for smc */
struct ib_cq *roce_cq_recv; /* recv completion queue */
struct tasklet_struct send_tasklet; /* called by send cq handler */
struct tasklet_struct recv_tasklet; /* called by recv cq handler */
- char mac[SMC_MAX_PORTS][6]; /* mac address per port*/
+ char mac[SMC_MAX_PORTS][ETH_ALEN];
+ /* mac address per port*/
union ib_gid gid[SMC_MAX_PORTS]; /* gid per port */
u8 initialized : 1; /* ib dev CQ, evthdl done */
struct work_struct port_event_work;
--
2.8.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 0/2] net/smc: fix typo and clc-bug
2017-01-12 13:57 [PATCH net-next 0/2] net/smc: fix typo and clc-bug Ursula Braun
2017-01-12 13:57 ` [PATCH net-next 1/2] net: fix AF_SMC related typo Ursula Braun
2017-01-12 13:57 ` [PATCH net-next 2/2] smc: ETH_ALEN as memcpy length for mac addresses Ursula Braun
@ 2017-01-12 14:47 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-01-12 14:47 UTC (permalink / raw)
To: ubraun; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens
From: Ursula Braun <ubraun@linux.vnet.ibm.com>
Date: Thu, 12 Jan 2017 14:57:13 +0100
> I received 2 bug reports for my new AF_SMC-code. Here are the fixes for them.
Series applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-12 14:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-12 13:57 [PATCH net-next 0/2] net/smc: fix typo and clc-bug Ursula Braun
2017-01-12 13:57 ` [PATCH net-next 1/2] net: fix AF_SMC related typo Ursula Braun
2017-01-12 13:57 ` [PATCH net-next 2/2] smc: ETH_ALEN as memcpy length for mac addresses Ursula Braun
2017-01-12 14:47 ` [PATCH net-next 0/2] net/smc: fix typo and clc-bug David Miller
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).