Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp226525pxa; Wed, 26 Aug 2020 23:55:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSca+JyW5VhREPApDShlbAfDp1SwMms7uEoONPbeXPbpgLcplTh6m3gqthhiio5Wn7jZB8 X-Received: by 2002:a17:906:289a:: with SMTP id o26mr19322190ejd.309.1598511339897; Wed, 26 Aug 2020 23:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598511339; cv=none; d=google.com; s=arc-20160816; b=QUeRAe0XAHL/X1TQ0bLDaoOLQLnE9QcPyA6p8/fKWMVf7mUQWnhvGYACV6aGHgvmAj v5bSGNEi4qgox/xKCUrVtcJ0tM/hLfsB2YZMlaLObDbwbC8EOcV4xQCuRaKtXOzRprDJ i9pWEvIc4jHtSWl1mIqmg4vLqR8SU9iWS+1UgtzzWI/kIB58NcztK2zQoRllaRNHZYpr Ra0N9O3G5N6OVVrktYZOBJHflUU4RJZXh/8s8bLL2lr9lflXlXyw5t7bC6jInrD+/AHn 1Bs82bv93Rp2Tb8Fdn+02KhuhKTerE9RjeEbDc0Ill2gKTeVAHaIhc8rVKwSb86SO9yu VD7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=BCoL4GC0gNjAzmmMRfC/gvKA1COigx1ubzs0rhx5Lso=; b=BHV0IgYLlrXmkRq7gFpTlYETHgz7i1A0Cmxa7+ynryRc7nHR4B/AxsoJLAKPxkdA99 6bhJBXiIQ6olDM5HLiqc4NdIppLRoesOeDFrDoO8Q//XC5r6Z4BocdxAkbiDBVaASBTZ TwYbhIgtnD88s/iQi7ccL6roxen7l1LT4FTzj3XlEXCYvAysTGICcjMD1TUnkV7K8dv3 C8/KMbb4GwQ82mO13MPvlwOiSbzIqrrblfG6X1v9mlFFalArvivsV/pkncA2ORHbM6Pn CED1xJjMHjG7d4onEXUJxpkHlL7fpKWJGaaV/ZRxi9sUE6O2IEmHm3wrZiM5mvBEUXg1 IpbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VLaHMikw; 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 h6si745858ejc.567.2020.08.26.23.55.17; Wed, 26 Aug 2020 23:55:39 -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=VLaHMikw; 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 S1727066AbgH0Gyg (ORCPT + 99 others); Thu, 27 Aug 2020 02:54:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbgH0Gyf (ORCPT ); Thu, 27 Aug 2020 02:54:35 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58FC1C061264; Wed, 26 Aug 2020 23:54:35 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id v15so2664274pgh.6; Wed, 26 Aug 2020 23:54:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=BCoL4GC0gNjAzmmMRfC/gvKA1COigx1ubzs0rhx5Lso=; b=VLaHMikwWNRlOpknfV2L9wpgFm0GPiV2o5zjbJeBijU7IWF/iGoEDEtGbJ30Le5UJP NoqQ+oAZ1FPOvuYv3mdRXTebnPgvys7VyNehhUDcGw10vRx67egVgmkiMU3ixxBzEb0y qlHVOFlfp3X8UeIfVeaA+NDFD+PQhTi6kaWX7KXk5v1S5tKZYDb+bhEEUhN8xVPWpHcC 5z7XBCqEi4IpxYh7u9+migwkB6amlkIj4SKK9+mGCYqX8Tu2VImrbFBQq05jI23dJhPB jrEUwfSL15fXZsi2Jg16d5kqgVDo4xTELNvBpdh4Mywl0I6sfHiRDR8rwOwy2lpvUacI r9YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BCoL4GC0gNjAzmmMRfC/gvKA1COigx1ubzs0rhx5Lso=; b=X0sqjMaWBh+fM/Vr6Rfb4W2suUWr2K7G65Eseg1/koy36hzsB3ouv+ZrvNY4rCheri PCv3BYmJbJwF/TCshM8387ghhyHnXgq72rH1xaV9WsU023Bfkwz00WqQhUgd89xxiQde JeV4OebA8+mAzlnyBPbsEOpK+m3QvYCP4mmTsQ5KtQanhsRU1JO8y+/xlaPQUceiXWLc 8uBmwOfxjOu1FIvJZZFk/Ydjua3uswnDgCr9TnIkANzEqpwebX+k98lOFD+4UpgzslCi od+B2Q1FMJQ6PTSWeAwI1GXgGwhsLvmlQVfeyv63QoaMyUsvdKo2+rZBrSVZKfsHb+aa g4Dg== X-Gm-Message-State: AOAM5307piuX2AFajqBG2Xf0F6QGjOK7G25+20TiZu7pp+BFc2XdnBKP lWYW3O6KGdI/ck2pBiiBwJY= X-Received: by 2002:a63:1b0b:: with SMTP id b11mr14028827pgb.447.1598511274585; Wed, 26 Aug 2020 23:54:34 -0700 (PDT) Received: from localhost.localdomain ([2405:204:810b:d5b5:fcb1:360f:550f:6dac]) by smtp.gmail.com with ESMTPSA id o2sm1162174pjh.4.2020.08.26.23.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2020 23:54:34 -0700 (PDT) From: Himadri Pandya To: 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, Himadri Pandya Subject: [PATCH] net: usb: Fix uninit-was-stored issue in asix_read_phy_addr() Date: Thu, 27 Aug 2020 12:23:55 +0530 Message-Id: <20200827065355.15177-1-himadrispandya@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); goto out; } -- 2.17.1