Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1652237rdb; Sun, 19 Nov 2023 05:13:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9HlpFzL9wrFJASZvjoA2AqHutjmONjlBJ/9a+uyqdtcpciZUMRy7FioH2GtjR+mkEebqv X-Received: by 2002:a05:6a20:9187:b0:187:962d:746b with SMTP id v7-20020a056a20918700b00187962d746bmr5909868pzd.9.1700399604029; Sun, 19 Nov 2023 05:13:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700399604; cv=none; d=google.com; s=arc-20160816; b=WI2JUbRjnN7OVPNUWobMXrub7LMIK7cL0qDYfds+YSTeoFmb8x32Ri0fBBffhzpQOJ FCVyHFKbt5x7uJp+5GGbl2X6XK9fbiY03MEDTERfwgIz/+WbxlEkcg9b+FYoHCzywau2 n7xXSVzsLGZio2Dlx/lJ5rLTSNZf9OnD/S0goOLaVgcGFqFRUi767AKbu+hjPlC/g1rd V9WHOZSbd60LL8C2djTRAZZFHsE5sauNtS4L2ZGeVqqZkQWUniCcb/6yO15q9jy3jrvR fpNc8Ibbvu58M9+LkcgeyV52Uzaym/JB4TnjDn8vAeNZa+ZIaFITv9P+/lxqCjuIJ9tm kmBw== 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=OPpyPHB4EhGYcnriCFOvgfeZBTvheeSlMx/axl0taMg=; fh=qbpIcWFAgt1thdhzZOITJaI1HR6sQ0ZdtrML7d39yi0=; b=z5afQT02szjvjFwb7jMHowyyFMTs4sNsratBjT/x29UQQuRvW6353hruzIUKh8DnNf LvBy/Ap6zS1KKpL+B0dy8GBlx5ev0yftV4WbWXrhqhyFvFLfxaSoykS1Qj2sS4dWD6g2 +iBuHvMP4Rp5va2u1XLtN7wycGsAQ5kGFhMAuTwaxEqF9SK9JTbdgYYhfbyFtgG4yMmh A6Qmjb8R7DROTYI3gcJ3jI/GerogxNodyyt26l345cWZJzkOL7jqtaUj6t+zHYv2AQIg 3ReQ06lwypg3vOFpOHzMULCE2ViPhibEiCSXwfZMznb7AEe8m0pIuD+rSDoBlqyufN4k WZ6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R+ie0+cl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id fh14-20020a056a00390e00b00690dbd360basi6220812pfb.152.2023.11.19.05.13.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 05:13:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R+ie0+cl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 70166808E8E4; Sun, 19 Nov 2023 05:13:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230155AbjKSNNK (ORCPT + 99 others); Sun, 19 Nov 2023 08:13:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjKSNNK (ORCPT ); Sun, 19 Nov 2023 08:13:10 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A208BC; Sun, 19 Nov 2023 05:13:07 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17605C433C9; Sun, 19 Nov 2023 13:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700399586; bh=U7USW0R0NtK5jKBGaPoJXwIxYcVtCri8oCrDMLqVZBs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=R+ie0+clo6+LeDv+eu2DiBK2e3dEFWtLqYf//caMrRdyJTdf8zbXs/f706BWXOt7a NB0U5qIQPiGLOAwcc/SYNnf9bzpb70vngCSk6AXPbVUB2sfnN6eImgaVPUOU9dAbfC Q3YrXXgm57PUdHghY+LiFvC3gO67ZylkXz42lgVyTFLYyrQ/S1bGr1UG5gJ1z2GK5w tdHAWN8DgaIc3SEV1r3v5LTy/BOkv5PHyE5r1NKf8vhV5ZJdDHLCX94P2yvBGbNrR4 zW9GW5n7ztBR37Bb8xdY+Da/thw0DBAkrsBy/gZYGR8IKISgPzMQPRztdR36BnnG1/ Oy1X9s7euCLqg== Date: Sun, 19 Nov 2023 15:13:02 +0200 From: Leon Romanovsky To: Shifeng Li Cc: mustafa.ismail@intel.com, shiraz.saleem@intel.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, dinghui@sangfor.com.cn Subject: Re: [PATCH] RDMA/irdma: Fix UAF in irdma_sc_ccq_get_cqe_info() Message-ID: <20231119131302.GB15293@unreal> References: <20231117065043.3822-1-lishifeng1992@126.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231117065043.3822-1-lishifeng1992@126.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 19 Nov 2023 05:13:21 -0800 (PST) On Thu, Nov 16, 2023 at 10:50:43PM -0800, Shifeng Li wrote: > When removing the irdma driver or unplugging its aux device, the ccq > queue is released before destorying the cqp_cmpl_wq queue. > But in the window, there may still be completion events for wqes. That > will cause a UAF in irdma_sc_ccq_get_cqe_info(). > > [34693.333191] BUG: KASAN: use-after-free in irdma_sc_ccq_get_cqe_info+0x82f/0x8c0 [irdma] > [34693.333194] Read of size 8 at addr ffff889097f80818 by task kworker/u67:1/26327 > [34693.333194] > [34693.333199] CPU: 9 PID: 26327 Comm: kworker/u67:1 Kdump: loaded Tainted: G O --------- -t - 4.18.0 #1 > [34693.333200] Hardware name: SANGFOR Inspur/NULL, BIOS 4.1.13 08/01/2016 > [34693.333211] Workqueue: cqp_cmpl_wq cqp_compl_worker [irdma] > [34693.333213] Call Trace: > [34693.333220] dump_stack+0x71/0xab > [34693.333226] print_address_description+0x6b/0x290 > [34693.333238] ? irdma_sc_ccq_get_cqe_info+0x82f/0x8c0 [irdma] > [34693.333240] kasan_report+0x14a/0x2b0 > [34693.333251] irdma_sc_ccq_get_cqe_info+0x82f/0x8c0 [irdma] > [34693.333264] ? irdma_free_cqp_request+0x151/0x1e0 [irdma] > [34693.333274] irdma_cqp_ce_handler+0x1fb/0x3b0 [irdma] > [34693.333285] ? irdma_ctrl_init_hw+0x2c20/0x2c20 [irdma] > [34693.333290] ? __schedule+0x836/0x1570 > [34693.333293] ? strscpy+0x83/0x180 > [34693.333296] process_one_work+0x56a/0x11f0 > [34693.333298] worker_thread+0x8f/0xf40 > [34693.333301] ? __kthread_parkme+0x78/0xf0 > [34693.333303] ? rescuer_thread+0xc50/0xc50 > [34693.333305] kthread+0x2a0/0x390 > [34693.333308] ? kthread_destroy_worker+0x90/0x90 > [34693.333310] ret_from_fork+0x1f/0x40 > > Signed-off-by: Shifeng Li > --- > drivers/infiniband/hw/irdma/hw.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Please add Fixes line and resubmit together with Shiraz's Acked-by, Thanks