Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1115647pxa; Fri, 28 Aug 2020 04:17:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4fkS4w7z31Rkr+bn8yUk4dYLaPtcV+7jAJ7RHvQox+/bI9HDT8ZEGOGFYYBmGmm6nHGX2 X-Received: by 2002:a17:907:a8c:: with SMTP id by12mr1203374ejc.554.1598613440678; Fri, 28 Aug 2020 04:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598613440; cv=none; d=google.com; s=arc-20160816; b=Ke/36IhGH88y0GdXkQeWtxsWmFrWYqWOH/Mmd53E6lMnsLFnau85BrjrrmqsZhQC9l EW4PaBksouPTyX6QKwz9n/VZj4HugZEIcXEghtlBSGaO9vjpJZ9Vkq5XWpD9m/puvzPY nm7QWkXD5SD6PJUiXQExgLnRetqlhdKnethtovj5XJ9E9M2g1R1Gr/jlpnR2OwcxvGhO wiNbeW23q7iWadc24d5NTwaqDMKRZI0d13Qb0xPp9qryXZHJG/xrw/dasaIwmaJXmhnF YdYuGTysGdxKl56yad99/FRBN4KztpKoZxtfooQ40UtRtkSJ3mCD4cjS1RvFsskAxbPs VYWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=bzCkNueS5Za9fJgI1E1trgmJ9rPWtcxrqIv2kBAEIIA=; b=Vtk/4Z7KtpbUS8q/i1hKNX/N4yM1819i9TpLcZ+2CVHs++25JXbGvAoEfuxljCXegN bc0ynUtWGsL8sHUMIgfMWlm2WarTemNLstCD9JK6u2ge/j9Lgzqomv+rq28X9skGFv7D wl077iByN6+wHXzoFDVsY2ExG4sCz+w83Y1t2xjKLGzn1iRIl9VHsD1ONJKAv8CKPT5h WdlsWf3EuJls8uKsa3guLQzIC73Y0SUoXLuYEVY4v+ICrFjPybZe0fjob4ol9PktB66F oyfYJK/FnrsG4aXesTgxv3LlaKUwezYB7Lfn1VhSA1o4JCRCHIcIw+mYiyLt3UJfMi62 MUzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nqNXrGMQ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a14si320074edx.573.2020.08.28.04.16.53; Fri, 28 Aug 2020 04:17:20 -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=@gmail.com header.s=20161025 header.b=nqNXrGMQ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729171AbgH1LHq (ORCPT + 99 others); Fri, 28 Aug 2020 07:07:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729177AbgH1LGr (ORCPT ); Fri, 28 Aug 2020 07:06:47 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D030C061264; Fri, 28 Aug 2020 04:06:36 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id k20so516260wmi.5; Fri, 28 Aug 2020 04:06:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bzCkNueS5Za9fJgI1E1trgmJ9rPWtcxrqIv2kBAEIIA=; b=nqNXrGMQwoqzpRB0gErrvZ6yYPDlhcf0cEjJP4PIpxwB3TJzLQD9R6QDUdKahtv6/G ZG5GzNPiR3HzMBsN7cl7yvedrbGYXei4jvXKk0FC+HLsZk4t3B8ErGvWAi6d0A1Hz3kD cqzdi1s+VA8IcfGwk04GBOtpvpWF3RhR4DZWmDeft7V1jvKr3zwKGJdg/60VgxmAE6T5 /r/dLa1uLko+S0/vjA52DFxzWzL1etpUz08eF86r1EkTpCn33uxnV9yZ3UEHiMonJsZ2 nVKQawEmps+uIMH/wWb+Bl17iC79KiLZDSXwusWhNGVKTqelTrDd0SzrUeaKdQ5YGE8P 4fZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bzCkNueS5Za9fJgI1E1trgmJ9rPWtcxrqIv2kBAEIIA=; b=Q9pcU0L4hpNSEdkVAg80LQpQ8rN0rvtec/Geb7QOS1wbJrpxiDJsaOIPQ5zAdfYjtA nNDO9lR3siWOOSCQ36BjhR2hs31HB4PcvY1CPMD38tMbK4DnlUa2qJAv8QOOLQtUSE7a wLIa04zOdlTUL6AILSUIVUVw6xTjMEmgMi6Gch6syGVDK8w6bxjgUht6K0pWUiL/Y/w9 ucre9CAlOJU09TXA+d3fu/mmDtRJgyfmzO9bQVFEtHj0egcGAvzQmr8clf/6xCk3LZQW 2KTq834GrQjubi6+GiVL3JETr5IBE3sHZZ8E9bKdfV8wZrz9HPC0ImTjGc2q9EkoVd8I oYHA== X-Gm-Message-State: AOAM5323VWmKtPx9jqWd/4NJiGg28l0RQmShZt5SU29nRDlgfh5rMOJV MEHbCEFzNz6w5AjlRvSwfnBCaPxAHUwsqwuiyi58a0DA+cs= X-Received: by 2002:a7b:c923:: with SMTP id h3mr1025587wml.29.1598612795186; Fri, 28 Aug 2020 04:06:35 -0700 (PDT) MIME-Version: 1.0 References: <20200827065355.15177-1-himadrispandya@gmail.com> <5dd266df-33cf-f351-7253-33a7f589cd56@gmail.com> In-Reply-To: <5dd266df-33cf-f351-7253-33a7f589cd56@gmail.com> From: Himadri Pandya Date: Fri, 28 Aug 2020 16:36:22 +0530 Message-ID: Subject: Re: [PATCH] net: usb: Fix uninit-was-stored issue in asix_read_phy_addr() To: Sergei Shtylyov Cc: David Miller , Jakub Kicinski , USB list , netdev , LKML , syzkaller-bugs , linux-kernel-mentees@lists.linuxfoundation.org, Greg KH Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 27, 2020 at 1:28 PM Sergei Shtylyov wrote: > > Hello! > > On 27.08.2020 9:53, Himadri Pandya wrote: > > > 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 > > --- > > drivers/net/usb/asix_common.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c > > index e39f41efda3e..7bc6e8f856fe 100644 > > --- 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 *dev, int internal) > > > > 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); > > Hm... printing possibly negative values as hex? > Yeah. That's odd! Fixing it. Thanks, Himadri > [...] > > MBR, Sergei