Commit d1fabc68 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Per-next-PR merge.

net/smc/af_smc.c
  b5dd4d69 ("net/smc: llc_conf_mutex refactor, replace it with rw_semaphore")
  e40b801b ("net/smc: fix potential panic dues to unprotected smc_llc_srv_add_link()")
https://lore.kernel.org/all/20230221124008.6303c330@canb.auug.org.au/Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 4d4266e3 f922c7b1
...@@ -4814,9 +4814,9 @@ F: net/sched/sch_etf.c ...@@ -4814,9 +4814,9 @@ F: net/sched/sch_etf.c
F: net/sched/sch_taprio.c F: net/sched/sch_taprio.c
CC2520 IEEE-802.15.4 RADIO DRIVER CC2520 IEEE-802.15.4 RADIO DRIVER
M: Varka Bhadram <varkabhadram@gmail.com> M: Stefan Schmidt <stefan@datenfreihafen.org>
L: linux-wpan@vger.kernel.org L: linux-wpan@vger.kernel.org
S: Maintained S: Odd Fixes
F: Documentation/devicetree/bindings/net/ieee802154/cc2520.txt F: Documentation/devicetree/bindings/net/ieee802154/cc2520.txt
F: drivers/net/ieee802154/cc2520.c F: drivers/net/ieee802154/cc2520.c
...@@ -10013,6 +10013,7 @@ F: drivers/clk/clk-versaclock5.c ...@@ -10013,6 +10013,7 @@ F: drivers/clk/clk-versaclock5.c
IEEE 802.15.4 SUBSYSTEM IEEE 802.15.4 SUBSYSTEM
M: Alexander Aring <alex.aring@gmail.com> M: Alexander Aring <alex.aring@gmail.com>
M: Stefan Schmidt <stefan@datenfreihafen.org> M: Stefan Schmidt <stefan@datenfreihafen.org>
M: Miquel Raynal <miquel.raynal@bootlin.com>
L: linux-wpan@vger.kernel.org L: linux-wpan@vger.kernel.org
S: Maintained S: Maintained
W: https://linux-wpan.org/ W: https://linux-wpan.org/
...@@ -12828,9 +12829,9 @@ F: drivers/iio/potentiometer/mcp4018.c ...@@ -12828,9 +12829,9 @@ F: drivers/iio/potentiometer/mcp4018.c
F: drivers/iio/potentiometer/mcp4531.c F: drivers/iio/potentiometer/mcp4531.c
MCR20A IEEE-802.15.4 RADIO DRIVER MCR20A IEEE-802.15.4 RADIO DRIVER
M: Xue Liu <liuxuenetmail@gmail.com> M: Stefan Schmidt <stefan@datenfreihafen.org>
L: linux-wpan@vger.kernel.org L: linux-wpan@vger.kernel.org
S: Maintained S: Odd Fixes
W: https://github.com/xueliu/mcr20a-linux W: https://github.com/xueliu/mcr20a-linux
F: Documentation/devicetree/bindings/net/ieee802154/mcr20a.txt F: Documentation/devicetree/bindings/net/ieee802154/mcr20a.txt
F: drivers/net/ieee802154/mcr20a.c F: drivers/net/ieee802154/mcr20a.c
...@@ -14193,9 +14194,9 @@ T: git git://linuxtv.org/media_tree.git ...@@ -14193,9 +14194,9 @@ T: git git://linuxtv.org/media_tree.git
F: drivers/media/radio/radio-mr800.c F: drivers/media/radio/radio-mr800.c
MRF24J40 IEEE 802.15.4 RADIO DRIVER MRF24J40 IEEE 802.15.4 RADIO DRIVER
M: Alan Ott <alan@signal11.us> M: Stefan Schmidt <stefan@datenfreihafen.org>
L: linux-wpan@vger.kernel.org L: linux-wpan@vger.kernel.org
S: Maintained S: Odd Fixes
F: Documentation/devicetree/bindings/net/ieee802154/mrf24j40.txt F: Documentation/devicetree/bindings/net/ieee802154/mrf24j40.txt
F: drivers/net/ieee802154/mrf24j40.c F: drivers/net/ieee802154/mrf24j40.c
......
...@@ -176,15 +176,6 @@ void bcmgenet_phy_power_set(struct net_device *dev, bool enable) ...@@ -176,15 +176,6 @@ void bcmgenet_phy_power_set(struct net_device *dev, bool enable)
static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv) static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv)
{ {
u32 reg;
if (!GENET_IS_V5(priv)) {
/* Speed settings are set in bcmgenet_mii_setup() */
reg = bcmgenet_sys_readl(priv, SYS_PORT_CTRL);
reg |= LED_ACT_SOURCE_MAC;
bcmgenet_sys_writel(priv, reg, SYS_PORT_CTRL);
}
if (priv->hw_params->flags & GENET_HAS_MOCA_LINK_DET) if (priv->hw_params->flags & GENET_HAS_MOCA_LINK_DET)
fixed_phy_set_link_update(priv->dev->phydev, fixed_phy_set_link_update(priv->dev->phydev,
bcmgenet_fixed_phy_link_update); bcmgenet_fixed_phy_link_update);
...@@ -217,6 +208,8 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) ...@@ -217,6 +208,8 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
if (!phy_name) { if (!phy_name) {
phy_name = "MoCA"; phy_name = "MoCA";
if (!GENET_IS_V5(priv))
port_ctrl |= LED_ACT_SOURCE_MAC;
bcmgenet_moca_phy_setup(priv); bcmgenet_moca_phy_setup(priv);
} }
break; break;
......
...@@ -523,9 +523,9 @@ irqreturn_t lan966x_ptp_irq_handler(int irq, void *args) ...@@ -523,9 +523,9 @@ irqreturn_t lan966x_ptp_irq_handler(int irq, void *args)
if (WARN_ON(!skb_match)) if (WARN_ON(!skb_match))
continue; continue;
spin_lock(&lan966x->ptp_ts_id_lock); spin_lock_irqsave(&lan966x->ptp_ts_id_lock, flags);
lan966x->ptp_skbs--; lan966x->ptp_skbs--;
spin_unlock(&lan966x->ptp_ts_id_lock); spin_unlock_irqrestore(&lan966x->ptp_ts_id_lock, flags);
/* Get the h/w timestamp */ /* Get the h/w timestamp */
lan966x_get_hwtimestamp(lan966x, &ts, delay); lan966x_get_hwtimestamp(lan966x, &ts, delay);
......
...@@ -973,8 +973,15 @@ static int qede_alloc_fp_array(struct qede_dev *edev) ...@@ -973,8 +973,15 @@ static int qede_alloc_fp_array(struct qede_dev *edev)
goto err; goto err;
} }
mem = krealloc(edev->coal_entry, QEDE_QUEUE_CNT(edev) * if (!edev->coal_entry) {
sizeof(*edev->coal_entry), GFP_KERNEL); mem = kcalloc(QEDE_MAX_RSS_CNT(edev),
sizeof(*edev->coal_entry), GFP_KERNEL);
} else {
mem = krealloc(edev->coal_entry,
QEDE_QUEUE_CNT(edev) * sizeof(*edev->coal_entry),
GFP_KERNEL);
}
if (!mem) { if (!mem) {
DP_ERR(edev, "coalesce entry allocation failed\n"); DP_ERR(edev, "coalesce entry allocation failed\n");
kfree(edev->coal_entry); kfree(edev->coal_entry);
......
...@@ -650,54 +650,22 @@ static int pppol2tp_tunnel_mtu(const struct l2tp_tunnel *tunnel) ...@@ -650,54 +650,22 @@ static int pppol2tp_tunnel_mtu(const struct l2tp_tunnel *tunnel)
return mtu - PPPOL2TP_HEADER_OVERHEAD; return mtu - PPPOL2TP_HEADER_OVERHEAD;
} }
/* connect() handler. Attach a PPPoX socket to a tunnel UDP socket static struct l2tp_tunnel *pppol2tp_tunnel_get(struct net *net,
*/ const struct l2tp_connect_info *info,
static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, bool *new_tunnel)
int sockaddr_len, int flags)
{ {
struct sock *sk = sock->sk;
struct pppox_sock *po = pppox_sk(sk);
struct l2tp_session *session = NULL;
struct l2tp_connect_info info;
struct l2tp_tunnel *tunnel; struct l2tp_tunnel *tunnel;
struct pppol2tp_session *ps;
struct l2tp_session_cfg cfg = { 0, };
bool drop_refcnt = false;
bool drop_tunnel = false;
bool new_session = false;
bool new_tunnel = false;
int error; int error;
error = pppol2tp_sockaddr_get_info(uservaddr, sockaddr_len, &info); *new_tunnel = false;
if (error < 0)
return error;
lock_sock(sk); tunnel = l2tp_tunnel_get(net, info->tunnel_id);
/* Check for already bound sockets */
error = -EBUSY;
if (sk->sk_state & PPPOX_CONNECTED)
goto end;
/* We don't supporting rebinding anyway */
error = -EALREADY;
if (sk->sk_user_data)
goto end; /* socket is already attached */
/* Don't bind if tunnel_id is 0 */
error = -EINVAL;
if (!info.tunnel_id)
goto end;
tunnel = l2tp_tunnel_get(sock_net(sk), info.tunnel_id);
if (tunnel)
drop_tunnel = true;
/* Special case: create tunnel context if session_id and /* Special case: create tunnel context if session_id and
* peer_session_id is 0. Otherwise look up tunnel using supplied * peer_session_id is 0. Otherwise look up tunnel using supplied
* tunnel id. * tunnel id.
*/ */
if (!info.session_id && !info.peer_session_id) { if (!info->session_id && !info->peer_session_id) {
if (!tunnel) { if (!tunnel) {
struct l2tp_tunnel_cfg tcfg = { struct l2tp_tunnel_cfg tcfg = {
.encap = L2TP_ENCAPTYPE_UDP, .encap = L2TP_ENCAPTYPE_UDP,
...@@ -706,40 +674,82 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, ...@@ -706,40 +674,82 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
/* Prevent l2tp_tunnel_register() from trying to set up /* Prevent l2tp_tunnel_register() from trying to set up
* a kernel socket. * a kernel socket.
*/ */
if (info.fd < 0) { if (info->fd < 0)
error = -EBADF; return ERR_PTR(-EBADF);
goto end;
}
error = l2tp_tunnel_create(info.fd, error = l2tp_tunnel_create(info->fd,
info.version, info->version,
info.tunnel_id, info->tunnel_id,
info.peer_tunnel_id, &tcfg, info->peer_tunnel_id, &tcfg,
&tunnel); &tunnel);
if (error < 0) if (error < 0)
goto end; return ERR_PTR(error);
l2tp_tunnel_inc_refcount(tunnel); l2tp_tunnel_inc_refcount(tunnel);
error = l2tp_tunnel_register(tunnel, sock_net(sk), error = l2tp_tunnel_register(tunnel, net, &tcfg);
&tcfg);
if (error < 0) { if (error < 0) {
kfree(tunnel); kfree(tunnel);
goto end; return ERR_PTR(error);
} }
drop_tunnel = true;
new_tunnel = true; *new_tunnel = true;
} }
} else { } else {
/* Error if we can't find the tunnel */ /* Error if we can't find the tunnel */
error = -ENOENT;
if (!tunnel) if (!tunnel)
goto end; return ERR_PTR(-ENOENT);
/* Error if socket is not prepped */ /* Error if socket is not prepped */
if (!tunnel->sock) if (!tunnel->sock) {
goto end; l2tp_tunnel_dec_refcount(tunnel);
return ERR_PTR(-ENOENT);
}
} }
return tunnel;
}
/* connect() handler. Attach a PPPoX socket to a tunnel UDP socket
*/
static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
int sockaddr_len, int flags)
{
struct sock *sk = sock->sk;
struct pppox_sock *po = pppox_sk(sk);
struct l2tp_session *session = NULL;
struct l2tp_connect_info info;
struct l2tp_tunnel *tunnel;
struct pppol2tp_session *ps;
struct l2tp_session_cfg cfg = { 0, };
bool drop_refcnt = false;
bool new_session = false;
bool new_tunnel = false;
int error;
error = pppol2tp_sockaddr_get_info(uservaddr, sockaddr_len, &info);
if (error < 0)
return error;
/* Don't bind if tunnel_id is 0 */
if (!info.tunnel_id)
return -EINVAL;
tunnel = pppol2tp_tunnel_get(sock_net(sk), &info, &new_tunnel);
if (IS_ERR(tunnel))
return PTR_ERR(tunnel);
lock_sock(sk);
/* Check for already bound sockets */
error = -EBUSY;
if (sk->sk_state & PPPOX_CONNECTED)
goto end;
/* We don't supporting rebinding anyway */
error = -EALREADY;
if (sk->sk_user_data)
goto end; /* socket is already attached */
if (tunnel->peer_tunnel_id == 0) if (tunnel->peer_tunnel_id == 0)
tunnel->peer_tunnel_id = info.peer_tunnel_id; tunnel->peer_tunnel_id = info.peer_tunnel_id;
...@@ -840,8 +850,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, ...@@ -840,8 +850,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
} }
if (drop_refcnt) if (drop_refcnt)
l2tp_session_dec_refcount(session); l2tp_session_dec_refcount(session);
if (drop_tunnel) l2tp_tunnel_dec_refcount(tunnel);
l2tp_tunnel_dec_refcount(tunnel);
release_sock(sk); release_sock(sk);
return error; return error;
......
...@@ -1839,8 +1839,10 @@ static int smcr_serv_conf_first_link(struct smc_sock *smc) ...@@ -1839,8 +1839,10 @@ static int smcr_serv_conf_first_link(struct smc_sock *smc)
smc_llc_link_active(link); smc_llc_link_active(link);
smcr_lgr_set_type(link->lgr, SMC_LGR_SINGLE); smcr_lgr_set_type(link->lgr, SMC_LGR_SINGLE);
down_write(&link->lgr->llc_conf_mutex);
/* initial contact - try to establish second link */ /* initial contact - try to establish second link */
smc_llc_srv_add_link(link, NULL); smc_llc_srv_add_link(link, NULL);
up_write(&link->lgr->llc_conf_mutex);
return 0; return 0;
} }
......
...@@ -1124,8 +1124,9 @@ static void smcr_buf_unuse(struct smc_buf_desc *buf_desc, bool is_rmb, ...@@ -1124,8 +1124,9 @@ static void smcr_buf_unuse(struct smc_buf_desc *buf_desc, bool is_rmb,
smc_buf_free(lgr, is_rmb, buf_desc); smc_buf_free(lgr, is_rmb, buf_desc);
} else { } else {
buf_desc->used = 0; /* memzero_explicit provides potential memory barrier semantics */
memset(buf_desc->cpu_addr, 0, buf_desc->len); memzero_explicit(buf_desc->cpu_addr, buf_desc->len);
WRITE_ONCE(buf_desc->used, 0);
} }
} }
...@@ -1136,19 +1137,17 @@ static void smc_buf_unuse(struct smc_connection *conn, ...@@ -1136,19 +1137,17 @@ static void smc_buf_unuse(struct smc_connection *conn,
if (!lgr->is_smcd && conn->sndbuf_desc->is_vm) { if (!lgr->is_smcd && conn->sndbuf_desc->is_vm) {
smcr_buf_unuse(conn->sndbuf_desc, false, lgr); smcr_buf_unuse(conn->sndbuf_desc, false, lgr);
} else { } else {
conn->sndbuf_desc->used = 0; memzero_explicit(conn->sndbuf_desc->cpu_addr, conn->sndbuf_desc->len);
memset(conn->sndbuf_desc->cpu_addr, 0, WRITE_ONCE(conn->sndbuf_desc->used, 0);
conn->sndbuf_desc->len);
} }
} }
if (conn->rmb_desc) { if (conn->rmb_desc) {
if (!lgr->is_smcd) { if (!lgr->is_smcd) {
smcr_buf_unuse(conn->rmb_desc, true, lgr); smcr_buf_unuse(conn->rmb_desc, true, lgr);
} else { } else {
conn->rmb_desc->used = 0; memzero_explicit(conn->rmb_desc->cpu_addr,
memset(conn->rmb_desc->cpu_addr, 0, conn->rmb_desc->len + sizeof(struct smcd_cdc_msg));
conn->rmb_desc->len + WRITE_ONCE(conn->rmb_desc->used, 0);
sizeof(struct smcd_cdc_msg));
} }
} }
} }
......
...@@ -17,6 +17,18 @@ SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV_NAME/net/ ...@@ -17,6 +17,18 @@ SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV_NAME/net/
DEBUGFS_DIR=/sys/kernel/debug/netdevsim/$DEV_NAME/ DEBUGFS_DIR=/sys/kernel/debug/netdevsim/$DEV_NAME/
DL_HANDLE=netdevsim/$DEV_NAME DL_HANDLE=netdevsim/$DEV_NAME
wait_for_devlink()
{
"$@" | grep -q $DL_HANDLE
}
devlink_wait()
{
local timeout=$1
busywait "$timeout" wait_for_devlink devlink dev
}
fw_flash_test() fw_flash_test()
{ {
RET=0 RET=0
...@@ -256,6 +268,9 @@ netns_reload_test() ...@@ -256,6 +268,9 @@ netns_reload_test()
ip netns del testns2 ip netns del testns2
ip netns del testns1 ip netns del testns1
# Wait until netns async cleanup is done.
devlink_wait 2000
log_test "netns reload test" log_test "netns reload test"
} }
...@@ -348,6 +363,9 @@ resource_test() ...@@ -348,6 +363,9 @@ resource_test()
ip netns del testns2 ip netns del testns2
ip netns del testns1 ip netns del testns1
# Wait until netns async cleanup is done.
devlink_wait 2000
log_test "resource test" log_test "resource test"
} }
......
...@@ -2065,6 +2065,8 @@ EOF ...@@ -2065,6 +2065,8 @@ EOF
################################################################################ ################################################################################
# main # main
trap cleanup EXIT
while getopts :t:pPhv o while getopts :t:pPhv o
do do
case $o in case $o in
......
...@@ -214,11 +214,10 @@ static void do_verify_udp(const char *data, int len) ...@@ -214,11 +214,10 @@ static void do_verify_udp(const char *data, int len)
static int recv_msg(int fd, char *buf, int len, int *gso_size) static int recv_msg(int fd, char *buf, int len, int *gso_size)
{ {
char control[CMSG_SPACE(sizeof(uint16_t))] = {0}; char control[CMSG_SPACE(sizeof(int))] = {0};
struct msghdr msg = {0}; struct msghdr msg = {0};
struct iovec iov = {0}; struct iovec iov = {0};
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
uint16_t *gsosizeptr;
int ret; int ret;
iov.iov_base = buf; iov.iov_base = buf;
...@@ -237,8 +236,7 @@ static int recv_msg(int fd, char *buf, int len, int *gso_size) ...@@ -237,8 +236,7 @@ static int recv_msg(int fd, char *buf, int len, int *gso_size)
cmsg = CMSG_NXTHDR(&msg, cmsg)) { cmsg = CMSG_NXTHDR(&msg, cmsg)) {
if (cmsg->cmsg_level == SOL_UDP if (cmsg->cmsg_level == SOL_UDP
&& cmsg->cmsg_type == UDP_GRO) { && cmsg->cmsg_type == UDP_GRO) {
gsosizeptr = (uint16_t *) CMSG_DATA(cmsg); *gso_size = *(int *)CMSG_DATA(cmsg);
*gso_size = *gsosizeptr;
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment