From patchwork Tue Jul 25 20:45:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108703 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp28873qge; Tue, 25 Jul 2017 13:45:55 -0700 (PDT) X-Received: by 10.84.234.9 with SMTP id m9mr22610934plk.15.1501015555801; Tue, 25 Jul 2017 13:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501015555; cv=none; d=google.com; s=arc-20160816; b=HQRqjYLXNfnNKc99msv3GlWiZr+D3repZ8L0IDJqhKf3NQxIcdogZvvhIguY8zAp/D Dfs2+rQn5rmFUO8BGZimCeklq/H9jnHj9rzSpvHwsybP5RU8V0Qd6w+bNSr+J7DdAMgf 9wHPNkFydZuTKNPslGmMICcnsxOJi1+o+kl/NpnT3gg+xvIj8tOallTjCoHYgv9tNqlB D+Dxo44wXa3isxn38yYTc29q4QS4b9ZIDiPNELSS+LuANqtG/s2d7qpLKbHK8V07ATWK 7F3sJJS64TxWSr+zSybh7I3Hur4/xHxIhK6kUYdkdOE/IkJ5gA2yXBPpS+kVqav0jIo4 5gWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=4HJJ+gH5/SQ1ZFIOrNUXLZcdOzmkcI/r+5iUUIhMx50=; b=FVCC1mraOhsi6LDXuhfZ72KzoG3ahhdPUXEb+yq0qLbXw8ijLrS4bppJhEltb5j0RG bKIaiNT8r8tyvjcDs7e2x9wYLMg4OrkSawxlpJtFeeb5U0crOM4yc7mJ5jiU3zlswD3i mxGMe1I9ZS4ZdHORBIciB0a3Kzvbg7h6SpnSHn72LqzNAV5SCLFyg7rTL5SE/qglUqZ9 XVKNQ2vOmfUNc7M6dPLleFDuzUTvjxt8S0pZlyzMQZgdBPo608IGs8jB/+cx49bck/LU ERSHSYu4JkoWqDxZI2Yt0Xp6bW2wCJm9y61/oUPO7KbMoJ7zL6nw1JceOcFl+cQc3gZ/ IHvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=P9CsiRMd; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1si9102153plm.762.2017.07.25.13.45.55; Tue, 25 Jul 2017 13:45:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=P9CsiRMd; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752605AbdGYUpx (ORCPT + 6 others); Tue, 25 Jul 2017 16:45:53 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:33625 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752552AbdGYUpw (ORCPT ); Tue, 25 Jul 2017 16:45:52 -0400 Received: by mail-pg0-f42.google.com with SMTP id g14so25954261pgu.0 for ; Tue, 25 Jul 2017 13:45:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4HJJ+gH5/SQ1ZFIOrNUXLZcdOzmkcI/r+5iUUIhMx50=; b=P9CsiRMd7J74zj9gl8MbqfqL7ljmJHEWtpk2dMQX4kygkxDm908pbfo9p2nGsK+csB HZxxtLAhfT77fNGUlqsx7tifA3yVi1OdeVuWerEOGQvsVa9JTv/TK3w/bDJpALTip73D Huz4PVmqHcLZyvXS1GmESGu2QIU9lMaF1mJbs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4HJJ+gH5/SQ1ZFIOrNUXLZcdOzmkcI/r+5iUUIhMx50=; b=YfFNoE/XNi2GB1hN2WMQRWHJH97DnfsoITF/hIsIMTP7XPTY+mpi6tGaUjwXPjIfIe Il2lSlcGHzg/TIeyz57HUaXqPzmAmYoVffKCKF/1QxuThROCkOhWvn5Ueme8urF6IxdC iaciW2KE2pW+w7+tpOrCUyfjJ42cUQkWnbpL6fStTYRN7YdinR/z4+Y0O2N6C+nc/C1Y hJad1dRaf5gLFLYvDZdMVVnQ9pyq0sDGCcyuzbmYDVVYx3ANQ/u4aM+kMHHLMLyBW1R4 EE4rVENPTVEsjkGP4hUkYQwJVpIxhFU99j4aqOXc4WrfO0XSGREWuvHPE+I4dcEIk/6/ YrFQ== X-Gm-Message-State: AIVw113Er0WV6D5siihbJBS08lu8Qyl+eFoZamcPUzfzpjr/5u8bC8Mn 8zIMyXfuG9DOhJf2O+eF8Q== X-Received: by 10.84.217.68 with SMTP id e4mr8255286plj.309.1501015552286; Tue, 25 Jul 2017 13:45:52 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id d4sm532125pfj.59.2017.07.25.13.45.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 13:45:51 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Oliver Neukum , "David S . Miller" Subject: [PATCH for-3.18 07/15] kaweth: fix oops upon failed memory allocation Date: Wed, 26 Jul 2017 02:15:18 +0530 Message-Id: <1501015526-32178-8-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501015526-32178-1-git-send-email-amit.pundir@linaro.org> References: <1501015526-32178-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Oliver Neukum commit 575ced7f8090c1a4e91e2daf8da9352a6a1fc7a7 upstream. Just return an error upon failure. Signed-off-by: Oliver Neukum Signed-off-by: David S. Miller Signed-off-by: Amit Pundir --- drivers/net/usb/kaweth.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index 95ef45a5e9df..40f3fbf2ca01 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c @@ -1009,6 +1009,7 @@ static int kaweth_probe( struct net_device *netdev; const eth_addr_t bcast_addr = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; int result = 0; + int rv = -EIO; dev_dbg(dev, "Kawasaki Device Probe (Device number:%d): 0x%4.4x:0x%4.4x:0x%4.4x\n", @@ -1049,6 +1050,10 @@ static int kaweth_probe( /* Download the firmware */ dev_info(dev, "Downloading firmware...\n"); kaweth->firmware_buf = (__u8 *)__get_free_page(GFP_KERNEL); + if (!kaweth->firmware_buf) { + rv = -ENOMEM; + goto err_free_netdev; + } if ((result = kaweth_download_firmware(kaweth, "kaweth/new_code.bin", 100, @@ -1209,7 +1214,7 @@ err_only_tx: err_free_netdev: free_netdev(netdev); - return -EIO; + return rv; } /****************************************************************