Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3377533imm; Thu, 17 May 2018 07:52:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpAH3RmH68o0UUVsr+TCt0v5J+vkMq7dvZFeBIFiTMjy+s5QFOKLJ0aIgE75wKxDJQZHLXT X-Received: by 2002:a63:6fc3:: with SMTP id k186-v6mr4330761pgc.111.1526568776640; Thu, 17 May 2018 07:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526568776; cv=none; d=google.com; s=arc-20160816; b=jn+tCCCVltpJRW1hRAm3gEgsSrxgpPuOUxUJTRSOC5r/KL2xKshjGNknxg7vq7JwGn eBu3rGKi8pCJMcPQzLNOyn/ToArrz2V7rXTpjqHkZdEihdkYxxY6UddFBAeNx9B9ayW9 ENHbeZPr2uTumlvei4ZnJfke0yJ8Oio0AcUVIEtLprUFhwe20FbTJfXL97SA9vOZ1Fn0 +MESQgTWXbUr+MlF56lkm9M9FDXXkAAQ4Zsc09bFOyQLHHLBHVxNm9uWj2fjJlO89l3M zpeZ2EUHm9eI5CQKk+IIcfs6SydBywg3091hHeP5Zbw0fwVSU+jlqg0kYkN84I2zrZWa XQoQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=MPlwoxbAj+Z3E1XJhO9R73wh8BzIxjwDJVcoQGOz8Wg=; b=iASNRZafJrWmnPII2FVfsMnyksneirNWcls2fFstszqMsgzkUYEbo0oGTKSCmmr5pG pwi5pBBp2oXAFJXfVsnyIhKZbv6ObFiYYZA/mP5BtW8IJM3Hi6pN6WY41PS7EJk7Ycbr Ned2N3SSZqpNgXFB35Ea2vqJNofr206uOonz4vw23KRQ4cp2WqYHuYbzuGgmEsqSTeD6 wW046UG2aTaE9a3uxUv8orjUp9unvwjeNloIa1fzKGNzhKoQ37CiTo2XWt5z0Hu6XmQb BXhwPxYqf+yyzWlf+xZoi57P/jxud+UaI2bIFMsqYKUIXDmUbTqK+8LAUgI9jrLuxKsH EcJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=kjKLrVGm; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bb5-v6si5004892plb.80.2018.05.17.07.52.42; Thu, 17 May 2018 07:52:56 -0700 (PDT) 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=@oracle.com header.s=corp-2017-10-26 header.b=kjKLrVGm; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752638AbeEQOvC (ORCPT + 99 others); Thu, 17 May 2018 10:51:02 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:36778 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752627AbeEQOu7 (ORCPT ); Thu, 17 May 2018 10:50:59 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4HEkhMY195875; Thu, 17 May 2018 14:50:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=MPlwoxbAj+Z3E1XJhO9R73wh8BzIxjwDJVcoQGOz8Wg=; b=kjKLrVGms40ClpzOI1WJ9FCODHbx/Ms7pKHear30S2/FWOSI+w2lRJbUsN5v0EiH39rg IMiAgcfsyAi6rKHm5mTpQHQqJT6kjlhQjopEXE3Z9ub1/Ex2/1KmyN+whiA0SF+FlVMc 6hBBVoBuUMzWAKaLYOyWg/Jl9SAoABC1Jmz+T6PhLshW2OA96y0YTeuRekiYioieel+0 BwKKYAqLogABZzJKUK8bn6ZfAHWq9548Em4F2rhKjD73BfYwAYEMltCDPMGZV4tK+bD/ 5vfOXWJrGCNI8iLLlQyjCeCu0URk/iWl2PvWXD/5Ln72M4HrI8PdgWIrSjVe2WAmLdpA +g== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2hx29whkek-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 May 2018 14:50:18 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w4HEoI8Z015770 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 May 2018 14:50:18 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w4HEoHoN020518; Thu, 17 May 2018 14:50:17 GMT Received: from [10.191.18.228] (/10.191.18.228) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 17 May 2018 07:50:17 -0700 Subject: Re: [PATCH V2] nvme-rdma: fix double free in nvme_rdma_free_queue To: Max Gurtovoy , keith.busch@intel.com, axboe@fb.com, hch@lst.de, sagi@grimberg.me Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org References: <1525945328-1908-1-git-send-email-jianchao.w.wang@oracle.com> From: "jianchao.wang" Message-ID: Date: Thu, 17 May 2018 22:50:13 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8895 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=784 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805170137 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Max Thanks for kindly review and suggestion for this. On 05/16/2018 08:18 PM, Max Gurtovoy wrote: > I don't know exactly what Christoph meant but IMO the best place to allocate it is in nvme_rdma_alloc_queue just before calling > > "set_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags);" > > then you will never get to double free since we clear the NVME_RDMA_Q_ALLOCATED bit in the beginning of nvme_rdma_free_queue. Yes, I will investigate the whether there is some special reason for async_event_sqe is not allocated in nvme_rdma_alloc_queue next. Thanks Jianchao