Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1838596pxb; Mon, 13 Sep 2021 06:40:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaIJurFyMd3N+3PKnven1J7abpwnIwwGNAiaAjX2AIfdIvaE8bDTyoOBW97iyX8nds5CgF X-Received: by 2002:a5d:959a:: with SMTP id a26mr2197137ioo.154.1631540418843; Mon, 13 Sep 2021 06:40:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631540418; cv=none; d=google.com; s=arc-20160816; b=LpaL95tYKxI77xrx2YvpetEKPQQ6txHQLH8xkFlpgKlnDimu750G886yU7SX0ZryfK j6tmqv2BgWmGiv5ot9B6E3gewhpjTEKLmecNocfzH1ygYRiMH15gmEc8gSRAV15KFCug zklp183W1tPjzKGZE7rkLP0EhOTPYTtAnp2RkjpBJsSyCSiaOajXoxRSmFjZkMFJINj3 8knJZwtDYQddm2+Mwe8v60KIZe8rzVp8sH5rA+DU79Xwz+WDkiazSjtjizlBsUhvEoiu UAOMI59T+mAND26LOie6z6JbCPtWZ5yNpe96TIf+Gzryh50uV+zanKWY2gEv99mMkbai hHWA== 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=i00Rbn0YyURqvYW7Tg11N3LK4jY3ueDpZZY6CiCoEZ0=; b=uEw2dhULjZpMwXKEDo+OaBSz9yaVzXeTPO7EGHU8K6vww1W1l2PW2d6lWbgW/CohQ9 uchtPuv13ypdfBT0kLEWu/vVw2RC5zci0Z9GJUqBaWKZFUG55V5KfVOKMQNkpLmp6wJl U8W/0FkhGRIkb+zxYzgX8wKaGte4j6n5F8xJxjgTozquVBtTgTqZaBHgwz3QoLSioKTz Qn2sWhRlBWPzzKFxXwWQP24Z3ncWgXrW+7kCRLRKhBMANWgWaZ0MBn+HY5CAeS6C3ZK9 Ghx0i96YTPxtuTpW95D/EARflE9s07DhKOyNTflo0Tasla37i3eKLhVK/p6cAF4IW3ig 81EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WvUNQPQw; 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 d8si6554473ilr.109.2021.09.13.06.40.06; Mon, 13 Sep 2021 06:40: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=WvUNQPQw; 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 S243684AbhIMNju (ORCPT + 99 others); Mon, 13 Sep 2021 09:39:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:35546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243015AbhIMNeq (ORCPT ); Mon, 13 Sep 2021 09:34:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3BBBF61248; Mon, 13 Sep 2021 13:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539617; bh=4eJwU9lTZ0i1A1AH5qtGZtYCVZnoLLhW5OWxtOFLISU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WvUNQPQws3vINKmp5QmKQt3FXzcijo6pcgpLSUFiL08Z24cs6cgHbMcOt4sJzjVBq 9AQ5Ah3574T1hKWklqepj8Kdnf1C4CH+Ui8gvSSEnHEcJkWpyJdc2g0UCmPrRAUKrn FAc+OsNu+Z3kp38mCA0hq1gS3IQ44+vc/wu0CVuQ= 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.10 092/236] media: dvb-usb: fix uninit-value in vp702x_read_mac_addr Date: Mon, 13 Sep 2021 15:13:17 +0200 Message-Id: <20210913131103.489724298@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@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 bf54747e2e01..a1d9e4801a2b 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