Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: get rid of an signed integer overflow in ip_idents_reserve()
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: 04ca697 ("ip: make IP identifiers less predictable") Signed-off-by: Eric Dumazet <[email protected]> Reported-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
- Loading branch information