Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BD0DC433EF for ; Tue, 16 Nov 2021 02:09:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF31461AAA for ; Tue, 16 Nov 2021 02:09:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239989AbhKPCMf (ORCPT ); Mon, 15 Nov 2021 21:12:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:40774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239151AbhKORyo (ORCPT ); Mon, 15 Nov 2021 12:54:44 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C922A632C2; Mon, 15 Nov 2021 17:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1636997604; bh=rc8XOJMOmpEbpYsG8zZOl51LRqyLmsNhcatKgb2d/og=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LtGC7/VWRwMDbTeZjDhpI3oCiF0aSyhQ6Kvl5F4CFkRai5m9NqkChXhv/JmdDLtCw UkWdbFu7XlAGaSw9xUuZXn/x5xLsZLOYOUt/sGzaVGz/tlmvHYMpfdwdWB64NHmiaQ oBaV0mcD8cnuydFeFPL/XyaA5+zHzKnU/Ndt91Cw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+e27b4fd589762b0b9329@syzkaller.appspotmail.com, Anant Thazhemadam , Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 208/575] media: usb: dvd-usb: fix uninit-value bug in dibusb_read_eeprom_byte() Date: Mon, 15 Nov 2021 17:58:53 +0100 Message-Id: <20211115165350.904325710@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211115165343.579890274@linuxfoundation.org> References: <20211115165343.579890274@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anant Thazhemadam [ Upstream commit 899a61a3305d49e8a712e9ab20d0db94bde5929f ] In dibusb_read_eeprom_byte(), if dibusb_i2c_msg() fails, val gets assigned an value that's not properly initialized. Using kzalloc() in place of kmalloc() for the buffer fixes this issue, as the val can now be set to 0 in the event dibusb_i2c_msg() fails. Reported-by: syzbot+e27b4fd589762b0b9329@syzkaller.appspotmail.com Tested-by: syzbot+e27b4fd589762b0b9329@syzkaller.appspotmail.com Signed-off-by: Anant Thazhemadam Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/dvb-usb/dibusb-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c index 02b51d1a1b67c..aff60c10cb0b2 100644 --- a/drivers/media/usb/dvb-usb/dibusb-common.c +++ b/drivers/media/usb/dvb-usb/dibusb-common.c @@ -223,7 +223,7 @@ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val) u8 *buf; int rc; - buf = kmalloc(2, GFP_KERNEL); + buf = kzalloc(2, GFP_KERNEL); if (!buf) return -ENOMEM; -- 2.33.0