From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE7DBC433F5 for ; Mon, 7 Feb 2022 11:26:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383812AbiBGLXh (ORCPT ); Mon, 7 Feb 2022 06:23:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382156AbiBGLS1 (ORCPT ); Mon, 7 Feb 2022 06:18:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BBFAC03F938; Mon, 7 Feb 2022 03:18:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 08133B80EC3; Mon, 7 Feb 2022 11:18:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 357C0C004E1; Mon, 7 Feb 2022 11:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644232688; bh=+2yQwBmdDLsntIJxVE0Bnkeye6Q+83n4LOF2QFZGPjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rikAK+FhMG5D2+NDfH9M4GzZVqoAeXJD050Fa9HSTMZl9+1PARV2Xdimx/09PeEP6 V3ZBmMNvKkxsqxR+SmesH2dVbPSMjTzHhCeZDW3i9ARSAJLmgfMOShVnh3bWC1YSTq AX++EuHajEnB4ca6aW7kIskVYdAjbIk4Ish8ZHDQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leon Romanovsky , =?UTF-8?q?H=C3=A5kon=20Bugge?= , Jason Gunthorpe Subject: [PATCH 4.19 64/86] RDMA/mlx4: Dont continue event handler after memory allocation failure Date: Mon, 7 Feb 2022 12:06:27 +0100 Message-Id: <20220207103759.661417834@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103757.550973048@linuxfoundation.org> References: <20220207103757.550973048@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leon Romanovsky commit f3136c4ce7acf64bee43135971ca52a880572e32 upstream. The failure to allocate memory during MLX4_DEV_EVENT_PORT_MGMT_CHANGE event handler will cause skip the assignment logic, but ib_dispatch_event() will be called anyway. Fix it by calling to return instead of break after memory allocation failure. Fixes: 00f5ce99dc6e ("mlx4: Use port management change event instead of smp_snoop") Link: https://lore.kernel.org/r/12a0e83f18cfad4b5f62654f141e240d04915e10.1643622264.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky Reviewed-by: HÃ¥kon Bugge Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/mlx4/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -3351,7 +3351,7 @@ static void mlx4_ib_event(struct mlx4_de case MLX4_DEV_EVENT_PORT_MGMT_CHANGE: ew = kmalloc(sizeof *ew, GFP_ATOMIC); if (!ew) - break; + return; INIT_WORK(&ew->work, handle_port_mgmt_change_event); memcpy(&ew->ib_eqe, eqe, sizeof *eqe);