Received: by 10.192.165.156 with SMTP id m28csp259585imm; Tue, 17 Apr 2018 09:40:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx49fxTJYh0BiqVsjUoHDxEx+57J7a5Yjyz3gSc/BpREIiS03klHcItX2m+Qs6SZx5gCNdxNs X-Received: by 2002:a17:902:f24:: with SMTP id 33-v6mr2769115ply.242.1523983237486; Tue, 17 Apr 2018 09:40:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523983237; cv=none; d=google.com; s=arc-20160816; b=hEIaV4pYURoZKkfppEWDXUpgmRJLBUUkZvrG5mTl3P/iiE7r2V7tl+tv1uFd6Xw3F4 /7bPpwqY+n5/mpcdfbza4TuFv7y6d08efnBHmXh98EBblzGTCOfsSZESe5KzDsHbdBXl oswG6cdDWECUmfcnglxiUQ6epq4pqqYp8xmkKCLPI6DqjTWoLDr5fcE5YVt//nB2BH+l UzhPMu72uhCBVjBoSvyIxUbHi4vCKT0bD5XY1Hp4arQmZnj/cKEKXQ61DTDWORyNHaTC FOboCnAel/8A/GJcDS8B3K1sdBMjpkUVrBq207u8d0l8XX/DsYh2ZzBHwhfGo/eG9tTy ZqpA== 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=FLOxsS/CY9dWJk/lasZNlY+CVQjvfNJ0PRfsc3BcRGs=; b=BUmaVxPXEEvQHZ6wr61VqUUcrwC1YbUzjuewP8EnFIeUN91ksP4KSTkCTV5iv+9h0X 3gOQdsfSTlE7M3UP6qYXbrd2BCYIP+SaU94n2dzHtYX2nKqdSDu6WUbQa+rjNjyiyiSJ iT/esJo5SimgN5px5PVnOR6Ftn9weRx7AwFidSubf3PMf9A7GMfOb8JbJStMpsOwAQiW yvpUt5yvEysnOUwsclAcozJQNAAH69tOb4F32L5P+ju6xAEnnk6opmf+FJWJsijr3byA LirqQ6kUUrtBt/1Pd64Jk84RzQ4wPtMceLRz5isc4pu2Rqzx6dtNkJlIjmxZqzyU/5jL kw1w== 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 o128si12431191pfg.5.2018.04.17.09.40.23; Tue, 17 Apr 2018 09:40:37 -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 S1755056AbeDQQGq (ORCPT + 99 others); Tue, 17 Apr 2018 12:06:46 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34862 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754017AbeDQQGm (ORCPT ); Tue, 17 Apr 2018 12:06:42 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3DD30C98; Tue, 17 Apr 2018 16:06:42 +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.14 07/49] lan78xx: Correctly indicate invalid OTP Date: Tue, 17 Apr 2018 17:58:46 +0200 Message-Id: <20180417155715.365754676@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155715.032245882@linuxfoundation.org> References: <20180417155715.032245882@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.14-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 @@ -928,7 +928,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;