* [PATCH] net: stmmac: dwmac-sun8i: Variable "val" in function sun8i_dwmac_set_syscon() could be uninitialized
From: Yizhuo @ 2019-08-31 2:00 UTC (permalink / raw)
Cc: csong, zhiyunq, Yizhuo, Giuseppe Cavallaro, Alexandre Torgue,
Jose Abreu, David S. Miller, Maxime Ripard, Chen-Yu Tsai,
Maxime Coquelin, netdev, linux-arm-kernel, linux-stm32,
linux-kernel
In function sun8i_dwmac_set_syscon(), local variable "val" could
be uninitialized if function regmap_field_read() returns -EINVAL.
However, it will be used directly in the if statement, which
is potentially unsafe.
Signed-off-by: Yizhuo <yzhai003@ucr.edu>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 4083019c547a..f97a4096f8fc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -873,7 +873,12 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv)
int ret;
u32 reg, val;
- regmap_field_read(gmac->regmap_field, &val);
+ ret = regmap_field_read(gmac->regmap_field, &val);
+ if (ret) {
+ dev_err(priv->device, "Fail to read from regmap field.\n");
+ return ret;
+ }
+
reg = gmac->variant->default_syscon_value;
if (reg != val)
dev_warn(priv->device,
--
2.17.1
^ permalink raw reply related
* Re: [PATCH 4.14] tcp: fix tcp_rtx_queue_tail in case of empty retransmit queue
From: David Miller @ 2019-08-31 2:20 UTC (permalink / raw)
To: cpaasch
Cc: jonathan.lemon, stable, gregkh, tim.froidcoeur, matthieu.baerts,
aprout, edumazet, jtl, linux-kernel, mkubecek, ncardwell, sashal,
ycheng, netdev
In-Reply-To: <20190830232657.GL45416@MacBook-Pro-64.local>
From: Christoph Paasch <cpaasch@apple.com>
Date: Fri, 30 Aug 2019 16:26:57 -0700
> (I don't see it in the stable-queue)
I don't handle any stable branch before the most recent two, so this isn't
my territory.
^ permalink raw reply
* [PATCH bpf-next 1/2] selftests/bpf: test_progs: fix verbose mode garbage
From: Stanislav Fomichev @ 2019-08-31 2:34 UTC (permalink / raw)
To: netdev, bpf; +Cc: davem, ast, daniel, Stanislav Fomichev
fseeko(.., 0, SEEK_SET) on a memstream just puts the buffer pointer
to the beginning so when we call fflush on it we get some garbage
log data from the previous test. Let's manually set terminating
byte to zero at the reported buffer size.
To show the issue consider the following snippet:
stream = open_memstream (&buf, &len);
fprintf(stream, "aaa");
fflush(stream);
printf("buf=%s, len=%zu\n", buf, len);
fseeko(stream, 0, SEEK_SET);
fprintf(stream, "b");
fflush(stream);
printf("buf=%s, len=%zu\n", buf, len);
Output:
buf=aaa, len=3
buf=baa, len=1
Fixes: 946152b3c5d6 ("selftests/bpf: test_progs: switch to open_memstream")
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
tools/testing/selftests/bpf/test_progs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index e5892cb60eca..e8616e778cb5 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -45,6 +45,7 @@ static void dump_test_log(const struct prog_test_def *test, bool failed)
if (env.verbose || test->force_log || failed) {
if (env.log_cnt) {
+ env.log_buf[env.log_cnt] = '\0';
fprintf(env.stdout, "%s", env.log_buf);
if (env.log_buf[env.log_cnt - 1] != '\n')
fprintf(env.stdout, "\n");
--
2.23.0.187.g17f5b7556c-goog
^ permalink raw reply related
* [PATCH bpf-next 2/2] selftests/bpf: test_progs: add missing \n to CHECK_FAIL
From: Stanislav Fomichev @ 2019-08-31 2:34 UTC (permalink / raw)
To: netdev, bpf; +Cc: davem, ast, daniel, Stanislav Fomichev
In-Reply-To: <20190831023427.239820-1-sdf@google.com>
Copy-paste error from CHECK.
Fixes: d38835b75f67 ("selftests/bpf: test_progs: remove global fail/success counts")
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
tools/testing/selftests/bpf/test_progs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h
index 33da849cb765..c8edb9464ba6 100644
--- a/tools/testing/selftests/bpf/test_progs.h
+++ b/tools/testing/selftests/bpf/test_progs.h
@@ -107,7 +107,7 @@ extern struct ipv6_packet pkt_v6;
int __ret = !!(condition); \
if (__ret) { \
test__fail(); \
- printf("%s:FAIL:%d ", __func__, __LINE__); \
+ printf("%s:FAIL:%d\n", __func__, __LINE__); \
} \
__ret; \
})
--
2.23.0.187.g17f5b7556c-goog
^ permalink raw reply related
* Re: [PATCH v3 03/11] net/mlx5e: Remove unlikely() from WARN*() condition
From: David Miller @ 2019-08-31 2:50 UTC (permalink / raw)
To: saeedm; +Cc: efremov, linux-kernel, joe, borisp, netdev, leon, akpm
In-Reply-To: <ad2ef15ddaec0033ce17d8ba252037ef70c7ac93.camel@mellanox.com>
From: Saeed Mahameed <saeedm@mellanox.com>
Date: Thu, 29 Aug 2019 21:23:30 +0000
> On Thu, 2019-08-29 at 19:50 +0300, Denis Efremov wrote:
>> "unlikely(WARN_ON_ONCE(x))" is excessive. WARN_ON_ONCE() already uses
>> unlikely() internally.
>>
>> Signed-off-by: Denis Efremov <efremov@linux.com>
>> Cc: Boris Pismenny <borisp@mellanox.com>
>> Cc: Saeed Mahameed <saeedm@mellanox.com>
>> Cc: Leon Romanovsky <leon@kernel.org>
>> Cc: Joe Perches <joe@perches.com>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: netdev@vger.kernel.org
>> ---
>> drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git
>> a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
>> b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
>> index 7833ddef0427..e5222d17df35 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
>> @@ -408,7 +408,7 @@ struct sk_buff *mlx5e_ktls_handle_tx_skb(struct
>> net_device *netdev,
>> goto out;
>>
>> tls_ctx = tls_get_ctx(skb->sk);
>> - if (unlikely(WARN_ON_ONCE(tls_ctx->netdev != netdev)))
>> + if (WARN_ON_ONCE(tls_ctx->netdev != netdev))
>> goto err_out;
>>
>> priv_tx = mlx5e_get_ktls_tx_priv_ctx(tls_ctx);
>
> Acked-by: Saeed Mahameed <saeedm@mellanox.com>
>
> Dave, you can take this one.
Ok, applied to net-next as well as the UDP patch.
^ permalink raw reply
* Re: [PATCH 1/1] forcedeth: use per cpu to collect xmit/recv statistics
From: Zhu Yanjun @ 2019-08-31 4:24 UTC (permalink / raw)
To: Eric Dumazet, netdev, davem, nan.1986san
In-Reply-To: <24ad8394-cb24-fcb7-0dc2-3435429bb8cd@gmail.com>
On 2019/8/30 17:32, Eric Dumazet wrote:
>
> On 8/30/19 10:35 AM, Zhu Yanjun wrote:
>> When testing with a background iperf pushing 1Gbit/sec traffic and running
>> both ifconfig and netstat to collect statistics, some deadlocks occurred.
>>
> This is quite a heavy patch trying to fix a bug...
This is to use per-cpu variable. Perhaps the changes are big.
>
> I suspect the root cause has nothing to do with stat
> collection since on 64bit arches there is no additional synchronization.
This bug is similar to the one that the commit 5f6b4e14cada ("net: dsa:
User per-cpu 64-bit statistics") tries to fix.
So a similar patch is to fix this similar bug in forcedeth.
> (u64_stats_update_begin(), u64_stats_update_end() are nops)
Sure. Exactly.
>
>> +static inline void nv_get_stats(int cpu, struct fe_priv *np,
>> + struct rtnl_link_stats64 *storage)
>> +{
>> + struct nv_txrx_stats *src = per_cpu_ptr(np->txrx_stats, cpu);
>> + unsigned int syncp_start;
>> +
>> + do {
>> + syncp_start = u64_stats_fetch_begin_irq(&np->swstats_rx_syncp);
>> + storage->rx_packets += src->stat_rx_packets;
>> + storage->rx_bytes += src->stat_rx_bytes;
>> + storage->rx_dropped += src->stat_rx_dropped;
>> + storage->rx_missed_errors += src->stat_rx_missed_errors;
>> + } while (u64_stats_fetch_retry_irq(&np->swstats_rx_syncp, syncp_start));
>> +
>> + do {
>> + syncp_start = u64_stats_fetch_begin_irq(&np->swstats_tx_syncp);
>> + storage->tx_packets += src->stat_tx_packets;
>> + storage->tx_bytes += src->stat_tx_bytes;
>> + storage->tx_dropped += src->stat_tx_dropped;
>> + } while (u64_stats_fetch_retry_irq(&np->swstats_tx_syncp, syncp_start));
>> +}
>> +
>>
> This is buggy :
> If the loops are ever restarted, the storage->fields will have
> been modified multiple times.
Sure. Sorry. My bad.
A similar changes in the commit 5f6b4e14cada ("net: dsa: User per-cpu
64-bit statistics").
I will use this similar changes.
I will send V2 soon.
Thanks a lot for your comments.
Zhu Yanjun
>
>
^ permalink raw reply
* [PATCH v5 1/1] net: br_netfiler_hooks: Drops IPv6 packets if IPv6 module is not loaded
From: Leonardo Bras @ 2019-08-31 4:40 UTC (permalink / raw)
To: netfilter-devel, coreteam, bridge, netdev, linux-kernel
Cc: Leonardo Bras, Pablo Neira Ayuso, Jozsef Kadlecsik,
Florian Westphal, Roopa Prabhu, Nikolay Aleksandrov,
David S. Miller
A kernel panic can happen if a host has disabled IPv6 on boot and have to
process guest packets (coming from a bridge) using it's ip6tables.
IPv6 packets need to be dropped if the IPv6 module is not loaded, and the
host ip6tables will be used.
Signed-off-by: Leonardo Bras <leonardo@linux.ibm.com>
---
Changes from v4:
- Check if the host ip6tables is going to be used before testing
ipv6 module presence
- Adds a warning about ipv6 module disabled.
net/bridge/br_netfilter_hooks.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c
index d3f9592f4ff8..af7800103e51 100644
--- a/net/bridge/br_netfilter_hooks.c
+++ b/net/bridge/br_netfilter_hooks.c
@@ -496,6 +496,10 @@ static unsigned int br_nf_pre_routing(void *priv,
if (!brnet->call_ip6tables &&
!br_opt_get(br, BROPT_NF_CALL_IP6TABLES))
return NF_ACCEPT;
+ if (!ipv6_mod_enabled()) {
+ pr_warn_once("Module ipv6 is disabled, so call_ip6tables is not supported.");
+ return NF_DROP;
+ }
nf_bridge_pull_encap_header_rcsum(skb);
return br_nf_pre_routing_ipv6(priv, skb, state);
--
2.20.1
^ permalink raw reply related
* Re: [PATCH v4 2/2] net: br_netfiler_hooks: Drops IPv6 packets if IPv6 module is not loaded
From: Leonardo Bras @ 2019-08-31 4:42 UTC (permalink / raw)
To: Florian Westphal
Cc: netfilter-devel, coreteam, bridge, netdev, linux-kernel,
Pablo Neira Ayuso, Jozsef Kadlecsik, Roopa Prabhu,
Nikolay Aleksandrov, David S. Miller
In-Reply-To: <20190830205541.GR20113@breakpoint.cc>
[-- Attachment #1: Type: text/plain, Size: 1904 bytes --]
On Fri, 2019-08-30 at 22:55 +0200, Florian Westphal wrote:
> Leonardo Bras <leonardo@linux.ibm.com> wrote:
> > A kernel panic can happen if a host has disabled IPv6 on boot and have to
> > process guest packets (coming from a bridge) using it's ip6tables.
> >
> > IPv6 packets need to be dropped if the IPv6 module is not loaded.
> >
> > Signed-off-by: Leonardo Bras <leonardo@linux.ibm.com>
> > ---
> > net/bridge/br_netfilter_hooks.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c
> > index d3f9592f4ff8..5e8693730df1 100644
> > --- a/net/bridge/br_netfilter_hooks.c
> > +++ b/net/bridge/br_netfilter_hooks.c
> > @@ -493,6 +493,8 @@ static unsigned int br_nf_pre_routing(void *priv,
> > brnet = net_generic(state->net, brnf_net_id);
> > if (IS_IPV6(skb) || is_vlan_ipv6(skb, state->net) ||
> > is_pppoe_ipv6(skb, state->net)) {
> > + if (!ipv6_mod_enabled())
> > + return NF_DROP;
> > if (!brnet->call_ip6tables &&
> > !br_opt_get(br, BROPT_NF_CALL_IP6TABLES))
> > return NF_ACCEPT;
>
> No, thats too aggressive and turns the bridge into an ipv6 blackhole.
>
> There are two solutions:
> 1. The above patch, but use NF_ACCEPT instead
> 2. keep the DROP, but move it below the call_ip6tables test,
> so that users can tweak call-ip6tables to accept packets.
Q: Does 2 mean that it will only be dropped if bridge intents to use
host's ip6tables? Else, it will be accepted by previous if?
> Perhaps it would be good to also add a pr_warn_once() that
> tells that ipv6 was disabled on command line and
> call-ip6tables isn't supported in this configuration.
>
Good idea, added.
> I would go with option two.
I think it's better than 1 too.
I sent a v5 with these changes:
https://lkml.org/lkml/2019/8/31/4
Thanks!
Leonardo Bras
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH net-next 0/4] qed*: Enhancements.
From: Jakub Kicinski @ 2019-08-31 5:10 UTC (permalink / raw)
To: Sudarsana Reddy Kalluru; +Cc: davem, netdev, mkalderon, aelior
In-Reply-To: <20190830074206.8836-1-skalluru@marvell.com>
On Fri, 30 Aug 2019 00:42:02 -0700, Sudarsana Reddy Kalluru wrote:
> The patch series adds couple of enhancements to qed/qede drivers.
> - Support for dumping the config id attributes via ethtool -w/W.
> - Support for dumping the GRC data of required memory regions using
> ethtool -w/W interfaces.
>
> Patch (1) adds driver APIs for reading the config id attributes.
> Patch (2) adds ethtool support for dumping the config id attributes.
> Patch (3) adds support for configuring the GRC dump config flags.
> Patch (4) adds ethtool support for dumping the grc dump.
I don't see anything too objectionable here, but without knowing what
GRC stands for etc. examples of what's actually exchanged here, it's
a little hard to judge..
^ permalink raw reply
* Re: [PATCH net-next 0/3] dpaa2-eth: Add new statistics counters
From: Jakub Kicinski @ 2019-08-31 6:12 UTC (permalink / raw)
To: Ioana Radulescu; +Cc: netdev, davem, ioana.ciornei
In-Reply-To: <1567160443-31297-1-git-send-email-ruxandra.radulescu@nxp.com>
On Fri, 30 Aug 2019 13:20:40 +0300, Ioana Radulescu wrote:
> Recent firmware versions offer access to more DPNI statistics
> counters. Add the relevant ones to ethtool interface stats.
>
> Also we can now make use of a new counter for in flight egress frames
> to avoid sleeping an arbitrary amount of time in the ndo_stop routine.
A little messy there in the comment of patch 2, and IMHO if you're
expecting particular errors to be ignored it's better to write:
if (err == -EOPNOTSUPP)
/* still fine*/;
else if (err)
/* real err */
than assume any error is for unsupported and add a extra comment
explaining that things may be not supported.
Series LGTM tho.
^ permalink raw reply
* Re: [PATCH net-next 0/2] Minor cleanup in devlink
From: Jakub Kicinski @ 2019-08-31 6:14 UTC (permalink / raw)
To: Parav Pandit; +Cc: netdev, davem, jiri
In-Reply-To: <20190830103945.18097-1-parav@mellanox.com>
On Fri, 30 Aug 2019 05:39:43 -0500, Parav Pandit wrote:
> Two minor cleanup in devlink.
>
> Patch-1 Explicitly defines devlink port index as unsigned int
> Patch-2 Uses switch-case to handle different port flavours attributes
Always nice to see one's comment addressed, even if it takes a while :)
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
^ permalink raw reply
* Re: [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions
From: Jakub Kicinski @ 2019-08-31 6:28 UTC (permalink / raw)
To: Igor Russkikh; +Cc: David S . Miller, netdev@vger.kernel.org
In-Reply-To: <cover.1567163402.git.igor.russkikh@aquantia.com>
On Fri, 30 Aug 2019 12:08:28 +0000, Igor Russkikh wrote:
> Here is a set of various bug fixes related to vlan filter offload and
> two other rare cases.
LGTM, Fixes tag should had been first there on patch 4.
You should also perhaps check the return value from
napi_complete_done() as an optimization for net-next?
^ permalink raw reply
* [PATCH] net: seeq: Fix the function used to release some memory in an error handling path
From: Christophe JAILLET @ 2019-08-31 7:17 UTC (permalink / raw)
To: davem, yuehaibing, tglx, gregkh, tbogendoerfer
Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET
In commit 99cd149efe82 ("sgiseeq: replace use of dma_cache_wback_inv"),
a call to 'get_zeroed_page()' has been turned into a call to
'dma_alloc_coherent()'. Only the remove function has been updated to turn
the corresponding 'free_page()' into 'dma_free_attrs()'.
The error hndling path of the probe function has not been updated.
Fix it now.
Rename the corresponding label to something more in line.
Fixes: 99cd149efe82 ("sgiseeq: replace use of dma_cache_wback_inv")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
If 'dma_alloc_coherent()' fails, maybe the message in printk could be
improved. The comment above may also not be relevant.
---
drivers/net/ethernet/seeq/sgiseeq.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/seeq/sgiseeq.c b/drivers/net/ethernet/seeq/sgiseeq.c
index 7a5e6c5abb57..276c7cae7cee 100644
--- a/drivers/net/ethernet/seeq/sgiseeq.c
+++ b/drivers/net/ethernet/seeq/sgiseeq.c
@@ -794,15 +794,16 @@ static int sgiseeq_probe(struct platform_device *pdev)
printk(KERN_ERR "Sgiseeq: Cannot register net device, "
"aborting.\n");
err = -ENODEV;
- goto err_out_free_page;
+ goto err_out_free_attrs;
}
printk(KERN_INFO "%s: %s %pM\n", dev->name, sgiseeqstr, dev->dev_addr);
return 0;
-err_out_free_page:
- free_page((unsigned long) sp->srings);
+err_out_free_attrs:
+ dma_free_attrs(&pdev->dev, sizeof(*sp->srings), sp->srings,
+ sp->srings_dma, DMA_ATTR_NON_CONSISTENT);
err_out_free_dev:
free_netdev(dev);
--
2.20.1
^ permalink raw reply related
* [PATCH][next] net: hns3: remove redundant assignment to pointer reg_info
From: Colin King @ 2019-08-31 7:29 UTC (permalink / raw)
To: Yisen Zhuang, Salil Mehta, David S . Miller, Huazhong Tan,
Zhongzhu Liu, netdev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Pointer reg_info is being initialized with a value that is never read and
is being re-assigned a little later on. The assignment is redundant
and hence can be removed.
Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
index 1debe37fe735..1c6b501fb7ca 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
@@ -279,7 +279,7 @@ static void hclge_dbg_dump_dcb(struct hclge_dev *hdev, const char *cmd_buf)
static void hclge_dbg_dump_reg_cmd(struct hclge_dev *hdev, const char *cmd_buf)
{
- struct hclge_dbg_reg_type_info *reg_info = &hclge_dbg_reg_info[0];
+ struct hclge_dbg_reg_type_info *reg_info;
bool has_dump = false;
int i;
--
2.20.1
^ permalink raw reply related
* Re: [PATCH net-next 03/14] bnxt_en: Refactor bnxt_sriov_enable().
From: Leon Romanovsky @ 2019-08-31 7:41 UTC (permalink / raw)
To: Michael Chan; +Cc: David Miller, Netdev, Vasundhara Volam, Jiri Pirko, Ray Jui
In-Reply-To: <CACKFLiku-5Q6mBFgd2L_gTqZ=UWUf_HTUeC_n6=aVH+V_o1p4g@mail.gmail.com>
On Fri, Aug 30, 2019 at 09:00:27AM -0700, Michael Chan wrote:
> On Fri, Aug 30, 2019 at 2:18 AM Leon Romanovsky <leon@kernel.org> wrote:
> >
> > On Mon, Aug 26, 2019 at 09:00:45AM +0300, Leon Romanovsky wrote:
> > > On Sun, Aug 25, 2019 at 11:54:54PM -0400, Michael Chan wrote:
> > > > Refactor the hardware/firmware configuration portion in
> > > > bnxt_sriov_enable() into a new function bnxt_cfg_hw_sriov(). This
> > > > new function can be called after a firmware reset to reconfigure the
> > > > VFs previously enabled.
> > >
> > > I wonder what does it mean for already bound VFs to vfio driver?
> > > Will you rebind them as well? Can I assume that FW error in one VF
> > > will trigger "restart" of other VFs too?
> >
> > Care to reply?
> >
> >
> Sorry, I missed your email earlier.
>
> A firmware reset/recovery has no direct effect on a VF or any function
> if it is just idle. The PCI interface of any function does not get
> reset.
>
> If a VF driver (Linux VF driver, DPDK driver, etc) has initialized on
> that function, meaning it has exchanged messages with firmware to
> register itself and to allocate resources (such as rings), then the
> firmware reset will require all those resources to be re-discovered
> and re-initialized. These VF resources are initially assigned by the
> PF. So this refactored function on the PF is to re-assign these
> resources back to the VF after the firmware reset. Again, if the VF
> is just bound to vfio and is idle, there is no effect.
Thanks for explaining the flow.
^ permalink raw reply
* Re: [PATCH] net: seeq: Fix the function used to release some memory in an error handling path
From: Thomas Bogendoerfer @ 2019-08-31 8:19 UTC (permalink / raw)
To: Christophe JAILLET
Cc: davem, yuehaibing, tglx, gregkh, netdev, linux-kernel,
kernel-janitors
In-Reply-To: <20190831071751.1479-1-christophe.jaillet@wanadoo.fr>
On Sat, 31 Aug 2019 09:17:51 +0200
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> In commit 99cd149efe82 ("sgiseeq: replace use of dma_cache_wback_inv"),
> a call to 'get_zeroed_page()' has been turned into a call to
> 'dma_alloc_coherent()'. Only the remove function has been updated to turn
> the corresponding 'free_page()' into 'dma_free_attrs()'.
> The error hndling path of the probe function has not been updated.
Looks good.
Reviewed-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Thomas.
--
SUSE Software Solutions Germany GmbH
HRB 247165 (AG München)
Geschäftsführer: Felix Imendörffer
^ permalink raw reply
* Re: [PATCH v5 1/1] net: br_netfiler_hooks: Drops IPv6 packets if IPv6 module is not loaded
From: Florian Westphal @ 2019-08-31 8:38 UTC (permalink / raw)
To: Leonardo Bras
Cc: netfilter-devel, coreteam, bridge, netdev, linux-kernel,
Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
Roopa Prabhu, Nikolay Aleksandrov, David S. Miller
In-Reply-To: <20190831044032.31931-1-leonardo@linux.ibm.com>
Leonardo Bras <leonardo@linux.ibm.com> wrote:
> A kernel panic can happen if a host has disabled IPv6 on boot and have to
> process guest packets (coming from a bridge) using it's ip6tables.
>
> IPv6 packets need to be dropped if the IPv6 module is not loaded, and the
> host ip6tables will be used.
>
> Signed-off-by: Leonardo Bras <leonardo@linux.ibm.com>
> ---
> Changes from v4:
> - Check if the host ip6tables is going to be used before testing
> ipv6 module presence
> - Adds a warning about ipv6 module disabled.
>
>
> net/bridge/br_netfilter_hooks.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c
> index d3f9592f4ff8..af7800103e51 100644
> --- a/net/bridge/br_netfilter_hooks.c
> +++ b/net/bridge/br_netfilter_hooks.c
> @@ -496,6 +496,10 @@ static unsigned int br_nf_pre_routing(void *priv,
> if (!brnet->call_ip6tables &&
> !br_opt_get(br, BROPT_NF_CALL_IP6TABLES))
> return NF_ACCEPT;
> + if (!ipv6_mod_enabled()) {
> + pr_warn_once("Module ipv6 is disabled, so call_ip6tables is not supported.");
> + return NF_DROP;
> + }
pr_warn_once needs a '\n'. Pablo, can you mangle this locally when
applying?
Patch looks good to me, so:
Acked-by: Florian Westphal <fw@strlen.de>
^ permalink raw reply
* Re: [PATCH v4 2/2] net: br_netfiler_hooks: Drops IPv6 packets if IPv6 module is not loaded
From: Florian Westphal @ 2019-08-31 8:43 UTC (permalink / raw)
To: Leonardo Bras
Cc: Florian Westphal, netfilter-devel, coreteam, bridge, netdev,
linux-kernel, Pablo Neira Ayuso, Jozsef Kadlecsik, Roopa Prabhu,
Nikolay Aleksandrov, David S. Miller
In-Reply-To: <2ba876f9ad6597e640df68f09659dce3c4b5ce03.camel@linux.ibm.com>
Leonardo Bras <leonardo@linux.ibm.com> wrote:
> > There are two solutions:
> > 1. The above patch, but use NF_ACCEPT instead
> > 2. keep the DROP, but move it below the call_ip6tables test,
> > so that users can tweak call-ip6tables to accept packets.
>
> Q: Does 2 mean that it will only be dropped if bridge intents to use
> host's ip6tables? Else, it will be accepted by previous if?
Yes, thats the idea: Let users decide if ipv6.disable or call-ip6tables
is more important to them.
^ permalink raw reply
* Re: [PATCH v3 01/11] checkpatch: check for nested (un)?likely() calls
From: Markus Elfring @ 2019-08-31 9:15 UTC (permalink / raw)
To: Denis Efremov, Joe Perches
Cc: Andrew Morton, Anton Altaparmakov, Andy Whitcroft,
Boris Ostrovsky, Boris Pismenny, Darrick J. Wong, David S. Miller,
Dennis Dalessandro, Dmitry Torokhov, dri-devel,
Inaky Perez-Gonzalez, Jürgen Groß, Leon Romanovsky,
linux-arm-msm, linux-fsdevel, linux-input, linux-kernel,
linux-ntfs-dev, linux-rdma, linux-wimax, linux-xfs,
Mike Marciniszyn, netdev, Pali Rohár, Rob Clark,
Saeed Mahameed, Sean Paul, Alexander Viro, xen-devel,
Enrico Weigelt
In-Reply-To: <20190829165025.15750-1-efremov@linux.com>
> +# nested likely/unlikely calls
> + if ($line =~ /\b(?:(?:un)?likely)\s*\(\s*!?\s*(IS_ERR(?:_OR_NULL|_VALUE)?|WARN)/) {
> + WARN("LIKELY_MISUSE",
How do you think about to use the specification “(?:IS_ERR(?:_(?:OR_NULL|VALUE))?|WARN)”
in this regular expression?
Regards,
Markus
^ permalink raw reply
* Re: [PATCH][next] zd1211rw: zd_usb: Use struct_size() helper
From: kbuild test robot @ 2019-08-31 9:38 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: kbuild-all, Daniel Drake, Ulrich Kunitz, Kalle Valo,
David S. Miller, linux-wireless, netdev, linux-kernel,
Gustavo A. R. Silva
In-Reply-To: <20190830185716.GA10044@embeddedor>
[-- Attachment #1: Type: text/plain, Size: 7287 bytes --]
Hi "Gustavo,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[cannot apply to v5.3-rc6 next-20190830]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Gustavo-A-R-Silva/zd1211rw-zd_usb-Use-struct_size-helper/20190831-161121
config: mips-allmodconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=mips
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/net/wireless/zydas/zd1211rw/zd_usb.c:22:0:
drivers/net/wireless/zydas/zd1211rw/zd_usb.c: In function 'check_read_regs':
>> drivers/net/wireless/zydas/zd1211rw/zd_def.h:18:25: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'size_t {aka unsigned int}' [-Wformat=]
dev_printk(level, dev, "%s() " fmt, __func__, ##args)
^
>> drivers/net/wireless/zydas/zd1211rw/zd_def.h:22:4: note: in expansion of macro 'dev_printk_f'
dev_printk_f(KERN_DEBUG, dev, fmt, ## args)
^~~~~~~~~~~~
>> drivers/net/wireless/zydas/zd1211rw/zd_usb.c:1635:3: note: in expansion of macro 'dev_dbg_f'
dev_dbg_f(zd_usb_dev(usb),
^~~~~~~~~
drivers/net/wireless/zydas/zd1211rw/zd_usb.c:1636:51: note: format string is defined here
"error: actual length %d less than expected %ld\n",
~~^
%d
vim +/dev_dbg_f +1635 drivers/net/wireless/zydas/zd1211rw/zd_usb.c
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1622
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c Jussi Kivilinna 2011-06-20 1623 static bool check_read_regs(struct zd_usb *usb, struct usb_req_read_regs *req,
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c Jussi Kivilinna 2011-06-20 1624 unsigned int count)
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1625 {
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1626 int i;
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1627 struct zd_usb_interrupt *intr = &usb->intr;
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1628 struct read_regs_int *rr = &intr->read_regs;
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1629 struct usb_int_regs *regs = (struct usb_int_regs *)rr->buffer;
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1630
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1631 /* The created block size seems to be larger than expected.
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1632 * However results appear to be correct.
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1633 */
d352eeccec7e84 drivers/net/wireless/zydas/zd1211rw/zd_usb.c Gustavo A. R. Silva 2019-08-30 1634 if (rr->length < struct_size(regs, regs, count)) {
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 @1635 dev_dbg_f(zd_usb_dev(usb),
d352eeccec7e84 drivers/net/wireless/zydas/zd1211rw/zd_usb.c Gustavo A. R. Silva 2019-08-30 1636 "error: actual length %d less than expected %ld\n",
d352eeccec7e84 drivers/net/wireless/zydas/zd1211rw/zd_usb.c Gustavo A. R. Silva 2019-08-30 1637 rr->length, struct_size(regs, regs, count));
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c Jussi Kivilinna 2011-06-20 1638 return false;
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1639 }
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c Jussi Kivilinna 2011-06-20 1640
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1641 if (rr->length > sizeof(rr->buffer)) {
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1642 dev_dbg_f(zd_usb_dev(usb),
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1643 "error: actual length %d exceeds buffer size %zu\n",
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1644 rr->length, sizeof(rr->buffer));
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c Jussi Kivilinna 2011-06-20 1645 return false;
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1646 }
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1647
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1648 for (i = 0; i < count; i++) {
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1649 struct reg_data *rd = ®s->regs[i];
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1650 if (rd->addr != req->addr[i]) {
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1651 dev_dbg_f(zd_usb_dev(usb),
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1652 "rd[%d] addr %#06hx expected %#06hx\n", i,
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1653 le16_to_cpu(rd->addr),
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c Daniel Drake 2006-06-02 1654 le16_to_cpu(req->addr[i]));
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c Jussi Kivilinna 2011-06-20 1655 return false;
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c Jussi Kivilinna 2011-06-20 1656 }
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c Jussi Kivilinna 2011-06-20 1657 }
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c Jussi Kivilinna 2011-06-20 1658
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c Jussi Kivilinna 2011-06-20 1659 return true;
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c Jussi Kivilinna 2011-06-20 1660 }
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c Jussi Kivilinna 2011-06-20 1661
:::::: The code at line 1635 was first introduced by commit
:::::: e85d0918b54fbd9b38003752f7d665416b06edd8 [PATCH] ZyDAS ZD1211 USB-WLAN driver
:::::: TO: Daniel Drake <dsd@gentoo.org>
:::::: CC: Jeff Garzik <jeff@garzik.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 61473 bytes --]
^ permalink raw reply
* RE: [PATCH 4.14] tcp: fix tcp_rtx_queue_tail in case of empty retransmit queue
From: maowenan @ 2019-08-31 10:53 UTC (permalink / raw)
To: David Miller, cpaasch@apple.com
Cc: jonathan.lemon@gmail.com, stable@vger.kernel.org,
gregkh@linuxfoundation.org, tim.froidcoeur@tessares.net,
matthieu.baerts@tessares.net, aprout@ll.mit.edu,
edumazet@google.com, jtl@netflix.com,
linux-kernel@vger.kernel.org, mkubecek@suse.cz,
ncardwell@google.com, sashal@kernel.org, ycheng@google.com,
netdev@vger.kernel.org
In-Reply-To: <20190830.192049.1447010488040109227.davem@davemloft.net>
[<ffffff90094930dc>] skb_peek_tail include/linux/skbuff.h:1516 [inline]
[<ffffff90094930dc>] tcp_write_queue_tail include/net/tcp.h:1478 [inline]
[<ffffff90094930dc>] tcp_rtx_queue_tail include/net/tcp.h:1543 [inline]
[<ffffff90094930dc>] tcp_fragment+0xc64/0xce8 net/ipv4/tcp_output.c:1175
[<ffffff90094a37f0>] tcp_write_wakeup+0x3f8/0x4a0 net/ipv4/tcp_output.c:3496
[<ffffff90094a38d0>] tcp_send_probe0+0x38/0x2d8 net/ipv4/tcp_output.c:3523
[<ffffff90094a75a0>] tcp_probe_timer net/ipv4/tcp_timer.c:343 [inline]
[<ffffff90094a75a0>] tcp_write_timer_handler+0x640/0x720 net/ipv4/tcp_timer.c:548
[<ffffff90094a76f8>] tcp_write_timer+0x78/0x1d0 net/ipv4/tcp_timer.c:562
[<ffffff90082610b0>] call_timer_fn.isra.1+0x58/0x180 kernel/time/timer.c:1144
[<ffffff90082616ec>] __run_timers kernel/time/timer.c:1218 [inline]
[<ffffff90082616ec>] run_timer_softirq+0x514/0x848 kernel/time/timer.c:1401
[<ffffff9008141a28>] __do_softirq+0x340/0x878 kernel/softirq.c:273
[<ffffff9008142890>] do_softirq_own_stack include/linux/interrupt.h:498 [inline]
[<ffffff9008142890>] invoke_softirq kernel/softirq.c:357 [inline]
[<ffffff9008142890>] irq_exit+0x170/0x370 kernel/softirq.c:391
[<ffffff900821d550>] __handle_domain_irq+0x100/0x1c0 kernel/irq/irqdesc.c:459
[<ffffff90080914a0>] handle_domain_irq include/linux/irqdesc.h:168 [inline]
[<ffffff90080914a0>] gic_handle_irq+0xd0/0x1f0 drivers/irqchip/irq-gic.c:377
^ permalink raw reply
* Recall: [PATCH 4.14] tcp: fix tcp_rtx_queue_tail in case of empty retransmit queue
From: maowenan @ 2019-08-31 10:54 UTC (permalink / raw)
To: David Miller, cpaasch@apple.com
Cc: jonathan.lemon@gmail.com, stable@vger.kernel.org,
gregkh@linuxfoundation.org, tim.froidcoeur@tessares.net,
matthieu.baerts@tessares.net, aprout@ll.mit.edu,
edumazet@google.com, jtl@netflix.com,
linux-kernel@vger.kernel.org, mkubecek@suse.cz,
ncardwell@google.com, sashal@kernel.org, ycheng@google.com,
netdev@vger.kernel.org
maowenan would like to recall the message, "[PATCH 4.14] tcp: fix tcp_rtx_queue_tail in case of empty retransmit queue".
^ permalink raw reply
* RE: [PATCH 4.14] tcp: fix tcp_rtx_queue_tail in case of empty retransmit queue
From: maowenan @ 2019-08-31 11:44 UTC (permalink / raw)
To: David Miller, cpaasch@apple.com
Cc: jonathan.lemon@gmail.com, stable@vger.kernel.org,
gregkh@linuxfoundation.org, tim.froidcoeur@tessares.net,
matthieu.baerts@tessares.net, aprout@ll.mit.edu,
edumazet@google.com, jtl@netflix.com,
linux-kernel@vger.kernel.org, mkubecek@suse.cz,
ncardwell@google.com, sashal@kernel.org, ycheng@google.com,
netdev@vger.kernel.org
In-Reply-To: <20190830.192049.1447010488040109227.davem@davemloft.net>
Tim
Can you share the reproduce steps for this issue? C or syzkaller is ok.
Thanks a lot.
^ permalink raw reply
* Re: [PATCH 4.14] tcp: fix tcp_rtx_queue_tail in case of empty retransmit queue
From: Sasha Levin @ 2019-08-31 12:20 UTC (permalink / raw)
To: Tim Froidcoeur
Cc: matthieu.baerts, aprout, cpaasch, davem, edumazet, gregkh,
jonathan.lemon, jtl, linux-kernel, mkubecek, ncardwell, stable,
ycheng, netdev
In-Reply-To: <20190824060351.3776-1-tim.froidcoeur@tessares.net>
On Sat, Aug 24, 2019 at 08:03:51AM +0200, Tim Froidcoeur wrote:
>Commit 8c3088f895a0 ("tcp: be more careful in tcp_fragment()")
>triggers following stack trace:
>
>[25244.848046] kernel BUG at ./include/linux/skbuff.h:1406!
>[25244.859335] RIP: 0010:skb_queue_prev+0x9/0xc
>[25244.888167] Call Trace:
>[25244.889182] <IRQ>
>[25244.890001] tcp_fragment+0x9c/0x2cf
>[25244.891295] tcp_write_xmit+0x68f/0x988
>[25244.892732] __tcp_push_pending_frames+0x3b/0xa0
>[25244.894347] tcp_data_snd_check+0x2a/0xc8
>[25244.895775] tcp_rcv_established+0x2a8/0x30d
>[25244.897282] tcp_v4_do_rcv+0xb2/0x158
>[25244.898666] tcp_v4_rcv+0x692/0x956
>[25244.899959] ip_local_deliver_finish+0xeb/0x169
>[25244.901547] __netif_receive_skb_core+0x51c/0x582
>[25244.903193] ? inet_gro_receive+0x239/0x247
>[25244.904756] netif_receive_skb_internal+0xab/0xc6
>[25244.906395] napi_gro_receive+0x8a/0xc0
>[25244.907760] receive_buf+0x9a1/0x9cd
>[25244.909160] ? load_balance+0x17a/0x7b7
>[25244.910536] ? vring_unmap_one+0x18/0x61
>[25244.911932] ? detach_buf+0x60/0xfa
>[25244.913234] virtnet_poll+0x128/0x1e1
>[25244.914607] net_rx_action+0x12a/0x2b1
>[25244.915953] __do_softirq+0x11c/0x26b
>[25244.917269] ? handle_irq_event+0x44/0x56
>[25244.918695] irq_exit+0x61/0xa0
>[25244.919947] do_IRQ+0x9d/0xbb
>[25244.921065] common_interrupt+0x85/0x85
>[25244.922479] </IRQ>
>
>tcp_rtx_queue_tail() (called by tcp_fragment()) can call
>tcp_write_queue_prev() on the first packet in the queue, which will trigger
>the BUG in tcp_write_queue_prev(), because there is no previous packet.
>
>This happens when the retransmit queue is empty, for example in case of a
>zero window.
>
>Patch is needed for 4.4, 4.9 and 4.14 stable branches.
There needs to be a better explanation of why it's not needed
upstream...
--
Thanks,
Sasha
^ permalink raw reply
* [PATCH v2 net] net: Properly update v4 routes with v6 nexthop
From: Donald Sharp @ 2019-08-31 12:22 UTC (permalink / raw)
To: netdev, dsahern, sworley
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: 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>
---
include/net/ip_fib.h | 4 ++--
include/net/nexthop.h | 5 +++--
net/ipv4/fib_semantics.c | 23 +++++++++++++----------
net/ipv6/route.c | 11 ++++++-----
4 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 4c81846ccce8..ab1ca9e238d2 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -513,7 +513,7 @@ int ip_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh,
struct netlink_callback *cb);
int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nh,
- unsigned char *flags, bool skip_oif);
+ u8 rt_family, unsigned char *flags, bool skip_oif);
int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nh,
- int nh_weight);
+ int nh_weight, u8 rt_family);
#endif /* _NET_FIB_H */
diff --git a/include/net/nexthop.h b/include/net/nexthop.h
index 95f766c31c90..331ebbc94fe7 100644
--- a/include/net/nexthop.h
+++ b/include/net/nexthop.h
@@ -161,7 +161,8 @@ struct nexthop *nexthop_mpath_select(const struct nexthop *nh, int nhsel)
}
static inline
-int nexthop_mpath_fill_node(struct sk_buff *skb, struct nexthop *nh)
+int nexthop_mpath_fill_node(struct sk_buff *skb, struct nexthop *nh,
+ u8 rt_family)
{
struct nh_group *nhg = rtnl_dereference(nh->nh_grp);
int i;
@@ -172,7 +173,7 @@ int nexthop_mpath_fill_node(struct sk_buff *skb, struct nexthop *nh)
struct fib_nh_common *nhc = &nhi->fib_nhc;
int weight = nhg->nh_entries[i].weight;
- if (fib_add_nexthop(skb, nhc, weight) < 0)
+ if (fib_add_nexthop(skb, nhc, weight, rt_family) < 0)
return -EMSGSIZE;
}
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 2db089e10ba0..673e5f2a6108 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1582,7 +1582,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg,
}
int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc,
- unsigned char *flags, bool skip_oif)
+ u8 rt_family, unsigned char *flags, bool skip_oif)
{
if (nhc->nhc_flags & RTNH_F_DEAD)
*flags |= RTNH_F_DEAD;
@@ -1613,7 +1613,7 @@ int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc,
/* if gateway family does not match nexthop family
* gateway is encoded as RTA_VIA
*/
- if (nhc->nhc_gw_family != nhc->nhc_family) {
+ if (rt_family != nhc->nhc_gw_family) {
int alen = sizeof(struct in6_addr);
struct nlattr *nla;
struct rtvia *via;
@@ -1654,7 +1654,7 @@ EXPORT_SYMBOL_GPL(fib_nexthop_info);
#if IS_ENABLED(CONFIG_IP_ROUTE_MULTIPATH) || IS_ENABLED(CONFIG_IPV6)
int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc,
- int nh_weight)
+ int nh_weight, u8 rt_family)
{
const struct net_device *dev = nhc->nhc_dev;
struct rtnexthop *rtnh;
@@ -1667,7 +1667,7 @@ int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc,
rtnh->rtnh_hops = nh_weight - 1;
rtnh->rtnh_ifindex = dev ? dev->ifindex : 0;
- if (fib_nexthop_info(skb, nhc, &flags, true) < 0)
+ if (fib_nexthop_info(skb, nhc, rt_family, &flags, true) < 0)
goto nla_put_failure;
rtnh->rtnh_flags = flags;
@@ -1684,7 +1684,8 @@ EXPORT_SYMBOL_GPL(fib_add_nexthop);
#endif
#ifdef CONFIG_IP_ROUTE_MULTIPATH
-static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi)
+static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi,
+ u8 rt_family)
{
struct nlattr *mp;
@@ -1693,13 +1694,14 @@ static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi)
goto nla_put_failure;
if (unlikely(fi->nh)) {
- if (nexthop_mpath_fill_node(skb, fi->nh) < 0)
+ if (nexthop_mpath_fill_node(skb, fi->nh, rt_family) < 0)
goto nla_put_failure;
goto mp_end;
}
for_nexthops(fi) {
- if (fib_add_nexthop(skb, &nh->nh_common, nh->fib_nh_weight) < 0)
+ if (fib_add_nexthop(skb, &nh->nh_common, nh->fib_nh_weight,
+ rt_family) < 0)
goto nla_put_failure;
#ifdef CONFIG_IP_ROUTE_CLASSID
if (nh->nh_tclassid &&
@@ -1717,7 +1719,8 @@ static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi)
return -EMSGSIZE;
}
#else
-static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi)
+static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi,
+ u8 family)
{
return 0;
}
@@ -1775,7 +1778,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
const struct fib_nh_common *nhc = fib_info_nhc(fi, 0);
unsigned char flags = 0;
- if (fib_nexthop_info(skb, nhc, &flags, false) < 0)
+ if (fib_nexthop_info(skb, nhc, AF_INET, &flags, false) < 0)
goto nla_put_failure;
rtm->rtm_flags = flags;
@@ -1790,7 +1793,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
}
#endif
} else {
- if (fib_add_multipath(skb, fi) < 0)
+ if (fib_add_multipath(skb, fi, AF_INET) < 0)
goto nla_put_failure;
}
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index fd059e08785a..cfb969e68d45 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -5329,7 +5329,7 @@ static int rt6_fill_node_nexthop(struct sk_buff *skb, struct nexthop *nh,
if (!mp)
goto nla_put_failure;
- if (nexthop_mpath_fill_node(skb, nh))
+ if (nexthop_mpath_fill_node(skb, nh, AF_INET6))
goto nla_put_failure;
nla_nest_end(skb, mp);
@@ -5337,7 +5337,7 @@ static int rt6_fill_node_nexthop(struct sk_buff *skb, struct nexthop *nh,
struct fib6_nh *fib6_nh;
fib6_nh = nexthop_fib6_nh(nh);
- if (fib_nexthop_info(skb, &fib6_nh->nh_common,
+ if (fib_nexthop_info(skb, &fib6_nh->nh_common, AF_INET6,
flags, false) < 0)
goto nla_put_failure;
}
@@ -5466,13 +5466,14 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
goto nla_put_failure;
if (fib_add_nexthop(skb, &rt->fib6_nh->nh_common,
- rt->fib6_nh->fib_nh_weight) < 0)
+ rt->fib6_nh->fib_nh_weight, AF_INET6) < 0)
goto nla_put_failure;
list_for_each_entry_safe(sibling, next_sibling,
&rt->fib6_siblings, fib6_siblings) {
if (fib_add_nexthop(skb, &sibling->fib6_nh->nh_common,
- sibling->fib6_nh->fib_nh_weight) < 0)
+ sibling->fib6_nh->fib_nh_weight,
+ AF_INET6) < 0)
goto nla_put_failure;
}
@@ -5489,7 +5490,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
rtm->rtm_flags |= nh_flags;
} else {
- if (fib_nexthop_info(skb, &rt->fib6_nh->nh_common,
+ if (fib_nexthop_info(skb, &rt->fib6_nh->nh_common, AF_INET6,
&nh_flags, false) < 0)
goto nla_put_failure;
--
2.21.0
^ permalink raw reply related
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