Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5635163imu; Mon, 26 Nov 2018 03:18:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/VJ+gVZiSM1t892ON5BRcqtdl3vtwmE4ZN/FdRCsepwWCXn8I7uj3LOuLE6VVu6BSGIfbck X-Received: by 2002:a63:5a08:: with SMTP id o8mr24306682pgb.185.1543231123148; Mon, 26 Nov 2018 03:18:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543231123; cv=none; d=google.com; s=arc-20160816; b=WqxiLhOFPds7b2eA8Em1ypyaPmg/hgykLLajOcoBduAqPEwQFeb/P0F+p6NWY6cW+1 8JQis4f9z+udbjisHuzyF6/+VtFYtI67UlAcWMNYEVuBQfKOzhGCYESIdetBPa6GnpOG EMrGTdS58P/ouPRhNGxuRJ623HLdZvzyHN6dPSm8F8IoLLU3gpIQK43Yr7MkmU4a+UYU RHJsnc0OcgfxQE8TIcRlK91EtX4wUGVd8TJKbfDaJ09xKbCptWXqQz/Zo7p6cn1wfOHh hDgCULAl8z05XuTxrwxlBcRQQUjhyyu+0g94aF9C4CtzmrlaSMKOeo1kexXclHEZj+gD C2gQ== 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=BFF3DuNuft7UsXj/Y8SnjnAKBRP6O8skORDFtLBHXqc=; b=YYzPNvXvrhJyo4at4KeqjpICAS1YPRYf9xffU1K08y4N/v6wTtcEFmALq7CULlwcNK sELH6hadqKALZNj3Z0+sF4oBNryOTiz8CZYDvDnKidM0RJ1mbNGic1mbrkJoNkxx9x3S AM6EouMK1YOwF8ynZK+8sWJHcuYAN/5NLrUEm5UWoFrYROGcxm5wfh8Yf93M9zeSyi2T A0MO1jhypCD8bjP7khDnJMIsVKFckK23X2NKL9H7zQeL/12A4OjxU1TgI9Og5P/sZFec wM9Cb6UD9f0w8uUOMEC5xtVw53Jkt5YphVQv3ptSbpU4hKYCTeFzULbytBYwcXF7jBZe sYtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZfKnwIK0; 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 l194si63676877pga.594.2018.11.26.03.18.28; Mon, 26 Nov 2018 03:18:43 -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=ZfKnwIK0; 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 S1730150AbeKZVzO (ORCPT + 99 others); Mon, 26 Nov 2018 16:55:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:37718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728901AbeKZVzN (ORCPT ); Mon, 26 Nov 2018 16:55:13 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 18C3A2089F; Mon, 26 Nov 2018 11:01:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543230088; bh=QVPM2doaAJypFhIXLBVFL3jV4kii6lrSB+eiYuqovJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZfKnwIK0z1MGuJi0X1OUlvz1YcNBQGxiui0VYNSnQK4I/5tf8sQdJUKjgYfOW5Mau kvUa04cxTfRDJgmHhMo1yc4I7Wz7w3bvFwkIuB1Qf+4IIcRyKFut2MwBf9480cns05 lt1477PuNZMoAcDIKgZBEX1Z20HttC5LX+XpDTb8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sagiv Ozeri , Denis Bolotin , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 38/62] qed: Fix potential memory corruption Date: Mon, 26 Nov 2018 11:51:19 +0100 Message-Id: <20181126105053.767763142@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105050.592727680@linuxfoundation.org> References: <20181126105050.592727680@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 0313e9c46979..467755b6dd0b 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_spq.c +++ b/drivers/net/ethernet/qlogic/qed/qed_spq.c @@ -144,6 +144,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; @@ -152,18 +153,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