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 X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54F49C433E2 for ; Thu, 14 May 2020 19:01:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34D3520727 for ; Thu, 14 May 2020 19:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589482890; bh=xKqNhfofCfsb6sZSc/K19nM7f9VNbEQR3BZ1CS7Z254=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=l34OSknPo0wstxeY5esa1Q1zEoj3uiSIe46smB29+YZm1jegQFuYK8lVZ3Zdjy89W ulw43ppBTZthP9F0Ft1xjliLl26pDnqsRgKEq9Ai1uNwYitkW2/LK7ywIJ5tIsckso rktwbByP2CpjOrwycyzoT3p21w9E/SfYwlDXGwc0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729695AbgENTB3 (ORCPT ); Thu, 14 May 2020 15:01:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:56148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727795AbgENSz3 (ORCPT ); Thu, 14 May 2020 14:55:29 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A5CD20767; Thu, 14 May 2020 18:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589482529; bh=xKqNhfofCfsb6sZSc/K19nM7f9VNbEQR3BZ1CS7Z254=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lkg+EhPvPX/GXpF2Byik7xI9neNwoTeVfEAVhCOVT2Tr25oKc5G1uEyQGzAiCuVwt YBdqSmTbZSHMD6P45MU5FudaNQbkOEVst+CTnZ/1vrV/ZmuwR/L4e+4TjPfePqVlV6 wFTsI6U+iPOhVVRybPaNl49t0GVuIojCe0rF2zIg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Moshe Shemesh , Eran Ben Elisha , Saeed Mahameed , Sasha Levin , netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 23/39] net/mlx5: Fix command entry leak in Internal Error State Date: Thu, 14 May 2020 14:54:40 -0400 Message-Id: <20200514185456.21060-23-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514185456.21060-1-sashal@kernel.org> References: <20200514185456.21060-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Moshe Shemesh [ Upstream commit cece6f432cca9f18900463ed01b97a152a03600a ] Processing commands by cmd_work_handler() while already in Internal Error State will result in entry leak, since the handler process force completion without doorbell. Forced completion doesn't release the entry and event completion will never arrive, so entry should be released. Fixes: 73dd3a4839c1 ("net/mlx5: Avoid using pending command interface slots") Signed-off-by: Moshe Shemesh Signed-off-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index dd6522b5737b3..950ea980808b9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -865,6 +865,10 @@ static void cmd_work_handler(struct work_struct *work) MLX5_SET(mbox_out, ent->out, syndrome, drv_synd); mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true); + /* no doorbell, no need to keep the entry */ + free_ent(cmd, ent->idx); + if (ent->callback) + free_cmd(ent); return; } -- 2.20.1