Thread (14 messages) 14 messages, 4 authors, 2016-09-22

Re: [PATCH net] net: get rid of an signed integer overflow in ip_idents_reserve()

flat view

From: David Miller <davem@davemloft.net>
Date: 2016-09-22 06:43:00

From: Eric Dumazet <redacted>
Date: Tue, 20 Sep 2016 18:06:17 -0700
From: Eric Dumazet <redacted>

Jiri Pirko reported an UBSAN warning happening in ip_idents_reserve()

[] UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:11
[] signed integer overflow:
[] -2117905507 + -695755206 cannot be represented in type 'int'

Since we do not have uatomic_add_return() yet, use atomic_cmpxchg()
so that the arithmetics can be done using unsigned int.

Fixes: 04ca6973f7c1 ("ip: make IP identifiers less predictable")
Signed-off-by: Eric Dumazet <redacted>
Reported-by: Jiri Pirko <jiri@resnulli.us>
---
David, Jiri, I removed the prandom_u32() stuff in favor of a traditional
loop to meet stable requirements. Thanks !
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help