Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2693892pxy; Mon, 3 May 2021 06:06:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwq6RM8DPkDShUhSDmuobnmHE8c0Ffuxl8JRuU+4C+Z8pS2Uianaij9yp1JfB3b7A7VQtFT X-Received: by 2002:a62:6142:0:b029:28e:b072:6b7 with SMTP id v63-20020a6261420000b029028eb07206b7mr2363166pfb.65.1620047197005; Mon, 03 May 2021 06:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620047196; cv=none; d=google.com; s=arc-20160816; b=Qxt6L3Enwn5xdNQxZZN2P7S9jtVDixGzx9aPs0+PwngQ8H729Nph063oVTzua+iUz6 u+MIrpmyPgfl8+HilPb1GoBL1BLe+8AkUMb8JOhru6FaxD4Qb54m0xyOH33Ma8swsG1E hMIEoDkxOCNPlAIyXSCI/HSyV1fcQTuZ8XgPR1Dk6dgwupQZINcCyNkVIkphyk+wzIiC 2GX8gFj10LvFHbstYIhCjgbUT2wFWA6TYZMph3YX/z5MXFkb3pzy2+6uS3z4X12b47yO inCNbinpmeZPPYE0fADoZYVGeZZwMLlL3DLhQY/NvpRX6/7z3J2ul96vOT8uZHdA/H0a bQOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zU9YmEWHnG2oTFW+lnWSgvrBfWbsBc0pS6X26R3j9xM=; b=HP6Eek9rx4auBro2fNsCNll4up0B4pRE6obXjKQ3zWAUqjk3ixqF0FG/YKHvyk6o5l hsLUOdyS9t7jTgZj2LAkIaN41uP7FPT7QDKBinIDkUA8SBwjTbkmnV2LUB11Oez0YFfR XfmhcmNIDywM9rNe9aFa+lc9QFzdJTkZwTsI6DM4ouil/meXLrCDRHyLkOkWhAAP3/8F M6NbtKfHWCAaIxf19cLFgAWJkzjjSAqMzCbAJMiRzzUzQ8fZiu4jFpEazqdI6CSWmfxh /mkQJU3QcFaRJ+1miotgTIW7vZjmhPKO/BQIJidoUe8/Rl/+MUk1p8DnPw/+L6Y2ktmv i7zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zK1YN8au; 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=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 gg20si413162pjb.134.2021.05.03.06.06.18; Mon, 03 May 2021 06:06:36 -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=@linuxfoundation.org header.s=korg header.b=zK1YN8au; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233690AbhECMAd (ORCPT + 99 others); Mon, 3 May 2021 08:00:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:34376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233608AbhECMAR (ORCPT ); Mon, 3 May 2021 08:00:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E884061278; Mon, 3 May 2021 11:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620043164; bh=73VzYlz/1SbBx7J36/SZlSRuTOcNuBkD3rlnJCI1wUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zK1YN8aum9ilnjNUc823dk2EkRzGOHtkxQmHwWZmhKD6VyYwllTr390XWyr45YbUe daIZV8rWrz1BYTiK6eVkFdjvldnrTg3BPMCuxlM8frlFy1e3avVG5C38WPtKVKa4Xf 0toJytobyk3bbFuevXkF7GMfVWDxxaveR5hQSlGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Kangjie Lu , Shannon Nelson , "David S . Miller" , stable Subject: [PATCH 22/69] Revert "niu: fix missing checks of niu_pci_eeprom_read" Date: Mon, 3 May 2021 13:56:49 +0200 Message-Id: <20210503115736.2104747-23-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210503115736.2104747-1-gregkh@linuxfoundation.org> References: <20210503115736.2104747-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit 26fd962bde0b15e54234fe762d86bc0349df1de4. Because of recent interactions with developers from @umn.edu, all commits from them have been recently re-reviewed to ensure if they were correct or not. Upon review, this commit was found to be incorrect for the reasons below, so it must be reverted. It will be fixed up "correctly" in a later kernel change. The change here was incorrect. While it is nice to check if niu_pci_eeprom_read() succeeded or not when using the data, any error that might have happened was not propagated upwards properly, causing the kernel to assume that these reads were successful, which results in invalid data in the buffer that was to contain the successfully read data. Cc: Kangjie Lu Cc: Shannon Nelson Cc: David S. Miller Fixes: 26fd962bde0b ("niu: fix missing checks of niu_pci_eeprom_read") Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/sun/niu.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index 707ccdd03b19..d70cdea756d1 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c @@ -8097,8 +8097,6 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end) start += 3; prop_len = niu_pci_eeprom_read(np, start + 4); - if (prop_len < 0) - return prop_len; err = niu_pci_vpd_get_propname(np, start + 5, namebuf, 64); if (err < 0) return err; @@ -8143,12 +8141,8 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end) netif_printk(np, probe, KERN_DEBUG, np->dev, "VPD_SCAN: Reading in property [%s] len[%d]\n", namebuf, prop_len); - for (i = 0; i < prop_len; i++) { - err = niu_pci_eeprom_read(np, off + i); - if (err >= 0) - *prop_buf = err; - ++prop_buf; - } + for (i = 0; i < prop_len; i++) + *prop_buf++ = niu_pci_eeprom_read(np, off + i); } start += len; -- 2.31.1