Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] soc: ti/knav_dma: include dmaengine header
From: David Miller @ 2017-09-05 16:12 UTC (permalink / raw)
  To: arnd; +Cc: arm, dave.jiang, netdev, m-karicheri2, linux-kernel
In-Reply-To: <20170905083146.1289546-1-arnd@arndb.de>

From: Arnd Bergmann <arnd@arndb.de>
Date: Tue,  5 Sep 2017 10:31:35 +0200

> A header file cleanup apparently caused a build regression
> with one driver using the knav infrastructure:
> 
> In file included from drivers/net/ethernet/ti/netcp_core.c:30:0:
> include/linux/soc/ti/knav_dma.h:129:30: error: field 'direction' has incomplete type
>   enum dma_transfer_direction direction;
>                               ^~~~~~~~~
> drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_txpipe_open':
> drivers/net/ethernet/ti/netcp_core.c:1349:21: error: 'DMA_MEM_TO_DEV' undeclared (first use in this function); did you mean 'DMA_MEMORY_MAP'?
>   config.direction = DMA_MEM_TO_DEV;
>                      ^~~~~~~~~~~~~~
>                      DMA_MEMORY_MAP
> drivers/net/ethernet/ti/netcp_core.c:1349:21: note: each undeclared identifier is reported only once for each function it appears in
> drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_setup_navigator_resources':
> drivers/net/ethernet/ti/netcp_core.c:1659:22: error: 'DMA_DEV_TO_MEM' undeclared (first use in this function); did you mean 'DMA_DESC_HOST'?
>   config.direction  = DMA_DEV_TO_MEM;
> 
> As the header is no longer included implicitly through netdevice.h,
> we should include it in the header that references the enum.
> 
> Fixes: 0dd5759dbb1c ("net: remove dmaengine.h inclusion from netdevice.h")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> If the cleanup patch hasn't been submitted for mainline yet, please
> add this fixup to the net-next tree, otherwise I'll merge it through
> arm-soc.

Applied to net-next.

^ permalink raw reply

* Re: [PATCH iproute2 master 0/2] Two minor BPF updates
From: Stephen Hemminger @ 2017-09-05 16:27 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: ast, netdev
In-Reply-To: <cover.1504570627.git.daniel@iogearbox.net>

On Tue,  5 Sep 2017 02:24:30 +0200
Daniel Borkmann <daniel@iogearbox.net> wrote:

> Two minor updates including a small cleanup for dumping
> the trace pipe and one for consolidating prog dumps for
> tc and xdp to use bpf_prog_info_by_fd() when possible.
> 
> Thanks!
> 
> Daniel Borkmann (2):
>   bpf: minor cleanups for bpf_trace_pipe
>   bpf: consolidate dumps to use bpf_dump_prog_info
> 
>  include/bpf_util.h |  2 +-
>  ip/ipaddress.c     |  6 ++++--
>  ip/iplink_xdp.c    | 19 +++++++++++++++----
>  ip/xdp.h           |  2 +-
>  lib/bpf.c          | 31 ++++++++++++++++++-------------
>  tc/f_bpf.c         |  8 ++++----
>  tc/m_bpf.c         |  8 ++++----
>  7 files changed, 47 insertions(+), 29 deletions(-)
> 

Applied, thanks Daniel

^ permalink raw reply

* Re: [PATCH iproute2/master] tc actions: store and dump correct length of user cookies
From: Stephen Hemminger @ 2017-09-05 16:27 UTC (permalink / raw)
  To: Simon Horman; +Cc: netdev, oss-drivers, Jamal Hadi Salim
In-Reply-To: <1504609584-20026-1-git-send-email-simon.horman@netronome.com>

On Tue,  5 Sep 2017 13:06:24 +0200
Simon Horman <simon.horman@netronome.com> wrote:

> Correct two errors which cancel each other out:
> * Do not send twice the length of the actual provided by the user to the kernel
> * Do not dump half the length of the cookie provided by the kernel
> 
> As the cookie is now stored in the kernel at its correct length rather
> than double the that length cookies of up to the maximum size of 16 bytes
> may now be stored rather than a maximum of half that length.
> 
> Output of dump is the same before and after this change,
> but the data stored in the kernel is now exactly the cookie
> rather than the cookie + as many trailing zeros.
> 
> Before:
>  # tc filter add dev eth0 protocol ip parent ffff: \
>        flower ip_proto udp action drop \
>        cookie 0123456789abcdef0123456789abcdef
>  RTNETLINK answers: Invalid argument
> 
> After:
>  # tc filter add dev eth0 protocol ip parent ffff: \
>        flower ip_proto udp action drop \
>        cookie 0123456789abcdef0123456789abcdef
>  # tc filter show dev eth0 ingress
>    eth_type ipv4
>    ip_proto udp
>    not_in_hw
> 	 action order 1: gact action drop
> 	  random type none pass val 0
> 	  index 1 ref 1 bind 1 installed 1 sec used 1 sec
> 	 Action statistics:
> 	 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> 	 backlog 0b 0p requeues 0
> 	 cookie len 16 0123456789abcdef0123456789abcdef
> 
> Fixes: fd8b3d2c1b9b ("actions: Add support for user cookies")
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Simon Horman <simon.horman@netronome.com>

Applied thanks

^ permalink raw reply

* Re: [PATCH net] rds: Fix non-atomic operation on shared flag variable
From: Santosh Shilimkar @ 2017-09-05 16:33 UTC (permalink / raw)
  To: Håkon Bugge
  Cc: David S . Miller, netdev, linux-rdma, rds-devel, linux-kernel,
	knut.omang, wei.lin.guay
In-Reply-To: <20170905154201.30198-1-Haakon.Bugge@oracle.com>

