diff options
| author | Felix Gu <ustc.gu@gmail.com> | 2026-08-22 02:58:47 +0800 |
|---|---|---|
| committer | Ulf Hansson <ulfh@kernel.org> | 2026-09-09 13:27:04 +0200 |
| commit | 53823e25793a97d07e6e98e0904bbf74cac8bc76 (patch) | |
| tree | 8cbb4897e52df04c7d6207cb96e704ff03e9134c | |
| parent | 8b0cc8707f65e0f51912e764e1b309b2559db1ec (diff) | |
| download | linux-next-53823e25793a97d07e6e98e0904bbf74cac8bc76.tar.gz linux-next-53823e25793a97d07e6e98e0904bbf74cac8bc76.zip | |
mmc: sdio_uart: fix xmit_fifo leak when the port table is full
sdio_uart_add_port() allocates the transmit fifo before claiming a
slot in sdio_uart_table[]. When all UART_NR slots are taken, it
returns -EBUSY with the fifo still allocated, but the probe error
path only kfree()s the port, leaking the transmit fifo.
Free the fifo in the failure path of sdio_uart_add_port() itself so
the function retains nothing on error.
Fixes: 8b197a5ce7a7 ("sdio_uart: Use kfifo instead of the messy circ stuff")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
| -rw-r--r-- | drivers/mmc/core/sdio_uart.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mmc/core/sdio_uart.c b/drivers/mmc/core/sdio_uart.c index 7fd5dedf3ac0..705163c42972 100644 --- a/drivers/mmc/core/sdio_uart.c +++ b/drivers/mmc/core/sdio_uart.c @@ -104,6 +104,9 @@ static int sdio_uart_add_port(struct sdio_uart_port *port) } spin_unlock(&sdio_uart_table_lock); + if (ret) + kfifo_free(&port->xmit_fifo); + return ret; } |
