Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4157368pxk; Tue, 8 Sep 2020 12:08:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs8XNd1FkgxMyv92IQKB6prSnX4a6g91y/cTFkA7ls2cEbed0w/wPdG9RwJ6UgNN9ED7/x X-Received: by 2002:a17:906:2a14:: with SMTP id j20mr28862484eje.376.1599592112376; Tue, 08 Sep 2020 12:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599592112; cv=none; d=google.com; s=arc-20160816; b=zX2pxbWn/xUp//l8oiP0V2+2+yY3dozdKQpmquhYcGNe/ZlKejGC9nyGVcYqZOoqab zRR2VEouR6kq10Rs0wedcq9bPd+P7GY6DUZS9OlMW8adnKTjMBqbP1qQUA82gHnon5ax o3lQJkJXbPLSR8hgb355cfVDNogc6k55tBxyac1ZIdUY5hhQoAj4YmRRvixph03ph+YJ fWivoSEPWRa2XEmUwPWayAd5E1sqtQnuqcA3mB8NgwnK3d1x+nleImwa/VTWg4ySR2es a53TraxP+Xc0goU3XobkMftan1AeqvFJV5l/MRws14GNY+RwalANj+B9XL459+CCTpQA kWlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rVxFXJNISe/Pl3PdXZReSikB2BeGezzZZdW8qVCvK5E=; b=AjZM+lwZwWop8KyFQwFCROpQ2fR1t/+D5G5wvP+ktaTYqpb3pQBdrepzXHlThKlGiR rDy/niBzZ/PcGeywAlekDluegfgj8aAKv1SniuqD3IUsZs8PN2uI8uR11AIDiTzmiAPl +4Fu8zxfZ7Im0aqsmzZ2xmgN4naISqHlQcwXVqyQg89aoME4IGJ2HQJqwxSzj/UOVleU ee1wUFCN4RNPahpP8AYJxi6uf4PjMbxPoDcxIUmFcQH/Vw/KGfRTiPShH70hJwY5VoGR lCVVhKrdWOuhajImBifvNXHDFff3JGf5aPeWpAxWb2NU9a0k03N335hGMq8oLfLSp8rS jJtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lLYSB5RM; 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=fail (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 cy15si3949130edb.525.2020.09.08.12.08.08; Tue, 08 Sep 2020 12:08:32 -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=@kernel.org header.s=default header.b=lLYSB5RM; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731399AbgIHTGA (ORCPT + 99 others); Tue, 8 Sep 2020 15:06:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:55072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731266AbgIHQHV (ORCPT ); Tue, 8 Sep 2020 12:07:21 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 74A3C23E24; Tue, 8 Sep 2020 15:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599580023; bh=FpBhz4Ddb/gh95CyeiOQkP7VcFwztOakNoXCsQt3mQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lLYSB5RMyGLlwQSc8vNEdPkkGqU0UEuXow3+9LGrneHFn8wuCEMFP/W+pZCWaa+Cs AtXnIwu4Z9m9b2ABSx4vUnVY+D3RO/DWqWQV5P3iLA9k1+nGHqZ7R1pwpfe9iv1Cgv +ckJwWYO1evaNF9Z06TDWsn+pC+Of9Qw1uxphsBk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himadri Pandya , "David S. Miller" Subject: [PATCH 5.4 129/129] net: usb: Fix uninit-was-stored issue in asix_read_phy_addr() Date: Tue, 8 Sep 2020 17:26:10 +0200 Message-Id: <20200908152236.319239743@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152229.689878733@linuxfoundation.org> References: <20200908152229.689878733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Himadri Pandya commit a092b7233f0e000cc6f2c71a49e2ecc6f917a5fc upstream. The buffer size is 2 Bytes and we expect to receive the same amount of data. But sometimes we receive less data and run into uninit-was-stored issue upon read. Hence modify the error check on the return value to match with the buffer size as a prevention. Reported-and-tested by: syzbot+a7e220df5a81d1ab400e@syzkaller.appspotmail.com Signed-off-by: Himadri Pandya Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/asix_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/usb/asix_common.c +++ b/drivers/net/usb/asix_common.c @@ -296,7 +296,7 @@ int asix_read_phy_addr(struct usbnet *de netdev_dbg(dev->net, "asix_get_phy_addr()\n"); - if (ret < 0) { + if (ret < 2) { netdev_err(dev->net, "Error reading PHYID register: %02x\n", ret); goto out; }