Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp389870pxk; Fri, 11 Sep 2020 09:36:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUgpKgNr9SjCnq8WIivnzB2qZY30DRHehjoifQJ+SMeDkvmj0OooGG3epsQk4/JaUMJilQ X-Received: by 2002:a50:fa94:: with SMTP id w20mr2980646edr.206.1599842189133; Fri, 11 Sep 2020 09:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599842189; cv=none; d=google.com; s=arc-20160816; b=KOvdbUbYoBBCm9sc0vZlNpTsXc4lpadr6T2CImbCQnOqzsEEx+Rzv4jG8NhlSB61+l v3jitllEs4tgEEOpaVDcM6qk2Z9Oe0h1DV1BP8nwG6jM9zVoguwE8UY2M3pHiQk72U5P /J4HI/DPIwVTss6/HXeR/BC/5iadMyzCDAvesuRevco5uv6i5LYdB0GZAlVLZA4uiC5N 3y1ooopAZJN6ni1SvnuTe0wQBPTJx5fYgtrqqKk8iMmZyETvocO/wwsk+AY4MNdKY7Uf jF8XHZrBG4cyvPrcbV7BgahWq+DRjcv5dNTkzOD6T3+T5GccLev5NmGIyPphvWXK/Dxb hPsA== 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=mTj+SebFvvhAJl6PqpR+IknqpaWJQvgqR6PcLIjvJ4k=; b=uh1K3UPqdSjDmQLNbdWFxj1DVpI8eUgy7fGCfZ2IoUxb12GV409PnfpGubHlejW2oI 2nyxktmu7I+eRQeaKEzRT+Crrnxcz7RcI1oUM0qga5wOuagMA+RLt1dYkWBaDHofop+5 aJLmjJ6BkSuGFejvBREeTL42kiFtWrJhu4hIa6GSZIBu6NJE5ur5+nlqDPlkhJ6I3WLq M/kYGeRnTmprB4rWC1bA4Hw3pbFQ9GAbR4vuIAAmkCSnVQv/9pfj/d19BpYxjNzKc14p mZPP3HQiEt/EjXcuvQmTn6DCgJwvwvyCdS92lhsLeMKp1dsPZg4MytO7vvl593ulIEWk ClGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XzTJR4v0; 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 n1si1489837edt.72.2020.09.11.09.36.06; Fri, 11 Sep 2020 09:36:29 -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=XzTJR4v0; 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 S1726490AbgIKQeT (ORCPT + 99 others); Fri, 11 Sep 2020 12:34:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:52728 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726446AbgIKPPh (ORCPT ); Fri, 11 Sep 2020 11:15:37 -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 196AE22246; Fri, 11 Sep 2020 12:58:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599829132; bh=JoQXBX4d16xcTyZAQCuJdMeWdYPKguExKHrFWB6Z2zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XzTJR4v0rUY/uxTtXFKb3UHM7xrHYI9eOL8r0U+MZjrT1xdet3EquAqzi8d4mE9wX kaKohkEBYKaXI0+dXwgPzDoiqTigZGdA59gqgSRcyUJIWdjUSkTfXT/4D+JE28ZBKQ MC8Tj8DK0gH1vv//+zkBXmoc3ObnY/+7hUOuwhLY= 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 4.9 62/71] net: usb: Fix uninit-was-stored issue in asix_read_phy_addr() Date: Fri, 11 Sep 2020 14:46:46 +0200 Message-Id: <20200911122508.003816840@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200911122504.928931589@linuxfoundation.org> References: <20200911122504.928931589@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 @@ -277,7 +277,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; }