Received: by 10.192.165.148 with SMTP id m20csp2475845imm; Sun, 22 Apr 2018 07:50:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx498epBVDyn8bkZNRcoPbghjhlduy0viP4pvL+j65xwOY9Nz/y3BC2ukp1pkTTIV65eN/1+5 X-Received: by 2002:a17:902:284b:: with SMTP id e69-v6mr17242668plb.240.1524408619671; Sun, 22 Apr 2018 07:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524408619; cv=none; d=google.com; s=arc-20160816; b=nV6I2loqF5DICTwPPxPz1M/lR26csDzqYHocByW7V4LwsBFMmEhvOkyaatKPGk+/mB XtFuTq/C3B28xi7BzrjhlD+dvY7fJKPKOmHnQsCPK2/RrTqe++qIJcdBh3w5nrRoNoCb WHy4WYFKXN7xleHBC6lC6xjGHLkL3q5VXC7TJbfKujBjt7mdCG2WzxP/gdqoQFGcDgKB niDs4bmB4vP9QzoJYxB4HyjGyzWwou846C41OxXQruHTRigKbnODDEORHu7HREncJMpc gCJ6Pbvw1d7jyVIMKsaPb2JymrG7Kg2ep3/NRoZUpk06VE4UafQhSodl9NeLVcnUlfWH 5AIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=fPmUWbhioPgAW4CkZgE2/3fguVzzSzjjMrbfZlIyRH8=; b=ZJH3BbRubRsACPyzd2jYiYrMuxuZFCdLh09CRoGSNmoYzujkO2QcAH3UK+IfmlyZ55 rUmT0qFxpQ2xdr0DAkK/T09h5LDxyg8rZmL/JAn7CQKMze6QWcwDh/XUQ3j1oUAK8f/J yZU15zUJWR26GTWFfmvGL5ykdINUs2SRwm2wOO92C+LK6uiyosUNJdgBFpG+P0ngASDG pzoKhyjR8uDbI+ulSzP9oPme22WAXJYUfyIJcn5jrZ3flOVJDorbUwA04Y5WT26dPxMb 12saCy00OOyTOH7zDSHgnd13aSxyEY68AATPKOExqJh8JxW+01uTNqOWMzIwyjHCGIe1 iuBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q10-v6si8727324pli.419.2018.04.22.07.50.05; Sun, 22 Apr 2018 07:50:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757231AbeDVOsj (ORCPT + 99 others); Sun, 22 Apr 2018 10:48:39 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57052 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932188AbeDVOPw (ORCPT ); Sun, 22 Apr 2018 10:15:52 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A58E0C87; Sun, 22 Apr 2018 14:15:51 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phil Elwell , "David S. Miller" Subject: [PATCH 4.4 18/97] lan78xx: Correctly indicate invalid OTP Date: Sun, 22 Apr 2018 15:52:56 +0200 Message-Id: <20180422135305.627086892@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135304.577223025@linuxfoundation.org> References: <20180422135304.577223025@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Phil Elwell [ Upstream commit 4bfc33807a9a02764bdd1e42e794b3b401240f27 ] lan78xx_read_otp tries to return -EINVAL in the event of invalid OTP content, but the value gets overwritten before it is returned and the read goes ahead anyway. Make the read conditional as it should be and preserve the error code. Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver") Signed-off-by: Phil Elwell Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/lan78xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -618,7 +618,8 @@ static int lan78xx_read_otp(struct lan78 offset += 0x100; else ret = -EINVAL; - ret = lan78xx_read_raw_otp(dev, offset, length, data); + if (!ret) + ret = lan78xx_read_raw_otp(dev, offset, length, data); } return ret;