Skip to content

Commit 7479b77

Browse files
committed
FROMLIST: misc: fastrpc: Add NULL check to fastrpc_buf_free to prevent crash
The fastrpc_buf_free function currently does not handle the case where the input buffer pointer (buf) is NULL. This can lead to a null pointer dereference, causing a crash or undefined behavior when the function attempts to access members of the buf structure. Add a NULL check to ensure safe handling of NULL pointers and prevent potential crashes. Link: https://lore.kernel.org/all/20250513042825.2147985-2-ekansh.gupta@oss.qualcomm.com/ Fixes: c68cfb7 ("misc: fastrpc: Add support for context Invoke method") Cc: stable@kernel.org Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
1 parent 19272b3 commit 7479b77

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/misc/fastrpc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,9 @@ static int fastrpc_map_lookup(struct fastrpc_user *fl, int fd,
394394

395395
static void fastrpc_buf_free(struct fastrpc_buf *buf)
396396
{
397+
if (!buf)
398+
return;
399+
397400
dma_free_coherent(buf->dev, buf->size, buf->virt,
398401
FASTRPC_PHYS(buf->phys));
399402
kfree(buf);

0 commit comments

Comments
 (0)