Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1599057pxf; Fri, 26 Mar 2021 10:31:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0uzE27KC6twhFlmoavpyD0/z4xyAMmZrZGeO/X+Tig2LrYaXaD1tDOhyU2Fe/BjTY4fA8 X-Received: by 2002:a17:906:1a16:: with SMTP id i22mr16687758ejf.522.1616779887528; Fri, 26 Mar 2021 10:31:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1616779887; cv=pass; d=google.com; s=arc-20160816; b=DXtX0oYpDu/LvsVaVm4klf72WR8cBSBi+Yq0Grkoj60inMx0JvK6PmBL5D1OLrcGwQ s/GClQSWqOA2JZjWUJoJURpUwAMkZbB58jt1ioUi+MP/9hhhnKisgcaF3nb1AeT89CrP p//wj4hGwn4z9RVKuse+mJxj5ZiH/bTk4ZiWWA7zHhmUR+oopFbEc0jTJq4Y6LO86AbU XJ9sOhJHDNpUdRWSlEZn6VGKvnYJ24qqK/GY5H0+PuJqMp6gVxCVPAt4vEJ9BI7700et o84YZs1PHHGlGkYFYrEt5xaNGAKvDs0uWPrWBspKiFQiVxGwyierEAi/HZTTcd1qQHTV YWYQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=aWTe6L+7lqyrRsQ3L+9x6GYP4pw+xZNyHx60gsQVtEA=; b=WKC4Hn7qOLsW19Chb1eFaQs+daUoaqcf6WqZiVT0kkH2JNpI2M9bCICs6IVHwU/9uf W7OBXZa15ml0R+tUGUg1KArrVWWUPrGlrMVl/0YUsTu5Y81qb1QgBoqdp89j7LNmYuXq Vm2Dq5bFwH1n6959TKDEnVX6MB9xNeQ8mFl4oFk4arGc41UP+KTQJb5BjWLcwlyATp9I ZQ8VD/Ezchn7saz1TmGCW5kGD88I5OmA0UohGVCw7Hf2VUsoOj/xdWCVDr2BaC93Nkr0 c0MDxrHUiweOWBu5D0emOdxbcvriG0qwmBJoI9m+Pmfkz7DK/xKs32ksjSDeRGwjkjao hpzQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=QlOmb4za; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k19si7022780eja.265.2021.03.26.10.31.04; Fri, 26 Mar 2021 10:31:27 -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=@Nvidia.com header.s=selector2 header.b=QlOmb4za; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230253AbhCZR1S (ORCPT + 99 others); Fri, 26 Mar 2021 13:27:18 -0400 Received: from mail-mw2nam10on2076.outbound.protection.outlook.com ([40.107.94.76]:54200 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230242AbhCZR0w (ORCPT ); Fri, 26 Mar 2021 13:26:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BvXMcnIaoSspqMQf0frTnHkcM2pGsz9y0yNl8YIGUbsfEWnKjWvq2cyWtXRvtQXrNZJN0pVQkMas+90bUOcZThAR1tfUR51457RYVliS9Xx02Ik4t6ZHfi9NqhcsvhO/3tjK332yUKE7YOAeepXNsXKoIU+FRaSXoTbTAh0uRbRvYjCPSxftXpKwOsIxdtATbt6yJdQPQbowqdm8ZmArhD/WpkUayPxq8uR5pJG/ySXtWD23kLRijIJ2lsuaOxoAbu7Zo3UPniY1iCik1WgqQ4XsV3WedTa6wcxlbpoEcktL9wN1b5SrNKUdTX7KVz61TGM81W7348ThkSa+FpmqKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aWTe6L+7lqyrRsQ3L+9x6GYP4pw+xZNyHx60gsQVtEA=; b=UbjfaQ4jEkj+F31d+d6g4Znt91Hqt9oTz6qR1kCrUDq/MgHW8JPEY7Q2qM+eDMG6YwHMGgTog9xwpNpOmeTn1qNdGRHwNkh+o6x4p8kEokPuRRri9/Mu+/rgPi5Wiuw9Jo6qd0Z4z6CylMcA+XWEf5GFEBSY30v9xjyRe6fq7hxzJ0kBXcZtYZ/OCywFmYx7ioiDQAN1akTUKgjoPlZdwwZsdYQ2ZNmcC6R/OSyceMZ5RPvO/yElbsMq9khNCMdAV5t5pxT6zXrZ3zub8cuWfNN/lL/u5awYypjXLoQKMPZW6JKWsZUEhLvV109+YQuGd0aCsLQunYFibd3C+0vwsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aWTe6L+7lqyrRsQ3L+9x6GYP4pw+xZNyHx60gsQVtEA=; b=QlOmb4zaDKbvPBRYhMEw811S1mpy/anBJlM+Tdx3Y6PyvEKxjp1hm35+1sFQVWZVkXPuUaT2NT0EPa9ncgZlmv7j8NaTboCSlTHKK0Skfww3LJ1lEHklJ3m1W/IdxidV1QsueRdvgBWdqa52bLZl4EzS2pD0N/lUs8956nrID79WOvP0LMn9SoTN0Ol3MT3ykXFsqz5KEg5GjKEV8S1LeLvi4yYXQ+Sx7oXxybnNQUHw2fJsbfWRpgYjDXdOJdO05Q6ZTa/Wgwl3zTJlhy6/EYB0qpnUQi0ADMz8Px4/fVSxgVNilrxQ9/dUJVWGmC26NPWzl1o93ApkQ0Q+YVrp/A== Authentication-Results: mail.ustc.edu.cn; dkim=none (message not signed) header.d=none;mail.ustc.edu.cn; dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) by DM6PR12MB4340.namprd12.prod.outlook.com (2603:10b6:5:2a8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.29; Fri, 26 Mar 2021 17:26:46 +0000 Received: from DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87]) by DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87%6]) with mapi id 15.20.3977.029; Fri, 26 Mar 2021 17:26:46 +0000 Date: Fri, 26 Mar 2021 14:26:44 -0300 From: Jason Gunthorpe To: Lv Yunlong Cc: sagi@grimberg.me, dledford@redhat.com, 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: <20210326172644.GB874948@nvidia.com> References: <20210322161325.7491-1-lyl2019@mail.ustc.edu.cn> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210322161325.7491-1-lyl2019@mail.ustc.edu.cn> X-Originating-IP: [142.162.115.133] X-ClientProxiedBy: BL1PR13CA0349.namprd13.prod.outlook.com (2603:10b6:208:2c6::24) To DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (142.162.115.133) by BL1PR13CA0349.namprd13.prod.outlook.com (2603:10b6:208:2c6::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.14 via Frontend Transport; Fri, 26 Mar 2021 17:26:45 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lPqEO-003fdo-4q; Fri, 26 Mar 2021 14:26:44 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d839dc13-be25-4c77-e8e9-08d8f07c546b X-MS-TrafficTypeDiagnostic: DM6PR12MB4340: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vKEbRHAzlvYi6lWJvY2RGcK/IuPXraj3aO/aRffAMoFWyaEckUUFnucYpnr9xSsMpzpXE0YJx4z7rHsN0qdbaKaxTm1KcbVTRaBph6Q0oxY49YZ4Koqcqubj9+fdPrTyftrSJ4KQjrtq2libSlKXd7Kes7gZR0jDJiICW6rUfgW0iUZ4KPpSP+6onRiUX5dQXRUSvSD/4gOe6fGv0woaTYcbvUXMv+/NRjDFsGlts+q5pmZP4U4u4VotEKg2Vzwduu+JYYr/SjYao0Q5JY+sc/c3Gy+uwPVzgnkQ9LY74jdVobCQpNHYWVmdwR5PBfnoODGVV3YxI/2U9lo/gWx59PLSgbShUO944v0gwISNR2ii7Kooe4Z+T9oPXwNhtf63e8GCyUuZ6VJIkSq6ygDyVtzTEj2dmgaeE4BLy6H06R0e2FokY721EAsewSnQQTLzZYwZ6iQz5ceP+XJsExSaMz01WI8pFujtTsi9Rytie09YkxXtuUgIBDnB661uLJWnNXAudW7jLCKyQwU26DgWTmGiec4VFrJlSvTUt7tB0Hf1CzOA5fzKo0Verqle2mH6ni3pd9+HcwliB8WTaIQgw6wzTZ/LXhu2sgneCxuJt23x6jZUCJKQje2Q0Y9lxmdGKxtvXX7121AtLA86m2opyXaXNn04lKRwC6gUAT3FHsHvcoxkjFWD1pIu3417HzqX X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3834.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(346002)(39860400002)(366004)(136003)(396003)(83380400001)(38100700001)(9786002)(9746002)(8676002)(8936002)(316002)(2906002)(86362001)(66556008)(66476007)(1076003)(6916009)(26005)(186003)(426003)(478600001)(5660300002)(66946007)(2616005)(4326008)(4744005)(36756003)(33656002)(27376004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?bXEi2upI0lHFu0EyrjrCBV8nVlXYr8EQtrwYTAnKD5Q6sqXC37q/GcPWwsPH?= =?us-ascii?Q?esL0tNs2+y+i/d5+QPNx1IK/f53b5BkyYhU1g8PGyTRypaMRO/bcJyAx8g95?= =?us-ascii?Q?9J8yH4srhqI3GbIl+JZ4UVwkfMB0zUGjLbjhJVaso4FTXaX/Ubg/eV/KzKtD?= =?us-ascii?Q?ZNPJOuBsECXdRwyAWmp2h4YijpbqAu/jOE8haugaBxv5SvS9E49utvg3bgQk?= =?us-ascii?Q?BFqbDWSqwnQdHm1UNBE6INWmSZDHsJvKkFyCEsHZp1WJBbo7dfDhYSECb2qT?= =?us-ascii?Q?w5vTh+meRAO2kEIj4a7QizUsKsPO6BX90KlOwg+uj5Ur7moPbA/c2Mo+pknc?= =?us-ascii?Q?kaqQXHAJSqFH2rQWnF6l9bSph1dOmdCZtBgSKKcFsWgPIfAyfBpFvwWi4aI7?= =?us-ascii?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AZ99qs0xy9yxJKjzeLY3B4EYy3?= =?us-ascii?Q?hfNSbTq99wWrrWEvzvgtkdrAbGqL/mYVXi1099oxKAP1fQ=3D=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d839dc13-be25-4c77-e8e9-08d8f07c546b X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3834.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2021 17:26:45.9492 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6cqrBy1BcMRPKWBDLZDadzwd1b6yH6H5vRJTiOSUwyzknzMSLA4ofBCJeDdF3jrL X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4340 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 > Acked-by: Sagi Grimberg > Reviewed-by: Leon Romanovsky > Reviewed-by: Max Gurtovoy > drivers/infiniband/ulp/isert/ib_isert.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) Applied to for-next, I added Fixes: ae9ea9ed38c9 ("iser-target: Split some logic in isert_connect_request to routines") Please ensure you add fixes lines when you send bug fixes. Thanks, Jason