mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 02:21:39 -04:00
media: cx231xx: fix null pointer deref in snd_cx231xx_pcm_close
Add a null check for the dev pointer after retrieving it from the substream. Without this, a use-after-free or null pointer dereference can occur when closing the audio device, causing a kernel page fault. Link: https://bugzilla.redhat.com/show_bug.cgi?id=2365068 Signed-off-by: Ashwin Gundarapu <linuxuser509@zohomail.in> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
committed by
Hans Verkuil
parent
bedd5ea6b7
commit
ab8c3ed895
@@ -443,6 +443,11 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream)
|
||||
int ret;
|
||||
struct cx231xx *dev = snd_pcm_substream_chip(substream);
|
||||
|
||||
if (!dev) {
|
||||
pr_err("cx231xx: called with null device\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
dev_dbg(dev->dev, "closing device\n");
|
||||
|
||||
/* inform hardware to stop streaming */
|
||||
|
||||
Reference in New Issue
Block a user