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
F: net/sched/sch_taprio.c
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
S: Maintained
S: Odd Fixes
F: Documentation/devicetree/bindings/net/ieee802154/cc2520.txt
F: drivers/net/ieee802154/cc2520.c
......@@ -10013,6 +10013,7 @@ F: drivers/clk/clk-versaclock5.c
IEEE 802.15.4 SUBSYSTEM
M: Alexander Aring <alex.aring@gmail.com>
M: Stefan Schmidt <stefan@datenfreihafen.org>
M: Miquel Raynal <miquel.raynal@bootlin.com>
L: linux-wpan@vger.kernel.org
S: Maintained
W: https://linux-wpan.org/
......@@ -12828,9 +12829,9 @@ F: drivers/iio/potentiometer/mcp4018.c
F: drivers/iio/potentiometer/mcp4531.c
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
S: Maintained
S: Odd Fixes
W: https://github.com/xueliu/mcr20a-linux
F: Documentation/devicetree/bindings/net/ieee802154/mcr20a.txt
F: drivers/net/ieee802154/mcr20a.c
......@@ -14193,9 +14194,9 @@ T: git git://linuxtv.org/media_tree.git
F: drivers/media/radio/radio-mr800.c
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
S: Maintained
S: Odd Fixes
F: Documentation/devicetree/bindings/net/ieee802154/mrf24j40.txt
F: drivers/net/ieee802154/mrf24j40.c
......
......@@ -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)
{
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)
fixed_phy_set_link_update(priv->dev->phydev,
bcmgenet_fixed_phy_link_update);
......@@ -217,6 +208,8 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
if (!phy_name) {
phy_name = "MoCA";
if (!GENET_IS_V5(priv))
port_ctrl |= LED_ACT_SOURCE_MAC;
bcmgenet_moca_phy_setup(priv);
}
break;
......
......@@ -523,9 +523,9 @@ irqreturn_t lan966x_ptp_irq_handler(int irq, void *args)
if (WARN_ON(!skb_match))
continue;
spin_lock(&lan966x->ptp_ts_id_lock);
spin_lock_irqsave(&lan966x->ptp_ts_id_lock, flags);
lan966x->ptp_skbs--;
spin_unlock(&lan966x->ptp_ts_id_lock);
spin_unlock_irqrestore(&lan966x->ptp_ts_id_lock, flags);
/* Get the h/w timestamp */
lan966x_get_hwtimestamp(lan966x, &ts, delay);
......
......@@ -973,8 +973,15 @@ static int qede_alloc_fp_array(struct qede_dev *edev)
goto err;
}
mem = krealloc(edev->coal_entry, QEDE_QUEUE_CNT(edev) *
if (!edev->coal_entry) {
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) {
DP_ERR(edev, "coalesce entry allocation failed\n");
kfree(edev->coal_entry);
......
......@@ -650,54 +650,22 @@ static int pppol2tp_tunnel_mtu(const struct l2tp_tunnel *tunnel)
return mtu - PPPOL2TP_HEADER_OVERHEAD;
}
/* 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)
static struct l2tp_tunnel *pppol2tp_tunnel_get(struct net *net,
const struct l2tp_connect_info *info,
bool *new_tunnel)
{
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 drop_tunnel = 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;
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 */
/* Don't bind if tunnel_id is 0 */
error = -EINVAL;
if (!info.tunnel_id)
goto end;
*new_tunnel = false;
tunnel = l2tp_tunnel_get(sock_net(sk), info.tunnel_id);
if (tunnel)
drop_tunnel = true;
tunnel = l2tp_tunnel_get(net, info->tunnel_id);
/* Special case: create tunnel context if session_id and
* peer_session_id is 0. Otherwise look up tunnel using supplied
* tunnel id.
*/
if (!info.session_id && !info.peer_session_id) {
if (!info->session_id && !info->peer_session_id) {
if (!tunnel) {
struct l2tp_tunnel_cfg tcfg = {
.encap = L2TP_ENCAPTYPE_UDP,
......@@ -706,40 +674,82 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
/* Prevent l2tp_tunnel_register() from trying to set up
* a kernel socket.
*/
if (info.fd < 0) {
error = -EBADF;
goto end;
}
if (info->fd < 0)
return ERR_PTR(-EBADF);
error = l2tp_tunnel_create(info.fd,
info.version,
info.tunnel_id,
info.peer_tunnel_id, &tcfg,
error = l2tp_tunnel_create(info->fd,
info->version,
info->tunnel_id,
info->peer_tunnel_id, &tcfg,
&tunnel);
if (error < 0)
goto end;
return ERR_PTR(error);
l2tp_tunnel_inc_refcount(tunnel);
error = l2tp_tunnel_register(tunnel, sock_net(sk),
&tcfg);
error = l2tp_tunnel_register(tunnel, net, &tcfg);
if (error < 0) {
kfree(tunnel);
goto end;
return ERR_PTR(error);
}
drop_tunnel = true;
new_tunnel = true;
*new_tunnel = true;
}
} else {
/* Error if we can't find the tunnel */
error = -ENOENT;
if (!tunnel)
goto end;
return ERR_PTR(-ENOENT);
/* Error if socket is not prepped */
if (!tunnel->sock)
goto end;
if (!tunnel->sock) {
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)
tunnel->peer_tunnel_id = info.peer_tunnel_id;
......@@ -840,7 +850,6 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
}
if (drop_refcnt)
l2tp_session_dec_refcount(session);
if (drop_tunnel)
l2tp_tunnel_dec_refcount(tunnel);
release_sock(sk);
......
......@@ -1839,8 +1839,10 @@ static int smcr_serv_conf_first_link(struct smc_sock *smc)
smc_llc_link_active(link);
smcr_lgr_set_type(link->lgr, SMC_LGR_SINGLE);
down_write(&link->lgr->llc_conf_mutex);
/* initial contact - try to establish second link */
smc_llc_srv_add_link(link, NULL);
up_write(&link->lgr->llc_conf_mutex);
return 0;
}
......
......@@ -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);
} else {
buf_desc->used = 0;
memset(buf_desc->cpu_addr, 0, buf_desc->len);
/* memzero_explicit provides potential memory barrier semantics */
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,
if (!lgr->is_smcd && conn->sndbuf_desc->is_vm) {
smcr_buf_unuse(conn->sndbuf_desc, false, lgr);
} else {
conn->sndbuf_desc->used = 0;
memset(conn->sndbuf_desc->cpu_addr, 0,
conn->sndbuf_desc->len);
memzero_explicit(conn->sndbuf_desc->cpu_addr, conn->sndbuf_desc->len);
WRITE_ONCE(conn->sndbuf_desc->used, 0);
}
}
if (conn->rmb_desc) {
if (!lgr->is_smcd) {
smcr_buf_unuse(conn->rmb_desc, true, lgr);
} else {
conn->rmb_desc->used = 0;
memset(conn->rmb_desc->cpu_addr, 0,
conn->rmb_desc->len +
sizeof(struct smcd_cdc_msg));
memzero_explicit(conn->rmb_desc->cpu_addr,
conn->rmb_desc->len + sizeof(struct smcd_cdc_msg));
WRITE_ONCE(conn->rmb_desc->used, 0);
}
}
}
......
......@@ -17,6 +17,18 @@ SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV_NAME/net/
DEBUGFS_DIR=/sys/kernel/debug/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()
{
RET=0
......@@ -256,6 +268,9 @@ netns_reload_test()
ip netns del testns2
ip netns del testns1
# Wait until netns async cleanup is done.
devlink_wait 2000
log_test "netns reload test"
}
......@@ -348,6 +363,9 @@ resource_test()
ip netns del testns2
ip netns del testns1
# Wait until netns async cleanup is done.
devlink_wait 2000
log_test "resource test"
}
......
......@@ -2065,6 +2065,8 @@ EOF
################################################################################
# main
trap cleanup EXIT
while getopts :t:pPhv o
do
case $o in
......
......@@ -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)
{
char control[CMSG_SPACE(sizeof(uint16_t))] = {0};
char control[CMSG_SPACE(sizeof(int))] = {0};
struct msghdr msg = {0};
struct iovec iov = {0};
struct cmsghdr *cmsg;
uint16_t *gsosizeptr;
int ret;
iov.iov_base = buf;
......@@ -237,8 +236,7 @@ static int recv_msg(int fd, char *buf, int len, int *gso_size)
cmsg = CMSG_NXTHDR(&msg, cmsg)) {
if (cmsg->cmsg_level == SOL_UDP
&& cmsg->cmsg_type == UDP_GRO) {
gsosizeptr = (uint16_t *) CMSG_DATA(cmsg);
*gso_size = *gsosizeptr;
*gso_size = *(int *)CMSG_DATA(cmsg);
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