From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 7C7CC4825A1; Sat, 12 Sep 2026 18:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789237911; cv=none; b=HqF5U9KBpl8+y8LH7pyHnwZESPS59zq/LHJMdhdMXCx8zrQ0f65ikjMy/qIAhWX5ZgoMhoTvEUEYgRHsm1H/VFP+gPqKPUjjzpUzSFxxgEZlCV3lDtYd5jcTLJxPKngWDJdUJp1dpvjLtoZJr/6Nzl5WzndtgydekwYJM65ChtI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789237911; c=relaxed/simple; bh=Ws8CAR8z3Lby6wr+h11/G4HWn4YpVeYs57Z7Eg+u+7Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HEpibaakjZnveF8o9557wjHUCcMTqZQ9MzD5AaTUaT/t0mIuEApCItvKb5VuK1cyBlE/7zQrKfOQ28N27LEhhZxEQimzRhOZK7cdKWy9I6vqbwbrIoReIgLW4FS3pvShLSYublEsKMp+UbbC0laoK58o5pHd+VAzFOL4VEEhGWE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=D/OTOLm8; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="D/OTOLm8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50EFA1F000FF; Sat, 12 Sep 2026 18:31:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789237907; bh=aHqyaUchHUZCP0Y/oBzZ+SuQZqTyi6L6X/HskHx26ic=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=D/OTOLm8coXeGsEnzWx9B+/c7UvfBEXuKCp69tqZGv3/XRLQ5eKHzETJ8em4w65JN NrIKLlRzBFWxHe+CulshVTUbc1sTkSsk9p8dunq5/27Kuu3KfPV75GQNCy9It68LJ0 0aXsrDrCUbwNVth0tQb8ugSiMPujs4ptIRW6tSUQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ruoyu Wang , Hans Verkuil Subject: [PATCH 5.15 310/935] media: cec: Serialize exclusive follower delivery Date: Sat, 12 Sep 2026 08:55:40 +0200 Message-ID: <20260912065533.917412763@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065526.833703348@linuxfoundation.org> References: <20260912065526.833703348@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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ruoyu Wang commit 1924d0788caa6c66fd320dd4704fae99487fd2c7 upstream. cec_receive_notify() reads the exclusive follower pointer without the adapter lock. Serialize the no-follower check and message delivery against mode changes and release. Fixes: 9881fe0ca187 ("[media] cec: add HDMI CEC framework (adapter)") Cc: stable@vger.kernel.org Signed-off-by: Ruoyu Wang Signed-off-by: Hans Verkuil Signed-off-by: Greg Kroah-Hartman --- drivers/media/cec/core/cec-adap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/media/cec/core/cec-adap.c +++ b/drivers/media/cec/core/cec-adap.c @@ -2128,9 +2128,13 @@ static int cec_receive_notify(struct cec * Unprocessed messages are aborted if userspace isn't doing * any processing either. */ + mutex_lock(&adap->lock); if (!is_broadcast && !is_reply && !adap->follower_cnt && - !adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT) + !adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT) { + mutex_unlock(&adap->lock); return cec_feature_abort(adap, msg); + } + mutex_unlock(&adap->lock); break; } @@ -2143,10 +2147,12 @@ skip_processing: * Send to the exclusive follower if there is one, otherwise send * to all followers. */ + mutex_lock(&adap->lock); if (adap->cec_follower) cec_queue_msg_fh(adap->cec_follower, msg); else cec_queue_msg_followers(adap, msg); + mutex_unlock(&adap->lock); return 0; }