Re: [PATCH net] net/sched: properly init chain in case of multiple control actions

2018-10-12 Thread Cong Wang
On Fri, Oct 12, 2018 at 1:39 PM Davide Caratti wrote: > Several TC actions allow users to specify a fallback control action, that > is usually stored in the action private data. 'goto chain x' never worked > for that case, because the action handler was never initialized. There is > only one

Some suggestions for tc-tests

2018-10-11 Thread Cong Wang
Hi, I tried to run tc-tests with some old iproute2 package, it is painful. I'd suggest the following improvements: 1. Create veth pair devices by its own. The most important thing for tc-tests is to automate everything, it is not friendly for users to create their own veth pair named v0p0 to

[Patch net] llc: set SOCK_RCU_FREE in llc_sap_add_socket()

2018-10-11 Thread Cong Wang
getting a zero refcnt. Fix it by setting SOCK_RCU_FREE in llc_sap_add_socket(). Reported-by: syzbot+11e05f04c15e03be5...@syzkaller.appspotmail.com Signed-off-by: Cong Wang --- net/llc/llc_conn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c index

Re: netconsole warning in 4.19.0-rc7

2018-10-10 Thread Cong Wang
(Cc'ing Dave) On Wed, Oct 10, 2018 at 5:14 AM Meelis Roos wrote: > > Thies 4.19-rc7 on a bunch of test machines and got this warning from one. > It is reproducible and I have not noticed it before. > [...] > [9.914805] WARNING: CPU: 0 PID: 0 at kernel/softirq.c:168 >

Re: Possible bug in traffic control?

2018-10-10 Thread Cong Wang
On Wed, Oct 10, 2018 at 8:54 AM Josh Coombs wrote: > > 2.3 billion 1 byte packets failed to re-create the bug. To try and > simplify the setup I removed macsec from the equation, using a single > host in the middle as the bridge. Interestingly, rather than 1.3Gbits > a second in both

Re: [PATCH net v2] net/sched: cls_api: add missing validation of netlink attributes

2018-10-09 Thread Cong Wang
On Tue, Oct 9, 2018 at 2:26 PM Davide Caratti wrote: > --- a/net/sched/sch_api.c > +++ b/net/sched/sch_api.c > @@ -1322,6 +1322,7 @@ const struct nla_policy rtm_tca_policy[TCA_MAX + 1] = { > [TCA_INGRESS_BLOCK] = { .type = NLA_U32 }, > [TCA_EGRESS_BLOCK] = { .type =

[Patch net-next] net_sched: convert idrinfo->lock from spinlock to a mutex

2018-10-02 Thread Cong Wang
;net_sched: change tcf_del_walker() to take idrinfo->lock") Reported-by: Ido Schimmel Cc: Jamal Hadi Salim Cc: Vlad Buslov Cc: Jiri Pirko Signed-off-by: Cong Wang --- include/net/act_api.h | 4 ++-- net/sched/act_api.c| 44 ++-- n

Re: [Patch net-next v3] net_sched: change tcf_del_walker() to take idrinfo->lock

2018-10-02 Thread Cong Wang
On Fri, Sep 28, 2018 at 9:47 PM Cong Wang wrote: > > Just FYI, the crash is fixed, but another RCU warning pops up after > my fix. So I am still debugging it, it is related to the kfree_rcu() in > tcf_chain_destroy(). Update: I tried very hard to make it working, the end result i

Re: [Patch net-next v3] net_sched: change tcf_del_walker() to take idrinfo->lock

2018-09-28 Thread Cong Wang
On Fri, Sep 28, 2018 at 11:29 AM Cong Wang wrote: > > On Fri, Sep 28, 2018 at 11:11 AM Ido Schimmel wrote: > > I don't think this will work given the reference count already dropped > > to 0, which is why the template deletion function was invoked. I didn't > > test th

Re: bond: take rcu lock in bond_poll_controller

2018-09-28 Thread Cong Wang
On Fri, Sep 28, 2018 at 12:02 PM Cong Wang wrote: > > On Fri, Sep 28, 2018 at 11:26 AM Dave Jones wrote: > > diff --git a/net/core/netpoll.c b/net/core/netpoll.c > > index 3219a2932463..4f9494381635 100644 > > --- a/net/core/netpoll.c > > +++ b/net/core/netpoll.

Re: bond: take rcu lock in bond_poll_controller

2018-09-28 Thread Cong Wang
On Fri, Sep 28, 2018 at 11:26 AM Dave Jones wrote: > diff --git a/net/core/netpoll.c b/net/core/netpoll.c > index 3219a2932463..4f9494381635 100644 > --- a/net/core/netpoll.c > +++ b/net/core/netpoll.c > @@ -330,6 +330,7 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct > sk_buff *skb,

Re: [Patch net-next v3] net_sched: change tcf_del_walker() to take idrinfo->lock

2018-09-28 Thread Cong Wang
On Fri, Sep 28, 2018 at 11:11 AM Ido Schimmel wrote: > I don't think this will work given the reference count already dropped > to 0, which is why the template deletion function was invoked. I didn't > test the patch, but I don't see what would prevent the chain from being > freed. Good catch!

Re: [Patch net-next v3] net_sched: change tcf_del_walker() to take idrinfo->lock

2018-09-28 Thread Cong Wang
On Fri, Sep 28, 2018 at 7:59 AM Ido Schimmel wrote: > > On Wed, Sep 19, 2018 at 04:37:29PM -0700, Cong Wang wrote: > > From: Vlad Buslov > > > > From: Vlad Buslov > > > > Action API was changed to work with actions and action_idr in concurrency > > s

Re: bond: take rcu lock in bond_poll_controller

2018-09-28 Thread Cong Wang
On Fri, Sep 28, 2018 at 10:25 AM Dave Jones wrote: > > On Fri, Sep 28, 2018 at 09:55:52AM -0700, Cong Wang wrote: > > On Fri, Sep 28, 2018 at 9:18 AM Dave Jones wrote: > > > > > > Callers of bond_for_each_slave_rcu are expected to hold the rcu lock, >

rcu_read_lock() in tcf_block_find()

2018-09-28 Thread Cong Wang
(Changing $subject as the discussion is going to a completely different topic) On Thu, Sep 27, 2018 at 3:19 PM Eric Dumazet wrote: > > > > On 09/27/2018 02:36 PM, Cong Wang wrote: > > > I don't understand what you mean by changing ip command, you must > > mean tc

Re: [Patch net-next] net_sched: fix an extack message in tcf_block_find()

2018-09-28 Thread Cong Wang
On Thu, Sep 27, 2018 at 1:42 PM Cong Wang wrote: > > It is clearly a copy-n-paste. > > Signed-off-by: Cong Wang I regret again for wasting my time, so: NAcked-by: Cong Wang I really don't care, do you?

Re: [Patch net-next] net_sched: fix an extack message in tcf_block_find()

2018-09-28 Thread Cong Wang
On Fri, Sep 28, 2018 at 4:36 AM Vlad Buslov wrote: > > On Thu 27 Sep 2018 at 20:42, Cong Wang wrote: > > It is clearly a copy-n-paste. > > > > Signed-off-by: Cong Wang > > --- > > net/sched/cls_api.c | 2 +- > > 1 file changed, 1 insertion(+), 1

Re: bond: take rcu lock in bond_poll_controller

2018-09-28 Thread Cong Wang
On Fri, Sep 28, 2018 at 9:18 AM Dave Jones wrote: > > Callers of bond_for_each_slave_rcu are expected to hold the rcu lock, > otherwise a trace like below is shown So why not take rcu read lock in netpoll_send_skb_on_dev() where RCU is also assumed? As I said, I can't explain why you didn't

Re: [Patch net-next] net_sched: fix an extack message in tcf_block_find()

2018-09-27 Thread Cong Wang
On Thu, Sep 27, 2018 at 2:16 PM Eric Dumazet wrote: > > > > On 09/27/2018 01:42 PM, Cong Wang wrote: > > It is clearly a copy-n-paste. > > > > Signed-off-by: Cong Wang > > --- > > net/sched/cls_api.c | 2 +- > > 1 file changed, 1 insertion(

[Patch net-next] net_sched: fix a crash in tc_new_tfilter()

2018-09-27 Thread Cong Wang
: use Qdisc rcu API instead of relying on rtnl lock") Signed-off-by: Cong Wang --- net/sched/cls_api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 8dd7f8af6d54..a4167ec0a220 100644 --- a/net/sched/cls_api.c +++ b

[Patch net-next] net_sched: fix an extack message in tcf_block_find()

2018-09-27 Thread Cong Wang
It is clearly a copy-n-paste. Signed-off-by: Cong Wang --- net/sched/cls_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 3de47e99b788..8dd7f8af6d54 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -655,7

Re: KASAN: use-after-free Read in tcf_block_find

2018-09-27 Thread Cong Wang
On Thu, Sep 27, 2018 at 1:11 AM Dmitry Vyukov wrote: > > Would a stack trace for call_rcu be helpful here? I have this idea for > a long time, but never get around to implementing it: > https://bugzilla.kernel.org/show_bug.cgi?id=198437 Yes. Generally speaking, showing backtrace of call_rcu() or

Re: bond: take rcu lock in bond_poll_controller

2018-09-25 Thread Cong Wang
On Mon, Sep 24, 2018 at 1:08 PM Dave Jones wrote: > > Callers of bond_for_each_slave_rcu are expected to hold the rcu lock, > otherwise a trace like below is shown Interesting, netpoll_send_skb_on_dev() already assumes RCU read lock when it calls rcu_dereference_bh()... I wonder how it can't

Re: [PATCH net-next v3 00/10] Refactor classifier API to work with Qdisc/blocks without rtnl lock

2018-09-25 Thread Cong Wang
e refcount.h in rtnetlink.h. > - Patch 3: > - Move rcu_head field to the end of struct Qdisc. > - Rearrange local variable declarations in qdisc_lookup_rcu(). > - Patch 5: > - Remove tcf_qdisc_put() and inline its content to callers. Overall looks good to me, Acked-by: Cong Wang There are some minor issues like qdisc_free_cb() can be static, please send follow-up patch to address it. Thanks.

Re: [PATCH net-next v2 08/10] net: sched: protect block idr with spinlock

2018-09-21 Thread Cong Wang
On Thu, Sep 20, 2018 at 12:36 AM Vlad Buslov wrote: > > > On Wed 19 Sep 2018 at 22:09, Cong Wang wrote: > > On Mon, Sep 17, 2018 at 12:19 AM Vlad Buslov wrote: > >> @@ -482,16 +483,25 @@ static int tcf_block_insert(struct tcf_block *bloc

Re: [PATCH net-next v2 05/10] net: sched: use Qdisc rcu API instead of relying on rtnl lock

2018-09-21 Thread Cong Wang
On Thu, Sep 20, 2018 at 12:21 AM Vlad Buslov wrote: > > > On Wed 19 Sep 2018 at 22:04, Cong Wang wrote: > > On Mon, Sep 17, 2018 at 12:19 AM Vlad Buslov wrote: > >> +static void tcf_qdisc_put(struct Qdisc *q, bool rtnl_held) > >> +{ > >> +

Re: [PATCH][next-next][v2] netlink: avoid to allocate full skb when sending to many devices

2018-09-21 Thread Cong Wang
On Thu, Sep 20, 2018 at 1:58 AM Li RongQing wrote: > > if skb->head is vmalloc address, when this skb is delivered, full > allocation for this skb is required, if there are many devices, > the full allocation will be called for every devices So why do you in practice need many netlink tap

Re: [PATCH net] ip6_tunnel: be careful when accessing the inner header

2018-09-21 Thread Cong Wang
On Wed, Sep 19, 2018 at 6:04 AM Paolo Abeni wrote: > diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c > index 419960b0ba16..a0b6932c3afd 100644 > --- a/net/ipv6/ip6_tunnel.c > +++ b/net/ipv6/ip6_tunnel.c > @@ -1234,7 +1234,7 @@ static inline int > ip4ip6_tnl_xmit(struct sk_buff *skb,

Re: [Patch net-next] ipv4: initialize ra_mutex in inet_init_net()

2018-09-20 Thread Cong Wang
On Thu, Sep 20, 2018 at 2:04 AM Kirill Tkhai wrote: > > On 20.09.2018 0:28, Cong Wang wrote: > You added me to CC, so you probably want to know my opinion about this. > Since it's not a real problem fix, but just a refactoring, I say you > my opinion, how this refactoring may

Re: [PATCH 2/3] net: Register af_inet_ops earlier

2018-09-20 Thread Cong Wang
isks on error path ordering, it is never late to bring this up again when any future change needs it, until that: Nacked-by: Cong Wang

Re: [PATCH 3/3] ipv4: initialize ra_mutex in inet_init_net()

2018-09-20 Thread Cong Wang
On Thu, Sep 20, 2018 at 2:12 AM Kirill Tkhai wrote: > > From: Cong Wang > > ra_mutex is a IPv4 specific mutex, it is inside struct netns_ipv4, > but its initialization is in the generic netns code, setup_net(). > > Move it to IPv4 specific net init code, inet_init_net(). &g

[Patch net-next v3] net_sched: change tcf_del_walker() to take idrinfo->lock

2018-09-19 Thread Cong Wang
Buslov [xiyou.wangc...@gmail.com: heavily modify the code and changelog] Signed-off-by: Cong Wang --- net/sched/act_api.c| 20 +++- net/sched/cls_flower.c | 13 +++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c

Re: [PATCH net-next v2 08/10] net: sched: protect block idr with spinlock

2018-09-19 Thread Cong Wang
On Mon, Sep 17, 2018 at 12:19 AM Vlad Buslov wrote: > @@ -482,16 +483,25 @@ static int tcf_block_insert(struct tcf_block *block, > struct net *net, > struct netlink_ext_ack *extack) > { > struct tcf_net *tn = net_generic(net, tcf_net_id); > + int err; >

Re: [PATCH net-next v2 05/10] net: sched: use Qdisc rcu API instead of relying on rtnl lock

2018-09-19 Thread Cong Wang
On Mon, Sep 17, 2018 at 12:19 AM Vlad Buslov wrote: > +static void tcf_qdisc_put(struct Qdisc *q, bool rtnl_held) > +{ > + if (!q) > + return; > + > + if (rtnl_held) > + qdisc_put(q); > + else > + qdisc_put_unlocked(q); > +} This is

Re: [PATCH net-next v2 01/10] net: core: netlink: add helper refcount dec and lock function

2018-09-19 Thread Cong Wang
On Mon, Sep 17, 2018 at 12:19 AM Vlad Buslov wrote: > --- a/net/core/rtnetlink.c > +++ b/net/core/rtnetlink.c > @@ -130,6 +130,12 @@ int rtnl_is_locked(void) > } > EXPORT_SYMBOL(rtnl_is_locked); > > +bool refcount_dec_and_rtnl_lock(refcount_t *r) > +{ > + return

Re: [Patch net-next] ipv4: initialize ra_mutex in inet_init_net()

2018-09-19 Thread Cong Wang
On Wed, Sep 19, 2018 at 1:25 AM Kirill Tkhai wrote: > > On 18.09.2018 23:17, Cong Wang wrote: > > On Mon, Sep 17, 2018 at 12:25 AM Kirill Tkhai wrote: > >> In inet_init() the order of registration is: > >> > >> ip_mr_init(); > >>

Re: [Patch net-next] ipv4: initialize ra_mutex in inet_init_net()

2018-09-18 Thread Cong Wang
On Mon, Sep 17, 2018 at 12:25 AM Kirill Tkhai wrote: > In inet_init() the order of registration is: > > ip_mr_init(); > init_inet_pernet_ops(); > > This means, ipmr_net_ops pernet operations are before af_inet_ops > in pernet_list. So, there is a theoretical probability, sometimes

Re: [net-next,RFC PATCH] Introduce TC Range classifier

2018-09-14 Thread Cong Wang
On Fri, Sep 14, 2018 at 2:53 AM Jiri Pirko wrote: > > Thu, Sep 13, 2018 at 10:52:01PM CEST, amritha.namb...@intel.com wrote: > >This patch introduces a TC range classifier to support filtering based > >on ranges. Only port-range filters are supported currently. This can > >be combined with flower

Re: [net-next, RFC PATCH] net: sched: cls_range: Introduce Range classifier

2018-09-14 Thread Cong Wang
On Thu, Sep 13, 2018 at 6:53 PM Amritha Nambiar wrote: > > This patch introduces a range classifier to support filtering based > on ranges. Only port-range filters are supported currently. This can > be combined with flower classifier to support filters that are a > combination of port-ranges and

Re: [PATCH net-next v2] net: sched: change tcf_del_walker() to take idrinfo->lock

2018-09-14 Thread Cong Wang
On Fri, Sep 14, 2018 at 3:46 AM Vlad Buslov wrote: > > > On Thu 13 Sep 2018 at 17:13, Cong Wang wrote: > > On Wed, Sep 12, 2018 at 1:51 AM Vlad Buslov wrote: > >> > >> > >> On Fri 07 Sep 2018 at 19:12, Cong Wang wrote: > >>

[Patch net-next] ipv4: initialize ra_mutex in inet_init_net()

2018-09-14 Thread Cong Wang
ra_mutex is a IPv4 specific mutex, it is inside struct netns_ipv4, but its initialization is in the generic netns code, setup_net(). Move it to IPv4 specific net init code, inet_init_net(). Fixes: d9ff3049739e ("net: Replace ip_ra_lock with per-net mutex") Cc: Kirill Tkhai Signed-of

Re: [PATCH net-next 08/13] net: sched: rename tcf_block_get{_ext}() and tcf_block_put{_ext}()

2018-09-13 Thread Cong Wang
On Wed, Sep 12, 2018 at 1:24 AM Vlad Buslov wrote: > > > On Fri 07 Sep 2018 at 20:09, Cong Wang wrote: > > On Thu, Sep 6, 2018 at 12:59 AM Vlad Buslov wrote: > >> > >> Functions tcf_block_get{_ext}() and tcf_block_put{_ext}() actually > >> attach/d

Re: [PATCH net-next v2] net: sched: change tcf_del_walker() to take idrinfo->lock

2018-09-13 Thread Cong Wang
On Wed, Sep 12, 2018 at 1:51 AM Vlad Buslov wrote: > > > On Fri 07 Sep 2018 at 19:12, Cong Wang wrote: > > On Fri, Sep 7, 2018 at 6:52 AM Vlad Buslov wrote: > >> > >> Action API was changed to work with actions and action_idr in concurrency > >> safe m

[Patch net] net_sched: notify filter deletion when deleting a chain

2018-09-11 Thread Cong Wang
When we delete a chain of filters, we need to notify user-space we are deleting each filters in this chain too. Fixes: 32a4f5ecd738 ("net: sched: introduce chain object to uapi") Cc: Jiri Pirko Signed-off-by: Cong Wang --- net/sched/cls_api.c | 2 ++ 1 file changed, 2 insertions(+)

[Patch net-next] llc: avoid blocking in llc_sap_close()

2018-09-11 Thread Cong Wang
llc_sap_close() is called by llc_sap_put() which could be called in BH context in llc_rcv(). We can't block in BH. There is no reason to block it here, kfree_rcu() should be sufficient. Signed-off-by: Cong Wang --- include/net/llc.h | 1 + net/llc/llc_core.c | 4 +--- 2 files changed, 2

[Patch net v2] rds: fix two RCU related problems

2018-09-10 Thread Cong Wang
protection in rds_find_bound() to close this race condition. Reported-and-tested-by: syzbot+8967084bcac563795...@syzkaller.appspotmail.com Reported-by: syzbot+93a5839deb3555374...@syzkaller.appspotmail.com Cc: Sowmini Varadhan Cc: Santosh Shilimkar Cc: rds-de...@oss.oracle.com Signed-off-by: Cong Wang

Re: [Patch net] rds: mark bound socket with SOCK_RCU_FREE

2018-09-10 Thread Cong Wang
On Mon, Sep 10, 2018 at 5:56 PM Santosh Shilimkar wrote: > > On 9/10/2018 5:45 PM, Cong Wang wrote: > > On Mon, Sep 10, 2018 at 5:26 PM Santosh Shilimkar > > wrote: > >> Would you mind posting an updated patch please with call_rcu and > >> above extended

Re: [Patch net] rds: mark bound socket with SOCK_RCU_FREE

2018-09-10 Thread Cong Wang
On Mon, Sep 10, 2018 at 5:26 PM Santosh Shilimkar wrote: > Would you mind posting an updated patch please with call_rcu and > above extended RCU grace period with rcu_read_lock. Thanks !! If you prefer to fix _two_ problems in one patch, sure. For the record, the bug this patch fixes is NOT

Re: [Patch net] rds: mark bound socket with SOCK_RCU_FREE

2018-09-10 Thread Cong Wang
On Mon, Sep 10, 2018 at 5:24 PM Sowmini Varadhan wrote: > > On (09/10/18 17:16), Cong Wang wrote: > > > > > > On (09/10/18 16:51), Cong Wang wrote: > > > > > > > > __rds_create_bind_key(key, addr, port, scope_id); > > > > -

Re: [Patch net] rds: mark bound socket with SOCK_RCU_FREE

2018-09-10 Thread Cong Wang
On Mon, Sep 10, 2018 at 5:04 PM Sowmini Varadhan wrote: > > On (09/10/18 16:51), Cong Wang wrote: > > > > __rds_create_bind_key(key, addr, port, scope_id); > > - rs = rhashtable_lookup_fast(_hash_table, key, ht_parms); > > + rcu_read_lock(); >

Re: [Patch net] rds: mark bound socket with SOCK_RCU_FREE

2018-09-10 Thread Cong Wang
On Mon, Sep 10, 2018 at 4:30 PM Sowmini Varadhan wrote: > > On (09/10/18 15:43), Santosh Shilimkar wrote: > > On 9/10/2018 3:24 PM, Cong Wang wrote: > > >When a rds sock is bound, it is inserted into the bind_hash_table > > >which is protected by RCU. But

[Patch net] rds: mark bound socket with SOCK_RCU_FREE

2018-09-10 Thread Cong Wang
sock as SOCK_RCU_FREE before inserting it into the bind_hash_table, so that it would be always freed after a RCU grace period. Reported-and-tested-by: syzbot+8967084bcac563795...@syzkaller.appspotmail.com Cc: Sowmini Varadhan Cc: Santosh Shilimkar Cc: rds-de...@oss.oracle.com Signed-off-by: Cong

[Patch net-next] net_sched: remove redundant qdisc lock classes

2018-09-07 Thread Cong Wang
We no longer take any spinlock on RX path for ingress qdisc, so this lockdep annotation is no longer needed. Cc: Jamal Hadi Salim Signed-off-by: Cong Wang --- net/sched/sch_api.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index

[Patch net-next] htb: use anonymous union for simplicity

2018-09-07 Thread Cong Wang
cl->leaf.q is slightly more readable than cl->un.leaf.q. Cc: Jamal Hadi Salim Signed-off-by: Cong Wang --- net/sched/sch_htb.c | 98 ++--- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/net/sched/sch_htb.c b/net/sched/sch

Re: [PATCH net-next 08/13] net: sched: rename tcf_block_get{_ext}() and tcf_block_put{_ext}()

2018-09-07 Thread Cong Wang
On Thu, Sep 6, 2018 at 12:59 AM Vlad Buslov wrote: > > Functions tcf_block_get{_ext}() and tcf_block_put{_ext}() actually > attach/detach block to specific Qdisc besides just taking/putting > reference. Rename them according to their purpose. Where exactly does it attach to? Each qdisc provides

Re: [PATCH net-next 09/13] net: sched: extend tcf_block with rcu

2018-09-07 Thread Cong Wang
On Thu, Sep 6, 2018 at 12:59 AM Vlad Buslov wrote: > > Extend tcf_block with rcu to allow safe deallocation when it is accessed > concurrently. This sucks, please fold this patch into where you call rcu_read_lock() on tcf block. This patch _alone_ is apparently not complete. This is not how we

Re: [PATCH net-next 13/13] net: sched: add flags to Qdisc class ops struct

2018-09-07 Thread Cong Wang
On Thu, Sep 6, 2018 at 12:59 AM Vlad Buslov wrote: > > Extend Qdisc_class_ops with flags. Create enum to hold possible class ops > flag values. Add first class ops flags value QDISC_CLASS_OPS_DOIT_UNLOCKED > to indicate that class ops functions can be called without taking rtnl > lock. We don't

Re: [PATCH net-next v2] net: sched: change tcf_del_walker() to take idrinfo->lock

2018-09-07 Thread Cong Wang
On Fri, Sep 7, 2018 at 6:52 AM Vlad Buslov wrote: > > Action API was changed to work with actions and action_idr in concurrency > safe manner, however tcf_del_walker() still uses actions without taking a > reference or idrinfo->lock first, and deletes them directly, disregarding > possible

Re: [PATCH 6/7] get rid of tc_u_common ->rcu

2018-09-06 Thread Cong Wang
On Wed, Sep 5, 2018 at 12:04 PM Al Viro wrote: > > From: Al Viro > > unused > > Signed-off-by: Al Viro > --- > net/sched/cls_u32.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c > index 8a1a573487bd..be9240ae1417 100644 > ---

Re: [PATCH 2/7] mark root hnode explicitly

2018-09-06 Thread Cong Wang
On Thu, Sep 6, 2018 at 8:50 PM Al Viro wrote: > > On Thu, Sep 06, 2018 at 08:23:36PM -0700, Cong Wang wrote: > > > Pretty sure there is a 'tp' in u32_set_parms() parameter list. > > > > Are you saying it is not what you want? If so, why? > > > > More imp

Re: [PATCH 2/7] mark root hnode explicitly

2018-09-06 Thread Cong Wang
On Thu, Sep 6, 2018 at 8:04 PM Al Viro wrote: > > On Thu, Sep 06, 2018 at 07:57:25PM -0700, Cong Wang wrote: > > > > - if (root_ht == ht) { > > > + if (ht->is_root) { > > > > > > What's wrong with comparing pointers with root ht? > &

Re: [PATCH 2/7] mark root hnode explicitly

2018-09-06 Thread Cong Wang
On Thu, Sep 6, 2018 at 3:59 AM Al Viro wrote: > > diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c > index 3f985f29ef30..d14048e38b5c 100644 > --- a/net/sched/cls_u32.c > +++ b/net/sched/cls_u32.c > @@ -84,6 +84,7 @@ struct tc_u_hnode { > int refcnt; >

[Patch net] net_sched: properly cancel netlink dump on failure

2018-09-06 Thread Cong Wang
Signed-off-by: Cong Wang --- net/sched/act_tunnel_key.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index 28d58bbc953e..681f6f04e7da 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c @@ -412

Re: [PATCH net-next] net: sched: change tcf_del_walker() to use concurrent-safe delete

2018-09-06 Thread Cong Wang
On Thu, Sep 6, 2018 at 4:14 AM Vlad Buslov wrote: > > Isn't a concurrent tcf_idr_check_alloc() able to livelock here with > > your change? > > > > idr_for_each_entry_ul{ > >spin_lock(>lock); > >idr_remove(); > >spin_unlock(>lock); > > // tcf_idr_check_alloc() jumps in, > >

Re: [PATCH net-next] net: sched: change tcf_del_walker() to use concurrent-safe delete

2018-09-05 Thread Cong Wang
On Wed, Sep 5, 2018 at 12:05 AM Vlad Buslov wrote: > > > On Tue 04 Sep 2018 at 22:41, Cong Wang wrote: > > On Mon, Sep 3, 2018 at 1:33 PM Vlad Buslov wrote: > >> > >> > >> On Mon 03 Sep 2018 at 18:50, Cong Wang wrote: > >> &

Re: 4.18.6 dl_seq_start [xt_hashlimit] unable to handle kernel NULL pointer dereference at 0000000000000050

2018-09-05 Thread Cong Wang
On Wed, Sep 5, 2018 at 4:06 AM Sami Farin wrote: > > 4.17 worked ok, this with 32 GB Ryzen system. > > BUG: unable to handle kernel NULL pointer dereference at 0050 > PGD 0 P4D 0 > Oops: [#1] PREEMPT SMP NOPTI > CPU: 0 PID: 6303 Comm: grep Tainted: GT 4.18.6+ #16

Re: [PATCH net-next] net: sched: change tcf_del_walker() to use concurrent-safe delete

2018-09-04 Thread Cong Wang
On Mon, Sep 3, 2018 at 1:33 PM Vlad Buslov wrote: > > > On Mon 03 Sep 2018 at 18:50, Cong Wang wrote: > > On Mon, Sep 3, 2018 at 12:06 AM Vlad Buslov wrote: > >> > >> Action API was changed to work with actions and action_idr in concurrency > >> safe m

Re: [PATCH net-next v2] net: sched: action_ife: take reference to meta module

2018-09-04 Thread Cong Wang
gt; > Implement add_metainfo_and_get_ops() function that returns with reference > to module taken if metainfo was added successfully, and call it from > use_all_metadata(), instead of calling __add_metainfo() directly. Acked-by: Cong Wang This one should go to -net too.

Re: [PATCH net] net/sched: fix memory leak in act_tunnel_key_init()

2018-09-04 Thread Cong Wang
On Tue, Sep 4, 2018 at 10:00 AM Davide Caratti wrote: > > If users try to install act_tunnel_key 'set' rules with duplicate values > of 'index', the tunnel metadata are allocated, but never released. Then, > kmemleak complains as follows: Acked-by: Cong Wang

Re: [Patch net] tipc: call start and done ops directly in __tipc_nl_compat_dumpit()

2018-09-03 Thread Cong Wang
On Mon, Sep 3, 2018 at 12:49 PM Cong Wang wrote: > > __tipc_nl_compat_dumpit() uses a netlink_callback on stack, > so the only way to align it with other ->dumpit() call path > is calling tipc_dump_start() and tipc_dump_done() directly > inside it. Otherwise ->dumpit() would

[Patch net] tipc: call start and done ops directly in __tipc_nl_compat_dumpit()

2018-09-03 Thread Cong Wang
t;tipc: switch to rhashtable iterator") Reported-by: syzbot+e93a2c41f91b8e2c7...@syzkaller.appspotmail.com Cc: Jon Maloy Cc: Ying Xue Signed-off-by: Cong Wang --- net/tipc/netlink_compat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c

Re: [PATCH net-next] net: sched: change tcf_del_walker() to use concurrent-safe delete

2018-09-03 Thread Cong Wang
On Mon, Sep 3, 2018 at 12:06 AM Vlad Buslov wrote: > > Action API was changed to work with actions and action_idr in concurrency > safe manner, however tcf_del_walker() still uses actions without taking > reference to them first and deletes them directly, disregarding possible > concurrent

Re: [PATCH net-next] net: sched: null actions array pointer before releasing action

2018-09-03 Thread Cong Wang
; time in error handling code of tca_action_gd(). Oops, good catch. Acked-by: Cong Wang David, this one should also go to -net rather than -net-next.

[Patch net] act_ife: fix a potential use-after-free

2018-09-03 Thread Cong Wang
Immediately after module_put(), user could delete this module, so e->ops could be already freed before we call e->ops->release(). Fix this by moving module_put() after ops->release(). Fixes: ef6980b6becb ("introduce IFE action") Cc: Jamal Hadi Salim Signed-off-by: Con

Re: [PATCH net-next] net: sched: action_ife: take reference to meta module

2018-09-03 Thread Cong Wang
eadlock") > Signed-off-by: Vlad Buslov This patch should be applied to -net rather than -net-next. Acked-by: Cong Wang One nit below. > static int add_metainfo(struct tcf_ife_info *ife, u32 metaid, void *metaval, > int len, bool exists) > { > @@ -349,7 +364

Re: [PATCH net-next] net: sched: action_ife: take reference to meta module

2018-09-03 Thread Cong Wang
On Mon, Sep 3, 2018 at 10:12 AM Vlad Buslov wrote: > > > On Mon 03 Sep 2018 at 17:03, Cong Wang wrote: > > On Mon, Sep 3, 2018 at 12:10 AM Vlad Buslov wrote: > >> > >> Recent refactoring of add_metainfo() caused use_all_metadata() to add > >> meta

Re: [PATCH net-next] net: sched: action_ife: take reference to meta module

2018-09-03 Thread Cong Wang
On Mon, Sep 3, 2018 at 12:10 AM Vlad Buslov wrote: > > Recent refactoring of add_metainfo() caused use_all_metadata() to add > metainfo to ife action metalist without taking reference to module. This > causes warning in module_put called from ife action cleanup function. > > Implement

[Patch net-nnext] Revert "net: sched: act: add extack for lookup callback"

2018-08-29 Thread Cong Wang
This reverts commit 331a9295de23 ("net: sched: act: add extack for lookup callback"). This extack is never used after 6 months... In fact, it can be just set in the caller, right after ->lookup(). Cc: Alexander Aring Signed-off-by: Cong Wang --- include/net/act_api.h | 3 +

[Patch net-nnext] net_sched: add missing tcf_lock for act_connmark

2018-08-29 Thread Cong Wang
According to the new locking rule, we have to take tcf_lock for both ->init() and ->dump(), as RTNL will be removed. However, it is missing for act_connmark. Cc: Vlad Buslov Signed-off-by: Cong Wang --- net/sched/act_connmark.c | 11 --- 1 file changed, 8 insertions(+), 3 del

[Patch iproute2 v2] ss: add UNIX_DIAG_VFS and UNIX_DIAG_ICONS for unix sockets

2018-08-29 Thread Cong Wang
UNIX_DIAG_VFS and UNIX_DIAG_ICONS are never used by ss, make them available in ss -e output. Cc: Stephen Hemminger Signed-off-by: Cong Wang --- misc/ss.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/misc/ss.c b/misc/ss.c index 41e7762b..b2c634c8 100644 --- a/misc

Re: [Patch iproute2] ss: add UNIX_DIAG_VFS and UNIX_DIAG_ICONS for unix sockets

2018-08-28 Thread Cong Wang
On Mon, Aug 27, 2018 at 3:27 PM Stephen Hemminger wrote: > > On Mon, 27 Aug 2018 14:46:52 -0700 > Cong Wang wrote: > > > UNIX_DIAG_VFS and UNIX_DIAG_ICONS are never used by ss, > > make them available in ss -e output. > > > > Cc: Stephen Hemminger > > S

Re: [PATCH net 1/2] net_sched: reject unknown tcfa_action values

2018-08-28 Thread Cong Wang
On Tue, Aug 28, 2018 at 7:25 AM Paolo Abeni wrote: > > +int tcf_action_destroy_one(struct tc_action *a, int bind) > +{ > + struct tc_action *actions[] = { a, NULL }; > + > + return tcf_action_destroy(actions, bind); > +} Make it static. > + > static int tcf_action_put(struct

Re: [PATCH net] net/sched: act_pedit: fix dump of extended layered op

2018-08-28 Thread Cong Wang
illrect sysimgblt > fb_sys_fops ttm drm ata_piix virtio_pci libata virtio_ring i2c_core virtio > floppy dm_mirror dm_region_hash dm_log dm_mod [last unloaded: act_pedit] > CR2: > > Like it's done for other TC actions, give up dumping pedit rules and return > an error if nla_nest_start() returns NULL. Looks good to me, Acked-by: Cong Wang While you are at it, please fix act_tunnel_key too. Thanks.

[Patch iproute2] ss: add UNIX_DIAG_VFS and UNIX_DIAG_ICONS for unix sockets

2018-08-27 Thread Cong Wang
UNIX_DIAG_VFS and UNIX_DIAG_ICONS are never used by ss, make them available in ss -e output. Cc: Stephen Hemminger Signed-off-by: Cong Wang --- misc/ss.c | 25 + 1 file changed, 25 insertions(+) diff --git a/misc/ss.c b/misc/ss.c index 41e7762b..d28bc1ec 100644

Re: [patch net 0/2] net: sched: couple of small fixes

2018-08-27 Thread Cong Wang
On Mon, Aug 27, 2018 at 11:58 AM Jiri Pirko wrote: > > From: Jiri Pirko > > Jiri Pirko (2): > net: sched: fix extack error message when chain is failed to be > created > net: sched: return -ENOENT when trying to remove filter from > non-existent chain Acked-by: Cong Wang

Re: broken behaviour of TC filter delete

2018-08-27 Thread Cong Wang
On Sat, Aug 25, 2018 at 6:06 AM Jiri Pirko wrote: > > Fri, Aug 24, 2018 at 08:11:07PM CEST, xiyou.wangc...@gmail.com wrote: > >On Fri, Aug 24, 2018 at 9:21 AM Roman Mashak wrote: > >> > >> So _before_ commit f71e0ca4db187af7c44987e9d21e9042c3046070 step 6 would > >> return -ENOENT with "Error:

Re: broken behaviour of TC filter delete

2018-08-24 Thread Cong Wang
On Fri, Aug 24, 2018 at 9:21 AM Roman Mashak wrote: > > So _before_ commit f71e0ca4db187af7c44987e9d21e9042c3046070 step 6 would > return -ENOENT with "Error: Filter with specified priority/protocol not > found." and _after_ the commit it returns -EINVAL (Error: Cannot find > specified filter

[Patch net] tipc: fix a missing rhashtable_walk_exit()

2018-08-23 Thread Cong Wang
rhashtable_walk_exit() must be paired with rhashtable_walk_enter(). Fixes: 40f9f4397060 ("tipc: Fix tipc_sk_reinit race conditions") Cc: Herbert Xu Cc: Ying Xue Signed-off-by: Cong Wang --- net/tipc/socket.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/tipc/socket.c

[Patch net] addrconf: reduce unnecessary atomic allocations

2018-08-22 Thread Cong Wang
All the 3 callers of addrconf_add_mroute() assert RTNL lock, they don't take any additional lock either, so it is safe to convert it to GFP_KERNEL. Same for sit_add_v4_addrs(). Cc: David Ahern Signed-off-by: Cong Wang --- net/ipv6/addrconf.c | 6 +++--- 1 file changed, 3 insertions(+), 3

[Patch net] net_sched: fix a compiler warning for tcf_exts_for_each_action()

2018-08-22 Thread Cong Wang
When CONFIG_NET_CLS_ACT=n, tcf_exts_for_each_action() is a nop, which leaves its parameters unused. Shut up the compiler warning by casting them to void. Fixes: 244cd96adb5f ("net_sched: remove list_head from tc_action") Reported-by: Stephen Rothwell Signed-off-by: Cong Wang --- i

Re: [Patch net 8/9] act_ife: move tcfa_lock down to where necessary

2018-08-20 Thread Cong Wang
On Mon, Aug 20, 2018 at 11:29 AM David Miller wrote: > > From: Cong Wang > Date: Sun, 19 Aug 2018 12:22:12 -0700 > > > The only time we need to take tcfa_lock is when adding > > a new metainfo to an existing ife->metalist. We don't need > > to take

[Patch net 2/9] net_sched: remove unnecessary ops->delete()

2018-08-19 Thread Cong Wang
oved. Fixes: b409074e6693 ("net: sched: add 'delete' function to action ops") Cc: Jiri Pirko Cc: Vlad Buslov Signed-off-by: Cong Wang --- include/net/act_api.h | 2 -- net/sched/act_api.c| 15 +++ net/sched/act_bpf.c| 8 net/sched/act_connmark.

[Patch net 6/9] net_sched: remove unused tcfa_capab

2018-08-19 Thread Cong Wang
Cc: Jamal Hadi Salim Signed-off-by: Cong Wang --- include/net/act_api.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/net/act_api.h b/include/net/act_api.h index f9c4b871af88..970303448c90 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -28,7 +28,6 @@ struct

[Patch net 7/9] Revert "net: sched: act_ife: disable bh when taking ife_mod_lock"

2018-08-19 Thread Cong Wang
This reverts commit 42c625a486f3 ("net: sched: act_ife: disable bh when taking ife_mod_lock"), because what ife_mod_lock protects is absolutely not touched in rate est timer BH context, they have no race. A better fix is following up. Cc: Vlad Buslov Cc: Jamal Hadi Salim Signed-of

[Patch net 4/9] net_sched: remove unused tcf_idr_check()

2018-08-19 Thread Cong Wang
tcf_idr_check() is replaced by tcf_idr_check_alloc(), and __tcf_idr_check() now can be folded into tcf_idr_search(). Fixes: 0190c1d452a9 ("net: sched: atomically check-allocate action") Cc: Jiri Pirko Cc: Vlad Buslov Signed-off-by: Cong Wang --- include/net/act_api.h | 2 --

[Patch net 8/9] act_ife: move tcfa_lock down to where necessary

2018-08-19 Thread Cong Wang
lad. Reported-by: Vlad Buslov Tested-by: Vlad Buslov Cc: Vlad Buslov Cc: Jamal Hadi Salim Signed-off-by: Cong Wang --- net/sched/act_ife.c | 38 +- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c in

[Patch net 3/9] net_sched: remove unused parameter for tcf_action_delete()

2018-08-19 Thread Cong Wang
Fixes: 16af6067392c ("net: sched: implement reference counted action release") Cc: Jiri Pirko Cc: Vlad Buslov Signed-off-by: Cong Wang --- net/sched/act_api.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 00

[Patch net 9/9] act_ife: fix a potential deadlock

2018-08-19 Thread Cong Wang
efore reading ifeoplist") Cc: Jamal Hadi Salim Signed-off-by: Cong Wang --- net/sched/act_ife.c | 34 +- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index 244a8cf48183..196430aefe87 100644 --- a/net/sched

[Patch net 1/9] net_sched: improve and refactor tcf_action_put_many()

2018-08-19 Thread Cong Wang
Cc: Vlad Buslov Signed-off-by: Cong Wang --- net/sched/act_api.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 229d63c99be2..cd69a6afcf88 100644 --- a/net/sched/act_api.c +++ b/net/sched

[Patch net 0/9] net_sched: pending clean up and bug fixes

2018-08-19 Thread Cong Wang
for it. Patch 9 fixes a potential deadlock found by me during code review. Please see each patch for details. Cc: Jamal Hadi Salim Signed-off-by: Cong Wang Cong Wang (9): net_sched: improve and refactor tcf_action_put_many() net_sched: remove unnecessary ops->delete() net_sched: remove unu

<    1   2   3   4   5   6   7   8   9   10   >