summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/airspy
diff options
context:
space:
mode:
authorDongliang Mu <mudongliangabcd@gmail.com>2022-08-11 06:57:00 +0200
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-08-30 07:31:42 +0200
commit23bc5eb55f8c9607965c20d9ddcc13cb1ae59568 (patch)
treec6e3dae1227017b2b4a13dbe2f9dfd3193a2eebc /drivers/media/usb/airspy
parentmedia: tm6000: Fix unused value in vidioc_try_fmt_vid_cap() (diff)
downloadlinux-23bc5eb55f8c9607965c20d9ddcc13cb1ae59568.tar.xz
linux-23bc5eb55f8c9607965c20d9ddcc13cb1ae59568.zip
media: airspy: fix memory leak in airspy probe
The commit ca9dc8d06ab6 ("media: airspy: respect the DMA coherency rules") moves variable buf from stack to heap, however, it only frees buf in the error handling code, missing deallocation in the success path. Fix this by freeing buf in the success path since this variable does not have any references in other code. Fixes: ca9dc8d06ab6 ("media: airspy: respect the DMA coherency rules") Reported-by: syzbot+bb25f85e5aa482864dc0@syzkaller.appspotmail.com Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com> Reviewed-by: Tommaso Merciai <tommaso.merciai@amarulasolution.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/usb/airspy')
-rw-r--r--drivers/media/usb/airspy/airspy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c
index b8b88244f963..462eb8423506 100644
--- a/drivers/media/usb/airspy/airspy.c
+++ b/drivers/media/usb/airspy/airspy.c
@@ -1070,6 +1070,10 @@ static int airspy_probe(struct usb_interface *intf,
ret);
goto err_free_controls;
}
+
+ /* Free buf if success*/
+ kfree(buf);
+
dev_info(s->dev, "Registered as %s\n",
video_device_node_name(&s->vdev));
dev_notice(s->dev, "SDR API is still slightly experimental and functionality changes may follow\n");