Repository navigation
Commit 4716c23
misc: fastrpc: Remove buffer from list prior to unmap operation
[ Upstream commit 6102ceb ]
fastrpc_req_munmap_impl() is called to unmap any buffer. The buffer is
getting removed from the list after it is unmapped from DSP. This can
create potential race conditions if multiple threads invoke unmap
concurrently, where one thread may remove the entry from the list while
another thread's unmap operation is still ongoing.
Fix this by removing the buffer entry from the list before calling the
unmap operation. If the unmap fails, the entry is re-added to the list
so that userspace can retry the unmap, or alternatively, the buffer
will be cleaned up during device release when the DSP process is torn
down and all DSP-side mappings are freed along with remaining buffers
in the list.
Fixes: 2419e55 ("misc: fastrpc: add mmap/unmap support")
Cc: stable@kernel.org
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
Signed-off-by: Jianping Li <jianping.li@oss.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
Link: https://patch.msgid.link/20260724223342.629168-3-srini@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent b10e064 commit 4716c23
1 file changed
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1409 | 1409 | | |
1410 | 1410 | | |
1411 | 1411 | | |
1412 | | - | |
1413 | | - | |
1414 | | - | |
1415 | 1412 | | |
1416 | 1413 | | |
1417 | 1414 | | |
| |||
1425 | 1422 | | |
1426 | 1423 | | |
1427 | 1424 | | |
| 1425 | + | |
1428 | 1426 | | |
1429 | 1427 | | |
1430 | 1428 | | |
1431 | 1429 | | |
1432 | 1430 | | |
1433 | 1431 | | |
1434 | 1432 | | |
| 1433 | + | |
1435 | 1434 | | |
1436 | 1435 | | |
1437 | 1436 | | |
| |||
1444 | 1443 | | |
1445 | 1444 | | |
1446 | 1445 | | |
1447 | | - | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
1448 | 1454 | | |
1449 | 1455 | | |
1450 | 1456 | | |
| |||
0 commit comments