On 9/5/2017 8:42 AM, Håkon Bugge wrote:
> The bits in m_flags in struct rds_message are used for a plurality of
> reasons, and from different contexts. To avoid any missing updates to
> m_flags, use the atomic set_bit() instead of the non-atomic equivalent.
> 
> Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
> Reviewed-by: Knut Omang <knut.omang@oracle.com>
> Reviewed-by: Wei Lin Guay <wei.lin.guay@oracle.com>
> ---
>   net/rds/send.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/rds/send.c b/net/rds/send.c
> index 41b9f0f..058a407 100644
> --- a/net/rds/send.c
> +++ b/net/rds/send.c
> @@ -273,7 +273,7 @@ int rds_send_xmit(struct rds_conn_path *cp)
>   			len = ntohl(rm->m_inc.i_hdr.h_len);
>   			if (cp->cp_unacked_packets == 0 ||
>   			    cp->cp_unacked_bytes < len) {
> -				__set_bit(RDS_MSG_ACK_REQUIRED, &rm->m_flags);
> +				set_bit(RDS_MSG_ACK_REQUIRED, &rm->m_flags);
>   
>   				cp->cp_unacked_packets =
>   					rds_sysctl_max_unacked_packets;
> @@ -829,7 +829,7 @@ static int rds_send_queue_rm(struct rds_sock *rs, struct rds_connection *conn,
>   		 * throughput hits a certain threshold.
>   		 */
>   		if (rs->rs_snd_bytes >= rds_sk_sndbuf(rs) / 2)
> -			__set_bit(RDS_MSG_ACK_REQUIRED, &rm->m_flags);
> +			set_bit(RDS_MSG_ACK_REQUIRED, &rm->m_flags);
>   
>   		list_add_tail(&rm->m_sock_item, &rs->rs_send_queue);
>   		set_bit(RDS_MSG_ON_SOCK, &rm->m_flags);
> 
Indeed, these couple of instances remained for the m_flags.
Patch looks good. Thanks !!

Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>

^ permalink raw reply

* Re: [PATCH iproute2 master 2/2] bpf: consolidate dumps to use bpf_dump_prog_info
From: Stephen Hemminger @ 2017-09-05 16:35 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: ast, netdev
In-Reply-To: <1e96ef342a4f34ee8c8119ee8cc1ed7092ea5ced.1504570627.git.daniel@iogearbox.net>

On Tue,  5 Sep 2017 02:24:32 +0200
Daniel Borkmann <daniel@iogearbox.net> wrote:

> Consolidate dump of prog info to use bpf_dump_prog_info() when possible.
> Moving forward, we want to have a consistent output for BPF progs when
> being dumped. E.g. in cls/act case we used to dump tag as a separate
> netlink attribute before we had BPF_OBJ_GET_INFO_BY_FD bpf(2) command.
> 
> Move dumping tag into bpf_dump_prog_info() as well, and only dump the
> netlink attribute for older kernels. Also, reuse bpf_dump_prog_info()
> for XDP case, so we can dump tag and whether program was jited, which
> we currently don't show.
> 
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>

I applied this to master, and resolved conflicts with net-next.
But the dump with JSON of xdp is now incomplete.

^ permalink raw reply

* Re: [PATCH iproute2 master 2/2] bpf: consolidate dumps to use bpf_dump_prog_info
From: Daniel Borkmann @ 2017-09-05 16:37 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: ast, netdev
In-Reply-To: <20170905093501.2f1fbbfc@xeon-e3>

On 09/05/2017 06:35 PM, Stephen Hemminger wrote:
[...]
> I applied this to master, and resolved conflicts with net-next.
> But the dump with JSON of xdp is now incomplete.

Ok, I will check it out, and send a follow-up to make it
complete again.

^ permalink raw reply

* Re: 915f3e3f76 ("mac80211_hwsim: Replace bogus hrtimer clockid"): BUG: kernel reboot-without-warning in test stage
From: Sebastian Andrzej Siewior @ 2017-09-05 16:41 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: kernel test robot, LKP, linux-kernel, netdev, linux-wireless, wfg
In-Reply-To: <alpine.DEB.2.20.1709050910150.1900@nanos>

On 2017-09-05 09:12:40 [+0200], Thomas Gleixner wrote:
> Sorry, no. That bisect is completely bogus. The commit in question merily
> replaces the unsupported clockid with a valid one.

The bisect is correct. It just has problems to express itself properly. So
the table says:

| WARNING:at_kernel/time/hrtimer.c:#hrtimer_init  | 7   |     |    |   |                                                                                
| BUG:kernel_reboot-without-warning_in_test_stage | 0   | 12  | 6  | 6 |                                                                                

which means _before_ your commit it counted a warning in hrtimer_init()
(an unsupported clock id was used). With your commit, the warning was
gone and I *think* the userland then printed
"BUG:kernel_reboot-without-warning_in_test_stage" because it had no
warning.
It seems that the bot learned to live with that warning which was around
for more than three years. Now that you removed it, it seems to be a
mistake to do so because nobody complained about it so far.

> Thanks,
> 
> 	tglx

Sebastian

^ permalink raw reply

* [ANNOUNCE] Iproute2 for Linux 4.13
From: Stephen Hemminger @ 2017-09-05 16:49 UTC (permalink / raw)
  To: netdev, linux-kernel


Update to iproute2 utility to support new features in Linux 4.13.
This is a larger than usual release because of lots of updates for BPF
and the new RDMA utility. Lots of cleanups and Coverity reported
potential issues as well.

Source:
  https://www.kernel.org/pub/linux/utils/net/iproute2/iproute2-4.13.0.tar.gz

Repository:
  git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git

Report problems (or enhancements) to the netdev@vger.kernel.org mailing list.

---
Alexander Alemayhu (1):
      examples/bpf: update list of examples

Andreas Henriksson (1):
      ss: fix help/man TCP-STATE description for listening

Arkadi Sharshevsky (1):
      bridge: Distinguish between externally learned vs offloaded FDBs

Casey Callendrello (1):
      netns: make /var/run/netns bind-mount recursive

Daniel Borkmann (8):
      bpf: remove obsolete samples
      bpf: support loading map in map from obj
      bpf: dump id/jited info for cls/act programs
      bpf: improve error reporting around tail calls
      bpf: fix mnt path when from env
      bpf: unbreak libelf linkage for bpf obj loader
      bpf: minor cleanups for bpf_trace_pipe
      bpf: consolidate dumps to use bpf_dump_prog_info

David Ahern (2):
      lib: Dump ext-ack string by default
      libnetlink: Fix extack attribute parsing

Girish Moodalbail (1):
      geneve: support for modifying geneve device

Hangbin Liu (1):
      utils: return default family when rtm_family is not RTNL_FAMILY_IPMR/IP6MR

Jakub Kicinski (3):
      bpf: print xdp offloaded mode
      bpf: add xdpdrv for requesting XDP driver mode
      bpf: allow requesting XDP HW offload

Jiri Benc (2):
      tc: m_tunnel_key: reformat the usage text
      tc: m_tunnel_key: add csum/nocsum option

Jiri Pirko (7):
      tc_filter: add support for chain index
      tc: actions: add helpers to parse and print control actions
      tc/actions: introduce support for goto chain action
      tc: flower: add support for tcp flags
      tc: gact: fix control action parsing
      tc: add support for TRAP action
      tc: don't print error message on miss when parsing action with default

Leon Romanovsky (8):
      utils: Move BIT macro to common header
      rdma: Add basic infrastructure for RDMA tool
      rdma: Add dev object
      rdma: Add link object
      rdma: Add json and pretty outputs
      rdma: Implement json output for dev object
      rdma: Add json output to link object
      rdma: Add initial manual for the tool

Martin KaFai Lau (1):
      bpf: Add support for IFLA_XDP_PROG_ID

Matteo Croce (3):
      tc: fix typo in manpage
      netns: avoid directory traversal
      netns: more input validation

Michal Kubecek (2):
      iplink: check for message truncation in iplink_get()
      iplink: double the buffer size also in iplink_get()

Or Gerlitz (1):
      tc: flower: add support for matching on ip tos and ttl

Phil Sutter (58):
      bpf: Make bytecode-file reading a little more robust
      Really fix get_addr() and get_prefix() error messages
      tc-simple: Fix documentation
      examples: Some shell fixes to cbq.init
      ifcfg: Quote left-hand side of [ ] expression
      tipc/node: Fix socket fd check in cmd_node_get_addr()
      iproute_lwtunnel: Argument to strerror must be positive
      iproute_lwtunnel: csum_mode value checking was ineffective
      ss: Don't leak fd in tcp_show_netlink_file()
      tc/em_ipset: Don't leak sockfd on error path
      ipvrf: Fix error path of vrf_switch()
      ifstat: Fix memleak in error case
      ifstat: Fix memleak in dump_kern_db() for json output
      ss: Fix potential memleak in unix_stats_print()
      tipc/bearer: Fix resource leak in error path
      devlink: No need for this self-assignment
      ipntable: No need to check and assign to parms_rta
      iproute: Fix for missing 'Oifs:' display
      lib/rt_names: Drop dead code in rtnl_rttable_n2a()
      ss: Skip useless check in parse_hostcond()
      ss: Drop useless assignment
      tc/m_gact: Drop dead code
      ipaddress: Avoid accessing uninitialized variable lcl
      iplink_can: Prevent overstepping array bounds
      ipmaddr: Avoid accessing uninitialized data
      ss: Use C99 initializer in netlink_show_one()
      netem/maketable: Check return value of fstat()
      tc/q_multiq: Don't pass garbage in TCA_OPTIONS
      iproute: Check mark value input
      iplink_vrf: Complain if main table is not found
      devlink: Check return code of strslashrsplit()
      lib/bpf: Don't leak fp in bpf_find_mntpt()
      ifstat, nstat: Check fdopen() return value
      tc/q_netem: Don't dereference possibly NULL pointer
      tc/tc_filter: Make sure filter name is not empty
      tipc/bearer: Prevent NULL pointer dereference
      ipntable: Avoid memory allocation for filter.name
      lib/fs: Fix format string in find_fs_mount()
      lib/inet_proto: Review inet_proto_{a2n,n2a}()
      lnstat_util: Simplify alloc_and_open() a bit
      tc/m_xt: Fix for potential string buffer overflows
      lib/ll_map: Choose size of new cache items at run-time
      ss: Make struct tcpstat fields 'timer' and 'timeout' unsigned
      ss: Make sure scanned index value to unix_state_map is sane
      netem/maketable: Check return value of fscanf()
      lib/bpf: Check return value of write()
      lib/fs: Fix and simplify make_path()
      lib/libnetlink: Don't pass NULL parameter to memcpy()
      ss: Fix for added diag support check
      link_gre6: Fix for changing tclass/flowlabel
      link_gre6: Print the tunnel's tclass setting
      utils: Implement strlcpy() and strlcat()
      Convert the obvious cases to strlcpy()
      Convert harmful calls to strncpy() to strlcpy()
      ipxfrm: Replace STRBUF_CAT macro with strlcat()
      tc_util: No need to terminate an snprintf'ed buffer
      lnstat_util: Make sure buffer is NUL-terminated
      lib/bpf: Fix bytecode-file parsing

Philip Prindeville (1):
      iproute2: add support for GRE ignore-df knob

Roopa Prabhu (2):
      ip: extend route get to return matching fib route
      iproute: extend route get for mpls routes

Simon Horman (1):
      tc actions: store and dump correct length of user cookies

Stephen Hemminger (27):
      update to current net-next headers
      update headers to get changes for TCA_FLOWER
      update headers to get IFLA_EVENT
      updated headers from net-next
      update headers from net-next (bpf and tc)
      more bpf header updates
      update headers to get TCA_TUNNEL_CSUM
      update kernel headers from net-next
      update headers to 4.13-rc1
      remove duplicated #include's
      Update headers from net-next
      ip: change flag names to an array
      update headers from 4.13-rc4
      tc: fix m_simple usage
      iproute: Add support for extended ack to rtnl_talk
      ss: enclose IPv6 address in brackets
      lib: fix extended ack with and without libmnl
      lib: need to pass LIBMNL flag
      tc, ip: more Makefile updates for LIBMNL
      vti6: fix local/remote any addr handling
      change how Config is used in Makefile's
      vti: print keys in hex not dotted notation
      rdma: fix duplicate initialization in port_names
      libnetlink: drop unused parameter to rtnl_dump_done
      bpf: drop unused parameter to bpf_report_map_in_map
      tc: use named initializer for default mqprio options
      v4.13.0

Vlad Yasevich (1):
      ip: Add IFLA_EVENT output to ip monitor

Élie Bouttier (1):
      ip route: replace exits with returns

^ permalink raw reply

* Re: [PATCH net v2] net: sched: don't use GFP_KERNEL under spin lock
From: Eric Dumazet @ 2017-09-05 17:17 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, jiri, Chris Mi, xiyou.wangcong, jhs, oss-drivers
In-Reply-To: <20170905153123.13209-1-jakub.kicinski@netronome.com>

On Tue, 2017-09-05 at 08:31 -0700, Jakub Kicinski wrote:
> The new TC IDR code uses GFP_KERNEL under spin lock.  Which leads
> to:
> 
> [  582.621091] BUG: sleeping function called from invalid context at ../mm/slab.h:416
> [  582.629721] in_atomic(): 1, irqs_disabled(): 0, pid: 3379, name: tc
> [  582.636939] 2 locks held by tc/3379:
> [  582.641049]  #0:  (rtnl_mutex){+.+.+.}, at: [<ffffffff910354ce>] rtnetlink_rcv_msg+0x92e/0x1400
> [  582.650958]  #1:  (&(&tn->idrinfo->lock)->rlock){+.-.+.}, at: [<ffffffff9110a5e0>] tcf_idr_create+0x2f0/0x8e0
> [  582.662217] Preemption disabled at:
> [  582.662222] [<ffffffff9110a5e0>] tcf_idr_create+0x2f0/0x8e0
> [  582.672592] CPU: 9 PID: 3379 Comm: tc Tainted: G        W       4.13.0-rc7-debug-00648-g43503a79b9f0 #287
> [  582.683432] Hardware name: Dell Inc. PowerEdge R730/072T6D, BIOS 2.3.4 11/08/2016
> [  582.691937] Call Trace:
> ...
> [  582.742460]  kmem_cache_alloc+0x286/0x540
> [  582.747055]  radix_tree_node_alloc.constprop.6+0x4a/0x450
> [  582.753209]  idr_get_free_cmn+0x627/0xf80
> ...
> [  582.815525]  idr_alloc_cmn+0x1a8/0x270
> ...
> [  582.833804]  tcf_idr_create+0x31b/0x8e0
> ...
> 
> Try to preallocate the memory with idr_prealloc(GFP_KERNEL)
> (as suggested by Eric Dumazet), and change the allocation 
> flags under spin lock.
> 
> Fixes: 65a206c01e8e ("net/sched: Change act_api and act_xxx modules to use IDR")
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Simon Horman <simon.horman@netronome.com>
> ---


Acked-by: Eric Dumazet <edumazet@google.com>

Not related to your patch, but it looks like idr_preload() has a bug
added in 4.11.  I will send a fix to lkml.

^ permalink raw reply

* Re: [PATCH net-next 2/4] ip/options: explicitly provide net ns to __ip_options_echo()
From: Eric Dumazet @ 2017-09-05 17:18 UTC (permalink / raw)
  To: Paolo Abeni, David S. Miller; +Cc: netdev, Eric Dumazet, Hannes Frederic Sowa
In-Reply-To: <31096a330a56cfd40eea136be505270184fbb5d4.1501775813.git.pabeni@redhat.com>

On Thu, 2017-08-03 at 18:07 +0200, Paolo Abeni wrote:
> __ip_options_echo() uses the current network namespace, and
> currently retrives it via skb->dst->dev.
> 
> This commit adds an explicit 'net' argument to __ip_options_echo()
> and update all the call sites to provide it, usually via a simpler
> sock_net().
> 
> After this change, __ip_options_echo() no more needs to access
> skb->dst and we can drop a couple of hack to preserve such
> info in the rx path.
> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---

David, Paolo

This commit (91ed1e666a4ea2e260452a7d7d311ac5ae852cba "ip/options:
explicitly provide net ns to __ip_options_echo()")

needs to be backported to linux-4.13 stable version to avoid these kind
of crashes [1]

This is because of MSG_PEEK operation, hitting skb_consume_udp() while
skb is still in receive queue.

Next read() finding again the skb then can see a NULL skb->dst

Thanks !

[1]
general protection fault: 0000 [#1] SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 0 PID: 3017 Comm: syzkaller446772 Not tainted 4.13.0+ #68
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
task: ffff8801cd0a4380 task.stack: ffff8801cc498000
RIP: 0010:__ip_options_echo+0xea8/0x1430 net/ipv4/ip_options.c:143
RSP: 0018:ffff8801cc49f628 EFLAGS: 00010246
RAX: dffffc0000000000 RBX: ffff8801cc49f928 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000004
RBP: ffff8801cc49f6b8 R08: ffff8801cc49f936 R09: ffffed0039893f28
R10: 0000000000000003 R11: ffffed0039893f27 R12: ffff8801cc49f918
R13: ffff8801ccbcf36c R14: 000000000000000f R15: 0000000000000018
FS:  0000000000979880(0000) GS:ffff8801db200000(0000)
knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000200c0ff0 CR3: 00000001cc4ed000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 ip_options_echo include/net/ip.h:574 [inline]
 ip_cmsg_recv_retopts net/ipv4/ip_sockglue.c:91 [inline]
 ip_cmsg_recv_offset+0xa17/0x1280 net/ipv4/ip_sockglue.c:207
 udp_recvmsg+0xe0b/0x1260 net/ipv4/udp.c:1641
 inet_recvmsg+0x14c/0x5f0 net/ipv4/af_inet.c:793
 sock_recvmsg_nosec net/socket.c:792 [inline]
 sock_recvmsg+0xc9/0x110 net/socket.c:799
 SYSC_recvfrom+0x2dc/0x570 net/socket.c:1788
 SyS_recvfrom+0x40/0x50 net/socket.c:1760
 entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x444c89
RSP: 002b:00007ffd80c788e8 EFLAGS: 00000286 ORIG_RAX: 000000000000002d
RAX: ffffffffffffffda RBX: ffffffffffffffff RCX: 0000000000444c89
RDX: 0000000000000000 RSI: 0000000020bc0000 RDI: 0000000000000004
RBP: 0000000000000082 R08: 00000000200c0ff0 R09: 0000000000000010
R10: 0000000000000000 R11: 0000000000000286 R12: 0000000000402390
R13: 0000000000402420 R14: 0000000000000000 R15: 0000000000000000
Code: f6 c1 01 0f 85 a5 01 00 00 48 89 4d b8 e8 31 e9 6b fd 48 8b 4d b8
48 b8 00 00 00 00 00 fc ff df 48 83 e1 fe 48 89 ca 48 c1 ea 03 <80> 3c
02 00 0f 85 41 02 00 00 48 8b 09 48 b8 00 00 00 00 00 fc 
RIP: __ip_options_echo+0xea8/0x1430 net/ipv4/ip_options.c:143 RSP:
ffff8801cc49f628
---[ end trace b30d95b284222843 ]---
Kernel panic - not syncing: Fatal exception

^ permalink raw reply

* [PATCH] radix-tree: must check __radix_tree_preload() return value
From: Eric Dumazet @ 2017-09-05 17:59 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Matthew Wilcox, Kirill A. Shutemov, Andrew Morton, netdev,
	Linus Torvalds, linux-kernel

From: Eric Dumazet <edumazet@google.com>

__radix_tree_preload() only disables preemption if no error is returned.

So we really need to make sure callers always check the return value.

idr_preload() contract is to always disable preemption, so we need
to add a missing preempt_disable() if an error happened.

Similarly, ida_pre_get() only needs to call preempt_enable() in the
case no error happened.

Fixes: 0a835c4f090a ("Reimplement IDR and IDA using the radix tree")
Fixes: 7ad3d4d85c7a ("ida: Move ida_bitmap to a percpu variable")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: <stable@vger.kernel.org>    [4.11+]
---
 lib/radix-tree.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 3527eb364964..fac702039304 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -463,7 +463,7 @@ radix_tree_node_free(struct radix_tree_node *node)
  * To make use of this facility, the radix tree must be initialised without
  * __GFP_DIRECT_RECLAIM being passed to INIT_RADIX_TREE().
  */
-static int __radix_tree_preload(gfp_t gfp_mask, unsigned nr)
+static __must_check int __radix_tree_preload(gfp_t gfp_mask, unsigned nr)
 {
 	struct radix_tree_preload *rtp;
 	struct radix_tree_node *node;
@@ -2104,7 +2104,10 @@ EXPORT_SYMBOL(radix_tree_tagged);
  */
 void idr_preload(gfp_t gfp_mask)
 {
-	__radix_tree_preload(gfp_mask, IDR_PRELOAD_SIZE);
+	int ret = __radix_tree_preload(gfp_mask, IDR_PRELOAD_SIZE);
+
+	if (ret)
+		preempt_disable();
 }
 EXPORT_SYMBOL(idr_preload);
 
@@ -2118,13 +2121,14 @@ EXPORT_SYMBOL(idr_preload);
  */
 int ida_pre_get(struct ida *ida, gfp_t gfp)
 {
-	__radix_tree_preload(gfp, IDA_PRELOAD_SIZE);
+	int ret = __radix_tree_preload(gfp, IDA_PRELOAD_SIZE);
 	/*
 	 * The IDA API has no preload_end() equivalent.  Instead,
 	 * ida_get_new() can return -EAGAIN, prompting the caller
 	 * to return to the ida_pre_get() step.
 	 */
-	preempt_enable();
+	if (!ret)
+		preempt_enable();
 
 	if (!this_cpu_read(ida_bitmap)) {
 		struct ida_bitmap *bitmap = kmalloc(sizeof(*bitmap), gfp);

^ permalink raw reply related

* Re: [PATCH] radix-tree: must check __radix_tree_preload() return value
From: Linus Torvalds @ 2017-09-05 18:07 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Matthew Wilcox, Matthew Wilcox, Kirill A. Shutemov, Andrew Morton,
	netdev, linux-kernel
In-Reply-To: <1504634367.15310.59.camel@edumazet-glaptop3.roam.corp.google.com>

On Tue, Sep 5, 2017 at 10:59 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> @@ -2104,7 +2104,10 @@ EXPORT_SYMBOL(radix_tree_tagged);
>   */
>  void idr_preload(gfp_t gfp_mask)
>  {
> -       __radix_tree_preload(gfp_mask, IDR_PRELOAD_SIZE);
> +       int ret = __radix_tree_preload(gfp_mask, IDR_PRELOAD_SIZE);
> +
> +       if (ret)
> +               preempt_disable();
>  }
>  EXPORT_SYMBOL(idr_preload);

Is there a reason for the "ret" variable that is entirely mis-named,
since it's never actually used as a return value?

(Sure. it's the return value of a function, but that is entirely
useless and pointless information, and adds no value. We should name
variables by the data they contain or how they are used, not by "it
was the return value of a function").

In other words, why isn't this just

        if (__radix_tree_preload(..))
                preempt_disable();

which is shorter and clearer and not confusing?

> @@ -2118,13 +2121,14 @@ EXPORT_SYMBOL(idr_preload);
>   */
>  int ida_pre_get(struct ida *ida, gfp_t gfp)
>  {
> -       __radix_tree_preload(gfp, IDA_PRELOAD_SIZE);
> +       int ret = __radix_tree_preload(gfp, IDA_PRELOAD_SIZE);
>         /*
>          * The IDA API has no preload_end() equivalent.  Instead,
>          * ida_get_new() can return -EAGAIN, prompting the caller
>          * to return to the ida_pre_get() step.
>          */
> -       preempt_enable();
> +       if (!ret)
> +               preempt_enable();

Same issue, but this time strengthened by an additional "why doesn't
this just use that idr_preload function then?" question..

               Linus

^ permalink raw reply

* [PATCH 1/2] b43: fix unitialized reads of ret by initializing the array to zero
From: Colin King @ 2017-09-05 18:15 UTC (permalink / raw)
  To: Kalle Valo, linux-wireless, b43-dev, netdev; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The u8 char array ret is not being initialized and elements outside
the range start to end contain just garbage values from the stack.
This results in a later scan of the array to read potentially
uninitialized values.  Fix this by initializing the array to zero.
This seems to have been an issue since the very first commit.

Detected by CoverityScan CID#139652 ("Uninitialized scalar variable")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/broadcom/b43/phy_g.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/b43/phy_g.c b/drivers/net/wireless/broadcom/b43/phy_g.c
index 822dcaa8ace6..f59c02166462 100644
--- a/drivers/net/wireless/broadcom/b43/phy_g.c
+++ b/drivers/net/wireless/broadcom/b43/phy_g.c
@@ -2297,7 +2297,7 @@ static u8 b43_gphy_aci_detect(struct b43_wldev *dev, u8 channel)
 static u8 b43_gphy_aci_scan(struct b43_wldev *dev)
 {
 	struct b43_phy *phy = &dev->phy;
-	u8 ret[13];
+	u8 ret[13] = { 0 };
 	unsigned int channel = phy->channel;
 	unsigned int i, j, start, end;
 
-- 
2.14.1

^ permalink raw reply related

* [PATCH 1/3] drivers: net: xgene: Read tx/rx delay for ACPI
From: Iyappan Subramanian @ 2017-09-05 18:16 UTC (permalink / raw)
  To: davem, netdev
  Cc: Quan Nguyen, dnelson, patches, linux-arm-kernel,
	Iyappan Subramanian
In-Reply-To: <1504635392-19089-1-git-send-email-isubramanian@apm.com>

This patch fixes reading tx/rx delay values for ACPI.

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Signed-off-by: Quan Nguyen <qnguyen@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 6e253d9..655c0fc 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1591,7 +1591,7 @@ static int xgene_get_tx_delay(struct xgene_enet_pdata *pdata)
 	struct device *dev = &pdata->pdev->dev;
 	int delay, ret;
 
-	ret = of_property_read_u32(dev->of_node, "tx-delay", &delay);
+	ret = device_property_read_u32(dev, "tx-delay", &delay);
 	if (ret) {
 		pdata->tx_delay = 4;
 		return 0;
@@ -1612,7 +1612,7 @@ static int xgene_get_rx_delay(struct xgene_enet_pdata *pdata)
 	struct device *dev = &pdata->pdev->dev;
 	int delay, ret;
 
-	ret = of_property_read_u32(dev->of_node, "rx-delay", &delay);
+	ret = device_property_read_u32(dev, "rx-delay", &delay);
 	if (ret) {
 		pdata->rx_delay = 2;
 		return 0;
-- 
2.7.4

^ permalink raw reply related

* [PATCH 0/3] drivers: net: xgene: Misc bug fixes
From: Iyappan Subramanian @ 2017-09-05 18:16 UTC (permalink / raw)
  To: davem, netdev; +Cc: linux-arm-kernel, dnelson, patches, Iyappan Subramanian

This patch set fixes bugs related to handling the case for ACPI for,
reading and programming tx/rx delay values.

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---

Iyappan Subramanian (2):
  drivers: net: xgene: Read tx/rx delay for ACPI
  drivers: net: xgene: Remove return statement from void function

Quan Nguyen (1):
  drivers: net: xgene: Configure tx/rx delay for ACPI

 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c   | 7 ++-----
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 6 ++----
 2 files changed, 4 insertions(+), 9 deletions(-)

-- 
2.7.4

^ permalink raw reply

* [PATCH 2/3] drivers: net: xgene: Configure tx/rx delay for ACPI
From: Iyappan Subramanian @ 2017-09-05 18:16 UTC (permalink / raw)
  To: davem, netdev
  Cc: linux-arm-kernel, dnelson, patches, Quan Nguyen,
	Iyappan Subramanian
In-Reply-To: <1504635392-19089-1-git-send-email-isubramanian@apm.com>

From: Quan Nguyen <qnguyen@apm.com>

This patch fixes configuring tx/rx delay values for ACPI.

Signed-off-by: Quan Nguyen <qnguyen@apm.com>
Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index e45b587..3188f55 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -468,7 +468,6 @@ static void xgene_enet_configure_clock(struct xgene_enet_pdata *pdata)
 
 static void xgene_gmac_set_speed(struct xgene_enet_pdata *pdata)
 {
-	struct device *dev = &pdata->pdev->dev;
 	u32 icm0, icm2, mc2;
 	u32 intf_ctl, rgmii, value;
 
@@ -500,10 +499,8 @@ static void xgene_gmac_set_speed(struct xgene_enet_pdata *pdata)
 		intf_ctl |= ENET_GHD_MODE;
 		CFG_MACMODE_SET(&icm0, 2);
 		CFG_WAITASYNCRD_SET(&icm2, 0);
-		if (dev->of_node) {
-			CFG_TXCLK_MUXSEL0_SET(&rgmii, pdata->tx_delay);
-			CFG_RXCLK_MUXSEL0_SET(&rgmii, pdata->rx_delay);
-		}
+		CFG_TXCLK_MUXSEL0_SET(&rgmii, pdata->tx_delay);
+		CFG_RXCLK_MUXSEL0_SET(&rgmii, pdata->rx_delay);
 		rgmii |= CFG_SPEED_1250;
 
 		xgene_enet_rd_csr(pdata, DEBUG_REG_ADDR, &value);
-- 
2.7.4

^ permalink raw reply related

* [PATCH 3/3] drivers: net: xgene: Remove return statement from void function
From: Iyappan Subramanian @ 2017-09-05 18:16 UTC (permalink / raw)
  To: davem, netdev; +Cc: linux-arm-kernel, dnelson, patches, Iyappan Subramanian
In-Reply-To: <1504635392-19089-1-git-send-email-isubramanian@apm.com>

commit 183db4 ("drivers: net: xgene: Correct probe sequence handling")
changed the return type of xgene_enet_check_phy_handle() to void.

This patch, removes the return statement from the last line.

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 655c0fc..3b889ef 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1674,8 +1674,6 @@ static void xgene_enet_check_phy_handle(struct xgene_enet_pdata *pdata)
 	ret = xgene_enet_phy_connect(pdata->ndev);
 	if (!ret)
 		pdata->mdio_driver = true;
-
-	return;
 }
 
 static void xgene_enet_gpiod_get(struct xgene_enet_pdata *pdata)
-- 
2.7.4

^ permalink raw reply related

* [PATCH 2/2] b43legacy: fix unitialized reads of ret by initializing the array to zero
From: Colin King @ 2017-09-05 18:16 UTC (permalink / raw)
  To: Larry Finger, Kalle Valo, linux-wireless, b43-dev, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The u8 char array ret is not being initialized and elements outside
the range start to end contain just garbage values from the stack.
This results in a later scan of the array to read potentially
uninitialized values.  Fix this by initializing the array to zero.
This seems to have been an issue since the very first commit.

Detected by CoverityScan CID#139653 ("Uninitialized scalar variable")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/broadcom/b43legacy/radio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/b43legacy/radio.c b/drivers/net/wireless/broadcom/b43legacy/radio.c
index 9501420340a9..eab1c9387846 100644
--- a/drivers/net/wireless/broadcom/b43legacy/radio.c
+++ b/drivers/net/wireless/broadcom/b43legacy/radio.c
@@ -280,7 +280,7 @@ u8 b43legacy_radio_aci_detect(struct b43legacy_wldev *dev, u8 channel)
 u8 b43legacy_radio_aci_scan(struct b43legacy_wldev *dev)
 {
 	struct b43legacy_phy *phy = &dev->phy;
-	u8 ret[13];
+	u8 ret[13] = { 0 };
 	unsigned int channel = phy->channel;
 	unsigned int i;
 	unsigned int j;
-- 
2.14.1

^ permalink raw reply related

* Re: [RFC net-next] net: sch_clsact: add support for global per-netns classifier mode
From: Cong Wang @ 2017-09-05 18:18 UTC (permalink / raw)
  To: Nikolay Aleksandrov
  Cc: Linux Kernel Network Developers, Roopa Prabhu, David Ahern,
	Jiri Pirko, Jamal Hadi Salim
In-Reply-To: <1504615701-20912-1-git-send-email-nikolay@cumulusnetworks.com>

On Tue, Sep 5, 2017 at 5:48 AM, Nikolay Aleksandrov
<nikolay@cumulusnetworks.com> wrote:
> Hi all,
> This RFC adds a new mode for clsact which designates a device's egress
> classifier as global per netns. The packets that are not classified for
> a particular device will be classified using the global classifier.
> We have needed a global classifier for some time now for various
> purposes and setting the single bridge or loopback/vrf device as the
> global classifier device is acceptable for us. Doing it this way avoids
> the act/cls device and queue dependencies.
>
> This is strictly an RFC patch just to show the intent, if we agree on
> the details the proposed patch will have support for both ingress and
> egress, and will be using a static key to avoid the fast path test when no
> global classifier has been configured.
>
> Example (need a modified tc that adds TCA_OPTIONS when using q_clsact):
> $ tc qdisc add dev lo clsact global
> $ tc filter add dev lo egress protocol ip u32 match ip dst 4.3.2.1/32 action drop
>
> the last filter will be global for all devices that don't have a
> specific egress_cl_list (i.e. have clsact configured).

Sorry this is too ugly.

netdevice is still implied in your command line even if you treat it
as global. It is essentially hard to bypass netdevice layer since
netdevice is the core of L2 and also where everything begins.

Maybe the best we can do here is make tc filters standalone
as tc actions so that filters can exist before qdisc's and netdevices.
But this probably requires significant works to make it working
with both existing non-standalone and bindings standalones
with qdisc's.

Note I don't look deeply into this, just one thought, at least this
appears less ugly than yours.

^ permalink raw reply

* Re: [RFC net-next] net: sch_clsact: add support for global per-netns classifier mode
From: Nikolay Aleksandrov @ 2017-09-05 18:25 UTC (permalink / raw)
  To: Cong Wang
  Cc: Linux Kernel Network Developers, Roopa Prabhu, David Ahern,
	Jiri Pirko, Jamal Hadi Salim
In-Reply-To: <CAM_iQpUYGH4BQ-ZUShbRAy6aJD2fYuM+oc_kWYyQ51n+===CQw@mail.gmail.com>

On 9/5/17 9:18 PM, Cong Wang wrote:
> On Tue, Sep 5, 2017 at 5:48 AM, Nikolay Aleksandrov
> <nikolay@cumulusnetworks.com> wrote:
>> Hi all,
>> This RFC adds a new mode for clsact which designates a device's egress
>> classifier as global per netns. The packets that are not classified for
>> a particular device will be classified using the global classifier.
>> We have needed a global classifier for some time now for various
>> purposes and setting the single bridge or loopback/vrf device as the
>> global classifier device is acceptable for us. Doing it this way avoids
>> the act/cls device and queue dependencies.
>>
>> This is strictly an RFC patch just to show the intent, if we agree on
>> the details the proposed patch will have support for both ingress and
>> egress, and will be using a static key to avoid the fast path test when no
>> global classifier has been configured.
>>
>> Example (need a modified tc that adds TCA_OPTIONS when using q_clsact):
>> $ tc qdisc add dev lo clsact global
>> $ tc filter add dev lo egress protocol ip u32 match ip dst 4.3.2.1/32 action drop
>>
>> the last filter will be global for all devices that don't have a
>> specific egress_cl_list (i.e. have clsact configured).
> 
> Sorry this is too ugly
> 
> netdevice is still implied in your command line even if you treat it
> as global. It is essentially hard to bypass netdevice layer since
> netdevice is the core of L2 and also where everything begins.
> 

This is only a quick RFC, that can be removed entirely if we limit it to the 
netns and its loopback device. Then we can drop the "device" keyword altogether.

> Maybe the best we can do here is make tc filters standalone
> as tc actions so that filters can exist before qdisc's and netdevices.
> But this probably requires significant works to make it working
> with both existing non-standalone and bindings standalones
> with qdisc's.
>

We've actually been discussing this option internally as well.
I think we'll look into doing that regardless of this patch.
> Note I don't look deeply into this, just one thought, at least this
> appears less ugly than yours.
> 

What I did was aimed at simplicity and is merely a mode of clsact which
doesn't have an impact if not configured. Every other solution requires
a much more invasive change, note that doesn't mean I don't agree. :-)

^ permalink raw reply

* Re: [PATCH] radix-tree: must check __radix_tree_preload() return value
From: Eric Dumazet @ 2017-09-05 18:34 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Matthew Wilcox, Matthew Wilcox, Kirill A. Shutemov, Andrew Morton,
	netdev, linux-kernel
In-Reply-To: <CA+55aFwNK39yB_wbwKSkk4VfLSxALzeZHT6dShpT1zZdpmeq1Q@mail.gmail.com>

On Tue, 2017-09-05 at 11:07 -0700, Linus Torvalds wrote:
> On Tue, Sep 5, 2017 at 10:59 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > @@ -2104,7 +2104,10 @@ EXPORT_SYMBOL(radix_tree_tagged);
> >   */
> >  void idr_preload(gfp_t gfp_mask)
> >  {
> > -       __radix_tree_preload(gfp_mask, IDR_PRELOAD_SIZE);
> > +       int ret = __radix_tree_preload(gfp_mask, IDR_PRELOAD_SIZE);
> > +
> > +       if (ret)
> > +               preempt_disable();
> >  }
> >  EXPORT_SYMBOL(idr_preload);
> 
> Is there a reason for the "ret" variable that is entirely mis-named,
> since it's never actually used as a return value?
> 
> (Sure. it's the return value of a function, but that is entirely
> useless and pointless information, and adds no value. We should name
> variables by the data they contain or how they are used, not by "it
> was the return value of a function").
> 
> In other words, why isn't this just
> 
>         if (__radix_tree_preload(..))
>                 preempt_disable();
> 
> which is shorter and clearer and not confusing?


...

> Same issue, but this time strengthened by an additional "why doesn't
> this just use that idr_preload function then?" question..
> 

Yep, I will send a v2, thanks.

^ permalink raw reply

* Re: [PATCH v2 net-next 0/2] flow_dissector: Flow dissector fixes
From: David Miller @ 2017-09-05 18:45 UTC (permalink / raw)
  To: tom; +Cc: netdev, hannes, alex.popov
In-Reply-To: <20170901210412.2915-1-tom@quantonium.net>

From: Tom Herbert <tom@quantonium.net>
Date: Fri,  1 Sep 2017 14:04:10 -0700

> This patch set fixes some basic issues with __skb_flow_dissect function.
> 
> Items addressed:
>   - Cleanup control flow in the function; in particular eliminate a
>     bunch of goto's and implement a simplified control flow model
>   - Add limits for number of encapsulations and headers that can be
>     dissected
> 
> v2:
>   - Simplify the logic for limits on flow dissection. Just set the
>     limit based on the number of headers the flow dissector can
>     processes. The accounted headers includes encapsulation headers,
>     extension headers, or other shim headers.
> 
> Tested:
> 
> Ran normal traffic, GUE, and VXLAN traffic.

Applied, thanks Tom.

^ permalink raw reply

* [PATCH v2] radix-tree: must check __radix_tree_preload() return value
From: Eric Dumazet @ 2017-09-05 18:46 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Matthew Wilcox, Kirill A. Shutemov, Andrew Morton, netdev,
	Linus Torvalds, linux-kernel
In-Reply-To: <1504634367.15310.59.camel@edumazet-glaptop3.roam.corp.google.com>

From: Eric Dumazet <edumazet@google.com>

__radix_tree_preload() only disables preemption if no error is returned.

So we really need to make sure callers always check the return value.

idr_preload() contract is to always disable preemption, so we need
to add a missing preempt_disable() if an error happened.

Similarly, ida_pre_get() only needs to call preempt_enable() in the
case no error happened.

Fixes: 0a835c4f090a ("Reimplement IDR and IDA using the radix tree")
Fixes: 7ad3d4d85c7a ("ida: Move ida_bitmap to a percpu variable")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: <stable@vger.kernel.org>    [4.11+]
---
v2: addressed Linus feedback, not adding useless/confusing 'ret' variables.

 lib/radix-tree.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 3527eb364964..afb3cb4d44b6 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -463,7 +463,7 @@ radix_tree_node_free(struct radix_tree_node *node)
  * To make use of this facility, the radix tree must be initialised without
  * __GFP_DIRECT_RECLAIM being passed to INIT_RADIX_TREE().
  */
-static int __radix_tree_preload(gfp_t gfp_mask, unsigned nr)
+static __must_check int __radix_tree_preload(gfp_t gfp_mask, unsigned nr)
 {
 	struct radix_tree_preload *rtp;
 	struct radix_tree_node *node;
@@ -2104,7 +2104,8 @@ EXPORT_SYMBOL(radix_tree_tagged);
  */
 void idr_preload(gfp_t gfp_mask)
 {
-	__radix_tree_preload(gfp_mask, IDR_PRELOAD_SIZE);
+	if (__radix_tree_preload(gfp_mask, IDR_PRELOAD_SIZE))
+		preempt_disable();
 }
 EXPORT_SYMBOL(idr_preload);
 
@@ -2118,13 +2119,13 @@ EXPORT_SYMBOL(idr_preload);
  */
 int ida_pre_get(struct ida *ida, gfp_t gfp)
 {
-	__radix_tree_preload(gfp, IDA_PRELOAD_SIZE);
 	/*
 	 * The IDA API has no preload_end() equivalent.  Instead,
 	 * ida_get_new() can return -EAGAIN, prompting the caller
 	 * to return to the ida_pre_get() step.
 	 */
-	preempt_enable();
+	if (!__radix_tree_preload(gfp, IDA_PRELOAD_SIZE))
+		preempt_enable();
 
 	if (!this_cpu_read(ida_bitmap)) {
 		struct ida_bitmap *bitmap = kmalloc(sizeof(*bitmap), gfp);

^ permalink raw reply related

* Re: [PATCH 6/10] ixgbe: Use ARRAY_SIZE macro
From: David Miller @ 2017-09-05 18:50 UTC (permalink / raw)
  To: thomas; +Cc: netdev, linux-kernel
In-Reply-To: <1504439110050-1907815276-6-diffsplit-thomas@m3y3r.de>

From: Thomas Meyer <thomas@m3y3r.de>
Date: Sun, 03 Sep 2017 14:19:31 +0200

> Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> yourself.
> Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> /ARRAY_SIZE(\1)/g' and manual check/verification.
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>

This should be submitted to the Intel ethernet driver maintainers.

Thank you.

^ permalink raw reply

* Re: [PATCH 7/10] net/mlx4_core: Use ARRAY_SIZE macro
From: David Miller @ 2017-09-05 18:50 UTC (permalink / raw)
  To: thomas-VsYtu1Qij5c
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1504439110050-1961876957-7-diffsplit-thomas-VsYtu1Qij5c@public.gmane.org>

From: Thomas Meyer <thomas-VsYtu1Qij5c@public.gmane.org>
Date: Sun, 03 Sep 2017 14:19:31 +0200

> Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
> yourself.
> Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
> 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
> /ARRAY_SIZE(\1)/g' and manual check/verification.
> 
> Signed-off-by: Thomas Meyer <thomas-VsYtu1Qij5c@public.gmane.org>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox