Received: by 10.192.165.156 with SMTP id m28csp239294imm; Tue, 17 Apr 2018 09:19:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx49Uzae1rF14IP8QItCX9BL7apF8wx4pwMInY/Q1GIw8n1GTztUoT5hi1W4mWqMwapWiJ1ne X-Received: by 2002:a17:902:7c0e:: with SMTP id x14-v6mr2703284pll.392.1523981968881; Tue, 17 Apr 2018 09:19:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523981968; cv=none; d=google.com; s=arc-20160816; b=ehT6mDff5dKGKWngQshHzOhONAYHvVx/MsrzVVcy6MIoK+mWt019kJGqTBWt1BnU/F KyOzgYzRvtgA5TUd6pvACsqj0qbUCZ9t3x6Mq4+H1hzg1KbbeBirly5b3oPPXmr4hdz5 O4XvUxUjq5H9OCSHb+ob9AqUXZ+aAVN8OAKvIsu7sfN02U4ij5QK6KkXPqLl80MelKnO Z7c2PTiZ86rQNrZ3KHantSogLIrAlCNWMRSOzRtyIFCMvKGWgZZJyjnIZoNC3+DUj1Gx e3qPhNZh5tM9W7X8tlTqJKiHCHD41jB+ZH87ERp+mBwxbeUzwhL2Gn4ei30KIJEkY/iL S0XQ== 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=fzcqnZq16Adhu6u7mHSUZEpqnsJFemZAhg5YgDaYJpQ=; b=jtdO2ltzB7MpI6DxelabRnTdVVvndTjvfqYxkGTePzfqoG+6OmxQrZQJff34rX2vcQ 3CnPac+JPQXcSUoGjcTlx6tA6kbNAha8uxk6E+RAk/TZD/TN7Dba1ZzK1ny0uYWXHRrc Pj47SsB8IIj+C7Kd53r8O2FZBd0D7+v4H7C5OMyb/KgOyyYxVZ2/A2CtqOrs9Z7q0qE2 knCJrOuoUnjlwcWMtXQWIkCr6CRZV2NebYEeuK1GbC2ldzh73XkIbHUw6tTbNLFg0B5r KyCRaZudlhTpwaUUU3avOdp46xm36bMn0n72wcAXgypHZIMBxwezsTYnS7oHKZ3zzn5j c2/g== 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 y2si11342233pgv.246.2018.04.17.09.19.14; Tue, 17 Apr 2018 09:19:28 -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 S1755792AbeDQQQR (ORCPT + 99 others); Tue, 17 Apr 2018 12:16:17 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36532 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755934AbeDQQKw (ORCPT ); Tue, 17 Apr 2018 12:10:52 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DBE24D0B; Tue, 17 Apr 2018 16:10: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.9 66/66] lan78xx: Correctly indicate invalid OTP Date: Tue, 17 Apr 2018 17:59:39 +0200 Message-Id: <20180417155648.707734660@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155645.868055442@linuxfoundation.org> References: <20180417155645.868055442@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.9-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 @@ -873,7 +873,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;