Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp9797pxf; Wed, 24 Mar 2021 19:10:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwX27FFzGq2kDJJPrFixlnwTA/Pkbnr4Chl8LbLewxOiYOM38To63cvxufBpHkEHsFaAclk X-Received: by 2002:a17:906:2612:: with SMTP id h18mr6771977ejc.309.1616638201836; Wed, 24 Mar 2021 19:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616638201; cv=none; d=google.com; s=arc-20160816; b=ln4RMoT1wYdrzV3dk4u7LcKdiauQs80R4cpohzioz8J6lBvnIlv2m+MR+d/aGQMJ2N 8m1Q+qPdOyhuEN4t8RXdlBfAWANhi4yGZLNSWV3qosuxnvM5uam8Oo8hqA/0zpAia2mw rmshkfRYV/fC8lSUJLmU47ZpXA+HxauRvQdttEdePdc5B+n/BQT17WAxtwrVr+dWGNeo CCzDnYK4FeZeM/vLNQezq6OMCIojtqBGYxMP/b4aVERaQgAuPPXoAMI9InREG5Sf1PkQ BVaVfnZ+Y2MSqQO1DsjlECL4dGeYR0Xd2rSedr8/Xjz6lqIoVx6UtveS3oH/3CBRr63w 6hEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pHVJjroZfQB99gqspTiU6x/500HYt5GS4zRbyA/ytQw=; b=kglApQOSiju/rOEMegpaY2murxnyATBh+Yj//Xz8G0cc+ZftCNM7V9pEhEf4Fs8g57 VDh0r0WPHxRqmffZppe9aIz28fZitcYQoMnutrHiePGoUSg5sRgBrRRBvr5lpEJTdGx+ hL27kogXgEFm06wBru8Cpl9LX6BHYr2kakrzOirzpCdsRP0R3sToeaV9rMplmcG1p8B7 2nhlOrH6OIwTOKVu6FvprhCRlED50WAR71clj9Ah/nge22637NtI2BXkatspE63yWKG8 3ygzEfVyQ8GlDBEz9EVM3iCSokP3H2mV1KWAYxGZoswrsudaJJSjnwhInb9wi9r1iFdY f5Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IX8HIiJc; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j20si3121293ejy.7.2021.03.24.19.09.38; Wed, 24 Mar 2021 19:10:01 -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=@kernel.org header.s=k20201202 header.b=IX8HIiJc; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234659AbhCXJVl (ORCPT + 99 others); Wed, 24 Mar 2021 05:21:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:55382 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231992AbhCXJVf (ORCPT ); Wed, 24 Mar 2021 05:21:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 06DB961A01; Wed, 24 Mar 2021 09:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616577694; bh=Z8Xi7Q8XrtT4F7FmogpqExj0J3gLxfayNYnPLUO4ciw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IX8HIiJcOggHfRNa7iDGiJ00dV3Dhn50tyxXMh6sG9pKDdFrygcQGGTXaYgrj14LD TRihOGZHrFKSV0NYKKlnMJUbzKzp/NkHIc02qgB8f8X1xUBrCYWpN195h85QgPzbxp 9DJbFxGTPsFk2YTzXVyIIKamwwJK4xgp/R3omLKfXCTkA566OvtEjE3nfcYFqT2GtB 46zH5pnRi2J169CxexKsMg+/2vj/pesvX0N9iZpz/4EhA4e/xbNdgqMom01x0l67L7 6AE8Pii5l4t7gLcnhrsDnITah7aIYIruTqgyurLdBArHGcFXsKjk/v1HnWu0JW8wuB MWc65FGkOBW7w== Date: Wed, 24 Mar 2021 11:21:30 +0200 From: Leon Romanovsky To: Lv Yunlong Cc: sagi@grimberg.me, dledford@redhat.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] infiniband: Fix a use after free in isert_connect_request Message-ID: References: <20210322161325.7491-1-lyl2019@mail.ustc.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210322161325.7491-1-lyl2019@mail.ustc.edu.cn> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 22, 2021 at 09:13:25AM -0700, Lv Yunlong wrote: > The device is got by isert_device_get() with refcount is 1, > and is assigned to isert_conn by isert_conn->device = device. > When isert_create_qp() failed, device will be freed with > isert_device_put(). > > Later, the device is used in isert_free_login_buf(isert_conn) > by the isert_conn->device->ib_device statement. This patch > free the device in the correct order. > > Signed-off-by: Lv Yunlong > --- > drivers/infiniband/ulp/isert/ib_isert.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > Thanks, Reviewed-by: Leon Romanovsky