All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2] Fixing a bug in team driver due to incorrect 'unsigned int' to 'int' conversion
@ 2016-10-07 13:02 Alex Sidorenko
  2016-10-08  3:51 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Sidorenko @ 2016-10-07 13:02 UTC (permalink / raw)
  To: netdev; +Cc: eric.dumazet, David Miller

Roundrobin runner of team driver uses 'unsigned int' variable to count
the number of sent_packets. Later it is passed to a subroutine
team_num_to_port_index(struct team *team, int num) as 'num' and when
we reach MAXINT (2**31-1), 'num' becomes negative.

This leads to using incorrect hash-bucket for port lookup
and as a result, packets are dropped. The fix consists of changing 
'int num' to 'unsigned int num'. Testing of a fixed kernel shows that
there is no packet drop anymore.


Signed-off-by: Alex Sidorenko <alexandre.sidorenko@hpe.com>


---
v2: fixed formatting

 include/linux/if_team.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 174f43f..c05216a 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -245,7 +245,7 @@ static inline struct team_port *team_get_port_by_index(struct team *team,
 	return NULL;
 }
 
-static inline int team_num_to_port_index(struct team *team, int num)
+static inline int team_num_to_port_index(struct team *team, unsigned int num)
 {
 	int en_port_count = ACCESS_ONCE(team->en_port_count);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net v2] Fixing a bug in team driver due to incorrect 'unsigned int' to 'int' conversion
  2016-10-07 13:02 [PATCH net v2] Fixing a bug in team driver due to incorrect 'unsigned int' to 'int' conversion Alex Sidorenko
@ 2016-10-08  3:51 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-10-08  3:51 UTC (permalink / raw)
  To: alexandre.sidorenko; +Cc: netdev, eric.dumazet

From: Alex Sidorenko <alexandre.sidorenko@hpe.com>
Date: Fri, 07 Oct 2016 09:02:33 -0400

> Roundrobin runner of team driver uses 'unsigned int' variable to count
> the number of sent_packets. Later it is passed to a subroutine
> team_num_to_port_index(struct team *team, int num) as 'num' and when
> we reach MAXINT (2**31-1), 'num' becomes negative.
> 
> This leads to using incorrect hash-bucket for port lookup
> and as a result, packets are dropped. The fix consists of changing 
> 'int num' to 'unsigned int num'. Testing of a fixed kernel shows that
> there is no packet drop anymore.
> 
> 
> Signed-off-by: Alex Sidorenko <alexandre.sidorenko@hpe.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-08  3:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-07 13:02 [PATCH net v2] Fixing a bug in team driver due to incorrect 'unsigned int' to 'int' conversion Alex Sidorenko
2016-10-08  3:51 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.