From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08EFF330B05; Mon, 29 Dec 2025 16:29:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767025764; cv=none; b=u2YA6Ns/PUT0zdqhjH/fMJjejajW3sMrN/iYseCZV8oBgBJ2hXGCAx6N6b90aWrCfwDBu3p/DnTv+YQnTuDvX+SjdZt0P9k+rRRLHxgijvcMr+LgBBfTijLo83EiDKju/OXmNFvmHFX7ovbUja5dqbZJsTYAq2uppQrGttHDSXE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767025764; c=relaxed/simple; bh=wa1/vosOp/24yLomJwuxlSMSctAQKYD0+BfUcQz63+Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=htKFH+LPwze+BJkSeKpO4EWtNjBfvmuOTtYaNoJteUqo8Zzl2iTMx3E7Dem6poC15Jy4W2jAruIYFNQRJ0K07M6PO3fdkRZaYaEumlGrvk6XeDTxWKhQQM/KxPS2cZgRAPD/UYn0KpGW8u6RGZ3C8GCQbxHNLCcv0gp+p0GamKs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=au0Go21s; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="au0Go21s" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CB6FC4CEF7; Mon, 29 Dec 2025 16:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1767025763; bh=wa1/vosOp/24yLomJwuxlSMSctAQKYD0+BfUcQz63+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=au0Go21sQj0vcTcrJhSI/y8bJOCajMpownpMVy7OSGIQcJK6huiXHZL/YV0/J78EI nAkosyDKFBNEwrMYRzPGEfD9CnVJdv2wZQmZmTaI3ZRHt5AI8VNbKyMthiJpE9c3Gy AukaKQvAZ/WdCHb1rlFpHa/IpJWGo71uVisNx0cI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+1d9c0edea5907af239e0@syzkaller.appspotmail.com, Jeongjun Park , Daniel Almeida , Hans Verkuil Subject: [PATCH 6.18 328/430] media: vidtv: initialize local pointers upon transfer of memory ownership Date: Mon, 29 Dec 2025 17:12:10 +0100 Message-ID: <20251229160736.400383060@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251229160724.139406961@linuxfoundation.org> References: <20251229160724.139406961@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jeongjun Park commit 98aabfe2d79f74613abc2b0b1cef08f97eaf5322 upstream. vidtv_channel_si_init() creates a temporary list (program, service, event) and ownership of the memory itself is transferred to the PAT/SDT/EIT tables through vidtv_psi_pat_program_assign(), vidtv_psi_sdt_service_assign(), vidtv_psi_eit_event_assign(). The problem here is that the local pointer where the memory ownership transfer was completed is not initialized to NULL. This causes the vidtv_psi_pmt_create_sec_for_each_pat_entry() function to fail, and in the flow that jumps to free_eit, the memory that was freed by vidtv_psi_*_table_destroy() can be accessed again by vidtv_psi_*_event_destroy() due to the uninitialized local pointer, so it is freed once again. Therefore, to prevent use-after-free and double-free vulnerability, local pointers must be initialized to NULL when transferring memory ownership. Cc: Reported-by: syzbot+1d9c0edea5907af239e0@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=1d9c0edea5907af239e0 Fixes: 3be8037960bc ("media: vidtv: add error checks") Signed-off-by: Jeongjun Park Reviewed-by: Daniel Almeida Signed-off-by: Hans Verkuil Signed-off-by: Greg Kroah-Hartman --- drivers/media/test-drivers/vidtv/vidtv_channel.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/media/test-drivers/vidtv/vidtv_channel.c +++ b/drivers/media/test-drivers/vidtv/vidtv_channel.c @@ -461,12 +461,15 @@ int vidtv_channel_si_init(struct vidtv_m /* assemble all programs and assign to PAT */ vidtv_psi_pat_program_assign(m->si.pat, programs); + programs = NULL; /* assemble all services and assign to SDT */ vidtv_psi_sdt_service_assign(m->si.sdt, services); + services = NULL; /* assemble all events and assign to EIT */ vidtv_psi_eit_event_assign(m->si.eit, events); + events = NULL; m->si.pmt_secs = vidtv_psi_pmt_create_sec_for_each_pat_entry(m->si.pat, m->pcr_pid);