Commit ac4436a
thermal: of: fix double-free on unregistration
Since commit 3d439b1 ("thermal/core: Alloc-copy-free the thermal
zone parameters structure"), thermal_zone_device_register() allocates
a copy of the tzp argument and frees it when unregistering, so
thermal_of_zone_register() now ends up leaking its original tzp and
double-freeing the tzp copy. Fix this by locating tzp on stack instead.
Fixes: 3d439b1 ("thermal/core: Alloc-copy-free the thermal zone parameters structure")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: 6.4+ <stable@vger.kernel.org> # 6.4+: 8bcbb18: thermal: core: constify params in thermal_zone_device_register
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>1 parent 80ddce5 commit ac4436a
1 file changed
+6
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | | - | |
| 241 | + | |
| 242 | + | |
242 | 243 | | |
243 | | - | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | 248 | | |
253 | 249 | | |
254 | 250 | | |
| |||
267 | 263 | | |
268 | 264 | | |
269 | 265 | | |
270 | | - | |
271 | | - | |
272 | 266 | | |
273 | 267 | | |
274 | 268 | | |
| |||
442 | 436 | | |
443 | 437 | | |
444 | 438 | | |
445 | | - | |
446 | 439 | | |
447 | 440 | | |
448 | 441 | | |
449 | 442 | | |
450 | 443 | | |
451 | | - | |
452 | 444 | | |
453 | 445 | | |
454 | 446 | | |
| |||
477 | 469 | | |
478 | 470 | | |
479 | 471 | | |
480 | | - | |
| 472 | + | |
481 | 473 | | |
482 | 474 | | |
483 | 475 | | |
| |||
509 | 501 | | |
510 | 502 | | |
511 | 503 | | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
| 504 | + | |
518 | 505 | | |
519 | 506 | | |
520 | 507 | | |
521 | 508 | | |
522 | 509 | | |
523 | 510 | | |
524 | 511 | | |
525 | | - | |
| 512 | + | |
526 | 513 | | |
527 | 514 | | |
528 | 515 | | |
529 | 516 | | |
530 | | - | |
| 517 | + | |
531 | 518 | | |
532 | 519 | | |
533 | 520 | | |
| |||
540 | 527 | | |
541 | 528 | | |
542 | 529 | | |
543 | | - | |
544 | | - | |
545 | 530 | | |
546 | 531 | | |
547 | 532 | | |
| |||
0 commit comments