media: ttusb-dec: Fix info-leak in ttusb_dec_send_command()
authorTomas Bortoli <tomasbortoli@gmail.com>
Wed, 31 Jul 2019 15:19:05 +0000 (12:19 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 10:27:50 +0000 (12:27 +0200)
[ Upstream commit a10feaf8c464c3f9cfdd3a8a7ce17e1c0d498da1 ]

The function at issue does not always initialize each byte allocated
for 'b' and can therefore leak uninitialized memory to a USB device in
the call to usb_bulk_msg()

Use kzalloc() instead of kmalloc()

Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
Reported-by: syzbot+0522702e9d67142379f1@syzkaller.appspotmail.com
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/usb/ttusb-dec/ttusb_dec.c

index a5de46f04247f82178d60366d8148a4140f7780e..f9b5de7ace01c05897db6abd9105e1b894b01d75 100644 (file)
@@ -272,7 +272,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,
 
        dprintk("%s\n", __func__);
 
-       b = kmalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL);
+       b = kzalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL);
        if (!b)
                return -ENOMEM;