Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp837408ybi; Fri, 12 Jul 2019 05:29:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwrM8Lhu2RHpK8MEFHJS+9cyyNI6R1GGCqonLRGFx8o3KGignVrpN5ukvsdO3HJYLIBtZ4v X-Received: by 2002:a65:5a44:: with SMTP id z4mr10592354pgs.41.1562934540245; Fri, 12 Jul 2019 05:29:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934540; cv=none; d=google.com; s=arc-20160816; b=ChZuZU5f+467odFrmisXSsStzYI/zJF7uBGT7H065q3Q4GESv2vAse580BEQHwYbxJ gPriYDjo4jofToN/ClcJLmhE2/+FU8qiiBhBOgimopjK0hyHNFvuAYgD/x0XfIUpW4ig EnfnHxSL+WQKnM/jzTV9nqq/9c3KfH8AuvT8WbhXfUxJ9om1pWfwakuymNEwKEkWJTkb 2MuAOqTotqUaaLgqbakRIcCznNDOOb4TJspWQSRaF9hULkgwRt3kcw9g1PXEFKhlC0hv 356tXPANFWnkw9ZhfxJoYODetBD8+yQ2kx/ZMUos6vHZ31/Lqm6rQUs2Ifup3A+WAbWx K5Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=47DdvnMJj+UJh2iPQtGvnQy2vJZoXmqaxhDiBCatKY8=; b=bD3Dnm4I5Qmc1wWHv5zUd6YpsWFxYEabh17HWHUbcO5XogosuXqnuH1L4wTVWKNLQl fN2fE/GcPgFIAqFE4xkSunwYVRqiGy78GhXYLcMAqoW8A68I+ba44JqanvTzfNiBMEfZ s68vfkna9YPz/dFqvcBVhwgy503f0LauCgvnrAnSbxQG98pBf/lSUrPXuxCiUTa4yqm7 ZiiFAfozITtK8hZuyamnSP+lDALOsDi3vLcONVGPU/zRHMlq3pfrqvJj+Pqx+UFJ5Kwt sDPcp3E3xwIOUX7xoTdx8Bi9vWY46T/mdeyFf2jC0uIb9reDRcq+ilyp7DLW78B6OAV9 gQRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Cwu8oUiV; 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 y34si8074662plb.423.2019.07.12.05.28.44; Fri, 12 Jul 2019 05:29:00 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Cwu8oUiV; 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 S1728150AbfGLM0h (ORCPT + 99 others); Fri, 12 Jul 2019 08:26:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:37942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727165AbfGLM0f (ORCPT ); Fri, 12 Jul 2019 08:26:35 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7FD992084B; Fri, 12 Jul 2019 12:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934395; bh=eJjymPxfk4v/tQtwcZbiDbsMpBU0JnS1GnRSFIQMZ6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cwu8oUiVJLKZNI5XFOKaFWsPT4jzvJagQMw+lp1Q2/lHZLSqNlqaOFbMim1YUMRW2 i/zsZeC6cIsoCmimE005hXf26zPnCVq3jUOt/RLWGl2bgh1Ueho4hGyshruJXFW/v7 9fTUogkmGYab42+6XQp8F92BijXV10wkT7sgH4Vo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Falcon , "David S. Miller" , Sasha Levin Subject: [PATCH 5.1 042/138] ibmvnic: Fix unchecked return codes of memory allocations Date: Fri, 12 Jul 2019 14:18:26 +0200 Message-Id: <20190712121630.284926636@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 7c940b1a5291e5069d561f5b8f0e51db6b7a259a ] The return values for these memory allocations are unchecked, which may cause an oops if the driver does not handle them after a failure. Fix by checking the function's return code. Signed-off-by: Thomas Falcon Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/ibm/ibmvnic.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 664e52fa7919..0e4029c54241 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -438,9 +438,10 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter) if (rx_pool->buff_size != be64_to_cpu(size_array[i])) { free_long_term_buff(adapter, &rx_pool->long_term_buff); rx_pool->buff_size = be64_to_cpu(size_array[i]); - alloc_long_term_buff(adapter, &rx_pool->long_term_buff, - rx_pool->size * - rx_pool->buff_size); + rc = alloc_long_term_buff(adapter, + &rx_pool->long_term_buff, + rx_pool->size * + rx_pool->buff_size); } else { rc = reset_long_term_buff(adapter, &rx_pool->long_term_buff); @@ -706,9 +707,9 @@ static int init_tx_pools(struct net_device *netdev) return rc; } - init_one_tx_pool(netdev, &adapter->tso_pool[i], - IBMVNIC_TSO_BUFS, - IBMVNIC_TSO_BUF_SZ); + rc = init_one_tx_pool(netdev, &adapter->tso_pool[i], + IBMVNIC_TSO_BUFS, + IBMVNIC_TSO_BUF_SZ); if (rc) { release_tx_pools(adapter); return rc; -- 2.20.1