lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2026011805-bamboo-disband-926a@gregkh>
Date: Sun, 18 Jan 2026 16:02:44 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Osama Abdelkader <osama.abdelkader@...il.com>
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Simon Horman <horms@...nel.org>,
	"Jiri Slaby (SUSE)" <jirislaby@...nel.org>,
	Sjur Braendeland <sjur.brandeland@...ricsson.com>,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	syzbot+f9d847b2b84164fa69f3@...kaller.appspotmail.com,
	stable@...r.kernel.org
Subject: Re: [PATCH] net: caif: fix memory leak in ldisc_receive

On Sun, Jan 18, 2026 at 03:47:54PM +0100, Osama Abdelkader wrote:
> Add NULL pointer checks for ser and ser->dev in ldisc_receive() to
> prevent memory leaks when the function is called during device close
> or in race conditions where tty->disc_data or ser->dev may be NULL.
> 
> The memory leak occurred because netdev_alloc_skb() would allocate an
> skb, but if ser or ser->dev was NULL, the function would return early
> without freeing the allocated skb. Additionally, ser->dev was accessed
> before checking if it was NULL, which could cause a NULL pointer
> dereference.
> 
> Reported-by: syzbot+f9d847b2b84164fa69f3@...kaller.appspotmail.com
> Closes:
> https://syzkaller.appspot.com/bug?extid=f9d847b2b84164fa69f3

Please do not wrap this line.

> Fixes: 9b27105b4a44 ("net-caif-driver: add CAIF serial driver (ldisc)")
> CC: stable@...r.kernel.org
> Signed-off-by: Osama Abdelkader <osama.abdelkader@...il.com>
> ---
>  drivers/net/caif/caif_serial.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
> index c398ac42eae9..0ec9670bd35c 100644
> --- a/drivers/net/caif/caif_serial.c
> +++ b/drivers/net/caif/caif_serial.c
> @@ -152,12 +152,16 @@ static void ldisc_receive(struct tty_struct *tty, const u8 *data,
>  	int ret;
>  
>  	ser = tty->disc_data;
> +	if (!ser)
> +		return;

Can this ever be true?

>  	/*
>  	 * NOTE: flags may contain information about break or overrun.
>  	 * This is not yet handled.
>  	 */
>  
> +	if (!ser->dev)
> +		return;

Why is this check here and not just merged together with the one you
added above?  And how can ->dev be NULL?

And where is the locking to prevent this from changing right after you
check it?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