Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1827848pxb; Mon, 13 Sep 2021 06:27:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKjRUTUOa59TMrbsCrAoNEU+PzKYT3NcAhV2y/duzKAmYIuvLeOrpelIvkBKoQMITr+8HZ X-Received: by 2002:a17:906:fc7:: with SMTP id c7mr12852830ejk.333.1631539638197; Mon, 13 Sep 2021 06:27:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631539638; cv=none; d=google.com; s=arc-20160816; b=wLIowX5s1JqoIcG709BZgx74018j/+JEYPg6nvhybvxIGb7djNUpU+Yi5Kz7FvEX7V QnwsZD05/1Ays9Ec4sVr118WDdZhZvUMneSgK2h6tRc3kRzmXu7PwuZ4ukyAFEqlSDuE JuDBtgwVX4HwXcX8581IQJb53ujc8hy8MVwSuv8rpDyjYTpGpny9+LvE4bqOGX5OZ0mY 1PGk0Hm7Rbfj7aSCLcYinsFi6wsbrmFa04BLrxgIn/cTrpp1K6uioBJQqrHhjIPpe+6v +2i7Jgc5OELWlY/NkmHCNEMYQrB/bsPXzRoObr/IIkQg+GdXcia7UkgERA7Ep9CAHqgY xqsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iXLBwov18Au8L6TsjDrQ8Nj0bqLQLaN50dlboSeC86A=; b=g57GaQ8wzPeQX01xsLriZRFq/QXIen0k4K29p6MtLUcmsfcmlKcZ+kAbi7MKt3ZWxH bnht5oA2ttGjmMGYxil4HWS6zex2q/fTAD31/CvP+eL8zbKWyTDgP5PqToonuvPbwj8Y jkUBmyR1KlKU/hTStq8lNCkjarw3cQywEgF595W4yZCg/0+Xjhy4wKreW43HEUL/kPf/ Wc/3QhZ9IqLoE8wau4QxLzvKVg8JRnaCv4udkl60Q11NE32YFKgwbkVYh8bc8aSdLhQP sV7uh2Us8ENVCUpToey3mkhLIP2FmoFqKCkShtRb9plxvyR7ZaqujA0Ba2BXhisrigI2 1UUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nH+N6kpz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c30si1316525edd.60.2021.09.13.06.26.53; Mon, 13 Sep 2021 06:27:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nH+N6kpz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241397AbhIMNYH (ORCPT + 99 others); Mon, 13 Sep 2021 09:24:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:34832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238525AbhIMNUy (ORCPT ); Mon, 13 Sep 2021 09:20:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2D69361214; Mon, 13 Sep 2021 13:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539144; bh=lyD0njKJ/aLyKDW2Y7S+vq8Ec95r1GDDF8sSuW+r5gU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nH+N6kpzyP+eAN/rzJz02LmK4tGiXQXwBScTp5ya6/NTmM56IzGFigY7uGRVT2Ut8 XuVpZXIjrxJxAlfUCNqKi3V+gFUADLHNhekE37vcxqMaSr6t75oOMN0/igdVO8hfTV LC91A+Q9P+a/pZQ47AlxelgD+Jmt/x02pzbNWYZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dongliang Mu , Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 056/144] media: dvb-usb: fix uninit-value in vp702x_read_mac_addr Date: Mon, 13 Sep 2021 15:13:57 +0200 Message-Id: <20210913131049.843704032@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131047.974309396@linuxfoundation.org> References: <20210913131047.974309396@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: Dongliang Mu [ Upstream commit 797c061ad715a9a1480eb73f44b6939fbe3209ed ] If vp702x_usb_in_op fails, the mac address is not initialized. And vp702x_read_mac_addr does not handle this failure, which leads to the uninit-value in dvb_usb_adapter_dvb_init. Fix this by handling the failure of vp702x_usb_in_op. Fixes: 786baecfe78f ("[media] dvb-usb: move it to drivers/media/usb/dvb-usb") Signed-off-by: Dongliang Mu Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/dvb-usb/vp702x.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/dvb-usb/vp702x.c b/drivers/media/usb/dvb-usb/vp702x.c index 381b5c898a07..b7ee972455e5 100644 --- a/drivers/media/usb/dvb-usb/vp702x.c +++ b/drivers/media/usb/dvb-usb/vp702x.c @@ -291,16 +291,22 @@ static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) static int vp702x_read_mac_addr(struct dvb_usb_device *d,u8 mac[6]) { u8 i, *buf; + int ret; struct vp702x_device_state *st = d->priv; mutex_lock(&st->buf_mutex); buf = st->buf; - for (i = 6; i < 12; i++) - vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, &buf[i - 6], 1); + for (i = 6; i < 12; i++) { + ret = vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, + &buf[i - 6], 1); + if (ret < 0) + goto err; + } memcpy(mac, buf, 6); +err: mutex_unlock(&st->buf_mutex); - return 0; + return ret; } static int vp702x_frontend_attach(struct dvb_usb_adapter *adap) -- 2.30.2