Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp253717pxa; Thu, 27 Aug 2020 01:00:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPpFkIEGX5W5iNb/Z8jOfcgwGQg5M/AlA6z4SwGg4hJ9kkckWEHTWItjtDsHMdsNSDekI2 X-Received: by 2002:a17:906:bcd5:: with SMTP id lw21mr19413092ejb.454.1598515209529; Thu, 27 Aug 2020 01:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598515209; cv=none; d=google.com; s=arc-20160816; b=r+EHjJU0F6KpwiZWqVnQeP70eyGLycj7AK+6K3AaWkWxPEseOY/fq8rws6EG+rY8Fq 7ibaMH+DbrP4KVkdSvWgdiO0219dMgCsf/3VDdpJnepVn4BMqjUfCQx5U66cYkM5X8Dh 7coptMFdY1jknMbyQ0+i1ORk0TGs8uvhJqwnnUg7PcclnaYPlZq96FpnlEEHmBlPYg1q 218lLJyho1L81hzDP+T4C/qnqkJFZ3F3Tpwpc3BuOGSm0FUNjpPRSsAW1cJLrHxnwZVQ d+TGo+CCbB3CFMQ2loNWn32qJNL4exsdQnxUcy58MG5oWabfl1duf2OuxspI0HCRl4WM k1pQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=lEBPqYLj1Sfpoe7PvHoeVpAVjO6ud5dnyjMuhp7FHVU=; b=aeWFCQbw2bEMgcFAVHE2Jnv4BMR30M/j1DWqgNZPik2rNvaz+uN8Ka2n2mDRAeze3L ze6GvRBEmdUFiTHVDVZOK7nONc7LQdBmRU8NK3i9gU4XaXnLiZThTUDU7lhQjaHm7omO ru1kZBeHLoplNJQ+alpWCYwib/9ffDrhPCXBJH0xUFcoG6z0dDrVqUIVSB5tFr8nE+kD J/zgA2lCzEvMsIKUA/hUz6ubs8VxEPVJsvms6Qx/D/YG7XqyJMnyozzcgazDzTSDOxio Hpofee7iZzL8Mdr3LPBu/FhgsyUBlKRhgNZbxRbBODIlSeY0KuX1/03LJX6kcNiHnYx4 EvRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UdpN9e9+; 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 p5si770860ejg.477.2020.08.27.00.59.46; Thu, 27 Aug 2020 01:00:09 -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=UdpN9e9+; 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 S1728471AbgH0H6T (ORCPT + 99 others); Thu, 27 Aug 2020 03:58:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728333AbgH0H6J (ORCPT ); Thu, 27 Aug 2020 03:58:09 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD8E5C061264; Thu, 27 Aug 2020 00:58:08 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id f26so5340447ljc.8; Thu, 27 Aug 2020 00:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lEBPqYLj1Sfpoe7PvHoeVpAVjO6ud5dnyjMuhp7FHVU=; b=UdpN9e9+xHs/VTWHW2V0XUZN9Egd4mwnCmlizNY/AIPcvPFUdBqRvFNQU8vo2kolFY 7y2T/O/r2Ov/tzGqMTcdLnb7fmAI3MyewZNKhgF/msyQT7ep+SBJ9MJYrVL3ZFSf8/lg fgpStsnUu58uIXrIb6sZBB73as3h9JlklSIHZwdaI5fVlpeBSVoP3GSxdwAKRIuGJ0G3 uheR2DVPPCDmJOgNe4rZtOHN3FRLjX6JrxavbkinDgK7QGTDkzOPEKPBJSpozg1JeTNn SVy2dKblpo1tKuycek1vObQRq14/QN8FwJFtMEbbj5T1J/lC/ZObD/EoVv5j9sc/krMV mzWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=lEBPqYLj1Sfpoe7PvHoeVpAVjO6ud5dnyjMuhp7FHVU=; b=GFSiPWO5CJh5RhvONpAtEqiyWLJ+ZAdW+3V27joBwBS4hlS8OesAcbieWJYG0PPviX yq236/4jg/kQrdyVwhb6H1ldAnKH2xTB9p/hOfiyxU2HkUKe0tU4rKCtjV8CJBeQSEZA W1IsAPkCTYzH8UhmrCVDq0rAfFSJKkwNHVCUzukIRoepVrVOjvqJhZ5C0Znt06gR0YN/ SerhNeqvgoadgNXAlyt/3nGzNwmChLNSlnK/dun6Lb2ZSukQuxoPq5nIa/VRhPywjRtg CrFtIfV6eD9g1ncoCiubdqcPulW7+UJa7AEfNsenopA5leBr6in+EdVQwSJ/tOodA0fJ pZ1Q== X-Gm-Message-State: AOAM5331J1dGNIESZwf11TK4h/Aph3zdKQ00E574etiUDcNlQ9nHuw7R ssUId5J19zwHX/P5RsB0qCA= X-Received: by 2002:a2e:a370:: with SMTP id i16mr9544469ljn.22.1598515087168; Thu, 27 Aug 2020 00:58:07 -0700 (PDT) Received: from ?IPv6:2a00:1fa0:4853:a15:71d2:9e85:be1:5e21? ([2a00:1fa0:4853:a15:71d2:9e85:be1:5e21]) by smtp.gmail.com with ESMTPSA id j6sm297282lja.23.2020.08.27.00.58.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Aug 2020 00:58:06 -0700 (PDT) Subject: Re: [PATCH] net: usb: Fix uninit-was-stored issue in asix_read_phy_addr() To: Himadri Pandya , davem@davemloft.net, kuba@kernel.org Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, linux-kernel-mentees@lists.linuxfoundation.org, gregkh@linuxfoundation.org References: <20200827065355.15177-1-himadrispandya@gmail.com> From: Sergei Shtylyov Organization: Brain-dead Software Message-ID: <5dd266df-33cf-f351-7253-33a7f589cd56@gmail.com> Date: Thu, 27 Aug 2020 10:57:56 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200827065355.15177-1-himadrispandya@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? [...] MBR, Sergei