Commit f94666f
FROMLIST: misc: fastrpc: Remove buffer from list prior to unmap operation
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.
Link: https://lore.kernel.org/all/20260526111124.515-3-jianping.li@oss.qualcomm.com/
Fixes: 2419e55 ("misc: fastrpc: add mmap/unmap support")
Cc: stable@kernel.org
Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
Signed-off-by: Jianping Li <jianping.li@oss.qualcomm.com>
Signed-off-by: Vinayak Katoch <vkatoch@qti.qualcomm.com>1 parent 27c6d79 commit f94666f
1 file changed
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2050 | 2050 | | |
2051 | 2051 | | |
2052 | 2052 | | |
2053 | | - | |
2054 | | - | |
2055 | | - | |
2056 | 2053 | | |
2057 | 2054 | | |
2058 | 2055 | | |
| |||
2066 | 2063 | | |
2067 | 2064 | | |
2068 | 2065 | | |
| 2066 | + | |
2069 | 2067 | | |
2070 | 2068 | | |
2071 | 2069 | | |
2072 | 2070 | | |
2073 | 2071 | | |
2074 | 2072 | | |
2075 | 2073 | | |
| 2074 | + | |
2076 | 2075 | | |
2077 | 2076 | | |
2078 | 2077 | | |
| |||
2085 | 2084 | | |
2086 | 2085 | | |
2087 | 2086 | | |
2088 | | - | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
2089 | 2095 | | |
2090 | 2096 | | |
2091 | 2097 | | |
| |||
0 commit comments