* [PATCH net-next] net/mlx5: DR, Remove useless set memory to zero use memset()
From: Wei Yongjun @ 2019-09-05 9:53 UTC (permalink / raw)
To: Saeed Mahameed, Leon Romanovsky, Mark Bloch, Alex Vesker,
Erez Shitrit
Cc: Wei Yongjun, netdev, linux-rdma, kernel-janitors
The memory return by kzalloc() has already be set to zero, so
remove useless memset(0).
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
index ef0dea44f3b3..5df8436b2ae3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
@@ -899,7 +899,6 @@ int mlx5dr_send_ring_alloc(struct mlx5dr_domain *dmn)
goto clean_qp;
}
- memset(dmn->send_ring->buf, 0, size);
dmn->send_ring->buf_size = size;
dmn->send_ring->mr = dr_reg_mr(dmn->mdev,
^ permalink raw reply related
* [PATCH net-next] net/mlx5: DR, Fix error return code in dr_domain_init_resources()
From: Wei Yongjun @ 2019-09-05 9:56 UTC (permalink / raw)
To: Saeed Mahameed, Leon Romanovsky, Mark Bloch, Alex Vesker,
Erez Shitrit
Cc: Wei Yongjun, netdev, linux-rdma, kernel-janitors
Fix to return negative error code -ENOMEM from the error handling
case instead of 0, as done elsewhere in this function.
Fixes: 4ec9e7b02697 ("net/mlx5: DR, Expose steering domain functionality")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
index 3b9cf0bccf4d..461cc2c30538 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
@@ -66,6 +66,7 @@ static int dr_domain_init_resources(struct mlx5dr_domain *dmn)
dmn->uar = mlx5_get_uars_page(dmn->mdev);
if (!dmn->uar) {
mlx5dr_err(dmn, "Couldn't allocate UAR\n");
+ ret = -ENOMEM;
goto clean_pd;
}
@@ -73,6 +74,7 @@ static int dr_domain_init_resources(struct mlx5dr_domain *dmn)
if (!dmn->ste_icm_pool) {
mlx5dr_err(dmn, "Couldn't get icm memory for %s\n",
dev_name(dmn->mdev->device));
+ ret = -ENOMEM;
goto clean_uar;
}
@@ -80,6 +82,7 @@ static int dr_domain_init_resources(struct mlx5dr_domain *dmn)
if (!dmn->action_icm_pool) {
mlx5dr_err(dmn, "Couldn't get action icm memory for %s\n",
dev_name(dmn->mdev->device));
+ ret = -ENOMEM;
goto free_ste_icm_pool;
}
^ permalink raw reply related
* Re: [PATCH] net: fixed_phy: Add forward declaration for struct gpio_desc;
From: David Miller @ 2019-09-05 9:54 UTC (permalink / raw)
To: mdf; +Cc: netdev, andrew, f.fainelli, hkallweit1, linux-kernel
In-Reply-To: <20190903184652.3148-1-mdf@kernel.org>
From: Moritz Fischer <mdf@kernel.org>
Date: Tue, 3 Sep 2019 11:46:52 -0700
> Add forward declaration for struct gpio_desc in order to address
> the following:
>
> ./include/linux/phy_fixed.h:48:17: error: 'struct gpio_desc' declared inside parameter list [-Werror]
> ./include/linux/phy_fixed.h:48:17: error: its scope is only this definition or declaration, which is probably not what you want [-Werror]
>
> Fixes commit 71bd106d2567 ("net: fixed-phy: Add
> fixed_phy_register_with_gpiod() API")
> Signed-off-by: Moritz Fischer <mdf@kernel.org>
Applied with Fixes tag fixed up.
^ permalink raw reply
* Re: [net PATCH] net: sock_map, fix missing ulp check in sock hash case
From: David Miller @ 2019-09-05 9:57 UTC (permalink / raw)
To: john.fastabend; +Cc: hdanton, jakub.kicinski, netdev
In-Reply-To: <156754228993.21629.4076822768659778848.stgit@john-Precision-5820-Tower>
From: John Fastabend <john.fastabend@gmail.com>
Date: Tue, 03 Sep 2019 13:24:50 -0700
> sock_map and ULP only work together when ULP is loaded after the sock
> map is loaded. In the sock_map case we added a check for this to fail
> the load if ULP is already set. However, we missed the check on the
> sock_hash side.
>
> Add a ULP check to the sock_hash update path.
>
> Fixes: 604326b41a6fb ("bpf, sockmap: convert to generic sk_msg interface")
> Reported-by: syzbot+7a6ee4d0078eac6bf782@syzkaller.appspotmail.com
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply
* Re: [PATCH net 0/2] nexthops: Fix multipath notifications for IPv6 and selftests
From: David Miller @ 2019-09-05 10:00 UTC (permalink / raw)
To: dsahern; +Cc: netdev, sharpd, dsahern
In-Reply-To: <20190903222213.7029-1-dsahern@kernel.org>
From: David Ahern <dsahern@kernel.org>
Date: Tue, 3 Sep 2019 15:22:11 -0700
> From: David Ahern <dsahern@gmail.com>
>
> A couple of bug fixes noticed while testing Donald's patch.
Series applied.
^ permalink raw reply
* Re: [PATCH v2 2/2] PTP: add support for one-shot output
From: Felipe Balbi @ 2019-09-05 10:03 UTC (permalink / raw)
To: Richard Cochran; +Cc: Christopher S Hall, netdev, linux-kernel, davem
In-Reply-To: <20190831144732.GA1692@localhost>
[-- Attachment #1: Type: text/plain, Size: 2004 bytes --]
Hi,
Richard Cochran <richardcochran@gmail.com> writes:
> On Fri, Aug 30, 2019 at 11:00:20AM +0300, Felipe Balbi wrote:
>> >> @@ -177,9 +177,8 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
>> >> err = -EFAULT;
>> >> break;
>> >> }
>> >> - if ((req.perout.flags || req.perout.rsv[0] || req.perout.rsv[1]
>> >> - || req.perout.rsv[2] || req.perout.rsv[3])
>> >> - && cmd == PTP_PEROUT_REQUEST2) {
>> >> + if ((req.perout.rsv[0] || req.perout.rsv[1] || req.perout.rsv[2]
>> >> + || req.perout.rsv[3]) && cmd == PTP_PEROUT_REQUEST2) {
>> >
>> > Please check that the reserved bits of req.perout.flags, namely
>> > ~PTP_PEROUT_ONE_SHOT, are clear.
>>
>> Actually, we should check more. PEROUT_FEATURE_ENABLE is still valid
>> here, right? So are RISING and FALLING edges, no?
>
> No. The ptp_extts_request.flags are indeed defined:
>
> struct ptp_extts_request {
> ...
> unsigned int flags; /* Bit field for PTP_xxx flags. */
> ...
> };
>
> But the ptp_perout_request.flags are reserved:
>
> struct ptp_perout_request {
> ...
> unsigned int flags; /* Reserved for future use. */
> ...
> };
This a bit confusing, really. Specially when the comment right above
those flags states:
/* PTP_xxx bits, for the flags field within the request structures. */
The request "structures" include EXTTS and PEROUT:
struct ptp_clock_request {
enum {
PTP_CLK_REQ_EXTTS,
PTP_CLK_REQ_PEROUT,
PTP_CLK_REQ_PPS,
} type;
union {
struct ptp_extts_request extts;
struct ptp_perout_request perout;
};
};
Seems like we will, at least, make it clear which flags are valid for
which request structures.
> For this ioctl, the test for enable/disable is
> ptp_perout_request.period is zero:
>
> enable = req.perout.period.sec || req.perout.period.nsec;
> err = ops->enable(ops, &req, enable);
>
> The usage pattern here is taken from timer_settime(2).
got it
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply
* Re: [PATCH 0/3] net: Use kzfree() directly
From: David Miller @ 2019-09-05 10:06 UTC (permalink / raw)
To: zhongjiang; +Cc: anna.schumaker, trond.myklebust, netdev, linux-kernel
In-Reply-To: <1567564752-6430-1-git-send-email-zhongjiang@huawei.com>
From: zhong jiang <zhongjiang@huawei.com>
Date: Wed, 4 Sep 2019 10:39:09 +0800
> With the help of Coccinelle. We find some place to replace.
>
> @@
> expression M, S;
> @@
>
> - memset(M, 0, S);
> - kfree(M);
> + kzfree(M);
Series applied to net-next.
^ permalink raw reply
* Re: [PATCH net-next 4/7] net: hns3: add client node validity judgment
From: Sergei Shtylyov @ 2019-09-05 10:12 UTC (permalink / raw)
To: Huazhong Tan, davem
Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm,
jakub.kicinski, Peng Li
In-Reply-To: <1567606006-39598-5-git-send-email-tanhuazhong@huawei.com>
On 04.09.2019 17:06, Huazhong Tan wrote:
> From: Peng Li <lipeng321@huawei.com>
>
> HNS3 driver can only unregister client which included in hnae3_client_list.
> This patch adds the client node validity judgment.
>
> Signed-off-by: Peng Li <lipeng321@huawei.com>
> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
> ---
> drivers/net/ethernet/hisilicon/hns3/hnae3.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.c b/drivers/net/ethernet/hisilicon/hns3/hnae3.c
> index 528f624..6aa5257 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.c
> @@ -138,12 +138,28 @@ EXPORT_SYMBOL(hnae3_register_client);
>
> void hnae3_unregister_client(struct hnae3_client *client)
> {
> + struct hnae3_client *client_tmp;
> struct hnae3_ae_dev *ae_dev;
> + bool existed = false;
>
> if (!client)
> return;
>
> mutex_lock(&hnae3_common_lock);
> +
> + list_for_each_entry(client_tmp, &hnae3_client_list, node) {
> + if (client_tmp->type == client->type) {
> + existed = true;
> + break;
> + }
> + }
> +
> + if (!existed) {
> + mutex_unlock(&hnae3_common_lock);
> + pr_err("client %s not existed!\n", client->name);
Did not exist, you mean?
[...]
MBR, Sergei
^ permalink raw reply
* Re: [PATCH net] ipv4: fix ifa_flags reuse problem in using ifconfig tool
From: David Miller @ 2019-09-05 10:13 UTC (permalink / raw)
To: suyj.fnst; +Cc: kuznet, yoshfuji, netdev, linux-kernel
In-Reply-To: <1567582667-56549-1-git-send-email-suyj.fnst@cn.fujitsu.com>
From: Su Yanjun <suyj.fnst@cn.fujitsu.com>
Date: Wed, 4 Sep 2019 15:37:47 +0800
> When NetworkManager has already set ipv4 address then uses
> ifconfig set another ipv4 address. It will use previous ifa_flags
> that will cause device route not be inserted.
>
> As NetworkManager has already support IFA_F_NOPREFIXROUTE flag [1],
> but ifconfig will reuse the ifa_flags. It's weird especially
> some old scripts or program [2] still use ifconfig.
>
> [1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/
> commit/fec80e7473ad16979af75ed299d68103e7aa3fe9
>
> [2] LTP or TAHI
>
> Signed-off-by: Su Yanjun <suyj.fnst@cn.fujitsu.com>
I don't know about this.
This will lose things like IFA_F_SECONDARY as well.
Sorry, I am not convinced that this change is correct nor safe.
^ permalink raw reply
* Re: [patch net-next] rocker: add missing init_net check in FIB notifier
From: David Miller @ 2019-09-05 10:15 UTC (permalink / raw)
To: jiri; +Cc: netdev, mlxsw
In-Reply-To: <20190904074047.840-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@resnulli.us>
Date: Wed, 4 Sep 2019 09:40:47 +0200
> From: Jiri Pirko <jiri@mellanox.com>
>
> Take only FIB events that are happening in init_net into account. No other
> namespaces are supported.
>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] r8152: adjust the settings of ups flags
From: David Miller @ 2019-09-05 10:16 UTC (permalink / raw)
To: hayeswang; +Cc: netdev, nic_swsd, linux-kernel
In-Reply-To: <1394712342-15778-327-Taiwan-albertk@realtek.com>
From: Hayes Wang <hayeswang@realtek.com>
Date: Wed, 4 Sep 2019 17:34:38 +0800
> The UPS feature only works for runtime suspend, so UPS flags only
> need to be set before enabling runtime suspend. Therefore, I create
> a struct to record relative information, and use it before runtime
> suspend.
>
> All chips could record such information, even though not all of
> them support the feature of UPS. Then, some functions could be
> combined.
>
> Signed-off-by: Hayes Wang <hayeswang@realtek.com>
This does not apply cleanly to net-next, please respin.
^ permalink raw reply
* Re: pull-request: can-next 2019-09-04 j1939,pull-request: can-next 2019-09-04 j1939
From: David Miller @ 2019-09-05 10:18 UTC (permalink / raw)
To: mkl
Cc: netdev, kernel, linux-can, socketcan, bst, ecathinds, dev.kurt,
maxime.jayat, robin, ore, david
In-Reply-To: <d56029d4-2d4c-3cb3-0e5b-e28866db87f1@pengutronix.de>
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Wed, 4 Sep 2019 14:29:56 +0200
> this is a pull request for net-next/master consisting of 21 patches.
Pulled, thanks Marc.
^ permalink raw reply
* Re: [PATCH v2 net-next 00/13] net: stmmac: Improvements for -next
From: David Miller @ 2019-09-05 10:20 UTC (permalink / raw)
To: Jose.Abreu
Cc: netdev, Joao.Pinto, peppe.cavallaro, alexandre.torgue,
mcoquelin.stm32, linux-stm32, linux-arm-kernel, linux-kernel
In-Reply-To: <cover.1567602867.git.joabreu@synopsys.com>
From: Jose Abreu <Jose.Abreu@synopsys.com>
Date: Wed, 4 Sep 2019 15:16:52 +0200
> Couple of improvements for -next tree. More info in commit logs.
Series applied, thank you.
^ permalink raw reply
* [PATCH 2/5] xfrm interface: ifname may be wrong in logs
From: Steffen Klassert @ 2019-09-05 10:21 UTC (permalink / raw)
To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev
In-Reply-To: <20190905102201.1636-1-steffen.klassert@secunet.com>
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
The ifname is copied when the interface is created, but is never updated
later. In fact, this property is used only in one error message, where the
netdevice pointer is available, thus let's use it.
Fixes: f203b76d7809 ("xfrm: Add virtual xfrm interfaces")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
include/net/xfrm.h | 1 -
net/xfrm/xfrm_interface.c | 10 +---------
2 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index b22db30c3d88..ad761ef84797 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -983,7 +983,6 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev);
struct xfrm_if_parms {
- char name[IFNAMSIZ]; /* name of XFRM device */
int link; /* ifindex of underlying L2 interface */
u32 if_id; /* interface identifyer */
};
diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
index 2310dc9e35c2..68336ee00d72 100644
--- a/net/xfrm/xfrm_interface.c
+++ b/net/xfrm/xfrm_interface.c
@@ -145,8 +145,6 @@ static int xfrmi_create(struct net_device *dev)
if (err < 0)
goto out;
- strcpy(xi->p.name, dev->name);
-
dev_hold(dev);
xfrmi_link(xfrmn, xi);
@@ -294,7 +292,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
if (tdev == dev) {
stats->collisions++;
net_warn_ratelimited("%s: Local routing loop detected!\n",
- xi->p.name);
+ dev->name);
goto tx_err_dst_release;
}
@@ -638,12 +636,6 @@ static int xfrmi_newlink(struct net *src_net, struct net_device *dev,
int err;
xfrmi_netlink_parms(data, &p);
-
- if (!tb[IFLA_IFNAME])
- return -EINVAL;
-
- nla_strlcpy(p.name, tb[IFLA_IFNAME], IFNAMSIZ);
-
xi = xfrmi_locate(net, &p);
if (xi)
return -EEXIST;
--
2.17.1
^ permalink raw reply related
* [PATCH 3/5] xfrm interface: fix list corruption for x-netns
From: Steffen Klassert @ 2019-09-05 10:21 UTC (permalink / raw)
To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev
In-Reply-To: <20190905102201.1636-1-steffen.klassert@secunet.com>
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
dev_net(dev) is the netns of the device and xi->net is the link netns,
where the device has been linked.
changelink() must operate in the link netns to avoid a corruption of
the xfrm lists.
Note that xi->net and dev_net(xi->physdev) are always the same.
Before the patch, the xfrmi lists may be corrupted and can later trigger a
kernel panic.
Fixes: f203b76d7809 ("xfrm: Add virtual xfrm interfaces")
Reported-by: Julien Floret <julien.floret@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Tested-by: Julien Floret <julien.floret@6wind.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/xfrm/xfrm_interface.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
index 68336ee00d72..53e5e47b2c55 100644
--- a/net/xfrm/xfrm_interface.c
+++ b/net/xfrm/xfrm_interface.c
@@ -503,7 +503,7 @@ static int xfrmi_change(struct xfrm_if *xi, const struct xfrm_if_parms *p)
static int xfrmi_update(struct xfrm_if *xi, struct xfrm_if_parms *p)
{
- struct net *net = dev_net(xi->dev);
+ struct net *net = xi->net;
struct xfrmi_net *xfrmn = net_generic(net, xfrmi_net_id);
int err;
@@ -663,9 +663,9 @@ static int xfrmi_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[],
struct netlink_ext_ack *extack)
{
- struct net *net = dev_net(dev);
+ struct xfrm_if *xi = netdev_priv(dev);
+ struct net *net = xi->net;
struct xfrm_if_parms p;
- struct xfrm_if *xi;
xfrmi_netlink_parms(data, &p);
xi = xfrmi_locate(net, &p);
@@ -707,7 +707,7 @@ static struct net *xfrmi_get_link_net(const struct net_device *dev)
{
struct xfrm_if *xi = netdev_priv(dev);
- return dev_net(xi->phydev);
+ return xi->net;
}
static const struct nla_policy xfrmi_policy[IFLA_XFRM_MAX + 1] = {
--
2.17.1
^ permalink raw reply related
* [PATCH 4/5] xfrm interface: fix management of phydev
From: Steffen Klassert @ 2019-09-05 10:22 UTC (permalink / raw)
To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev
In-Reply-To: <20190905102201.1636-1-steffen.klassert@secunet.com>
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
With the current implementation, phydev cannot be removed:
$ ip link add dummy type dummy
$ ip link add xfrm1 type xfrm dev dummy if_id 1
$ ip l d dummy
kernel:[77938.465445] unregister_netdevice: waiting for dummy to become free. Usage count = 1
Manage it like in ip tunnels, ie just keep the ifindex. Not that the side
effect, is that the phydev is now optional.
Fixes: f203b76d7809 ("xfrm: Add virtual xfrm interfaces")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Tested-by: Julien Floret <julien.floret@6wind.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
include/net/xfrm.h | 1 -
net/xfrm/xfrm_interface.c | 32 +++++++++++++++++---------------
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index ad761ef84797..aa08a7a5f6ac 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -990,7 +990,6 @@ struct xfrm_if_parms {
struct xfrm_if {
struct xfrm_if __rcu *next; /* next interface in list */
struct net_device *dev; /* virtual device associated with interface */
- struct net_device *phydev; /* physical device */
struct net *net; /* netns for packet i/o */
struct xfrm_if_parms p; /* interface parms */
diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
index 53e5e47b2c55..2ab4859df55a 100644
--- a/net/xfrm/xfrm_interface.c
+++ b/net/xfrm/xfrm_interface.c
@@ -175,7 +175,6 @@ static void xfrmi_dev_uninit(struct net_device *dev)
struct xfrmi_net *xfrmn = net_generic(xi->net, xfrmi_net_id);
xfrmi_unlink(xfrmn, xi);
- dev_put(xi->phydev);
dev_put(dev);
}
@@ -362,7 +361,7 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev)
goto tx_err;
}
- fl.flowi_oif = xi->phydev->ifindex;
+ fl.flowi_oif = xi->p.link;
ret = xfrmi_xmit2(skb, dev, &fl);
if (ret < 0)
@@ -548,7 +547,7 @@ static int xfrmi_get_iflink(const struct net_device *dev)
{
struct xfrm_if *xi = netdev_priv(dev);
- return xi->phydev->ifindex;
+ return xi->p.link;
}
@@ -574,12 +573,14 @@ static void xfrmi_dev_setup(struct net_device *dev)
dev->needs_free_netdev = true;
dev->priv_destructor = xfrmi_dev_free;
netif_keep_dst(dev);
+
+ eth_broadcast_addr(dev->broadcast);
}
static int xfrmi_dev_init(struct net_device *dev)
{
struct xfrm_if *xi = netdev_priv(dev);
- struct net_device *phydev = xi->phydev;
+ struct net_device *phydev = __dev_get_by_index(xi->net, xi->p.link);
int err;
dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
@@ -594,13 +595,19 @@ static int xfrmi_dev_init(struct net_device *dev)
dev->features |= NETIF_F_LLTX;
- dev->needed_headroom = phydev->needed_headroom;
- dev->needed_tailroom = phydev->needed_tailroom;
+ if (phydev) {
+ dev->needed_headroom = phydev->needed_headroom;
+ dev->needed_tailroom = phydev->needed_tailroom;
- if (is_zero_ether_addr(dev->dev_addr))
- eth_hw_addr_inherit(dev, phydev);
- if (is_zero_ether_addr(dev->broadcast))
- memcpy(dev->broadcast, phydev->broadcast, dev->addr_len);
+ if (is_zero_ether_addr(dev->dev_addr))
+ eth_hw_addr_inherit(dev, phydev);
+ if (is_zero_ether_addr(dev->broadcast))
+ memcpy(dev->broadcast, phydev->broadcast,
+ dev->addr_len);
+ } else {
+ eth_hw_addr_random(dev);
+ eth_broadcast_addr(dev->broadcast);
+ }
return 0;
}
@@ -644,13 +651,8 @@ static int xfrmi_newlink(struct net *src_net, struct net_device *dev,
xi->p = p;
xi->net = net;
xi->dev = dev;
- xi->phydev = dev_get_by_index(net, p.link);
- if (!xi->phydev)
- return -ENODEV;
err = xfrmi_create(dev);
- if (err < 0)
- dev_put(xi->phydev);
return err;
}
--
2.17.1
^ permalink raw reply related
* [PATCH 5/5] xfrm: policy: avoid warning splat when merging nodes
From: Steffen Klassert @ 2019-09-05 10:22 UTC (permalink / raw)
To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev
In-Reply-To: <20190905102201.1636-1-steffen.klassert@secunet.com>
From: Florian Westphal <fw@strlen.de>
syzbot reported a splat:
xfrm_policy_inexact_list_reinsert+0x625/0x6e0 net/xfrm/xfrm_policy.c:877
CPU: 1 PID: 6756 Comm: syz-executor.1 Not tainted 5.3.0-rc2+ #57
Call Trace:
xfrm_policy_inexact_node_reinsert net/xfrm/xfrm_policy.c:922 [inline]
xfrm_policy_inexact_node_merge net/xfrm/xfrm_policy.c:958 [inline]
xfrm_policy_inexact_insert_node+0x537/0xb50 net/xfrm/xfrm_policy.c:1023
xfrm_policy_inexact_alloc_chain+0x62b/0xbd0 net/xfrm/xfrm_policy.c:1139
xfrm_policy_inexact_insert+0xe8/0x1540 net/xfrm/xfrm_policy.c:1182
xfrm_policy_insert+0xdf/0xce0 net/xfrm/xfrm_policy.c:1574
xfrm_add_policy+0x4cf/0x9b0 net/xfrm/xfrm_user.c:1670
xfrm_user_rcv_msg+0x46b/0x720 net/xfrm/xfrm_user.c:2676
netlink_rcv_skb+0x1f0/0x460 net/netlink/af_netlink.c:2477
xfrm_netlink_rcv+0x74/0x90 net/xfrm/xfrm_user.c:2684
netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
netlink_unicast+0x809/0x9a0 net/netlink/af_netlink.c:1328
netlink_sendmsg+0xa70/0xd30 net/netlink/af_netlink.c:1917
sock_sendmsg_nosec net/socket.c:637 [inline]
sock_sendmsg net/socket.c:657 [inline]
There is no reproducer, however, the warning can be reproduced
by adding rules with ever smaller prefixes.
The sanity check ("does the policy match the node") uses the prefix value
of the node before its updated to the smaller value.
To fix this, update the prefix earlier. The bug has no impact on tree
correctness, this is only to prevent a false warning.
Reported-by: syzbot+8cc27ace5f6972910b31@syzkaller.appspotmail.com
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/xfrm/xfrm_policy.c | 6 ++++--
tools/testing/selftests/net/xfrm_policy.sh | 7 +++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 8ca637a72697..0fa7c5ce3b2c 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -912,6 +912,7 @@ static void xfrm_policy_inexact_node_reinsert(struct net *net,
} else if (delta > 0) {
p = &parent->rb_right;
} else {
+ bool same_prefixlen = node->prefixlen == n->prefixlen;
struct xfrm_policy *tmp;
hlist_for_each_entry(tmp, &n->hhead, bydst) {
@@ -919,9 +920,11 @@ static void xfrm_policy_inexact_node_reinsert(struct net *net,
hlist_del_rcu(&tmp->bydst);
}
+ node->prefixlen = prefixlen;
+
xfrm_policy_inexact_list_reinsert(net, node, family);
- if (node->prefixlen == n->prefixlen) {
+ if (same_prefixlen) {
kfree_rcu(n, rcu);
return;
}
@@ -929,7 +932,6 @@ static void xfrm_policy_inexact_node_reinsert(struct net *net,
rb_erase(*p, new);
kfree_rcu(n, rcu);
n = node;
- n->prefixlen = prefixlen;
goto restart;
}
}
diff --git a/tools/testing/selftests/net/xfrm_policy.sh b/tools/testing/selftests/net/xfrm_policy.sh
index 5445943bf07f..7a1bf94c5bd3 100755
--- a/tools/testing/selftests/net/xfrm_policy.sh
+++ b/tools/testing/selftests/net/xfrm_policy.sh
@@ -106,6 +106,13 @@ do_overlap()
#
# 10.0.0.0/24 and 10.0.1.0/24 nodes have been merged as 10.0.0.0/23.
ip -net $ns xfrm policy add src 10.1.0.0/24 dst 10.0.0.0/23 dir fwd priority 200 action block
+
+ # similar to above: add policies (with partially random address), with shrinking prefixes.
+ for p in 29 28 27;do
+ for k in $(seq 1 32); do
+ ip -net $ns xfrm policy add src 10.253.1.$((RANDOM%255))/$p dst 10.254.1.$((RANDOM%255))/$p dir fwd priority $((200+k)) action block 2>/dev/null
+ done
+ done
}
do_esp_policy_get_check() {
--
2.17.1
^ permalink raw reply related
* pull request (net): ipsec 2019-09-05
From: Steffen Klassert @ 2019-09-05 10:21 UTC (permalink / raw)
To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev
1) Several xfrm interface fixes from Nicolas Dichtel:
- Avoid an interface ID corruption on changelink.
- Fix wrong intterface names in the logs.
- Fix a list corruption when changing network namespaces.
- Fix unregistation of the underying phydev.
2) Fix a potential warning when merging xfrm_plocy nodes.
From Florian Westphal.
Please pull or let me know if there are problems.
Thanks!
The following changes since commit 114a5c3240155fdb01bf821c9d326d7bb05bd464:
Merge tag 'mlx5-fixes-2019-07-11' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux (2019-07-11 15:06:37 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git master
for you to fetch changes up to 769a807d0b41df4201dbeb01c22eaeb3e5905532:
xfrm: policy: avoid warning splat when merging nodes (2019-08-20 08:09:42 +0200)
----------------------------------------------------------------
Florian Westphal (1):
xfrm: policy: avoid warning splat when merging nodes
Nicolas Dichtel (4):
xfrm interface: avoid corruption on changelink
xfrm interface: ifname may be wrong in logs
xfrm interface: fix list corruption for x-netns
xfrm interface: fix management of phydev
include/net/xfrm.h | 2 --
net/xfrm/xfrm_interface.c | 56 +++++++++++++-----------------
net/xfrm/xfrm_policy.c | 6 ++--
tools/testing/selftests/net/xfrm_policy.sh | 7 ++++
4 files changed, 36 insertions(+), 35 deletions(-)
^ permalink raw reply
* [PATCH 1/5] xfrm interface: avoid corruption on changelink
From: Steffen Klassert @ 2019-09-05 10:21 UTC (permalink / raw)
To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev
In-Reply-To: <20190905102201.1636-1-steffen.klassert@secunet.com>
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
The new parameters must not be stored in the netdev_priv() before
validation, it may corrupt the interface. Note also that if data is NULL,
only a memset() is done.
$ ip link add xfrm1 type xfrm dev lo if_id 1
$ ip link add xfrm2 type xfrm dev lo if_id 2
$ ip link set xfrm1 type xfrm dev lo if_id 2
RTNETLINK answers: File exists
$ ip -d link list dev xfrm1
5: xfrm1@lo: <NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/none 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0 minmtu 68 maxmtu 1500
xfrm if_id 0x2 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
=> "if_id 0x2"
Fixes: f203b76d7809 ("xfrm: Add virtual xfrm interfaces")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Tested-by: Julien Floret <julien.floret@6wind.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/xfrm/xfrm_interface.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
index 74868f9d81fb..2310dc9e35c2 100644
--- a/net/xfrm/xfrm_interface.c
+++ b/net/xfrm/xfrm_interface.c
@@ -671,12 +671,12 @@ static int xfrmi_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[],
struct netlink_ext_ack *extack)
{
- struct xfrm_if *xi = netdev_priv(dev);
struct net *net = dev_net(dev);
+ struct xfrm_if_parms p;
+ struct xfrm_if *xi;
- xfrmi_netlink_parms(data, &xi->p);
-
- xi = xfrmi_locate(net, &xi->p);
+ xfrmi_netlink_parms(data, &p);
+ xi = xfrmi_locate(net, &p);
if (!xi) {
xi = netdev_priv(dev);
} else {
@@ -684,7 +684,7 @@ static int xfrmi_changelink(struct net_device *dev, struct nlattr *tb[],
return -EEXIST;
}
- return xfrmi_update(xi, &xi->p);
+ return xfrmi_update(xi, &p);
}
static size_t xfrmi_get_size(const struct net_device *dev)
--
2.17.1
^ permalink raw reply related
* Re: [PATCH 0/4] gianfar: some assorted cleanup
From: David Miller @ 2019-09-05 10:28 UTC (permalink / raw)
To: asolokha
Cc: claudiu.manoil, ioana.ciornei, linux, andrew, olteanv, f.fainelli,
netdev
In-Reply-To: <20190904135223.31754-1-asolokha@kb.kras.ru>
From: Arseny Solokha <asolokha@kb.kras.ru>
Date: Wed, 4 Sep 2019 20:52:18 +0700
> This is a cleanup series for the gianfar Ethernet driver, following up a
> discussion in [1]. It is intended to precede a conversion of gianfar from
> PHYLIB to PHYLINK API, which will be submitted later in its version 2.
> However, it won't make a conversion cleaner, except for the last patch in
> this series. Obviously this series is not intended for -stable.
>
> The first patch looks super controversial to me, as it moves lots of code
> around for the sole purpose of getting rid of static forward declarations
> in two translation units. On the other hand, this change is purely
> mechanical and cannot do any harm other than cluttering git blame output.
> I can prepare an alternative patch for only swapping adjacent functions
> around, if necessary.
>
> The second patch is a trivial follow-up to the first one, making functions
> that are only called from the same translation unit static.
>
> The third patch removes some now unused macro and structure definitions
> from gianfar.h, slipped away from various cleanups in the past.
>
> The fourth patch, also suggested in [1], makes the driver consistently use
> PHY connection type value obtained from a Device Tree node, instead of
> ignoring it and using the one auto-detected by MAC, when connecting to PHY.
> Obviously a value has to be specified correctly in DT source, or omitted
> altogether, in which case the driver will fall back to auto-detection. When
> querying a DT node, the driver will also take both applicable properties
> into account by making a proper API call instead of open-coding the lookup
> half-way correctly.
>
> [1] https://lore.kernel.org/netdev/CA+h21hruqt6nGG5ksDSwrGH_w5GtGF4fjAMCWJne7QJrjusERQ@mail.gmail.com/
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH v2 0/2] Fix GMII2RGMII private field
From: David Miller @ 2019-09-05 10:32 UTC (permalink / raw)
To: harini.katakam
Cc: andrew, f.fainelli, hkallweit1, michal.simek, netdev,
linux-arm-kernel, linux-kernel, harinikatakamlinux,
radhey.shyam.pandey
In-Reply-To: <1567605621-6818-1-git-send-email-harini.katakam@xilinx.com>
From: Harini Katakam <harini.katakam@xilinx.com>
Date: Wed, 4 Sep 2019 19:30:19 +0530
> Fix the usage of external phy's priv field by gmii2rgmii driver.
>
> Based on net-next.
Series applied to net-next.
^ permalink raw reply
* Re: [PATCH v1] pppoatm: use %*ph to print small buffer
From: David Miller @ 2019-09-05 10:33 UTC (permalink / raw)
To: andriy.shevchenko; +Cc: mitch, netdev
In-Reply-To: <20190904174459.77067-1-andriy.shevchenko@linux.intel.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Wed, 4 Sep 2019 20:44:59 +0300
> Use %*ph format to print small buffer as hex string.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied to net-next.
^ permalink raw reply
* Re: [PATCH v3 net] net: Properly update v4 routes with v6 nexthop
From: David Miller @ 2019-09-05 10:36 UTC (permalink / raw)
To: sharpd; +Cc: netdev, dsahern, sworley
In-Reply-To: <20190904141158.17021-1-sharpd@cumulusnetworks.com>
From: Donald Sharp <sharpd@cumulusnetworks.com>
Date: Wed, 4 Sep 2019 10:11:58 -0400
> When creating a v4 route that uses a v6 nexthop from a nexthop group.
> Allow the kernel to properly send the nexthop as v6 via the RTA_VIA
> attribute.
>
> Broken behavior:
>
> $ ip nexthop add via fe80::9 dev eth0
> $ ip nexthop show
> id 1 via fe80::9 dev eth0 scope link
> $ ip route add 4.5.6.7/32 nhid 1
> $ ip route show
> default via 10.0.2.2 dev eth0
> 4.5.6.7 nhid 1 via 254.128.0.0 dev eth0
> 10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15
> $
>
> Fixed behavior:
>
> $ ip nexthop add via fe80::9 dev eth0
> $ ip nexthop show
> id 1 via fe80::9 dev eth0 scope link
> $ ip route add 4.5.6.7/32 nhid 1
> $ ip route show
> default via 10.0.2.2 dev eth0
> 4.5.6.7 nhid 1 via inet6 fe80::9 dev eth0
> 10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15
> $
>
> v2, v3: Addresses code review comments from David Ahern
>
> Fixes: dcb1ecb50edf (“ipv4: Prepare for fib6_nh from a nexthop object”)
> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Applied, thank you.
^ permalink raw reply
* Re: [PATCH] net: qed: Move static keyword to the front of declaration
From: David Miller @ 2019-09-05 10:39 UTC (permalink / raw)
To: kw; +Cc: aelior, GR-everest-linux-l2, netdev, linux-kernel
In-Reply-To: <20190904141730.31497-1-kw@linux.com>
From: Krzysztof Wilczynski <kw@linux.com>
Date: Wed, 4 Sep 2019 16:17:30 +0200
> Move the static keyword to the front of declaration of iwarp_state_names,
> and resolve the following compiler warning that can be seen when building
> with warnings enabled (W=1):
>
> drivers/net/ethernet/qlogic/qed/qed_iwarp.c:385:1: warning:
> ‘static’ is not at beginning of declaration [-Wold-style-declaration]
>
> Also, resolve checkpatch.pl script warning:
>
> WARNING: static const char * array should probably be
> static const char * const
>
> Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
Applied to net-next.
^ permalink raw reply
* Re: [PATCH] net: hns: Move static keyword to the front of declaration
From: David Miller @ 2019-09-05 10:39 UTC (permalink / raw)
To: kw
Cc: yisen.zhuang, salil.mehta, liuyonglong, lipeng321, gregkh,
colin.king, huang.zijiang, tglx, netdev, linux-kernel
In-Reply-To: <20190904142116.31884-1-kw@linux.com>
From: Krzysztof Wilczynski <kw@linux.com>
Date: Wed, 4 Sep 2019 16:21:16 +0200
> Move the static keyword to the front of declaration of g_dsaf_mode_match,
> and resolve the following compiler warning that can be seen when building
> with warnings enabled (W=1):
>
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c:27:1: warning:
> ‘static’ is not at beginning of declaration [-Wold-style-declaration]
>
> Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
Applied to net-next.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox