From patchwork Tue Sep 4 17:29:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 10587729 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5592C13BB for ; Tue, 4 Sep 2018 17:30:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 433B729E6C for ; Tue, 4 Sep 2018 17:30:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36C3129EB0; Tue, 4 Sep 2018 17:30:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD36229E6C for ; Tue, 4 Sep 2018 17:30:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727798AbeIDVzv (ORCPT ); Tue, 4 Sep 2018 17:55:51 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:52579 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727272AbeIDVzu (ORCPT ); Tue, 4 Sep 2018 17:55:50 -0400 Received: from localhost.localdomain ([37.4.249.97]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.183]) with ESMTPSA (Nemesis) id 0Lp7GG-1fREJi3M9c-00esIV; Tue, 04 Sep 2018 19:29:38 +0200 From: Stefan Wahren To: Woojung Huh Cc: Microchip Linux Driver Support , "David S. Miller" , netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Wahren Subject: [PATCH V2 1/4 next] net: lan78xx: Bail out if lan78xx_get_endpoints fails Date: Tue, 4 Sep 2018 19:29:09 +0200 Message-Id: <1536082152-3669-2-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536082152-3669-1-git-send-email-stefan.wahren@i2se.com> References: <1536082152-3669-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K1:B/B9WzsyPV6JdCvAOS/Kzjn0ncEXoPUrMhptKGJjexecT1vqpOD eyu4RPmiCLJy63Uv9sCRjKqyAV7n+CafQ0+DCGZ/Wc9Jj2MByqinnxQRDe6fe48Qz3KIe9M +hyG8Fx8Zj3SOsxrCLo/TOwmjJnQHqt2NuXVMrzoxFOjP9FtgzF35lEip833g6HThWAaPgf On3HHCOaYF+UWPT7P2kmA== X-UI-Out-Filterresults: notjunk:1;V01:K0:LjWl2pm+5hk=:cbchJ6Zwyx6HaiJzUDXtO/ YIWPgF+pqkgCE5QD4LonANCoKQd5TzX3Aft3c+1FxWD3CqfkUHXX7XnjkGHX/CS3MNOp8+scD sFYEF7dut3niWECuuW1mQrWNEbmSRVgQgPhW1QF676WvAWfPpuDbnxwTmt8FT5Tusamcdexdo hIpEkvcKeBJLtW2PiVPBg90WDg/el197pZd7Zge5JmSrq7n5/A+w04bA5aaMU67o61JJUXxCI YHA/X/Hogqw9PLel/LIpu/Uobhe7g+7rIzFL840VnYAibpJSdw1kNFJfhBlm2E5f5cbcyFPtT QQcevy8t5pesSYUIcnFvxxtXO3hTrKuaro4UA4q0aSDQ4Io23f2CNR7jzycOl9aXY4FSi1ED8 96x4g4/sMhTzBd5TXyhq6hnpA4wExu/czpDu5fC4yeG9FSLWX2k26m7fcHjlr3O28KJ0kEdFc mOvK+DpzGzdOsD5JAJORoPy6B1zvIb15GEZP2WOudv+3jyLW3i0AdcJSiKMQa0iDdH/tIAs2H wPq7+KOhnGSeznVY0bppIeNxTOHHt76NWYvDrMo8RCUTfvjotHMlUGxSP90tO8A3MQV2ukmnx Q1hb3po9PS3UYm9p2FmHHxujpe8STz/8KVM/rM0bnARUwv975xhcTfXy7Hij+wkPhHV08zjvO 6Mc2VzhuaGbD6ZP4sYIbkv8Hk+CBCH4UanxrGxflNUv/+HMo99/qJ4wRXqJdIXXRZvOs= Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We need to bail out if lan78xx_get_endpoints() fails, otherwise the result is overwritten. Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet") Signed-off-by: Stefan Wahren Reviewed-by: Raghuram Chary Jallipalli --- drivers/net/usb/lan78xx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index a9991c5..3f70b94 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -2952,6 +2952,11 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf) int i; ret = lan78xx_get_endpoints(dev, intf); + if (ret) { + netdev_warn(dev->net, "lan78xx_get_endpoints failed: %d\n", + ret); + return ret; + } dev->data[0] = (unsigned long)kzalloc(sizeof(*pdata), GFP_KERNEL);