Re: [PATCH v2 1/4] misc: fastrpc: Add NULL check to fastrpc_buf_free to prevent crash
From: Dmitry Baryshkov
Date: Thu Jan 15 2026 - 15:43:33 EST
On Thu, Jan 15, 2026 at 04:28:48PM +0800, Jianping Li wrote:
> From: Ekansh Gupta <ekansh.gupta@xxxxxxxxxxxxxxxx>
>
> 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.
When does it happen? Do you have a backtrace or is it a safety coding?
Do you pass NULL buffer pointers to the function?
>
> Fixes: c68cfb718c8f9 ("misc: fastrpc: Add support for context Invoke method")
> Cc: stable@xxxxxxxxxx
> Co-developed-by: Ekansh Gupta <ekansh.gupta@xxxxxxxxxxxxxxxx>
> Signed-off-by: Ekansh Gupta <ekansh.gupta@xxxxxxxxxxxxxxxx>
> Signed-off-by: Jianping Li <jianping.li@xxxxxxxxxxxxxxxx>
> ---
> drivers/misc/fastrpc.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
--
With best wishes
Dmitry