From patchwork Mon Oct 24 11:30:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9395 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp478280wru; Mon, 24 Oct 2022 07:17:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70LWkbyubiYJiHWydEI3e9uJ7hlj+/PIeAeO2psrAbRi5KTkR6pkuldsZ5zpAwL8AFE+IL X-Received: by 2002:a17:906:3019:b0:7a7:6425:7d1e with SMTP id 25-20020a170906301900b007a764257d1emr4921544ejz.663.1666621025814; Mon, 24 Oct 2022 07:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621025; cv=none; d=google.com; s=arc-20160816; b=fSVfhg1CChrc/iW3iRb0FcX2QXk+4x2/Cu/SAdC+MgjYHi4rvXnRBidHYu2tAKc6L5 l7eQ/sfqEbnPuM1mUgqrXP2oMBacwq21R/+MR8DJa2E5c1pTlGRNVCv/HfmlwOpYUysO 7Vbvy2emuCZHHAwFq5CXd5uItmk8HY9MxHAmFVrC3P8iSKSGgb0iycKMajVGc1x+5Jd/ H9VXvRvbFzkY6rbTm9uXMPwDbtFOmE5iCfoLXRGblofyXHemJ0wZfwOBW0fbLwGr9aQQ ZA4A4BZOL+XB+1umL/hg9SSytXrErUeiVLCbQxMEDcEMuatvU9Wol5rhuAXHGC5jmn10 55rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ifLAnXgpitx37TzzZWKrZsEbF5sIWdM1+wvX69HjYPM=; b=HwvjABWl53Q5GXKUfmbFE9bGnDLJmr6dmdyHwfE0GY5kO/pXnxGfIbdz0wxx8yjmL2 d4F6il+LyWExQP3L9QDj3M6ijipUpdG0cY3jfMvajKWBLd3qsWrcYjeViIuxA8Zxn/iL SVycCWqtbmxRCnorHA1r0oRGZRMfFo4wDAJEuIyUWQluCnMkai1RGXF0k/ClUGUblWgT 7JLgwLsnsnRHDLMAOz7nlMUjTZp5sqDP3Fr12kuDDeBxxyBV+sY3iaO1DLvuf4Y2HaXc BjKKNpbKORk5uw8iKzG66Smn2pI9VFCxMiYXRf/WwVqiWqa2QCIoeS5A4XTOYZ9fc9i+ Zkdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ishv0RYW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eh1-20020a0564020f8100b00461f285ce57si757949edb.211.2022.10.24.07.16.42; Mon, 24 Oct 2022 07:17:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ishv0RYW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233273AbiJXOG5 (ORCPT + 99 others); Mon, 24 Oct 2022 10:06:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235066AbiJXODL (ORCPT ); Mon, 24 Oct 2022 10:03:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56C78C06B9; Mon, 24 Oct 2022 05:48:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 902A7B819D8; Mon, 24 Oct 2022 12:45:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBF3DC433D7; Mon, 24 Oct 2022 12:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615544; bh=UpGV3MCFoWwSYcI8v9uQ//HwCNdnrEZeTGv2SdVdgNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ishv0RYWZT45G8ktoRNHpBbIEvQ+ary8/QUGINvoTUYzSw49HWBxc8gAuS+SHkpkl Lod4raKLDcLS28Pv37rE2T/8pRwTLlnuZABY6Y7ZWXwFoVTNmIGoBNnZlcx5BWCj71 ljUPmDwDLwDPxPDKCmcS2Xoa9yWWzANI5k/LbtBM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+ab99dc4c6e961eed8b8e@syzkaller.appspotmail.com, Zhu Yanjun , Li Zhijian , Bob Pearson , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.15 290/530] RDMA/rxe: Fix "kernel NULL pointer dereference" error Date: Mon, 24 Oct 2022 13:30:34 +0200 Message-Id: <20221024113058.185846533@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747578809260409481?= X-GMAIL-MSGID: =?utf-8?q?1747578809260409481?= From: Zhu Yanjun [ Upstream commit a625ca30eff806395175ebad3ac1399014bdb280 ] When rxe_queue_init in the function rxe_qp_init_req fails, both qp->req.task.func and qp->req.task.arg are not initialized. Because of creation of qp fails, the function rxe_create_qp will call rxe_qp_do_cleanup to handle allocated resource. Before calling __rxe_do_task, both qp->req.task.func and qp->req.task.arg should be checked. Fixes: 8700e3e7c485 ("Soft RoCE driver") Link: https://lore.kernel.org/r/20220822011615.805603-2-yanjun.zhu@linux.dev Reported-by: syzbot+ab99dc4c6e961eed8b8e@syzkaller.appspotmail.com Signed-off-by: Zhu Yanjun Reviewed-by: Li Zhijian Reviewed-by: Bob Pearson Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_qp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c index 661b83d65af3..4a6eb6de3b08 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -793,7 +793,9 @@ void rxe_qp_destroy(struct rxe_qp *qp) rxe_cleanup_task(&qp->comp.task); /* flush out any receive wr's or pending requests */ - __rxe_do_task(&qp->req.task); + if (qp->req.task.func) + __rxe_do_task(&qp->req.task); + if (qp->sq.queue) { __rxe_do_task(&qp->comp.task); __rxe_do_task(&qp->req.task);