misc: fastrpc: Reset metadata buffer to avoid incorrect free
authorEkansh Gupta <quic_ekangupt@quicinc.com>
Fri, 13 Oct 2023 12:20:04 +0000 (13:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Oct 2023 18:58:49 +0000 (20:58 +0200)
commit1c29d80134ac116e0196c7bad58a2121381b679c
tree2c6c917ec7872f3aa1ee92857bbbbb277286a2e4
parent58720809f52779dc0f08e53e54b014209d13eebb
misc: fastrpc: Reset metadata buffer to avoid incorrect free

Metadata buffer is allocated during get_args for any remote call.
This buffer carries buffers, fdlists and other payload information
for the call. If the buffer is not reset, put_args might find some
garbage FDs in the fdlist which might have an existing mapping in
the list. This could result in improper freeing of FD map when DSP
might still be using the buffer. Added change to reset the metadata
buffer after allocation.

Fixes: 8f6c1d8c4f0c ("misc: fastrpc: Add fdlist implementation")
Cc: stable <stable@kernel.org>
Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231013122007.174464-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/fastrpc.c