* [PATCH] net: sched: integer overflow fix
@ 2012-12-21 20:39 Stefan Hasko
2012-12-21 22:51 ` Eric Dumazet
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hasko @ 2012-12-21 20:39 UTC (permalink / raw)
To: Jamal Hadi Salim, David S. Miller, netdev; +Cc: linux-kernel, Stefan Hasko
Fixed integer overflow in function htb_dequeue
Signed-off-by: Stefan Hasko <hasko.stevo@gmail.com>
---
net/sched/sch_htb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index d2922c0..1bd3faa 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -919,7 +919,7 @@ ok:
q->now = ktime_to_ns(ktime_get());
start_at = jiffies;
- next_event = q->now + 5 * NSEC_PER_SEC;
+ next_event = q->now + (u32)5 * NSEC_PER_SEC;
for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
/* common case optimization - skip event handler quickly */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] net: sched: integer overflow fix
2012-12-21 20:39 Stefan Hasko
@ 2012-12-21 22:51 ` Eric Dumazet
2012-12-22 0:11 ` Eric Dumazet
0 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2012-12-21 22:51 UTC (permalink / raw)
To: Stefan Hasko
Cc: Jamal Hadi Salim, David S. Miller, netdev, linux-kernel,
Vimalkumar
On Fri, 2012-12-21 at 21:39 +0100, Stefan Hasko wrote:
> Fixed integer overflow in function htb_dequeue
>
> Signed-off-by: Stefan Hasko <hasko.stevo@gmail.com>
> ---
> net/sched/sch_htb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
> index d2922c0..1bd3faa 100644
> --- a/net/sched/sch_htb.c
> +++ b/net/sched/sch_htb.c
> @@ -919,7 +919,7 @@ ok:
> q->now = ktime_to_ns(ktime_get());
> start_at = jiffies;
>
> - next_event = q->now + 5 * NSEC_PER_SEC;
> + next_event = q->now + (u32)5 * NSEC_PER_SEC;
>
> for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
> /* common case optimization - skip event handler quickly */
But this patch is wrong !
I am a bit surprised, as I remember spotting this error in one patch
submission from Vimalkumar.
Apparently it got lost.
Please fix the bug for good, not adding another one.
Thanks
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: sched: integer overflow fix
2012-12-21 22:51 ` Eric Dumazet
@ 2012-12-22 0:11 ` Eric Dumazet
0 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2012-12-22 0:11 UTC (permalink / raw)
To: Stefan Hasko
Cc: Jamal Hadi Salim, David S. Miller, netdev, linux-kernel,
Vimalkumar
On Fri, 2012-12-21 at 14:51 -0800, Eric Dumazet wrote:
> On Fri, 2012-12-21 at 21:39 +0100, Stefan Hasko wrote:
> > Fixed integer overflow in function htb_dequeue
> >
> > Signed-off-by: Stefan Hasko <hasko.stevo@gmail.com>
> > ---
> > net/sched/sch_htb.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
> > index d2922c0..1bd3faa 100644
> > --- a/net/sched/sch_htb.c
> > +++ b/net/sched/sch_htb.c
> > @@ -919,7 +919,7 @@ ok:
> > q->now = ktime_to_ns(ktime_get());
> > start_at = jiffies;
> >
> > - next_event = q->now + 5 * NSEC_PER_SEC;
> > + next_event = q->now + (u32)5 * NSEC_PER_SEC;
> >
> > for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
> > /* common case optimization - skip event handler quickly */
>
> But this patch is wrong !
>
Please resend your patch using something like
It will work much better.
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index d2922c0..51561ea 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -919,7 +919,7 @@ ok:
q->now = ktime_to_ns(ktime_get());
start_at = jiffies;
- next_event = q->now + 5 * NSEC_PER_SEC;
+ next_event = q->now + 5LLU * NSEC_PER_SEC;
for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
/* common case optimization - skip event handler quickly */
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] net: sched: integer overflow fix
@ 2012-12-22 1:04 Stefan Hasko
2012-12-22 1:16 ` Eric Dumazet
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hasko @ 2012-12-22 1:04 UTC (permalink / raw)
To: Jamal Hadi Salim, David S. Miller, netdev; +Cc: linux-kernel, Stefan Hasko
Sorry, I did not realize different sizes casting problem, now it's clear to me. Thanks for help.
Fixed integer overflow in function htb_dequeue
Signed-off-by: Stefan Hasko <hasko.stevo@gmail.com>
---
net/sched/sch_htb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index d2922c0..51561ea 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -919,7 +919,7 @@ ok:
q->now = ktime_to_ns(ktime_get());
start_at = jiffies;
- next_event = q->now + 5 * NSEC_PER_SEC;
+ next_event = q->now + 5LLU * NSEC_PER_SEC;
for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
/* common case optimization - skip event handler quickly */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] net: sched: integer overflow fix
2012-12-22 1:04 [PATCH] net: sched: integer overflow fix Stefan Hasko
@ 2012-12-22 1:16 ` Eric Dumazet
2012-12-22 8:03 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2012-12-22 1:16 UTC (permalink / raw)
To: Stefan Hasko; +Cc: Jamal Hadi Salim, David S. Miller, netdev, linux-kernel
On Sat, 2012-12-22 at 02:04 +0100, Stefan Hasko wrote:
> Sorry, I did not realize different sizes casting problem, now it's clear to me. Thanks for help.
>
> Fixed integer overflow in function htb_dequeue
>
> Signed-off-by: Stefan Hasko <hasko.stevo@gmail.com>
> ---
> net/sched/sch_htb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
> index d2922c0..51561ea 100644
> --- a/net/sched/sch_htb.c
> +++ b/net/sched/sch_htb.c
> @@ -919,7 +919,7 @@ ok:
> q->now = ktime_to_ns(ktime_get());
> start_at = jiffies;
>
> - next_event = q->now + 5 * NSEC_PER_SEC;
> + next_event = q->now + 5LLU * NSEC_PER_SEC;
>
> for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
> /* common case optimization - skip event handler quickly */
I guess David will remove the first line of your changelog
Acked-by: Eric Dumazet <edumazet@google.com>
Thanks
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: sched: integer overflow fix
2012-12-22 1:16 ` Eric Dumazet
@ 2012-12-22 8:03 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2012-12-22 8:03 UTC (permalink / raw)
To: eric.dumazet; +Cc: hasko.stevo, jhs, netdev, linux-kernel
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 21 Dec 2012 17:16:37 -0800
> On Sat, 2012-12-22 at 02:04 +0100, Stefan Hasko wrote:
>> Sorry, I did not realize different sizes casting problem, now it's clear to me. Thanks for help.
>>
>> Fixed integer overflow in function htb_dequeue
>>
>> Signed-off-by: Stefan Hasko <hasko.stevo@gmail.com>
>> ---
>> net/sched/sch_htb.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
>> index d2922c0..51561ea 100644
>> --- a/net/sched/sch_htb.c
>> +++ b/net/sched/sch_htb.c
>> @@ -919,7 +919,7 @@ ok:
>> q->now = ktime_to_ns(ktime_get());
>> start_at = jiffies;
>>
>> - next_event = q->now + 5 * NSEC_PER_SEC;
>> + next_event = q->now + 5LLU * NSEC_PER_SEC;
>>
>> for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
>> /* common case optimization - skip event handler quickly */
>
> I guess David will remove the first line of your changelog
>
> Acked-by: Eric Dumazet <edumazet@google.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-12-22 8:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-22 1:04 [PATCH] net: sched: integer overflow fix Stefan Hasko
2012-12-22 1:16 ` Eric Dumazet
2012-12-22 8:03 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2012-12-21 20:39 Stefan Hasko
2012-12-21 22:51 ` Eric Dumazet
2012-12-22 0:11 ` Eric Dumazet
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).