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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E5FDC433F5 for ; Wed, 24 Nov 2021 12:18:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243815AbhKXMVL (ORCPT ); Wed, 24 Nov 2021 07:21:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:33140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243291AbhKXMP5 (ORCPT ); Wed, 24 Nov 2021 07:15:57 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A69F960295; Wed, 24 Nov 2021 12:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637755822; bh=4QXA8Sz8+uy2QwtIoTw8eT2RxQ41eRuIz/FE6ziP7eI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jNXl50iJtiiUL3qH9V79YfNjsT+5MWHzdIXJReTiW2cI6n4enjggLcopOntVQo4X4 olXlXpHQRk1uqza3NpbtEMWyhTmuBM4o/mHYMFpYvoEMA0iFdifc6aV71TnSz2wjIV qpK5JM1lfYdL47ayN3VHD8YpauXgiTpj0g3bYHtI= 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 4.9 071/207] media: usb: dvd-usb: fix uninit-value bug in dibusb_read_eeprom_byte() Date: Wed, 24 Nov 2021 12:55:42 +0100 Message-Id: <20211124115706.217922058@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211124115703.941380739@linuxfoundation.org> References: <20211124115703.941380739@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 bcacb0f220282..3e45642ae186b 100644 --- a/drivers/media/usb/dvb-usb/dibusb-common.c +++ b/drivers/media/usb/dvb-usb/dibusb-common.c @@ -226,7 +226,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