Commit c58e88d
icmp: prevent possible NULL dereferences from icmp_build_probe()
First problem is a double call to __in_dev_get_rcu(), because
the second one could return NULL.
if (__in_dev_get_rcu(dev) && __in_dev_get_rcu(dev)->ifa_list)
Second problem is a read from dev->ip6_ptr with no NULL check:
if (!list_empty(&rcu_dereference(dev->ip6_ptr)->addr_list))
Use the correct RCU API to fix these.
v2: add missing include <net/addrconf.h>
Fixes: d329ea5 ("icmp: add response to RFC 8335 PROBE messages")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Andreas Roeseler <andreas.a.roeseler@gmail.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent 0b8fe5b commit c58e88d
1 file changed
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| |||
1032 | 1033 | | |
1033 | 1034 | | |
1034 | 1035 | | |
| 1036 | + | |
| 1037 | + | |
1035 | 1038 | | |
1036 | 1039 | | |
1037 | 1040 | | |
| |||
1115 | 1118 | | |
1116 | 1119 | | |
1117 | 1120 | | |
1118 | | - | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
1119 | 1124 | | |
1120 | | - | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
1121 | 1128 | | |
| 1129 | + | |
1122 | 1130 | | |
1123 | 1131 | | |
1124 | 1132 | | |
| |||
0 commit comments