From patchwork Fri Nov 18 11:38:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 9436287 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B1EED6047D for ; Fri, 18 Nov 2016 11:39:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 859872988D for ; Fri, 18 Nov 2016 11:39:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A26C29893; Fri, 18 Nov 2016 11:39:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9204B2988D for ; Fri, 18 Nov 2016 11:39:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753014AbcKRLjd (ORCPT ); Fri, 18 Nov 2016 06:39:33 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35226 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751986AbcKRLjH (ORCPT ); Fri, 18 Nov 2016 06:39:07 -0500 Received: by mail-wm0-f68.google.com with SMTP id a20so5275247wme.2 for ; Fri, 18 Nov 2016 03:39:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4ydxkPIovEW6xCIIewKZShz1n3evtzHkqFheSPs+IWw=; b=bXfef6/IAptd33vRgJ8SADXtXrMRuZdQGYgM1037w9C4erHr9cWG7ZASuSULS20XCa RvH1dIhlfi3o7vZKcsi1wf67BNK95O42aMI//KiiKWDzVq1A2r633+YPixKceR4S8ifs 1gV2q7T11IGGEolPIcab5cbIchFKDOxME/V1g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4ydxkPIovEW6xCIIewKZShz1n3evtzHkqFheSPs+IWw=; b=csf7HnxN1oGXA0YNKYhQeqo8C6NUIfi6k/2ldGx14pSc9/z9CY3r2+5n4usCIw+WgU mLFdjUjbLGvvNwwFk8wp2fp4uUIHlfzE6/AOE1cNVuobRfjESCpFM68j88mNXk/nuuxs In8UIGuy1TcTU8K8KoonsNSwZwfqkdJEr4vuF3y/LcBHomR71uvKTVfKvLmWBrHuk4ey q9uaTFMLI2xRnzKjGdKnhmcMyGFG1b3RJT9tTWRFtJ2872lY/m7YjvzfjlbgiUiBs6ol hqH8Jjf4R882Ti8K1HZcwVutQlog4KbOqN+xsWcPPeocZg3/s5soZPCvlGMmLa0pjELb anNg== X-Gm-Message-State: AKaTC03hcfKAAp0TDEstl7oJHj5+gBxtiH3T5NdLRWSGyPHS05t0PilcGir+OKu22fOeHA== X-Received: by 10.194.111.102 with SMTP id ih6mr5261181wjb.214.1479469145808; Fri, 18 Nov 2016 03:39:05 -0800 (PST) Received: from Macroninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id d10sm8371963wja.20.2016.11.18.03.39.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Nov 2016 03:39:05 -0800 (PST) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: axboe@fb.com, keith.busch@intel.com, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 1/2] nvme: lightnvm: frees wrong cmd structure Date: Fri, 18 Nov 2016 12:38:13 +0100 Message-Id: <1479469094-1337-2-git-send-email-m@bjorling.me> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1479469094-1337-1-git-send-email-m@bjorling.me> References: <1479469094-1337-1-git-send-email-m@bjorling.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When struct nvme_request was introduced, the nvme_nvm_submit_io was converted to the new interface. The interface moves nvme_nvm_command data structure into the struct request pdu. On io completion, rq->cmd is freed, which should have been the dereferenced pdu nvme_request->cmd. Fixes: d49187e97e94 "nvme: introduce struct nvme_request" Signed-off-by: Matias Bjørling --- drivers/nvme/host/lightnvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index 442f677..de3dc87 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -477,7 +477,7 @@ static void nvme_nvm_end_io(struct request *rq, int error) rqd->ppa_status = nvme_req(rq)->result.u64; nvm_end_io(rqd, error); - kfree(rq->cmd); + kfree(nvme_req(rq)->cmd); blk_mq_free_request(rq); }