Commit 03819ab
net: usb: lan78xx: Fix double free issue with interrupt buffer allocation
In lan78xx_probe(), the buffer `buf` was being freed twice: once
implicitly through `usb_free_urb(dev->urb_intr)` with the
`URB_FREE_BUFFER` flag and again explicitly by `kfree(buf)`. This caused
a double free issue.
To resolve this, reordered `kmalloc()` and `usb_alloc_urb()` calls to
simplify the initialization sequence and removed the redundant
`kfree(buf)`. Now, `buf` is allocated after `usb_alloc_urb()`, ensuring
it is correctly managed by `usb_fill_int_urb()` and freed by
`usb_free_urb()` as intended.
Fixes: a6df95c ("lan78xx: Fix memory allocation bug")
Cc: John Efstathiades <john.efstathiades@pebblebay.com>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://patch.msgid.link/20241116130558.1352230-1-o.rempel@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent f26a29a commit 03819ab
1 file changed
+14
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4414 | 4414 | | |
4415 | 4415 | | |
4416 | 4416 | | |
4417 | | - | |
4418 | | - | |
| 4417 | + | |
| 4418 | + | |
| 4419 | + | |
4419 | 4420 | | |
4420 | 4421 | | |
4421 | 4422 | | |
4422 | 4423 | | |
4423 | | - | |
4424 | | - | |
| 4424 | + | |
| 4425 | + | |
4425 | 4426 | | |
4426 | | - | |
4427 | | - | |
4428 | | - | |
4429 | | - | |
4430 | | - | |
4431 | | - | |
| 4427 | + | |
4432 | 4428 | | |
4433 | 4429 | | |
| 4430 | + | |
| 4431 | + | |
| 4432 | + | |
| 4433 | + | |
| 4434 | + | |
4434 | 4435 | | |
4435 | 4436 | | |
4436 | 4437 | | |
4437 | 4438 | | |
4438 | 4439 | | |
4439 | | - | |
| 4440 | + | |
4440 | 4441 | | |
4441 | 4442 | | |
4442 | 4443 | | |
4443 | 4444 | | |
4444 | 4445 | | |
4445 | 4446 | | |
4446 | 4447 | | |
4447 | | - | |
| 4448 | + | |
4448 | 4449 | | |
4449 | 4450 | | |
4450 | 4451 | | |
| |||
4466 | 4467 | | |
4467 | 4468 | | |
4468 | 4469 | | |
4469 | | - | |
| 4470 | + | |
4470 | 4471 | | |
4471 | | - | |
4472 | | - | |
4473 | 4472 | | |
4474 | 4473 | | |
4475 | 4474 | | |
| |||
0 commit comments