Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2319225pxb; Mon, 20 Sep 2021 18:42:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjYtZlzgIuy8G+yziqFFADMmrLdKBIawnPI5ZRbRJ5yDOgSUqxYNrSXFYctIEYF+t8fZEe X-Received: by 2002:a05:6e02:48d:: with SMTP id b13mr19603986ils.171.1632188530872; Mon, 20 Sep 2021 18:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188530; cv=none; d=google.com; s=arc-20160816; b=OPR6jiSIhbfECHaR4IlDJN+r0UfjUpZ7MwTs2TekoNXhIOspKMyMpQtPKAD7v/SYqK KRci4VYWPGaguAYV45xwcRNhvAhLajOa298Xtr5SryGLdxa241+zsvam15Z7aIFj+SNy czrNvmqw+wajTpGltjSb5hfhYfKE+9Fcq37nbH7f/pAgOXJqRJth4be4U9L+9JOL7VGc o0NN//80uo0HLkTFPhhWDxADpH60JFXFNTX92E53/JNUiVCSMpyknKyGkFtB+G08sBMb U5jsRkFKjXbKeT7fB0kRBw6oqMzC1BzMONFuwGQppNDbqdzYlbrxVjAD2R5hRP6JzyCB CgPw== 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=xFrBCB1S4Fn3bNJXjvijE+ARSFDKwGDoeFpkHG9Ri38=; b=i/ls8LE3A+WqkwEPXpPLGUDJ6BJdoFXxU/ZT3/qze8E10vn/IQQKYfLMaX+n+YqPDR Cc+WgbcMIJp1CTYD238isjI7kA2fAjHT/PmMyGrdzx73z1ZukTT9ZexkejiZwh8eDcKp eq15Qq6bNLfF0U4/1qn04VazXvaNjOSv6hgAV8j3Nf0+0vJkdF4yBpkNH6BXwtM/ZRoD G+l15mr5/YLDnfsmIKJMhve2HW0vZctFUMZJLnWt8+X4ZhbwrJkV/MIJHIxmqGp1oOL3 ll/b0T/9REDYdijbuzAHM01Y+9uIjHzl0j0MExpcMyuc/1Zzwy7LlX231rMRAexjvkKX AejQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=112aspXF; 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 e46si13135691jaf.50.2021.09.20.18.42.00; Mon, 20 Sep 2021 18:42:10 -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=112aspXF; 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 S243575AbhITQst (ORCPT + 99 others); Mon, 20 Sep 2021 12:48:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:36518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237833AbhITQsA (ORCPT ); Mon, 20 Sep 2021 12:48:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0C1E161211; Mon, 20 Sep 2021 16:46:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632156393; bh=HHqY1ev6eyJK1MPUdupiJ7mVkEyP7VGaewKnwPOqjS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=112aspXFTZfGrbI88KqqHApJ4K0miWNFpLkE/Uh5NGRZvaSfTJp9wnWuWRGlIw3va TGCmMXxJ7e/vA4iNQFeRbyT+USYqmHDq3Nsaz7I5a/XHfayp3Ad15oZbzgcUB0718e DiUhgRW58+U8YxyC5ntDC220+m+2OZujM47oNGvQ= 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 4.4 039/133] media: dvb-usb: fix uninit-value in vp702x_read_mac_addr Date: Mon, 20 Sep 2021 18:41:57 +0200 Message-Id: <20210920163913.922367155@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163912.603434365@linuxfoundation.org> References: <20210920163912.603434365@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 ee1e19e36445..55d515507f0e 100644 --- a/drivers/media/usb/dvb-usb/vp702x.c +++ b/drivers/media/usb/dvb-usb/vp702x.c @@ -294,16 +294,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