]> git.baikalelectronics.ru Git - kernel.git/commit
Merge branch 'idr-fix-overflow-cases-on-32-bit-CPU'
authorDavid S. Miller <davem@davemloft.net>
Tue, 2 Jul 2019 02:15:46 +0000 (19:15 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Jul 2019 02:15:46 +0000 (19:15 -0700)
commitbd1fc0728bc42d9b844867003e2032249df8b5db
tree88f7b417e9a8c7061b04e7ba0a77c3884b4f018b
parentb69857fd1181f70bd1e758e6f80594bc512e27c1
parent0cb12ff5004b2457e280e5e153cb0f70bcb70596
Merge branch 'idr-fix-overflow-cases-on-32-bit-CPU'

Cong Wang says:

====================
idr: fix overflow cases on 32-bit CPU

idr_get_next_ul() is problematic by design, it can't handle
the following overflow case well on 32-bit CPU:

u32 id = UINT_MAX;
idr_alloc_u32(&id);
while (idr_get_next_ul(&id) != NULL)
 id++;

when 'id' overflows and becomes 0 after UINT_MAX, the loop
goes infinite.

Fix this by eliminating external users of idr_get_next_ul()
and migrating them to idr_for_each_entry_continue_ul(). And
add an additional parameter for these iteration macros to detect
overflow properly.

Please merge this through networking tree, as all the users
are in networking subsystem.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>