Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3420397pxf; Mon, 29 Mar 2021 01:32:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQuhgay3Dxtp3LwgSoN2luGWqz0YGhJGIZjQGr3FFElJP7cZCAXKBldLjdVnfCc8Zj5fKx X-Received: by 2002:aa7:d4d2:: with SMTP id t18mr27561050edr.342.1617006751017; Mon, 29 Mar 2021 01:32:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617006751; cv=none; d=google.com; s=arc-20160816; b=OTix+9/C79QoQ8O1/KvvehBFNp4zYVj6dwpQc08kdVZkQwvHoFxNHtiUx6afMDQL6W xiTwtuc4+/FzLJM6pdjEls/AuD9g1CLmWhT6i0NifDNMB5aHULm7i7TBVff3l6zJxov8 ocJajMFCR7SFXvqtxg7eKcmdalkimFH/JRfwkNusADk3QKrlau4/8Vk2Hj0jwwKcCoqn GmUyXbblDZ0uI3rQQkNZeEZXgnGNqqRsQACmt+gwYThryWWxWCrMG6wEGxNGJyAoAyL+ G8nAuiKkAqHzb/uV7oN0Ra1HCEtiJzFHAitbo+7ztcoqwDaUS/SwtNzAuvkvp5L0N9bg O9kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/lka/mCH1a2+164Rock+utyKw21GXbN37MceKEV6Ki8=; b=RqztUjIMNyPQ1cr/awSAnt39WDsaoY6o6GOYf6l1jYUFSq0fF74wpa8AwuAuLzeVSD ymr/fyqXbMJ+p/3IfkfiUyClRsWosqVDpWG8nLrqYysi7WTx5Ohoyq9BNqYpcDRzEgB4 acQnmJyNOzlqfL6wQRRqcLaUuaPk1jlvfML+gJBAh7TGY4F1DEqzMTYXY0aybUAB6D47 EDVCeTmQmlR/9g1IN4c713kixy3UA0jGSC9t5egYlfmMQO7BzS7OrecC0eT6zOBHxs3c Spi51bM6O+tjrhNPBi9jNweR+puOk9oB8LN4XFHZ96BgXQPlG32SSNC/lg2Y97Zr5yyW Nq4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=elsZZ2CV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w18si12251219ejy.196.2021.03.29.01.32.09; Mon, 29 Mar 2021 01:32:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=elsZZ2CV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234754AbhC2I27 (ORCPT + 99 others); Mon, 29 Mar 2021 04:28:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:34210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233348AbhC2ISf (ORCPT ); Mon, 29 Mar 2021 04:18:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6FAB061878; Mon, 29 Mar 2021 08:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617005915; bh=aozgTVH3HTG6JxHeF/viQWKnhix4qY/2AgcsbmddK/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=elsZZ2CV6XCIf1QV8kNQgk6AqZ5hwozmeaLRyDI23ZfWdYLXyb/kHTtOOmVN+RvWn myAH51LS9ZebmzGSP2/w1HVv6UwG13WJNqdaOUqudIAuDcYeUVAv3dMNrFKGFH9o9/ KfR14QcFAyuTJP/MD5EF983f6hbKuwj2hiAynIRo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lv Yunlong , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.10 050/221] nvme-rdma: Fix a use after free in nvmet_rdma_write_data_done Date: Mon, 29 Mar 2021 09:56:21 +0200 Message-Id: <20210329075630.849373096@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@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: Lv Yunlong [ Upstream commit abec6561fc4e0fbb19591a0b35676d8c783b5493 ] In nvmet_rdma_write_data_done, rsp is recoverd by wc->wr_cqe and freed by nvmet_rdma_release_rsp(). But after that, pr_info() used the freed chunk's member object and could leak the freed chunk address with wc->wr_cqe by computing the offset. Signed-off-by: Lv Yunlong Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/target/rdma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c index 06b6b742bb21..6c1f3ab7649c 100644 --- a/drivers/nvme/target/rdma.c +++ b/drivers/nvme/target/rdma.c @@ -802,9 +802,8 @@ static void nvmet_rdma_write_data_done(struct ib_cq *cq, struct ib_wc *wc) nvmet_req_uninit(&rsp->req); nvmet_rdma_release_rsp(rsp); if (wc->status != IB_WC_WR_FLUSH_ERR) { - pr_info("RDMA WRITE for CQE 0x%p failed with status %s (%d).\n", - wc->wr_cqe, ib_wc_status_msg(wc->status), - wc->status); + pr_info("RDMA WRITE for CQE failed with status %s (%d).\n", + ib_wc_status_msg(wc->status), wc->status); nvmet_rdma_error_comp(queue); } return; -- 2.30.1