From patchwork Mon Oct 24 11:30:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9104 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456078wru; Mon, 24 Oct 2022 06:33:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KHoq3qgI4Ym3S4cb088SEwJUmK+Kpu5naTCJTGLzFsqlVU5kOdbtCXBsdFyRIZt1PWwIp X-Received: by 2002:aa7:838a:0:b0:550:5e4a:ab55 with SMTP id u10-20020aa7838a000000b005505e4aab55mr34061246pfm.10.1666618412554; Mon, 24 Oct 2022 06:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618412; cv=none; d=google.com; s=arc-20160816; b=JT7u+PRQRLQ1S4UKxmDl5BkRM+P9lHcSAsNA8chUxnzM3kYdOHzMRw9GaEWCh8clM2 pKLJS8RCZduJ0KcAvBR+OyDQNQZ0n4G2yINCEQcLXZYtZMqj2sHVSDifR46sgzOtSQah PjN7BFfP6vrTn2C098iA724dhS4XCmqdypObPyTmsl22nvShHq9BV//SF3wXYE0yKLrU kUvLzUb4QyB4fWpnrJ93o/J00T+B1SbCeF58wbzyaFfJIPr1HgBzQt2u+nRvGhlTX62L mX9M7UcLqcz3JzSsw5XLbzrlnvATydj89ws9Xoe96+8bxfYv510Ot8EduOTc3Sd/nnSJ X1iw== 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=pW79O/rV6V2nWCZprfSLoNGq57d6B98SVhz5FPutbkM=; b=T5j5YIuoujVvreDJSnUf4tVNHfqCMDLMe2avhmkHJNZ+hRr8mJobcEEaNRW/5rFYjt XAKkuf7p9dImjdeP0AMDBakSZ/6aiPEqN+2RZQelA7okaatJ3+YL0IL9yYts35dIiXeJ HQmLP0YCOcy2bjg3+IuZXRkDkuzIFoMDlNYxSCJtShnpPnuhpyxCQEkD3snuVX0cx9Vq BloENX9YMG8wdF4yVgibZiyL22O3j60DWY02F4CNxIWQBLWXd8c/GrFdjk2nmKfY0eu9 19qqgr8s9mcmI2zzWeOMqWqPNwvmSwJZ0OXfp7+b2iB35CXCFQkmUKAM6dOvD8iOmTDY HhZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gMCLksyB; 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 p5-20020a63e645000000b0046aeabd6548si35277752pgj.104.2022.10.24.06.33.19; Mon, 24 Oct 2022 06:33:32 -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=gMCLksyB; 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 S230040AbiJXNQr (ORCPT + 99 others); Mon, 24 Oct 2022 09:16:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235571AbiJXNOz (ORCPT ); Mon, 24 Oct 2022 09:14:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02119A2A84; Mon, 24 Oct 2022 05:25:43 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 0E742612DA; Mon, 24 Oct 2022 12:25:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C86AC433C1; Mon, 24 Oct 2022 12:25:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614305; bh=A2cmLKhgaLuOHRm03hf+NAzBffCw+SrwMhodahhuDxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gMCLksyBBQkQzXMMcDQ930DM7S37KLQyGEcH4rimJUHe0jG5wgJTIHlCIF8qFjR7A Pj64KKlAcd1kUhtJtfXS7eDt2GS237uOaej4kjFP+5nOsoASnVMELJ0mfJG2HhaSOH 3nE15zeeirh/A9cL1oDFPrGsIoVSmcOBTRA3RILM= 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.10 210/390] RDMA/rxe: Fix "kernel NULL pointer dereference" error Date: Mon, 24 Oct 2022 13:30:07 +0200 Message-Id: <20221024113031.725302420@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747576068374410442?= X-GMAIL-MSGID: =?utf-8?q?1747576068374410442?= 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 2847ab4d9a5f..6acef6e923de 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -775,7 +775,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);