Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7259307imu; Wed, 14 Nov 2018 14:23:59 -0800 (PST) X-Google-Smtp-Source: AJdET5e+Cw6NwIFcdPGpaeR7ZvTYRzutZZ5GbpyWY3Hw84WnSb0MsjIncIe3raiC3S5IwORJ7ak7 X-Received: by 2002:a63:310:: with SMTP id 16mr3345584pgd.79.1542234239754; Wed, 14 Nov 2018 14:23:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542234239; cv=none; d=google.com; s=arc-20160816; b=kRkfBYZCl/gvXeTvVb1RrSR8bWjq13sVwANwZxqULruV+rMG3setK34m5pq74hRfER 6XgtG0Wnk/fJKo5qhVmXrvBc9Yrm+bTm/dP5vTYEni8CQEn0IIvHk+rr3H0nV9Pc+1t1 nfT3L5ba+Szr5xg4QBnDaK9Mcmux43IAg9kAfveAT1vwR6iHfB3DvSyeUUP+tpIscdIt /MwZmhQvWHNG/AXt3Uw1QgXrzOmkGuseEz05bNGrRgrScDQboUgMnq3okNqa0Ai3Jhoh il3c0STRVALIQmo2144lMeZSdK59dKircn1CdRke6+BKHzZR9gstupusOOlmEpUdgyTt I8Cw== 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; bh=K63008KtSh32HxBjO2amBvITQho9xVfJMUWBSfxlDU4=; b=hZlYNuGa4E/3eg4K9kiazy+mo4QZYte15qbjHkQQhwuIa3p27YH0OSpkVA6x4BKo+P 7r380Ek9kpeE6uPKvxyBo8z5mHWcZVnMULgdJaB9VaRSOedn/psHnI3GAYxInVxmsqsq lidLjNiF/sg/IYaCmQsPRIHowPPcNTyyAdIWZNNMIoT0ZwHXJTgvg+UR4Ia88m+joZBR iVPe3cISHpUi3+ojrGCkTndyhVthPE2zto1EhnAy9utAGBvBs/dWw4x3fl0o8JVZbMnB icHCN65EfwL1cUYvVgbU9/Hbea+oeFVT4nbu8O+NN6gHinhJN1YaKD/mDYs1ZgSZq8Vf i5zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VfUP0yAA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 88-v6si26385863plb.57.2018.11.14.14.23.21; Wed, 14 Nov 2018 14:23:59 -0800 (PST) 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=VfUP0yAA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729117AbeKOI12 (ORCPT + 99 others); Thu, 15 Nov 2018 03:27:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:34392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729066AbeKOI11 (ORCPT ); Thu, 15 Nov 2018 03:27:27 -0500 Received: from sasha-vm.mshome.net (unknown [64.114.255.114]) (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 D1A0C22522; Wed, 14 Nov 2018 22:22:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542234143; bh=bDzVpBEeasCK6L2LHb5Avj++8I4uhG/rkiWq/6M38lw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VfUP0yAA5NLEq8AAEAXbOuyWqGrKhle2asINIZlvf22r1bpm1eDhOVYesvhktxc9/ /ILYRLVcN8A/2GqsPoPi4K6uOPpeggE0Bn+AdyfvEryPyZWpgICbtQcC4Wpdk7HW/J zv60k2ic219tLlT1ojNyRbcoxPHflX3vMYRCC2DI= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sagiv Ozeri , Denis Bolotin , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.19 63/73] qed: Fix potential memory corruption Date: Wed, 14 Nov 2018 17:21:57 -0500 Message-Id: <20181114222207.98701-63-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181114222207.98701-1-sashal@kernel.org> References: <20181114222207.98701-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sagiv Ozeri [ Upstream commit fa5c448d98f0df660bfcad3dd5facc027ef84cd3 ] A stuck ramrod should be deleted from the completion_pending list, otherwise it will be added again in the future and corrupt the list. Return error value to inform that ramrod is stuck and should be deleted. Signed-off-by: Sagiv Ozeri Signed-off-by: Denis Bolotin Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/qlogic/qed/qed_spq.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_spq.c b/drivers/net/ethernet/qlogic/qed/qed_spq.c index 43619b6bb232..7106ad17afe2 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_spq.c +++ b/drivers/net/ethernet/qlogic/qed/qed_spq.c @@ -142,6 +142,7 @@ static int qed_spq_block(struct qed_hwfn *p_hwfn, DP_INFO(p_hwfn, "Ramrod is stuck, requesting MCP drain\n"); rc = qed_mcp_drain(p_hwfn, p_ptt); + qed_ptt_release(p_hwfn, p_ptt); if (rc) { DP_NOTICE(p_hwfn, "MCP drain failed\n"); goto err; @@ -150,18 +151,15 @@ static int qed_spq_block(struct qed_hwfn *p_hwfn, /* Retry after drain */ rc = __qed_spq_block(p_hwfn, p_ent, p_fw_ret, true); if (!rc) - goto out; + return 0; comp_done = (struct qed_spq_comp_done *)p_ent->comp_cb.cookie; - if (comp_done->done == 1) + if (comp_done->done == 1) { if (p_fw_ret) *p_fw_ret = comp_done->fw_return_code; -out: - qed_ptt_release(p_hwfn, p_ptt); - return 0; - + return 0; + } err: - qed_ptt_release(p_hwfn, p_ptt); DP_NOTICE(p_hwfn, "Ramrod is stuck [CID %08x cmd %02x protocol %02x echo %04x]\n", le32_to_cpu(p_ent->elem.hdr.cid), -- 2.17.1