* [PATCH] hostap: hide unused procfs helpers
From: YueHaibing @ 2018-07-13 7:03 UTC (permalink / raw)
To: j, kvalo; +Cc: linux-kernel, netdev, linux-wireless, davem, YueHaibing
When CONFIG_PROC_FS isn't set, gcc warning this:
drivers/net/wireless/intersil/hostap/hostap_hw.c:2901:12: warning: ‘prism2_registers_proc_show’ defined but not used [-Wunused-function]
static int prism2_registers_proc_show(struct seq_file *m, void *v)
drivers/net/wireless/intersil/hostap/hostap_proc.c:16:12: warning: ‘prism2_debug_proc_show’ defined but not used [-Wunused-function]
static int prism2_debug_proc_show(struct seq_file *m, void *v)
^
drivers/net/wireless/intersil/hostap/hostap_proc.c:49:12: warning: ‘prism2_stats_proc_show’ defined but not used [-Wunused-function]
static int prism2_stats_proc_show(struct seq_file *m, void *v)
^
drivers/net/wireless/intersil/hostap/hostap_proc.c:177:12: warning: ‘prism2_crypt_proc_show’ defined but not used [-Wunused-function]
static int prism2_crypt_proc_show(struct seq_file *m, void *v)
^
fix this by adding #ifdef around them.
hfa384x_read_reg is only used by prism2_registers_proc_show,so move it
into #ifdef.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/wireless/intersil/hostap/hostap_ap.c | 8 ++++----
drivers/net/wireless/intersil/hostap/hostap_hw.c | 17 +++++++----------
drivers/net/wireless/intersil/hostap/hostap_proc.c | 10 ++++++----
3 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/drivers/net/wireless/intersil/hostap/hostap_ap.c b/drivers/net/wireless/intersil/hostap/hostap_ap.c
index d1884b8..0094b1d 100644
--- a/drivers/net/wireless/intersil/hostap/hostap_ap.c
+++ b/drivers/net/wireless/intersil/hostap/hostap_ap.c
@@ -66,7 +66,7 @@ static void prism2_send_mgmt(struct net_device *dev,
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
-#ifndef PRISM2_NO_PROCFS_DEBUG
+#if !defined(PRISM2_NO_PROCFS_DEBUG) && defined(CONFIG_PROC_FS)
static int ap_debug_proc_show(struct seq_file *m, void *v)
{
struct ap_data *ap = PDE_DATA(file_inode(m->file));
@@ -81,8 +81,7 @@ static int ap_debug_proc_show(struct seq_file *m, void *v)
seq_printf(m, "tx_drop_nonassoc=%u\n", ap->tx_drop_nonassoc);
return 0;
}
-#endif /* PRISM2_NO_PROCFS_DEBUG */
-
+#endif
static void ap_sta_hash_add(struct ap_data *ap, struct sta_info *sta)
{
@@ -990,7 +989,7 @@ static void prism2_send_mgmt(struct net_device *dev,
}
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
-
+#ifdef CONFIG_PROC_FS
static int prism2_sta_proc_show(struct seq_file *m, void *v)
{
struct sta_info *sta = m->private;
@@ -1059,6 +1058,7 @@ static int prism2_sta_proc_show(struct seq_file *m, void *v)
return 0;
}
+#endif
static void handle_add_proc_queue(struct work_struct *work)
{
diff --git a/drivers/net/wireless/intersil/hostap/hostap_hw.c b/drivers/net/wireless/intersil/hostap/hostap_hw.c
index 2720aa3..ad1aa65 100644
--- a/drivers/net/wireless/intersil/hostap/hostap_hw.c
+++ b/drivers/net/wireless/intersil/hostap/hostap_hw.c
@@ -151,13 +151,6 @@ static int prism2_get_ram_size(local_info_t *local);
#define HFA384X_MAGIC 0x8A32
#endif
-
-static u16 hfa384x_read_reg(struct net_device *dev, u16 reg)
-{
- return HFA384X_INW(reg);
-}
-
-
static void hfa384x_read_regs(struct net_device *dev,
struct hfa384x_regs *regs)
{
@@ -2897,7 +2890,12 @@ static void hostap_tick_timer(struct timer_list *t)
}
-#ifndef PRISM2_NO_PROCFS_DEBUG
+#if !defined(PRISM2_NO_PROCFS_DEBUG) && defined(CONFIG_PROC_FS)
+static u16 hfa384x_read_reg(struct net_device *dev, u16 reg)
+{
+ return HFA384X_INW(reg);
+}
+
static int prism2_registers_proc_show(struct seq_file *m, void *v)
{
local_info_t *local = m->private;
@@ -2951,8 +2949,7 @@ static int prism2_registers_proc_show(struct seq_file *m, void *v)
return 0;
}
-#endif /* PRISM2_NO_PROCFS_DEBUG */
-
+#endif
struct set_tim_data {
struct list_head list;
diff --git a/drivers/net/wireless/intersil/hostap/hostap_proc.c b/drivers/net/wireless/intersil/hostap/hostap_proc.c
index 5b33cca..703d74c 100644
--- a/drivers/net/wireless/intersil/hostap/hostap_proc.c
+++ b/drivers/net/wireless/intersil/hostap/hostap_proc.c
@@ -11,8 +11,7 @@
#define PROC_LIMIT (PAGE_SIZE - 80)
-
-#ifndef PRISM2_NO_PROCFS_DEBUG
+#if !defined(PRISM2_NO_PROCFS_DEBUG) && defined(CONFIG_PROC_FS)
static int prism2_debug_proc_show(struct seq_file *m, void *v)
{
local_info_t *local = m->private;
@@ -43,9 +42,9 @@ static int prism2_debug_proc_show(struct seq_file *m, void *v)
return 0;
}
-#endif /* PRISM2_NO_PROCFS_DEBUG */
-
+#endif
+#ifdef CONFIG_PROC_FS
static int prism2_stats_proc_show(struct seq_file *m, void *v)
{
local_info_t *local = m->private;
@@ -82,6 +81,7 @@ static int prism2_stats_proc_show(struct seq_file *m, void *v)
return 0;
}
+#endif
static int prism2_wds_proc_show(struct seq_file *m, void *v)
{
@@ -174,6 +174,7 @@ static const struct seq_operations prism2_bss_list_proc_seqops = {
.show = prism2_bss_list_proc_show,
};
+#ifdef CONFIG_PROC_FS
static int prism2_crypt_proc_show(struct seq_file *m, void *v)
{
local_info_t *local = m->private;
@@ -190,6 +191,7 @@ static int prism2_crypt_proc_show(struct seq_file *m, void *v)
}
return 0;
}
+#endif
static ssize_t prism2_pda_proc_read(struct file *file, char __user *buf,
size_t count, loff_t *_pos)
--
2.7.0
^ permalink raw reply related
* Re: [PATCH] hostap: hide unused procfs helpers
From: Arend van Spriel @ 2018-07-13 7:26 UTC (permalink / raw)
To: YueHaibing, j, kvalo-sgV2jX0FEOL9JmXXK+q4OQ
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
davem-fT/PcQaiUtIeIZ0/mPfg9Q, Randy Dunlap
In-Reply-To: <20180713070317.6724-1-yuehaibing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
+ Randy
On 7/13/2018 9:03 AM, YueHaibing wrote:
> When CONFIG_PROC_FS isn't set, gcc warning this:
>
> drivers/net/wireless/intersil/hostap/hostap_hw.c:2901:12: warning: ‘prism2_registers_proc_show’ defined but not used [-Wunused-function]
> static int prism2_registers_proc_show(struct seq_file *m, void *v)
>
> drivers/net/wireless/intersil/hostap/hostap_proc.c:16:12: warning: ‘prism2_debug_proc_show’ defined but not used [-Wunused-function]
> static int prism2_debug_proc_show(struct seq_file *m, void *v)
> ^
> drivers/net/wireless/intersil/hostap/hostap_proc.c:49:12: warning: ‘prism2_stats_proc_show’ defined but not used [-Wunused-function]
> static int prism2_stats_proc_show(struct seq_file *m, void *v)
> ^
> drivers/net/wireless/intersil/hostap/hostap_proc.c:177:12: warning: ‘prism2_crypt_proc_show’ defined but not used [-Wunused-function]
> static int prism2_crypt_proc_show(struct seq_file *m, void *v)
> ^
>
> fix this by adding #ifdef around them.
> hfa384x_read_reg is only used by prism2_registers_proc_show,so move it
> into #ifdef.
There was already a fix for this posted by Randy Dunlap taking a
different approach, ie. use __maybe_unused classifier. To be honest I
prefer the ifdef approach as it is more explicit and does not feel like
a cheat.
Actually some of the functions are between a flag already
PRISM2_NO_PROCFS_DEBUG which is in a private header file
hostap_config.h. Seems like this would be better placed in Kconfig and
depend on CONFIG_PROCFS. Anyway, this driver is old cruft. Maybe some
people are still running it, but it is probably not worth the effort so
fine with either fix.
Regards,
Arend
^ permalink raw reply
* Re: [PATCH 10/18] brcmsmac: change strncpy+truncation to strlcpy
From: Arend van Spriel @ 2018-07-13 7:19 UTC (permalink / raw)
To: Dominique Martinet
Cc: Franky Lin, Hante Meuleman, Chi-Hsien Lin, Wright Feng,
Kalle Valo, David S. Miller, linux-wireless,
brcm80211-dev-list.pdl, brcm80211-dev-list, netdev, linux-kernel
In-Reply-To: <1531445147-19566-1-git-send-email-asmadeus@codewreck.org>
On 7/13/2018 3:25 AM, Dominique Martinet wrote:
> Generated by scripts/coccinelle/misc/strncpy_truncation.cocci
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
> ---
>
> Please see https://marc.info/?l=linux-kernel&m=153144450722324&w=2 (the
> first patch of the serie) for the motivation behind this patch
I would prefer to have the motivation in the commit message of this patch.
Regards,
Arend
^ permalink raw reply
* Re: [PATCH 11/18] wireless/ti: change strncpy+truncation to strlcpy
From: Greg Kroah-Hartman @ 2018-07-13 7:38 UTC (permalink / raw)
To: Dominique Martinet
Cc: Kalle Valo, David S. Miller, Thomas Gleixner, Kate Stewart,
Philippe Ombredanne, Joe Perches, linux-wireless, netdev,
linux-kernel
In-Reply-To: <1531445149-19607-1-git-send-email-asmadeus@codewreck.org>
On Fri, Jul 13, 2018 at 03:25:49AM +0200, Dominique Martinet wrote:
> Generated by scripts/coccinelle/misc/strncpy_truncation.cocci
>
> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
I don't know about other maintainers, but I know I wouldn't take such a
horrid changelog description as this :)
good luck!
greg k-h
^ permalink raw reply
* Re: [PATCH 11/18] wireless/ti: change strncpy+truncation to strlcpy
From: Arend van Spriel @ 2018-07-13 7:47 UTC (permalink / raw)
To: Greg Kroah-Hartman, Dominique Martinet
Cc: Kalle Valo, David S. Miller, Thomas Gleixner, Kate Stewart,
Philippe Ombredanne, Joe Perches, linux-wireless, netdev,
linux-kernel
In-Reply-To: <20180713073810.GA31984@kroah.com>
On 7/13/2018 9:38 AM, Greg Kroah-Hartman wrote:
> On Fri, Jul 13, 2018 at 03:25:49AM +0200, Dominique Martinet wrote:
>> Generated by scripts/coccinelle/misc/strncpy_truncation.cocci
>>
>> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
>
> I don't know about other maintainers, but I know I wouldn't take such a
> horrid changelog description as this :)
>
> good luck!
especially as that script is not in the kernel tree yet. The patch
adding that script contains a good motivation, but I would want to see
that in commit message of every patch or at least the gist of it.
Regards,
Arend
^ permalink raw reply
* kernel BUG at net/ipv4/ip_output.c:LINE!
From: syzbot @ 2018-07-13 8:00 UTC (permalink / raw)
To: davem, kuznet, linux-kernel, netdev, syzkaller-bugs, yoshfuji
Hello,
syzbot found the following crash on:
HEAD commit: c25c74b7476e Merge tag 'trace-v4.18-rc3-2' of git://git.ke..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1708b92c400000
kernel config: https://syzkaller.appspot.com/x/.config?x=25856fac4e580aa7
dashboard link: https://syzkaller.appspot.com/bug?extid=90d5ec0c05e708f3b66d
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
Unfortunately, I don't have any reproducer for this crash yet.
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+90d5ec0c05e708f3b66d@syzkaller.appspotmail.com
------------[ cut here ]------------
kernel BUG at net/ipv4/ip_output.c:773!
invalid opcode: 0000 [#1] SMP KASAN
CPU: 0 PID: 15085 Comm: syz-executor7 Not tainted 4.18.0-rc4+ #143
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
RIP: 0010:ip_do_fragment+0x2468/0x2ae0 net/ipv4/ip_output.c:773
Code: 8b 8d 70 fe ff ff e9 67 e8 ff ff 4c 89 ef e8 df 7a 57 fb e9 49 e9 ff
ff 4c 89 f7 e8 d2 7a 57 fb e9 c1 e5 ff ff e8 b8 a0 19 fb <0f> 0b 4c 89 e7
e8 be 7a 57 fb e9 85 e8 ff ff 4c 89 f7 89 8d 70 fe
RSP: 0018:ffff880195016880 EFLAGS: 00010246
RAX: 0000000000040000 RBX: ffff8801ce7be940 RCX: ffffc90002a12000
RDX: 0000000000040000 RSI: ffffffff86626ae8 RDI: 0000000000000005
RBP: ffff880195016a58 R08: ffff8801c66e8180 R09: ffffed00323180ba
R10: ffffed00323180bc R11: ffff8801918c05e3 R12: ffff8801ce7bea04
R13: 00000000fffffff2 R14: ffff8801ce7bea10 R15: dffffc0000000000
FS: 00007effc88a9700(0000) GS:ffff8801dae00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffdeada9000 CR3: 00000001b3b5d000 CR4: 00000000001406f0
DR0: 0000000020000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
Call Trace:
ip_fragment.constprop.49+0x179/0x240 net/ipv4/ip_output.c:546
ip_finish_output+0x6e4/0xfa0 net/ipv4/ip_output.c:315
NF_HOOK_COND include/linux/netfilter.h:276 [inline]
ip_output+0x223/0x880 net/ipv4/ip_output.c:405
dst_output include/net/dst.h:444 [inline]
ip_local_out+0xc5/0x1b0 net/ipv4/ip_output.c:124
iptunnel_xmit+0x567/0x850 net/ipv4/ip_tunnel_core.c:91
ip_tunnel_xmit+0x1598/0x3af1 net/ipv4/ip_tunnel.c:778
__gre_xmit+0x5e1/0x980 net/ipv4/ip_gre.c:449
ipgre_xmit+0x3e8/0xb50 net/ipv4/ip_gre.c:701
__netdev_start_xmit include/linux/netdevice.h:4148 [inline]
netdev_start_xmit include/linux/netdevice.h:4157 [inline]
xmit_one net/core/dev.c:3034 [inline]
dev_hard_start_xmit+0x26c/0xc30 net/core/dev.c:3050
__dev_queue_xmit+0x29ef/0x3910 net/core/dev.c:3569
dev_queue_xmit+0x17/0x20 net/core/dev.c:3602
__bpf_tx_skb net/core/filter.c:1952 [inline]
__bpf_redirect_common net/core/filter.c:1990 [inline]
__bpf_redirect+0x5b7/0xae0 net/core/filter.c:1997
____bpf_clone_redirect net/core/filter.c:2030 [inline]
bpf_clone_redirect+0x2f6/0x490 net/core/filter.c:2002
bpf_prog_bebbfe2050753572+0x12c/0x1000
Modules linked in:
Dumping ftrace buffer:
(ftrace buffer empty)
---[ end trace 2c302777c0a564f9 ]---
RIP: 0010:ip_do_fragment+0x2468/0x2ae0 net/ipv4/ip_output.c:773
Code: 8b 8d 70 fe ff ff e9 67 e8 ff ff 4c 89 ef e8 df 7a 57 fb e9 49 e9 ff
ff 4c 89 f7 e8 d2 7a 57 fb e9 c1 e5 ff ff e8 b8 a0 19 fb <0f> 0b 4c 89 e7
e8 be 7a 57 fb e9 85 e8 ff ff 4c 89 f7 89 8d 70 fe
RSP: 0018:ffff880195016880 EFLAGS: 00010246
RAX: 0000000000040000 RBX: ffff8801ce7be940 RCX: ffffc90002a12000
RDX: 0000000000040000 RSI: ffffffff86626ae8 RDI: 0000000000000005
RBP: ffff880195016a58 R08: ffff8801c66e8180 R09: ffffed00323180ba
R10: ffffed00323180bc R11: ffff8801918c05e3 R12: ffff8801ce7bea04
R13: 00000000fffffff2 R14: ffff8801ce7bea10 R15: dffffc0000000000
FS: 00007effc88a9700(0000) GS:ffff8801dae00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffdeada9000 CR3: 00000001b3b5d000 CR4: 00000000001406f0
DR0: 0000000020000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with
syzbot.
^ permalink raw reply
* Re: [PATCH 11/18] wireless/ti: change strncpy+truncation to strlcpy
From: Dominique Martinet @ 2018-07-13 8:13 UTC (permalink / raw)
To: Arend van Spriel
Cc: Greg Kroah-Hartman, Kalle Valo, David S. Miller, Thomas Gleixner,
Kate Stewart, Philippe Ombredanne, Joe Perches, linux-wireless,
netdev, linux-kernel
In-Reply-To: <5B485917.7090102@broadcom.com>
Arend van Spriel wrote on Fri, Jul 13, 2018:
> The patch adding that script contains a good motivation, but I would want to
> see that in commit message of every patch or at least the gist of
> it.
In retrospect, I definitely agree - I was happy I got coccinelle to work
and a bit too tired to make rationale decisions when I sent the serie as
it's not a kind of thing I'm used to.
For the patch you ack'd, in particular, there would be no gcc warning in
the first place because the source string's size is not known at compile
time and for some reason gcc does not mind silent truncation in that
case, so the usefulnes of the patch is fairly limited in the first
place (it's possibly simpler/good to aim for consistency but that's
about it). I however didn't take the time to make that analysis for all
the patches.
> especially as that script is not in the kernel tree yet.
I did think about that, but wasn't sure what was appropriate in this
case.
I now think it would have been better to save everyone a dozen of mails
and wait for the coccinelle patch to land first; but it's a bit late for
regret :)
I'll only catter after the coccinelle script until it lands, so if
anyone is inclined to take one of the rest as they are, great, but
otherwise feel free to ignore them for now.
(In particular, this very patch should not remove the first comment
here, as pointed out by Himanshu Jha in reply to the first patch)
Thanks for taking the time to give feedback,
--
Dominique Martinet
^ permalink raw reply
* Re: [PATCH][net-next] bridge: clean up mtu_set_by_user setting to false and comments
From: Nikolay Aleksandrov @ 2018-07-13 8:00 UTC (permalink / raw)
To: Li RongQing, netdev
In-Reply-To: <1531464444-26517-1-git-send-email-lirongqing@baidu.com>
On 13/07/18 09:47, Li RongQing wrote:
> Once mtu_set_by_user is set to true, br_mtu_auto_adjust will
> not run, and no chance to clear mtu_set_by_user.
>
^^
This was by design, there is no error here and no "cleanup" is needed.
If you read the ndo_change_mtu() call you'll see the comment:
/* this flag will be cleared if the MTU was automatically adjusted */
It is the only way we can know that the MTU was automatically adjusted or set
by the user manually in which case we need to _stop_ automatically adjusting
MTU. This was done to be backwards compatible as much as possible but still
give the option to have user-configured MTU which doesn't disappear (and is
not overwritten).
So please next time read the original commit.
>From the original commit 804b854d374e ("net: bridge: disable bridge MTU auto tuning if it was set manually"):
" ...
Let's improve on that situation and allow for the user to
set any MTU within ETH_MIN/MAX limits, but once manually configured it
is the user's responsibility to keep it correct afterwards.
In case the MTU isn't manually set - the behaviour reverts to the
previous and the bridge follows the minimum MTU.
...
"
> and br_mtu_auto_adjust will run only if mtu_set_by_user is
> false, so not need to set it to false again
>
> Cc: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> net/bridge/br_device.c | 1 -
> net/bridge/br_if.c | 4 ----
> 2 files changed, 5 deletions(-)
>
> diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
> index e682a668ce57..c636bc2749c2 100644
> --- a/net/bridge/br_device.c
> +++ b/net/bridge/br_device.c
> @@ -227,7 +227,6 @@ static int br_change_mtu(struct net_device *dev, int new_mtu)
>
> dev->mtu = new_mtu;
>
> - /* this flag will be cleared if the MTU was automatically adjusted */
> br->mtu_set_by_user = true;
> #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
> /* remember the MTU in the rtable for PMTU */
> diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> index 05e42d86882d..47c65da4b1be 100644
> --- a/net/bridge/br_if.c
> +++ b/net/bridge/br_if.c
> @@ -450,11 +450,7 @@ void br_mtu_auto_adjust(struct net_bridge *br)
> if (br->mtu_set_by_user)
> return;
>
> - /* change to the minimum MTU and clear the flag which was set by
> - * the bridge ndo_change_mtu callback
> - */
> dev_set_mtu(br->dev, br_mtu_min(br));
> - br->mtu_set_by_user = false;
> }
>
> static void br_set_gso_limits(struct net_bridge *br)
>
Nacked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
^ permalink raw reply
* Re: general protection fault in kfree (2)
From: syzbot @ 2018-07-13 9:02 UTC (permalink / raw)
To: davem, ericvh, linux-kernel, lucho, netdev, rminnich,
syzkaller-bugs, v9fs-developer
In-Reply-To: <000000000000483ec605708a998d@google.com>
syzbot has found a reproducer for the following crash on:
HEAD commit: 3ee15ba60e6b Add linux-next specific files for 20180712
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=11d3652c400000
kernel config: https://syzkaller.appspot.com/x/.config?x=fe1c3df2c7c0c81
dashboard link: https://syzkaller.appspot.com/bug?extid=1ff9d2e170913c4ef264
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=10d9d1a4400000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10657794400000
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+1ff9d2e170913c4ef264@syzkaller.appspotmail.com
FS-Cache: O-cookie c=00000000bfe1c402 [p=00000000445b4196 fl=222 nc=0 na=1]
FS-Cache: O-cookie d=00000000a5eb7aa3 n=000000005d36a973
kasan: CONFIG_KASAN_INLINE enabled
FS-Cache: O-key=[10] '
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] SMP KASAN
CPU: 0 PID: 4474 Comm: syz-executor242 Not tainted
4.18.0-rc4-next-20180712+ #6
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
34
RIP: 0010:virt_to_head_page include/linux/mm.h:638 [inline]
RIP: 0010:virt_to_cache mm/slab.c:399 [inline]
RIP: 0010:kfree+0xa0/0x260 mm/slab.c:3809
Code:
32
82 cb 01 00
39
00 48 ba 00 00
34
00 80 ff 77
36
00 00 48 01
39
c2 48 89 df
35
48 b8 00 00 00
31
00 00 ea ff
35
ff 48 c1 ea
35
0c 48 c1 e2
'
06 48 01 c2 <48>
FS-Cache: N-cookie c=00000000525aeed3 [p=00000000445b4196 fl=2 nc=0 na=1]
8b 42 08 a8 01
FS-Cache: N-cookie d=00000000a5eb7aa3 n=000000003a05f34d
48 8d 48 ff 48
FS-Cache: N-key=[10] '
0f 45 d1 4c 8b
34
6a 18 49 63 75
32
74
RSP: 0018:ffff8801b105f5d0 EFLAGS: 00010003
39
RAX: ffffea0000000000 RBX: f780d0382154ac00 RCX: 1ffff1003620bed8
RDX: 03ddef20e0855280 RSI: ffffffff87700e50 RDI: f780d0382154ac00
RBP: ffff8801b105f5f0 R08: ffff8801ade02380 R09: ffffed003620bdf8
34
R10: ffffed0039d876c0 R11: 0000000000000001 R12: 0000000000000282
R13: ffffffff87700e8a R14: ffff8801b105f740 R15: ffff8801ce4c0540
FS: 00007feab2d14700(0000) GS:ffff8801dae00000(0000) knlGS:0000000000000000
36
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f32b40b0000 CR3: 00000001c4338000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
39
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
35
p9_client_version net/9p/client.c:1010 [inline]
p9_client_create+0xfea/0x1770 net/9p/client.c:1070
31
35
35
'
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
v9fs_session_init+0x21a/0x1a80 fs/9p/v9fs.c:400
v9fs_mount+0x7c/0x900 fs/9p/vfs_super.c:135
legacy_get_tree+0x118/0x440 fs/fs_context.c:659
vfs_get_tree+0x1cb/0x5c0 fs/super.c:1743
do_new_mount fs/namespace.c:2567 [inline]
do_mount+0x6c1/0x1fb0 fs/namespace.c:2889
ksys_mount+0x12d/0x140 fs/namespace.c:3105
__do_sys_mount fs/namespace.c:3119 [inline]
__se_sys_mount fs/namespace.c:3116 [inline]
__x64_sys_mount+0xbe/0x150 fs/namespace.c:3116
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x445b59
Code: e8 bc e7 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff
ff 0f 83 2b 0e fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007feab2d13da8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00000000006dac3c RCX: 0000000000445b59
RDX: 0000000020000180 RSI: 0000000020000140 RDI: 0000000000000000
RBP: 00000000006dac38 R08: 0000000020000300 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0031656c69662f2e
R13: 6f6c3d6568636163 R14: 64663d736e617274 R15: 0000000000000001
Modules linked in:
Dumping ftrace buffer:
(ftrace buffer empty)
---[ end trace bacf24c1f955b911 ]---
general protection fault: 0000 [#2] SMP KASAN
CPU: 1 PID: 4472 Comm: syz-executor242 Tainted: G D
4.18.0-rc4-next-20180712+ #6
RIP: 0010:virt_to_head_page include/linux/mm.h:638 [inline]
RIP: 0010:virt_to_cache mm/slab.c:399 [inline]
RIP: 0010:kfree+0xa0/0x260 mm/slab.c:3809
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Code:
RIP: 0010:virt_to_head_page include/linux/mm.h:638 [inline]
RIP: 0010:virt_to_cache mm/slab.c:399 [inline]
RIP: 0010:kfree+0xa0/0x260 mm/slab.c:3809
82
Code:
cb
82
01
cb
00
01
00
00
48
00
ba
48
00 00
ba
00
00
80
00
ff
00
77
80
00
ff
00
77
48
00 00
01
48
c2
01
48
c2
89
48
df
89
48
df
b8
48
00
b8
00
00
00
00
00
00
00
00
ea
00
ff
ea
ff
ff
48
ff
c1
48
ea
c1
0c
ea
48
0c
c1
48
e2
c1
06
e2
48
06
01
48
c2
01
<48>
c2
8b
<48>
42
8b
08
42
a8
08
01
a8
48
01
8d
48
48
8d
ff
48
48
ff
0f
48
45
0f
d1
45
4c
d1
8b
4c
6a
8b
18
6a
49
18
63
49
75
63
74
75
74
RSP: 0018:ffff8801b105f5d0 EFLAGS: 00010003
RSP: 0018:ffff8801b3db75d0 EFLAGS: 00010003
RAX: ffffea0000000000 RBX: f780d0382154ac00 RCX: 1ffff1003620bed8
RDX: 03ddef20e0855280 RSI: ffffffff87700e50 RDI: f780d0382154ac00
RAX: ffffea0000000000 RBX: afd91d4db7636200 RCX: 1ffff100367b6ed8
RBP: ffff8801b105f5f0 R08: ffff8801ade02380 R09: ffffed003620bdf8
RDX: 02bf505536dd8d80 RSI: ffffffff87700e50 RDI: afd91d4db7636200
R10: ffffed0039d876c0 R11: 0000000000000001 R12: 0000000000000282
RBP: ffff8801b3db75f0 R08: ffff8801ad62a300 R09: ffffed00367b6df8
R13: ffffffff87700e8a R14: ffff8801b105f740 R15: ffff8801ce4c0540
R10: ffffed0039d876e0 R11: 0000000000000001 R12: 0000000000000282
FS: 00007feab2d14700(0000) GS:ffff8801dae00000(0000) knlGS:0000000000000000
R13: ffffffff87700e8a R14: ffff8801b3db7740 R15: ffff8801aa0a03c0
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
FS: 00007feab2d14700(0000) GS:ffff8801daf00000(0000) knlGS:0000000000000000
CR2: 00007f32b40b0000 CR3: 00000001c4338000 CR4: 00000000001406f0
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
CR2: 00007f32b40b0000 CR3: 00000001c0acc000 CR4: 00000000001406e0
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
^ permalink raw reply
* FYI: [PATCH net-next 2/2] docs: networking: Fix failover build warnings
From: Markus Heiser @ 2018-07-13 9:04 UTC (permalink / raw)
To: Tobin C. Harding, David S. Miller
Cc: Sridhar Samudrala, linux-doc, netdev, linux-kernel,
Jonathan Corbet
In-Reply-To: <20180711214250.19039-3-me@tobin.cc>
Hy Tobin,
> Add '::' before code snippets and indent all snippets uniformly starting
> with 2 spaces.
Just FYI about reST Markup (no need to fix anything in your patch).
You can also add '::' (the markup for literal blocks) at the last line of the
previous paragraph, e.g:
<snip>---
Booting a VM with the above configuration will result in the following 3
netdevs created in the VM.::
4: ens10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
group default qlen 1000
link/ether 52:54:00:00:12:53 brd ff:ff:ff:ff:ff:ff
<snap>---
IMO its more readable in plain text. Anyway it is not wrong to add '::' in a
separated new line ... and thanks for your patch.
If you have any doubt about reST markup, I recommend the primer from the Sphinx
project:
http://www.sphinx-doc.org/en/stable/rest.html
and the quickref from the (underlying) docutils project:
http://docutils.sourceforge.net/docs/user/rst/quickref.html
-- Markus --
^ permalink raw reply
* Re: Re: [Qemu-devel] [PATCH v3 0/3] Use of unique identifier for pairing virtio and passthrough devices...
From: Cornelia Huck @ 2018-07-13 9:15 UTC (permalink / raw)
To: Samudrala, Sridhar
Cc: Siwei Liu, Michael S. Tsirkin, si-wei liu, Roman Kagan,
Venu Busireddy, Marcel Apfelbaum, virtio-dev, qemu-devel,
Alexander Duyck, Netdev
In-Reply-To: <77823ff9-a02a-808b-e919-b4950a64ae3c@intel.com>
On Thu, 12 Jul 2018 21:20:41 -0400
"Samudrala, Sridhar" <sridhar.samudrala@intel.com> wrote:
> On 7/12/2018 6:19 PM, Siwei Liu wrote:
> > On Thu, Jul 12, 2018 at 2:00 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> >> On Thu, Jul 12, 2018 at 01:52:53PM -0700, Siwei Liu wrote:
> >>> The definition is incomplete due to lack of spec. There's no "host"
> >>> part defined yet in the host-guest interface. If match by MAC is an
> >>> interface, the same must be done on the host(device) side as well,
> >>> which has been agreed not the way to go. However, I don't think that's
> >>> what the author intends to do by interpreting his QEMU patch - it
> >>> missed the other parts as well, such as the feature negotiation and
> >>> how it interacts with the paired device.
> >>>
> >>> What I said is that match by MAC is just a guest implementation that
> >>> one can change at any time. We now have the group ID on QEMU, why
> >>> still sticking to matching by MAC? It shoulnd't be a host-guest
> >>> interface in the first place anyway.
> >> I think that match by MAC is a simple portable way to match devices.
> >> E.g. it will work seamlessly with niche things like zPCI. However
> > That's a good point. I'm not sure if it's a valid assumption that zPCI
> > should always use the same MAC address as that of virtio. Someone
I think we can mostly disregard the weirdness that is zPCI right now.
There should be no fundamental reasons that matching by MAC would not
work, though.
> > who's more familiar with the use case may decide and work on that. It
> > means VFIO device has to take in the MAC address as an identifier to
> > the "-device vfio-pci,.." QEMU option. I think there's no point to
> > match device using group ID in QEMU while using MAC in the guest.
> > Based on that assumption, I'd go with making VIRTIO_NET_F_STANDBY to
> > match device based on group ID, while someone may come up with another
> > feature bit later, say VIRTIO_NET_F_STANDBY_BY_MAC when its QEMU
> > support is available. Would it make sense?
>
> VIRTIO_NET_F_STANDBY as defined in the guest virtio_net driver supports match
> by MAC address. I think we should add support for this feature bit in QEMU.
> If submitting a patch to update the spec is a pre-requisite to add this
> feature bit to QEMU, i can do that.
Doing a spec patch and implementing matching by MAC in QEMU sounds like
a good plan to me.
>
> As far as i understand, group id patches to QEMU are still under review.
> Matching by group ID can be another feature bit that could support matching
> by group id as well as MAC.
That plan sounds good to me as well.
^ permalink raw reply
* 答复: [PATCH][net-next] bridge: clean up mtu_set_by_user setting to false and comments
From: Li,Rongqing @ 2018-07-13 9:11 UTC (permalink / raw)
To: Nikolay Aleksandrov, netdev@vger.kernel.org
In-Reply-To: <780d2dff-c03c-8e0a-f2c0-2b3d5974512d@cumulusnetworks.com>
> -----邮件原件-----
> 发件人: Nikolay Aleksandrov [mailto:nikolay@cumulusnetworks.com]
> 发送时间: 2018年7月13日 16:01
> 收件人: Li,Rongqing <lirongqing@baidu.com>; netdev@vger.kernel.org
> 主题: Re: [PATCH][net-next] bridge: clean up mtu_set_by_user setting to
> false and comments
>
> On 13/07/18 09:47, Li RongQing wrote:
> > Once mtu_set_by_user is set to true, br_mtu_auto_adjust will not run,
> > and no chance to clear mtu_set_by_user.
> >
> ^^
> This was by design, there is no error here and no "cleanup" is needed.
> If you read the ndo_change_mtu() call you'll see the comment:
> /* this flag will be cleared if the MTU was automatically adjusted */
>
But after this comment, mtu_set_by_user is set to true, and br_mtu_auto_adjust
will not truly be run, how to set mtu_set_by_user to false?
230 /* this flag will be cleared if the MTU was automatically adjusted */
231 br->mtu_set_by_user = true;
And the line 457 is useless, since it run only if it is false?
445 void br_mtu_auto_adjust(struct net_bridge *br)
446 {
447 ASSERT_RTNL();
448
449 /* if the bridge MTU was manually configured don't mess with it */
450 if (br->mtu_set_by_user)
451 return;
452
453 /* change to the minimum MTU and clear the flag which was set by
454 * the bridge ndo_change_mtu callback
455 */
456 dev_set_mtu(br->dev, br_mtu_min(br));
457 br->mtu_set_by_user = false;
458 }
-R
^ permalink raw reply
* [PATCH net-next] net: ipmr: add support for passing full packet on wrong vif
From: Nikolay Aleksandrov @ 2018-07-13 9:16 UTC (permalink / raw)
To: netdev; +Cc: davem, sharpd, Nikolay Aleksandrov
This patch adds support for IGMPMSG_WRVIFWHOLE which is used to pass
full packet and real vif id when the incoming interface is wrong.
While the RP and FHR are setting up state we need to be sending the
registers encapsulated with all the data inside otherwise we lose it.
The RP then decapsulates it and forwards it to the interested parties.
Currently with WRONGVIF we can only be sending empty register packets
and will lose that data.
This behaviour can be enabled by using MRT_PIM with
val == IGMPMSG_WRVIFWHOLE. This doesn't prevent IGMPMSG_WRONGVIF from
happening, it happens in addition to it, also it is controlled by the same
throttling parameters as WRONGVIF (i.e. 1 packet per 3 seconds currently).
Both messages are generated to keep backwards compatibily and avoid
breaking someone who was enabling MRT_PIM with val == 4, since any
positive val is accepted and treated the same.
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
We have been running with this patch for over an year and FRRouting fully
supports this WRVIFWHOLE message officially. Actually it uses both WRONGVIF
and WRVIFWHOLE for different purposes right now.
include/linux/mroute_base.h | 1 +
include/uapi/linux/mroute.h | 2 ++
net/ipv4/ipmr.c | 21 ++++++++++++++++-----
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/include/linux/mroute_base.h b/include/linux/mroute_base.h
index fd436cdd4725..6675b9f81979 100644
--- a/include/linux/mroute_base.h
+++ b/include/linux/mroute_base.h
@@ -254,6 +254,7 @@ struct mr_table {
atomic_t cache_resolve_queue_len;
bool mroute_do_assert;
bool mroute_do_pim;
+ bool mroute_do_wrvifwhole;
int mroute_reg_vif_num;
};
diff --git a/include/uapi/linux/mroute.h b/include/uapi/linux/mroute.h
index 10f9ff9426a2..5d37a9ccce63 100644
--- a/include/uapi/linux/mroute.h
+++ b/include/uapi/linux/mroute.h
@@ -120,6 +120,7 @@ enum {
IPMRA_TABLE_MROUTE_DO_ASSERT,
IPMRA_TABLE_MROUTE_DO_PIM,
IPMRA_TABLE_VIFS,
+ IPMRA_TABLE_MROUTE_DO_WRVIFWHOLE,
__IPMRA_TABLE_MAX
};
#define IPMRA_TABLE_MAX (__IPMRA_TABLE_MAX - 1)
@@ -173,5 +174,6 @@ enum {
#define IGMPMSG_NOCACHE 1 /* Kern cache fill request to mrouted */
#define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */
#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */
+#define IGMPMSG_WRVIFWHOLE 4 /* For PIM Register and assert processing */
#endif /* _UAPI__LINUX_MROUTE_H */
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 82f914122f1b..5660adcf7a04 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1052,7 +1052,7 @@ static int ipmr_cache_report(struct mr_table *mrt,
struct sk_buff *skb;
int ret;
- if (assert == IGMPMSG_WHOLEPKT)
+ if (assert == IGMPMSG_WHOLEPKT || assert == IGMPMSG_WRVIFWHOLE)
skb = skb_realloc_headroom(pkt, sizeof(struct iphdr));
else
skb = alloc_skb(128, GFP_ATOMIC);
@@ -1060,7 +1060,7 @@ static int ipmr_cache_report(struct mr_table *mrt,
if (!skb)
return -ENOBUFS;
- if (assert == IGMPMSG_WHOLEPKT) {
+ if (assert == IGMPMSG_WHOLEPKT || assert == IGMPMSG_WRVIFWHOLE) {
/* Ugly, but we have no choice with this interface.
* Duplicate old header, fix ihl, length etc.
* And all this only to mangle msg->im_msgtype and
@@ -1071,9 +1071,12 @@ static int ipmr_cache_report(struct mr_table *mrt,
skb_reset_transport_header(skb);
msg = (struct igmpmsg *)skb_network_header(skb);
memcpy(msg, skb_network_header(pkt), sizeof(struct iphdr));
- msg->im_msgtype = IGMPMSG_WHOLEPKT;
+ msg->im_msgtype = assert;
msg->im_mbz = 0;
- msg->im_vif = mrt->mroute_reg_vif_num;
+ if (assert == IGMPMSG_WRVIFWHOLE)
+ msg->im_vif = vifi;
+ else
+ msg->im_vif = mrt->mroute_reg_vif_num;
ip_hdr(skb)->ihl = sizeof(struct iphdr) >> 2;
ip_hdr(skb)->tot_len = htons(ntohs(ip_hdr(pkt)->tot_len) +
sizeof(struct iphdr));
@@ -1372,6 +1375,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval,
struct mr_table *mrt;
struct vifctl vif;
struct mfcctl mfc;
+ bool do_wrvifwhole;
u32 uval;
/* There's one exception to the lock - MRT_DONE which needs to unlock */
@@ -1502,10 +1506,12 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval,
break;
}
+ do_wrvifwhole = (val == IGMPMSG_WRVIFWHOLE);
val = !!val;
if (val != mrt->mroute_do_pim) {
mrt->mroute_do_pim = val;
mrt->mroute_do_assert = val;
+ mrt->mroute_do_wrvifwhole = do_wrvifwhole;
}
break;
case MRT_TABLE:
@@ -1983,6 +1989,9 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt,
MFC_ASSERT_THRESH)) {
c->_c.mfc_un.res.last_assert = jiffies;
ipmr_cache_report(mrt, skb, true_vifi, IGMPMSG_WRONGVIF);
+ if (mrt->mroute_do_wrvifwhole)
+ ipmr_cache_report(mrt, skb, true_vifi,
+ IGMPMSG_WRVIFWHOLE);
}
goto dont_forward;
}
@@ -2659,7 +2668,9 @@ static bool ipmr_fill_table(struct mr_table *mrt, struct sk_buff *skb)
mrt->mroute_reg_vif_num) ||
nla_put_u8(skb, IPMRA_TABLE_MROUTE_DO_ASSERT,
mrt->mroute_do_assert) ||
- nla_put_u8(skb, IPMRA_TABLE_MROUTE_DO_PIM, mrt->mroute_do_pim))
+ nla_put_u8(skb, IPMRA_TABLE_MROUTE_DO_PIM, mrt->mroute_do_pim) ||
+ nla_put_u8(skb, IPMRA_TABLE_MROUTE_DO_WRVIFWHOLE,
+ mrt->mroute_do_wrvifwhole))
return false;
return true;
--
2.11.0
^ permalink raw reply related
* Re: [PATCH] connector: hide unused procfs helpers
From: YueHaibing @ 2018-07-13 9:31 UTC (permalink / raw)
To: zbr; +Cc: linux-kernel, netdev
In-Reply-To: <20180713071141.15996-1-yuehaibing@huawei.com>
pls ignore this,my bad.
On 2018/7/13 15:11, YueHaibing wrote:
> When CONFIG_PROC_FS isn't set, gcc warning this:
>
> drivers/connector/connector.c:242:12: warning: ‘cn_proc_show’ defined but not used [-Wunused-function]
> static int cn_proc_show(struct seq_file *m, void *v)
> ^
> fix this by adding #ifdef around it.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/connector/connector.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
> index e718b8c..e2636d4 100644
> --- a/drivers/connector/connector.c
> +++ b/drivers/connector/connector.c
> @@ -239,6 +239,7 @@ void cn_del_callback(struct cb_id *id)
> }
> EXPORT_SYMBOL_GPL(cn_del_callback);
>
> +#ifdef CONFIG_PROC_FS
> static int cn_proc_show(struct seq_file *m, void *v)
> {
> struct cn_queue_dev *dev = cdev.cbdev;
> @@ -259,6 +260,7 @@ static int cn_proc_show(struct seq_file *m, void *v)
>
> return 0;
> }
> +#endif
>
> static struct cn_dev cdev = {
> .input = cn_rx_skb,
>
^ permalink raw reply
* Re: [PATCH 03/10] atmel: hide unused procfs helpers
From: YueHaibing @ 2018-07-13 9:31 UTC (permalink / raw)
To: simon, kvalo; +Cc: linux-kernel, netdev, linux-wireless, davem
In-Reply-To: <20180713064658.10340-1-yuehaibing@huawei.com>
pls ignore this,my bad.
On 2018/7/13 14:46, YueHaibing wrote:
> When CONFIG_PROC_FS isn't set, gcc warning this:
>
> drivers/net/wireless/atmel/atmel.c:1402:12: warning: ‘atmel_proc_show’ defined but not used [-Wunused-function]
> static int atmel_proc_show(struct seq_file *m, void *v)
> ^
> fix this by adding #ifdef around it.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/net/wireless/atmel/atmel.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/wireless/atmel/atmel.c b/drivers/net/wireless/atmel/atmel.c
> index b01dc34..3940876 100644
> --- a/drivers/net/wireless/atmel/atmel.c
> +++ b/drivers/net/wireless/atmel/atmel.c
> @@ -1399,6 +1399,7 @@ static int atmel_validate_channel(struct atmel_private *priv, int channel)
> return 0;
> }
>
> +#ifdef CONFIG_PROC_FS
> static int atmel_proc_show(struct seq_file *m, void *v)
> {
> struct atmel_private *priv = m->private;
> @@ -1481,6 +1482,7 @@ static int atmel_proc_show(struct seq_file *m, void *v)
> seq_printf(m, "Current state:\t\t%s\n", s);
> return 0;
> }
> +#endif
>
> static const struct net_device_ops atmel_netdev_ops = {
> .ndo_open = atmel_open,
>
^ permalink raw reply
* Re: 答复: [PATCH][net-next] bridge: clean up mtu_set_by_user setting to false and comments
From: Nikolay Aleksandrov @ 2018-07-13 9:19 UTC (permalink / raw)
To: Li,Rongqing, netdev@vger.kernel.org
In-Reply-To: <2AD939572F25A448A3AE3CAEA61328C23785704D@BC-MAIL-M28.internal.baidu.com>
On 13/07/18 12:11, Li,Rongqing wrote:
>
>
>> -----邮件原件-----
>> 发件人: Nikolay Aleksandrov [mailto:nikolay@cumulusnetworks.com]
>> 发送时间: 2018年7月13日 16:01
>> 收件人: Li,Rongqing <lirongqing@baidu.com>; netdev@vger.kernel.org
>> 主题: Re: [PATCH][net-next] bridge: clean up mtu_set_by_user setting to
>> false and comments
>>
>> On 13/07/18 09:47, Li RongQing wrote:
>>> Once mtu_set_by_user is set to true, br_mtu_auto_adjust will not run,
>>> and no chance to clear mtu_set_by_user.
>>>
>> ^^
>> This was by design, there is no error here and no "cleanup" is needed.
>> If you read the ndo_change_mtu() call you'll see the comment:
>> /* this flag will be cleared if the MTU was automatically adjusted */
>>
> But after this comment, mtu_set_by_user is set to true, and br_mtu_auto_adjust
> will not truly be run, how to set mtu_set_by_user to false?
It will be run if the mtu_set_by_user is set to "false".
>
> 230 /* this flag will be cleared if the MTU was automatically adjusted */
> 231 br->mtu_set_by_user = true;
>
> And the line 457 is useless, since it run only if it is false?
dev_set_mtu() calls ndo_change_mtu() which makes mtu_set_by_user = true but that is
not really _true_ since this is an automatic MTU adjustment so we need to revert the
value to false so the automatic adjustment will continue to work.
But if you go ahead and set the MTU yourself manually, then mtu_set_by_user will be
equal to true and will stay that way, thus disabling the auto adjust behaviour.
This is used to differentiate when auto adjust is used and when user has set the MTU.
As I already said everything is working as expected and you should not remove this code.
>
> 445 void br_mtu_auto_adjust(struct net_bridge *br)
> 446 {
> 447 ASSERT_RTNL();
> 448
> 449 /* if the bridge MTU was manually configured don't mess with it */
> 450 if (br->mtu_set_by_user)
> 451 return;
> 452
> 453 /* change to the minimum MTU and clear the flag which was set by
> 454 * the bridge ndo_change_mtu callback
> 455 */
> 456 dev_set_mtu(br->dev, br_mtu_min(br));
> 457 br->mtu_set_by_user = false;
> 458 }
>
>
> -R
>
^ permalink raw reply
* Re: [PATCH] isdn/capi: hide unused procfs helpers
From: YueHaibing @ 2018-07-13 9:33 UTC (permalink / raw)
To: isdn; +Cc: linux-kernel, netdev, keescook, viro
In-Reply-To: <20180713041114.16112-1-yuehaibing@huawei.com>
pls ignore this,there has a fix from Randy.
On 2018/7/13 12:11, YueHaibing wrote:
> When CONFIG_PROC_FS isn't set, gcc warning this:
>
> drivers/isdn/capi/capi.c:1324:12: warning: ‘capi20_proc_show’ defined but not used [-Wunused-function]
> static int capi20_proc_show(struct seq_file *m, void *v)
> ^
> drivers/isdn/capi/capi.c:1347:12: warning: ‘capi20ncci_proc_show’ defined but not used [-Wunused-function]
> static int capi20ncci_proc_show(struct seq_file *m, void *v)
> ^
> drivers/isdn/capi/capidrv.c:2454:12: warning: ‘capidrv_proc_show’ defined but not used [-Wunused-function]
> static int capidrv_proc_show(struct seq_file *m, void *v)
> ^
>
> We can fix the warning by adding the same #ifdef around them.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/isdn/capi/capi.c | 2 ++
> drivers/isdn/capi/capidrv.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
> index 6e0c281..594f767 100644
> --- a/drivers/isdn/capi/capi.c
> +++ b/drivers/isdn/capi/capi.c
> @@ -1317,6 +1317,7 @@ static inline void capinc_tty_exit(void) { }
>
> /* -------- /proc functions ----------------------------------------- */
>
> +#ifdef CONFIG_PROC_FS
> /*
> * /proc/capi/capi20:
> * minor applid nrecvctlpkt nrecvdatapkt nsendctlpkt nsenddatapkt
> @@ -1359,6 +1360,7 @@ static int capi20ncci_proc_show(struct seq_file *m, void *v)
> mutex_unlock(&capidev_list_lock);
> return 0;
> }
> +#endif
>
> static void __init proc_init(void)
> {
> diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
> index ee510f9..c6f45d7 100644
> --- a/drivers/isdn/capi/capidrv.c
> +++ b/drivers/isdn/capi/capidrv.c
> @@ -2447,6 +2447,7 @@ lower_callback(struct notifier_block *nb, unsigned long val, void *v)
> return NOTIFY_OK;
> }
>
> +#ifdef CONFIG_PROC_FS
> /*
> * /proc/capi/capidrv:
> * nrecvctlpkt nrecvdatapkt nsendctlpkt nsenddatapkt
> @@ -2460,6 +2461,7 @@ static int capidrv_proc_show(struct seq_file *m, void *v)
> global.ap.nsentdatapkt);
> return 0;
> }
> +#endif
>
> static void __init proc_init(void)
> {
>
^ permalink raw reply
* Re: [PATCH] hostap: hide unused procfs helpers
From: YueHaibing @ 2018-07-13 9:37 UTC (permalink / raw)
To: Arend van Spriel, j, kvalo
Cc: linux-kernel, netdev, linux-wireless, davem, Randy Dunlap
In-Reply-To: <5B485441.1080305@broadcom.com>
On 2018/7/13 15:26, Arend van Spriel wrote:
> + Randy
>
> On 7/13/2018 9:03 AM, YueHaibing wrote:
>> When CONFIG_PROC_FS isn't set, gcc warning this:
>>
>> drivers/net/wireless/intersil/hostap/hostap_hw.c:2901:12: warning: ‘prism2_registers_proc_show’ defined but not used [-Wunused-function]
>> static int prism2_registers_proc_show(struct seq_file *m, void *v)
>>
>> drivers/net/wireless/intersil/hostap/hostap_proc.c:16:12: warning: ‘prism2_debug_proc_show’ defined but not used [-Wunused-function]
>> static int prism2_debug_proc_show(struct seq_file *m, void *v)
>> ^
>> drivers/net/wireless/intersil/hostap/hostap_proc.c:49:12: warning: ‘prism2_stats_proc_show’ defined but not used [-Wunused-function]
>> static int prism2_stats_proc_show(struct seq_file *m, void *v)
>> ^
>> drivers/net/wireless/intersil/hostap/hostap_proc.c:177:12: warning: ‘prism2_crypt_proc_show’ defined but not used [-Wunused-function]
>> static int prism2_crypt_proc_show(struct seq_file *m, void *v)
>> ^
>>
>> fix this by adding #ifdef around them.
>> hfa384x_read_reg is only used by prism2_registers_proc_show,so move it
>> into #ifdef.
>
> There was already a fix for this posted by Randy Dunlap taking a different approach, ie. use __maybe_unused classifier. To be honest I prefer the ifdef approach as it is more explicit and does not feel like a cheat.
>
> Actually some of the functions are between a flag already PRISM2_NO_PROCFS_DEBUG which is in a private header file hostap_config.h. Seems like this would be better placed in Kconfig and depend on CONFIG_PROCFS. Anyway, this driver is old cruft. Maybe some people are still running it, but it is probably not worth the effort so fine with either fix.
>
I dont check Randy's patch. ignore this pls.
> Regards,
> Arend
>
> .
>
^ permalink raw reply
* [PATCH net-next 0/4] TC: refactor TC_ACT_REDIRECT action
From: Paolo Abeni @ 2018-07-13 9:54 UTC (permalink / raw)
To: netdev
Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, Alexei Starovoitov,
Daniel Borkmann, Marcelo Ricardo Leitner
This series is aimed at improving the act_mirred redirect performances.
Such action is used by OVS to represent TC S/W flows, and it's current largest
bottle-neck is the need for a skb_clone() for each packet.
The first 2 patches introduce some cleanup and safeguards to allow changing the
TC_ACT_REDIRECT handling: currently the action context is stored in per CPU
variables, and we allow also to use the tcf_result. Finally we use this extended
infrastructure in act_mirred to implement redirect via TC_ACT_REDIRECT, when
possible.
Overall this the above gives a ~10% performance improvement in forwarding tput,
when using the TC S/W datapath.
Paolo Abeni (4):
tc/act: user space can't use TC_ACT_REDIRECT directly
tc/act: remove unneeded RCU lock in action callback
net/sched: refactor TC_ACT_REDIRECT handling
act_mirred: use ACT_REDIRECT when possible
include/net/act_api.h | 2 +-
include/net/sch_generic.h | 17 ++++++++++++++++-
include/uapi/linux/pkt_cls.h | 1 +
net/core/dev.c | 4 ++--
net/core/filter.c | 29 +++++++++++++++++++++++------
net/core/lwt_bpf.c | 5 ++++-
net/sched/act_api.c | 5 +++++
net/sched/act_bpf.c | 8 ++++----
net/sched/act_csum.c | 12 +++---------
net/sched/act_ife.c | 5 +----
net/sched/act_mirred.c | 19 ++++++++++++++-----
net/sched/act_sample.c | 4 +---
net/sched/act_skbedit.c | 10 +++-------
net/sched/act_skbmod.c | 21 +++++++++------------
net/sched/act_tunnel_key.c | 6 +-----
net/sched/act_vlan.c | 19 +++++++------------
net/sched/cls_bpf.c | 8 +++++---
17 files changed, 100 insertions(+), 75 deletions(-)
--
2.17.1
^ permalink raw reply
* [PATCH net-next 1/4] tc/act: user space can't use TC_ACT_REDIRECT directly
From: Paolo Abeni @ 2018-07-13 9:54 UTC (permalink / raw)
To: netdev
Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, Alexei Starovoitov,
Daniel Borkmann, Marcelo Ricardo Leitner
In-Reply-To: <cover.1531473946.git.pabeni@redhat.com>
Only cls_bpf and act_bpf can safely use such value. If a generic
action is configured by user space to return TC_ACT_REDIRECT,
the usually visible behavior is passing the skb up the stack - as
for unknown action, but, with complex configuration, more random
results can be obtained.
This patch forcefully converts TC_ACT_REDIRECT to TC_ACT_LAST + 1
at action init time, making the kernel behavior more consistent.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
include/uapi/linux/pkt_cls.h | 1 +
net/sched/act_api.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index c4262d911596..7cdd62b51106 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -45,6 +45,7 @@ enum {
* the skb and act like everything
* is alright.
*/
+#define TC_ACT_LAST TC_ACT_TRAP
/* There is a special kind of actions called "extended actions",
* which need a value parameter. These have a local opcode located in
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 148a89ab789b..f6438f246dab 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -895,6 +895,11 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
}
}
+ if (a->tcfa_action == TC_ACT_REDIRECT) {
+ net_warn_ratelimited("TC_ACT_REDIRECT can't be used directly");
+ a->tcfa_action = TC_ACT_LAST + 1;
+ }
+
return a;
err_mod:
--
2.17.1
^ permalink raw reply related
* [PATCH net-next 2/4] tc/act: remove unneeded RCU lock in action callback
From: Paolo Abeni @ 2018-07-13 9:55 UTC (permalink / raw)
To: netdev
Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, Alexei Starovoitov,
Daniel Borkmann, Marcelo Ricardo Leitner
In-Reply-To: <cover.1531473946.git.pabeni@redhat.com>
Each lockless action currently does its own RCU locking in ->act().
This is allows using plain RCU accessor, even if the context
is really RCU BH.
This change drops the per action RCU lock, replace the accessors
with _bh variant, cleans up a bit the surronding code and documents
the RCU status in the relevant header.
No functional nor performance change is intended.
The goal of this patch is clarifying that the RCU critical section
used by the tc actions extends up to the classifier's caller.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
include/net/act_api.h | 2 +-
include/net/sch_generic.h | 2 ++
net/sched/act_bpf.c | 4 +---
net/sched/act_csum.c | 12 +++---------
net/sched/act_ife.c | 5 +----
net/sched/act_mirred.c | 4 +---
net/sched/act_sample.c | 4 +---
net/sched/act_skbedit.c | 10 +++-------
net/sched/act_skbmod.c | 21 +++++++++------------
net/sched/act_tunnel_key.c | 6 +-----
net/sched/act_vlan.c | 19 +++++++------------
11 files changed, 30 insertions(+), 59 deletions(-)
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 683ce41053d9..8c9bc02d05e1 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -85,7 +85,7 @@ struct tc_action_ops {
size_t size;
struct module *owner;
int (*act)(struct sk_buff *, const struct tc_action *,
- struct tcf_result *);
+ struct tcf_result *); /* called under RCU BH lock*/
int (*dump)(struct sk_buff *, struct tc_action *, int, int);
void (*cleanup)(struct tc_action *);
int (*lookup)(struct net *net, struct tc_action **a, u32 index,
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 7432100027b7..056dc1083aa3 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -275,6 +275,8 @@ struct tcf_proto {
/* Fast access part */
struct tcf_proto __rcu *next;
void __rcu *root;
+
+ /* called under RCU BH lock*/
int (*classify)(struct sk_buff *,
const struct tcf_proto *,
struct tcf_result *);
diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
index 06f743d8ed41..ac20266460c0 100644
--- a/net/sched/act_bpf.c
+++ b/net/sched/act_bpf.c
@@ -45,8 +45,7 @@ static int tcf_bpf(struct sk_buff *skb, const struct tc_action *act,
tcf_lastuse_update(&prog->tcf_tm);
bstats_cpu_update(this_cpu_ptr(prog->common.cpu_bstats), skb);
- rcu_read_lock();
- filter = rcu_dereference(prog->filter);
+ filter = rcu_dereference_bh(prog->filter);
if (at_ingress) {
__skb_push(skb, skb->mac_len);
bpf_compute_data_pointers(skb);
@@ -56,7 +55,6 @@ static int tcf_bpf(struct sk_buff *skb, const struct tc_action *act,
bpf_compute_data_pointers(skb);
filter_res = BPF_PROG_RUN(filter, skb);
}
- rcu_read_unlock();
/* A BPF program may overwrite the default action opcode.
* Similarly as in cls_bpf, if filter_res == -1 we use the
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index bd232d3bd022..4f092fbd1e20 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -561,15 +561,14 @@ static int tcf_csum(struct sk_buff *skb, const struct tc_action *a,
u32 update_flags;
int action;
- rcu_read_lock();
- params = rcu_dereference(p->params);
+ params = rcu_dereference_bh(p->params);
tcf_lastuse_update(&p->tcf_tm);
bstats_cpu_update(this_cpu_ptr(p->common.cpu_bstats), skb);
action = params->action;
if (unlikely(action == TC_ACT_SHOT))
- goto drop_stats;
+ goto drop;
update_flags = params->update_flags;
switch (tc_skb_protocol(skb)) {
@@ -583,16 +582,11 @@ static int tcf_csum(struct sk_buff *skb, const struct tc_action *a,
break;
}
-unlock:
- rcu_read_unlock();
return action;
drop:
- action = TC_ACT_SHOT;
-
-drop_stats:
qstats_drop_inc(this_cpu_ptr(p->common.cpu_qstats));
- goto unlock;
+ return TC_ACT_SHOT;
}
static int tcf_csum_dump(struct sk_buff *skb, struct tc_action *a, int bind,
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index 3d6e265758c0..df4060e32d43 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -820,14 +820,11 @@ static int tcf_ife_act(struct sk_buff *skb, const struct tc_action *a,
struct tcf_ife_params *p;
int ret;
- rcu_read_lock();
- p = rcu_dereference(ife->params);
+ p = rcu_dereference_bh(ife->params);
if (p->flags & IFE_ENCODE) {
ret = tcf_ife_encode(skb, a, res, p);
- rcu_read_unlock();
return ret;
}
- rcu_read_unlock();
return tcf_ife_decode(skb, a, res);
}
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 6afd89a36c69..eeb335f03102 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -181,11 +181,10 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
tcf_lastuse_update(&m->tcf_tm);
bstats_cpu_update(this_cpu_ptr(m->common.cpu_bstats), skb);
- rcu_read_lock();
m_mac_header_xmit = READ_ONCE(m->tcfm_mac_header_xmit);
m_eaction = READ_ONCE(m->tcfm_eaction);
retval = READ_ONCE(m->tcf_action);
- dev = rcu_dereference(m->tcfm_dev);
+ dev = rcu_dereference_bh(m->tcfm_dev);
if (unlikely(!dev)) {
pr_notice_once("tc mirred: target device is gone\n");
goto out;
@@ -236,7 +235,6 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
if (tcf_mirred_is_act_redirect(m_eaction))
retval = TC_ACT_SHOT;
}
- rcu_read_unlock();
return retval;
}
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index 3079e7be5bde..2608ccc83e5e 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -140,8 +140,7 @@ static int tcf_sample_act(struct sk_buff *skb, const struct tc_action *a,
bstats_cpu_update(this_cpu_ptr(s->common.cpu_bstats), skb);
retval = READ_ONCE(s->tcf_action);
- rcu_read_lock();
- psample_group = rcu_dereference(s->psample_group);
+ psample_group = rcu_dereference_bh(s->psample_group);
/* randomly sample packets according to rate */
if (psample_group && (prandom_u32() % s->rate == 0)) {
@@ -165,7 +164,6 @@ static int tcf_sample_act(struct sk_buff *skb, const struct tc_action *a,
skb_pull(skb, skb->mac_len);
}
- rcu_read_unlock();
return retval;
}
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index da56e6938c9e..a6db47ebec11 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -43,8 +43,7 @@ static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a,
tcf_lastuse_update(&d->tcf_tm);
bstats_cpu_update(this_cpu_ptr(d->common.cpu_bstats), skb);
- rcu_read_lock();
- params = rcu_dereference(d->params);
+ params = rcu_dereference_bh(d->params);
action = READ_ONCE(d->tcf_action);
if (params->flags & SKBEDIT_F_PRIORITY)
@@ -77,14 +76,11 @@ static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a,
}
if (params->flags & SKBEDIT_F_PTYPE)
skb->pkt_type = params->ptype;
-
-unlock:
- rcu_read_unlock();
return action;
+
err:
qstats_drop_inc(this_cpu_ptr(d->common.cpu_qstats));
- action = TC_ACT_SHOT;
- goto unlock;
+ return TC_ACT_SHOT;
}
static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = {
diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c
index cdc6bacfb190..c437c6d51a71 100644
--- a/net/sched/act_skbmod.c
+++ b/net/sched/act_skbmod.c
@@ -41,20 +41,14 @@ static int tcf_skbmod_run(struct sk_buff *skb, const struct tc_action *a,
* then MAX_EDIT_LEN needs to change appropriately
*/
err = skb_ensure_writable(skb, MAX_EDIT_LEN);
- if (unlikely(err)) { /* best policy is to drop on the floor */
- qstats_overlimit_inc(this_cpu_ptr(d->common.cpu_qstats));
- return TC_ACT_SHOT;
- }
+ if (unlikely(err)) /* best policy is to drop on the floor */
+ goto drop;
- rcu_read_lock();
action = READ_ONCE(d->tcf_action);
- if (unlikely(action == TC_ACT_SHOT)) {
- qstats_overlimit_inc(this_cpu_ptr(d->common.cpu_qstats));
- rcu_read_unlock();
- return action;
- }
+ if (unlikely(action == TC_ACT_SHOT))
+ goto drop;
- p = rcu_dereference(d->skbmod_p);
+ p = rcu_dereference_bh(d->skbmod_p);
flags = p->flags;
if (flags & SKBMOD_F_DMAC)
ether_addr_copy(eth_hdr(skb)->h_dest, p->eth_dst);
@@ -62,7 +56,6 @@ static int tcf_skbmod_run(struct sk_buff *skb, const struct tc_action *a,
ether_addr_copy(eth_hdr(skb)->h_source, p->eth_src);
if (flags & SKBMOD_F_ETYPE)
eth_hdr(skb)->h_proto = p->eth_type;
- rcu_read_unlock();
if (flags & SKBMOD_F_SWAPMAC) {
u16 tmpaddr[ETH_ALEN / 2]; /* ether_addr_copy() requirement */
@@ -73,6 +66,10 @@ static int tcf_skbmod_run(struct sk_buff *skb, const struct tc_action *a,
}
return action;
+
+drop:
+ qstats_overlimit_inc(this_cpu_ptr(d->common.cpu_qstats));
+ return TC_ACT_SHOT;
}
static const struct nla_policy skbmod_policy[TCA_SKBMOD_MAX + 1] = {
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index 3ec585d58762..1ab959ef3547 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -31,9 +31,7 @@ static int tunnel_key_act(struct sk_buff *skb, const struct tc_action *a,
struct tcf_tunnel_key_params *params;
int action;
- rcu_read_lock();
-
- params = rcu_dereference(t->params);
+ params = rcu_dereference_bh(t->params);
tcf_lastuse_update(&t->tcf_tm);
bstats_cpu_update(this_cpu_ptr(t->common.cpu_bstats), skb);
@@ -53,8 +51,6 @@ static int tunnel_key_act(struct sk_buff *skb, const struct tc_action *a,
break;
}
- rcu_read_unlock();
-
return action;
}
diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
index ad37f308175a..15a0ee214c9c 100644
--- a/net/sched/act_vlan.c
+++ b/net/sched/act_vlan.c
@@ -40,11 +40,9 @@ static int tcf_vlan(struct sk_buff *skb, const struct tc_action *a,
if (skb_at_tc_ingress(skb))
skb_push_rcsum(skb, skb->mac_len);
- rcu_read_lock();
-
action = READ_ONCE(v->tcf_action);
- p = rcu_dereference(v->vlan_p);
+ p = rcu_dereference_bh(v->vlan_p);
switch (p->tcfv_action) {
case TCA_VLAN_ACT_POP:
@@ -61,7 +59,7 @@ static int tcf_vlan(struct sk_buff *skb, const struct tc_action *a,
case TCA_VLAN_ACT_MODIFY:
/* No-op if no vlan tag (either hw-accel or in-payload) */
if (!skb_vlan_tagged(skb))
- goto unlock;
+ goto out;
/* extract existing tag (and guarantee no hw-accel tag) */
if (skb_vlan_tag_present(skb)) {
tci = skb_vlan_tag_get(skb);
@@ -86,18 +84,15 @@ static int tcf_vlan(struct sk_buff *skb, const struct tc_action *a,
BUG();
}
- goto unlock;
-
-drop:
- action = TC_ACT_SHOT;
- qstats_drop_inc(this_cpu_ptr(v->common.cpu_qstats));
-
-unlock:
- rcu_read_unlock();
+out:
if (skb_at_tc_ingress(skb))
skb_pull_rcsum(skb, skb->mac_len);
return action;
+
+drop:
+ qstats_drop_inc(this_cpu_ptr(v->common.cpu_qstats));
+ return TC_ACT_SHOT;
}
static const struct nla_policy vlan_policy[TCA_VLAN_MAX + 1] = {
--
2.17.1
^ permalink raw reply related
* [PATCH net-next 3/4] net/sched: refactor TC_ACT_REDIRECT handling
From: Paolo Abeni @ 2018-07-13 9:55 UTC (permalink / raw)
To: netdev
Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, Alexei Starovoitov,
Daniel Borkmann, Marcelo Ricardo Leitner
In-Reply-To: <cover.1531473946.git.pabeni@redhat.com>
This patch changes the TC_ACT_REDIRECT code path to allow
providing the redirect parameters via the tcf_result argument.
Such union is expanded to host the redirect device, the redirect
direction (ingress/egress) and the stats to be updated on error
conditions.
Actions/classifiers using TC_ACT_REDIRECT can either:
* fill the tcf_result redirect related fields
* clear such fields and use the bpf per cpu redirect info
skb_do_redirect now tries to fetch the relevant data from tcf_result
and fall back to access redirect info. It also updates the stats
accordingly to the redirect result, if provided by the caller.
This will allow using the TC_ACT_REDIRECT action in more places in
the next patch.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
include/net/sch_generic.h | 15 ++++++++++++++-
net/core/dev.c | 4 ++--
net/core/filter.c | 29 +++++++++++++++++++++++------
net/core/lwt_bpf.c | 5 ++++-
net/sched/act_bpf.c | 4 +++-
net/sched/cls_bpf.c | 8 +++++---
6 files changed, 51 insertions(+), 14 deletions(-)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 056dc1083aa3..dd9e00d017b3 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -235,9 +235,22 @@ struct tcf_result {
u32 classid;
};
const struct tcf_proto *goto_tp;
+
+ /* used by the TC_ACT_REDIRECT action */
+ struct {
+ /* device and direction, or 0 bpf redirect */
+ long dev_ingress;
+ struct gnet_stats_queue *qstats;
+ };
};
};
+#define TCF_RESULT_REDIR_DEV(res) \
+ ((struct net_device *)((res)->dev_ingress & ~1))
+#define TCF_RESULT_REDIR_INGRESS(res) ((res)->dev_ingress & 1)
+#define TCF_RESULT_SET_REDIRECT(res, dev, ingress) \
+ ((res)->dev_ingress = (long)(dev) | (!!(ingress)))
+
struct tcf_proto_ops {
struct list_head head;
char kind[IFNAMSIZ];
@@ -543,7 +556,7 @@ struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
struct netlink_ext_ack *extack);
void __qdisc_calculate_pkt_len(struct sk_buff *skb,
const struct qdisc_size_table *stab);
-int skb_do_redirect(struct sk_buff *);
+int skb_do_redirect(struct sk_buff *skb, struct tcf_result *res);
static inline void skb_reset_tc(struct sk_buff *skb)
{
diff --git a/net/core/dev.c b/net/core/dev.c
index 14a748ee8cc9..a283dbfde30c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3538,7 +3538,7 @@ sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev)
return NULL;
case TC_ACT_REDIRECT:
/* No need to push/pop skb's mac_header here on egress! */
- skb_do_redirect(skb);
+ skb_do_redirect(skb, &cl_res);
*ret = NET_XMIT_SUCCESS;
return NULL;
default:
@@ -4600,7 +4600,7 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret,
* redirecting to another netdev
*/
__skb_push(skb, skb->mac_len);
- skb_do_redirect(skb);
+ skb_do_redirect(skb, &cl_res);
return NULL;
default:
break;
diff --git a/net/core/filter.c b/net/core/filter.c
index b9ec916f4e3a..4f64cf5189e6 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2062,19 +2062,36 @@ BPF_CALL_2(bpf_redirect, u32, ifindex, u64, flags)
return TC_ACT_REDIRECT;
}
-int skb_do_redirect(struct sk_buff *skb)
+int skb_do_redirect(struct sk_buff *skb, struct tcf_result *res)
{
- struct redirect_info *ri = this_cpu_ptr(&redirect_info);
+ struct gnet_stats_queue *stats;
struct net_device *dev;
+ int ret, flags;
- dev = dev_get_by_index_rcu(dev_net(skb->dev), ri->ifindex);
- ri->ifindex = 0;
+ if (!res->dev_ingress) {
+ struct redirect_info *ri = this_cpu_ptr(&redirect_info);
+
+ dev = dev_get_by_index_rcu(dev_net(skb->dev), ri->ifindex);
+ flags = ri->flags;
+ ri->ifindex = 0;
+ stats = NULL;
+ } else {
+ dev = TCF_RESULT_REDIR_DEV(res);
+ flags = TCF_RESULT_REDIR_INGRESS(res) ? BPF_F_INGRESS : 0;
+ stats = res->qstats;
+ }
if (unlikely(!dev)) {
kfree_skb(skb);
- return -EINVAL;
+ ret = -EINVAL;
+ goto out;
}
- return __bpf_redirect(skb, dev, ri->flags);
+ ret = __bpf_redirect(skb, dev, flags);
+
+out:
+ if (ret && stats)
+ qstats_overlimit_inc(res->qstats);
+ return ret;
}
static const struct bpf_func_proto bpf_redirect_proto = {
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
index e7e626fb87bb..8dde1093994a 100644
--- a/net/core/lwt_bpf.c
+++ b/net/core/lwt_bpf.c
@@ -65,7 +65,10 @@ static int run_lwt_bpf(struct sk_buff *skb, struct bpf_lwt_prog *lwt,
lwt->name ? : "<unknown>");
ret = BPF_OK;
} else {
- ret = skb_do_redirect(skb);
+ struct tcf_result res;
+
+ res.dev_ingress = 0;
+ ret = skb_do_redirect(skb, &res);
if (ret == 0)
ret = BPF_REDIRECT;
}
diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
index ac20266460c0..6fd46b691181 100644
--- a/net/sched/act_bpf.c
+++ b/net/sched/act_bpf.c
@@ -67,10 +67,12 @@ static int tcf_bpf(struct sk_buff *skb, const struct tc_action *act,
* returned.
*/
switch (filter_res) {
+ case TC_ACT_REDIRECT:
+ res->dev_ingress = 0;
+ /* fall-through */
case TC_ACT_PIPE:
case TC_ACT_RECLASSIFY:
case TC_ACT_OK:
- case TC_ACT_REDIRECT:
action = filter_res;
break;
case TC_ACT_SHOT:
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
index 66e0ac9811f9..f0fb7ded8fe2 100644
--- a/net/sched/cls_bpf.c
+++ b/net/sched/cls_bpf.c
@@ -65,14 +65,16 @@ static const struct nla_policy bpf_policy[TCA_BPF_MAX + 1] = {
.len = sizeof(struct sock_filter) * BPF_MAXINSNS },
};
-static int cls_bpf_exec_opcode(int code)
+static int cls_bpf_exec_opcode(int code, struct tcf_result *res)
{
switch (code) {
+ case TC_ACT_REDIRECT:
+ res->dev_ingress = 0;
+ /* fall-through */
case TC_ACT_OK:
case TC_ACT_SHOT:
case TC_ACT_STOLEN:
case TC_ACT_TRAP:
- case TC_ACT_REDIRECT:
case TC_ACT_UNSPEC:
return code;
default:
@@ -113,7 +115,7 @@ static int cls_bpf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
res->classid = TC_H_MAJ(prog->res.classid) |
qdisc_skb_cb(skb)->tc_classid;
- ret = cls_bpf_exec_opcode(filter_res);
+ ret = cls_bpf_exec_opcode(filter_res, res);
if (ret == TC_ACT_UNSPEC)
continue;
break;
--
2.17.1
^ permalink raw reply related
* [PATCH net-next 4/4] act_mirred: use ACT_REDIRECT when possible
From: Paolo Abeni @ 2018-07-13 9:55 UTC (permalink / raw)
To: netdev
Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, Alexei Starovoitov,
Daniel Borkmann, Marcelo Ricardo Leitner
In-Reply-To: <cover.1531473946.git.pabeni@redhat.com>
When mirred is invoked from the ingress path, and it wants to redirect
the processed packet, it can now use the ACT_REDIRECT action,
filling the tcf_result accordingly.
This avoids a skb_clone() in the TC S/W data path giving a ~10%
improvement in forwarding performances. Overall TC S/W performances
are now comparable to the kernel openswitch datapath.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
net/sched/act_mirred.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index eeb335f03102..b19317426117 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -175,6 +175,7 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
struct net_device *dev;
struct sk_buff *skb2;
int retval, err = 0;
+ bool want_ingress;
int m_eaction;
int mac_len;
@@ -185,6 +186,17 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
m_eaction = READ_ONCE(m->tcfm_eaction);
retval = READ_ONCE(m->tcf_action);
dev = rcu_dereference_bh(m->tcfm_dev);
+ want_ingress = tcf_mirred_act_wants_ingress(m_eaction);
+ if (skb_at_tc_ingress(skb) && tcf_mirred_is_act_redirect(m_eaction)) {
+ skb->tc_redirected = 1;
+ skb->tc_from_ingress = 1;
+
+ /* the core redirect code will check dev and its status */
+ TCF_RESULT_SET_REDIRECT(res, dev, want_ingress);
+ res->qstats = this_cpu_ptr(m->common.cpu_qstats);
+ return TC_ACT_REDIRECT;
+ }
+
if (unlikely(!dev)) {
pr_notice_once("tc mirred: target device is gone\n");
goto out;
@@ -204,8 +216,7 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
* and devices expect a mac header on xmit, then mac push/pull is
* needed.
*/
- if (skb_at_tc_ingress(skb) != tcf_mirred_act_wants_ingress(m_eaction) &&
- m_mac_header_xmit) {
+ if (skb_at_tc_ingress(skb) != want_ingress && m_mac_header_xmit) {
if (!skb_at_tc_ingress(skb)) {
/* caught at egress, act ingress: pull mac */
mac_len = skb_network_header(skb) - skb_mac_header(skb);
--
2.17.1
^ permalink raw reply related
* plusb module support for PL2501
From: James Betts @ 2018-07-13 9:58 UTC (permalink / raw)
To: netdev
The plusb module appears to be not maintained.
I would like to submit a patch for the PL2501 device;
> lsusb | grep PL2501
Bus 001 Device 053: ID 067b:2501 Prolific Technology, Inc. PL2501
USB-USB Bridge (USB 2.0)
There have been patches previously submitted for this device but they
have not been applied and I was wondering if there was a technical
reason for the patches not being applied ?
There are comments in the code (drivers/net/usb/plusb.c) but the
associated patch that added the comments did not add support for the
device.
Can I submit a suitable patch for this device ?
Thanks
James
^ permalink raw reply
* 答复: 答复: [PATCH][net-next] bridge: clean up mtu_set_by_user setting to false and comments
From: Li,Rongqing @ 2018-07-13 10:56 UTC (permalink / raw)
To: Nikolay Aleksandrov, netdev@vger.kernel.org
In-Reply-To: <6b2d6c0c-5100-dd8e-66f4-2849979faa4c@cumulusnetworks.com>
> This is used to differentiate when auto adjust is used and when user has set
> the MTU.
> As I already said everything is working as expected and you should not
> remove this code.
>
I see, thank you, and sorry for the noise.
-R
^ 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