* [Patch net-next 1/2] net_sched: fix errno in tcindex_set_parms()
@ 2014-09-25 19:06 Cong Wang
2014-09-25 19:06 ` [Patch net-next 2/2] net_sched: fix another regression in cls_tcindex Cong Wang
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Cong Wang @ 2014-09-25 19:06 UTC (permalink / raw)
To: netdev; +Cc: davem, Cong Wang, John Fastabend
When kmemdup() fails, we should return -ENOMEM.
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
net/sched/cls_tcindex.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index 5054fae..9d78fd7 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -237,15 +237,14 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
if (err < 0)
return err;
+ err = -ENOMEM;
/* tcindex_data attributes must look atomic to classifier/lookup so
* allocate new tcindex data and RCU assign it onto root. Keeping
* perfect hash and hash pointers from old data.
*/
cp = kzalloc(sizeof(*cp), GFP_KERNEL);
- if (!cp) {
- err = -ENOMEM;
+ if (!cp)
goto errout;
- }
cp->mask = p->mask;
cp->shift = p->shift;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Patch net-next 2/2] net_sched: fix another regression in cls_tcindex
2014-09-25 19:06 [Patch net-next 1/2] net_sched: fix errno in tcindex_set_parms() Cong Wang
@ 2014-09-25 19:06 ` Cong Wang
2014-09-25 21:18 ` John Fastabend
2014-09-28 21:35 ` David Miller
2014-09-25 21:07 ` [Patch net-next 1/2] net_sched: fix errno in tcindex_set_parms() John Fastabend
2014-09-28 21:35 ` David Miller
2 siblings, 2 replies; 8+ messages in thread
From: Cong Wang @ 2014-09-25 19:06 UTC (permalink / raw)
To: netdev; +Cc: davem, Cong Wang, John Fastabend
Clearly the following change is not expected:
- if (!cp.perfect && !cp.h)
- cp.alloc_hash = cp.hash;
+ if (!cp->perfect && cp->h)
+ cp->alloc_hash = cp->hash;
Fixes: commit 331b72922c5f58d48fd ("net: sched: RCU cls_tcindex")
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
net/sched/cls_tcindex.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index 9d78fd7..a18eb1b 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -303,7 +303,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
cp->hash = DEFAULT_HASH_SIZE;
}
- if (!cp->perfect && cp->h)
+ if (!cp->perfect && !cp->h)
cp->alloc_hash = cp->hash;
/* Note: this could be as restrictive as if (handle & ~(mask >> shift))
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Patch net-next 1/2] net_sched: fix errno in tcindex_set_parms()
2014-09-25 19:06 [Patch net-next 1/2] net_sched: fix errno in tcindex_set_parms() Cong Wang
2014-09-25 19:06 ` [Patch net-next 2/2] net_sched: fix another regression in cls_tcindex Cong Wang
@ 2014-09-25 21:07 ` John Fastabend
2014-09-25 22:57 ` John Fastabend
2014-09-28 21:35 ` David Miller
2 siblings, 1 reply; 8+ messages in thread
From: John Fastabend @ 2014-09-25 21:07 UTC (permalink / raw)
To: Cong Wang, netdev; +Cc: davem, John Fastabend
On 09/25/2014 12:06 PM, Cong Wang wrote:
> When kmemdup() fails, we should return -ENOMEM.
>
> Cc: John Fastabend <john.fastabend@gmail.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
Acked-by: John Fastabend <john.r.fastabend@intel.com>
Thanks Cong.
> net/sched/cls_tcindex.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
> index 5054fae..9d78fd7 100644
> --- a/net/sched/cls_tcindex.c
> +++ b/net/sched/cls_tcindex.c
> @@ -237,15 +237,14 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
> if (err < 0)
> return err;
>
> + err = -ENOMEM;
> /* tcindex_data attributes must look atomic to classifier/lookup so
> * allocate new tcindex data and RCU assign it onto root. Keeping
> * perfect hash and hash pointers from old data.
> */
> cp = kzalloc(sizeof(*cp), GFP_KERNEL);
> - if (!cp) {
> - err = -ENOMEM;
> + if (!cp)
> goto errout;
> - }
>
> cp->mask = p->mask;
> cp->shift = p->shift;
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Patch net-next 2/2] net_sched: fix another regression in cls_tcindex
2014-09-25 19:06 ` [Patch net-next 2/2] net_sched: fix another regression in cls_tcindex Cong Wang
@ 2014-09-25 21:18 ` John Fastabend
2014-09-28 21:35 ` David Miller
1 sibling, 0 replies; 8+ messages in thread
From: John Fastabend @ 2014-09-25 21:18 UTC (permalink / raw)
To: Cong Wang, netdev; +Cc: davem, John Fastabend
On 09/25/2014 12:06 PM, Cong Wang wrote:
> Clearly the following change is not expected:
>
> - if (!cp.perfect && !cp.h)
> - cp.alloc_hash = cp.hash;
> + if (!cp->perfect && cp->h)
> + cp->alloc_hash = cp->hash;
>
> Fixes: commit 331b72922c5f58d48fd ("net: sched: RCU cls_tcindex")
> Cc: John Fastabend <john.fastabend@gmail.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
> net/sched/cls_tcindex.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
> index 9d78fd7..a18eb1b 100644
> --- a/net/sched/cls_tcindex.c
> +++ b/net/sched/cls_tcindex.c
> @@ -303,7 +303,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
> cp->hash = DEFAULT_HASH_SIZE;
> }
>
> - if (!cp->perfect && cp->h)
> + if (!cp->perfect && !cp->h)
> cp->alloc_hash = cp->hash;
>
> /* Note: this could be as restrictive as if (handle & ~(mask >> shift))
>
Dang thanks. I added a test to my scripts that doesn't set the
hash explicitly with TCA_TCINDEX_HASH. It looks like changes to
the filter after the initial setup could fail without this fix.
Acked-by: John Fastabend <john.r.fastabend@intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Patch net-next 1/2] net_sched: fix errno in tcindex_set_parms()
2014-09-25 21:07 ` [Patch net-next 1/2] net_sched: fix errno in tcindex_set_parms() John Fastabend
@ 2014-09-25 22:57 ` John Fastabend
2014-09-26 0:27 ` John Fastabend
0 siblings, 1 reply; 8+ messages in thread
From: John Fastabend @ 2014-09-25 22:57 UTC (permalink / raw)
To: John Fastabend; +Cc: Cong Wang, netdev, davem
On 09/25/2014 02:07 PM, John Fastabend wrote:
> On 09/25/2014 12:06 PM, Cong Wang wrote:
>> When kmemdup() fails, we should return -ENOMEM.
>>
>> Cc: John Fastabend <john.fastabend@gmail.com>
>> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>> ---
>
> Acked-by: John Fastabend <john.r.fastabend@intel.com>
>
> Thanks Cong.
>
Related to this we should probably push error messages
from the dump routines correctly. If you see u32_dump()
returns a -EINVAL even though it was due to a memory
allocation failure. This is not necessarily due to my
patches though I think the error returning from dump
has always been a simple -1 value.
I'll take a look at it, unless you beat me to it, after
I finish up the percpu stats which I'm doing now.
.John
--
John Fastabend Intel Corporation
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Patch net-next 1/2] net_sched: fix errno in tcindex_set_parms()
2014-09-25 22:57 ` John Fastabend
@ 2014-09-26 0:27 ` John Fastabend
0 siblings, 0 replies; 8+ messages in thread
From: John Fastabend @ 2014-09-26 0:27 UTC (permalink / raw)
To: John Fastabend; +Cc: Cong Wang, netdev, davem
On 09/25/2014 03:57 PM, John Fastabend wrote:
> On 09/25/2014 02:07 PM, John Fastabend wrote:
>> On 09/25/2014 12:06 PM, Cong Wang wrote:
>>> When kmemdup() fails, we should return -ENOMEM.
>>>
>>> Cc: John Fastabend <john.fastabend@gmail.com>
>>> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>>> ---
>>
>> Acked-by: John Fastabend <john.r.fastabend@intel.com>
>>
>> Thanks Cong.
>>
>
> Related to this we should probably push error messages
> from the dump routines correctly. If you see u32_dump()
> returns a -EINVAL even though it was due to a memory
> allocation failure. This is not necessarily due to my
> patches though I think the error returning from dump
> has always been a simple -1 value.
>
> I'll take a look at it, unless you beat me to it, after
> I finish up the percpu stats which I'm doing now.
>
> .John
>
Also just in case you hit them, there is an suspicious
rcu usage from qdisc_watchdog and another from task_csl_state()
call in cls_cgroup.
The qdisc_watchdog is due to the annotation on the qdisc
and I'm not entirely convinced the cls_cgroup hasn't been
there all along.
I'm looking into them but most likely wont figure it out
tonight as I have to take off for a bit.
Thanks,
John
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Patch net-next 1/2] net_sched: fix errno in tcindex_set_parms()
2014-09-25 19:06 [Patch net-next 1/2] net_sched: fix errno in tcindex_set_parms() Cong Wang
2014-09-25 19:06 ` [Patch net-next 2/2] net_sched: fix another regression in cls_tcindex Cong Wang
2014-09-25 21:07 ` [Patch net-next 1/2] net_sched: fix errno in tcindex_set_parms() John Fastabend
@ 2014-09-28 21:35 ` David Miller
2 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2014-09-28 21:35 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, john.fastabend
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Thu, 25 Sep 2014 12:06:04 -0700
> When kmemdup() fails, we should return -ENOMEM.
>
> Cc: John Fastabend <john.fastabend@gmail.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Patch net-next 2/2] net_sched: fix another regression in cls_tcindex
2014-09-25 19:06 ` [Patch net-next 2/2] net_sched: fix another regression in cls_tcindex Cong Wang
2014-09-25 21:18 ` John Fastabend
@ 2014-09-28 21:35 ` David Miller
1 sibling, 0 replies; 8+ messages in thread
From: David Miller @ 2014-09-28 21:35 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, john.fastabend
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Thu, 25 Sep 2014 12:06:05 -0700
> Clearly the following change is not expected:
>
> - if (!cp.perfect && !cp.h)
> - cp.alloc_hash = cp.hash;
> + if (!cp->perfect && cp->h)
> + cp->alloc_hash = cp->hash;
>
> Fixes: commit 331b72922c5f58d48fd ("net: sched: RCU cls_tcindex")
> Cc: John Fastabend <john.fastabend@gmail.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-09-28 21:35 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-25 19:06 [Patch net-next 1/2] net_sched: fix errno in tcindex_set_parms() Cong Wang
2014-09-25 19:06 ` [Patch net-next 2/2] net_sched: fix another regression in cls_tcindex Cong Wang
2014-09-25 21:18 ` John Fastabend
2014-09-28 21:35 ` David Miller
2014-09-25 21:07 ` [Patch net-next 1/2] net_sched: fix errno in tcindex_set_parms() John Fastabend
2014-09-25 22:57 ` John Fastabend
2014-09-26 0:27 ` John Fastabend
2014-09-28 21:35 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).