Commit e3d81d7
xfrm: Fix wraparound in xfrm_policy_addr_delta()
BugLink: https://bugs.launchpad.net/bugs/1916056
[ Upstream commit da64ae2 ]
Use three-way comparison for address components to avoid integer
wraparound in the result of xfrm_policy_addr_delta(). This ensures
that the search trees are built and traversed correctly.
Treat IPv4 and IPv6 similarly by returning 0 when prefixlen == 0.
Prefix /0 has only one equivalence class.
Fixes: 9cf545e ("xfrm: policy: store inexact policies in a tree ordered by destination address")
Signed-off-by: Visa Hankala <[email protected]>
Acked-by: Florian Westphal <[email protected]>
Signed-off-by: Steffen Klassert <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Kamal Mostafa <[email protected]>
Signed-off-by: Stefan Bader <[email protected]>1 parent e088aeb commit e3d81d7
File tree
2 files changed
+61
-8
lines changed- net/xfrm
- tools/testing/selftests/net
2 files changed
+61
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
790 | 790 | | |
791 | 791 | | |
792 | 792 | | |
| 793 | + | |
793 | 794 | | |
794 | 795 | | |
795 | 796 | | |
796 | 797 | | |
797 | 798 | | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
802 | 809 | | |
803 | 810 | | |
804 | 811 | | |
| |||
809 | 816 | | |
810 | 817 | | |
811 | 818 | | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
816 | 826 | | |
817 | 827 | | |
818 | 828 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
290 | 331 | | |
291 | 332 | | |
292 | 333 | | |
| |||
438 | 479 | | |
439 | 480 | | |
440 | 481 | | |
| 482 | + | |
| 483 | + | |
441 | 484 | | |
442 | 485 | | |
443 | 486 | | |
0 commit comments