aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2019-08-26 08:14:02 -0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-08-29 10:22:20 -0300
commitecbce48f1ff2442371ebcd12ec0ecddb431fbd72 (patch)
tree5ef9f9a528d9ab9b40f4d3f7599b1ae9e9031c31 /drivers/media
parentmedia: don't do a 31 bit shift on a signed int (diff)
downloadlinux-dev-ecbce48f1ff2442371ebcd12ec0ecddb431fbd72.tar.xz
linux-dev-ecbce48f1ff2442371ebcd12ec0ecddb431fbd72.zip
media: em28xx: Fix exception handling in em28xx_alloc_urbs()
A null pointer would be passed to a call of the function "kfree" directly after a call of the function "kcalloc" failed at one place. Pass the data structure member "urb" instead for which memory was allocated before (so that this resource will be properly cleaned up). This issue was detected by using the Coccinelle software. Fixes: d571b592c6206d33731f41aa710fa0f69ac8611b ("media: em28xx: don't use coherent buffer for DMA transfers") Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/usb/em28xx/em28xx-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 2b8c84a5c9a8..e6088b5d1b80 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -931,7 +931,7 @@ int em28xx_alloc_urbs(struct em28xx *dev, enum em28xx_mode mode, int xfer_bulk,
usb_bufs->buf = kcalloc(num_bufs, sizeof(void *), GFP_KERNEL);
if (!usb_bufs->buf) {
- kfree(usb_bufs->buf);
+ kfree(usb_bufs->urb);
return -ENOMEM;
}