Commit 9df99c3
net: inet6: do not leave a dangling sk pointer in inet6_create()
sock_init_data() attaches the allocated sk pointer to the provided sock
object. If inet6_create() fails later, the sk object is released, but the
sock object retains the dangling sk pointer, which may cause use-after-free
later.
Clear the sock sk pointer on error.
Signed-off-by: Ignat Korchagin <ignat@cloudflare.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20241014153808.51894-8-ignat@cloudflare.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent 9365fa5 commit 9df99c3
1 file changed
+10
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 255 | + | |
| 256 | + | |
259 | 257 | | |
260 | 258 | | |
261 | 259 | | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
| 260 | + | |
| 261 | + | |
266 | 262 | | |
267 | 263 | | |
268 | 264 | | |
269 | 265 | | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
| 266 | + | |
| 267 | + | |
274 | 268 | | |
275 | 269 | | |
276 | 270 | | |
277 | 271 | | |
278 | 272 | | |
279 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
280 | 278 | | |
281 | 279 | | |
282 | 280 | | |
| |||
0 commit comments