Skip to content
Commit 5de3f535 authored by Takashi Iwai's avatar Takashi Iwai Committed by dinglongwei
Browse files

media: imon: fix access to invalid resource for the second interface

stable inclusion
from stable-v5.10.202
commit 0f5068519f89d928d6c51100e4b274479123829f
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9R4N0
CVE: CVE-2023-52754

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=0f5068519f89d928d6c51100e4b274479123829f



--------------------------------

[ Upstream commit a1766a4fd83befa0b34d932d532e7ebb7fab1fa7 ]

imon driver probes two USB interfaces, and at the probe of the second
interface, the driver assumes blindly that the first interface got
bound with the same imon driver.  It's usually true, but it's still
possible that the first interface is bound with another driver via a
malformed descriptor.  Then it may lead to a memory corruption, as
spotted by syzkaller; imon driver accesses the data from drvdata as
struct imon_context object although it's a completely different one
that was assigned by another driver.

This patch adds a sanity check -- whether the first interface is
really bound with the imon driver or not -- for avoiding the problem
above at the probe time.

Reported-by: default avatar <syzbot+59875ffef5cb9c9b29e9@syzkaller.appspotmail.com>
Closes: https://lore.kernel.org/all/000000000000a838aa0603cc74d6@google.com/


Tested-by: default avatarRicardo B. Marliere <ricardo@marliere.net>
Link: https://lore.kernel.org/r/20230922005152.163640-1-ricardo@marliere.net


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>

Conflicts:
	drivers/media/rc/imon.c
[Fix context]
Signed-off-by: default avatardinglongwei <dinglongwei1@huawei.com>
parent 0a378cfa
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment