From patchwork Mon Oct 24 11:30:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp404883wru; Mon, 24 Oct 2022 04:55:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wX32OhHcASS6GVQNNST9T12m0qmJYbMV6kctvyYgUdi9Mvoz0GyquoTA7Nfj4rtOmSy8L X-Received: by 2002:a17:90a:5915:b0:20a:d6d5:31bd with SMTP id k21-20020a17090a591500b0020ad6d531bdmr37715619pji.15.1666612544095; Mon, 24 Oct 2022 04:55:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612544; cv=none; d=google.com; s=arc-20160816; b=ney627y8wJQ6p8+ZS7tTiL+ngcNek4Uok4n4WbayyAKJx+7UyQjfLzAhkxhpcaeyq2 a+qk9CnVAcc/z/WoL1PK4bV9uBqfLn2wqNX4mOQ8NCoAR2G7RAmZEkh3Vq4SZNLi+5fW qQle4cQVQN8PMmRgEqSsXLNedzNlBFT8AAGbkXQmXZ1XkNoOmLzcSyY9jl97yFA9/gAN ew8oAE4Wm4DSNRCXd+ysX+1NkbEpL72rwB9dCf7jcS93bWzzrL3atd7k4ubvNqqUyBOG HtwpsAy04y6HN2E4AIleqxd2q+5EYOuZT84SAIrDSK8IdG8lFNc/WVLvIdOyQmtRbTfX etQQ== 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=xN9q8VfGLZX60AcXQPgh/FQZcXJGLaGKDBjrJHR585g=; b=EpOy67EdnAS38SiEFazKNF+KuzMHy95F0F7gFfag6w5OuSNhQR2Ej3QG6PysLPrsFY XeJMkhcVbiKwtGa6hR0vBW/RVDPJZzBrODB7mNZAYN7pnCnuLSDuhEpUBPyGUoZUgDEK +zV9u8broi/fXu19QOocld+UMvRs/8jqHXRYYf+qDibmuWXI4sf0dqMSTC8m/691J+3Q QhwbqcHtFNBaXGrH5eqojBdwVgbP/x5bqFHIfWWoUsiYZvwWKKVfJx9B8tPRvPSSaGF1 PT20CKdJ0ACLGArxC0/h7C/FYN/qNOLDezM+YC9okCs27H5LH9065f28tQep1R7rqZpV XQiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BH81XZ+G; 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 q11-20020a63504b000000b0046ade103855si34070180pgl.312.2022.10.24.04.55.30; Mon, 24 Oct 2022 04:55:44 -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=BH81XZ+G; 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 S231965AbiJXLzW (ORCPT + 99 others); Mon, 24 Oct 2022 07:55:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232156AbiJXLyB (ORCPT ); Mon, 24 Oct 2022 07:54:01 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 801D65FDE8; Mon, 24 Oct 2022 04:45:12 -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 sin.source.kernel.org (Postfix) with ESMTPS id E416ACE1349; Mon, 24 Oct 2022 11:42:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF854C433D6; Mon, 24 Oct 2022 11:42:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611760; bh=l6n/qFqqCSTBFLJCECF9BE32+/UL6/1RoyVyjBEIt1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BH81XZ+GigZC27mPiRZlyFHXQ/anz0heuDryWrzzDyv4CG2mfnIHrKTyiaPs5+VVQ eR7zRcRg7XR1mV43anUL0xM1ctgNAroD0EBvxVlZODYKPjYDz8h4Pcyl5s/QRhEWN8 9ngDq/lWlCq3WyhWSAsJhl7l8df/xKkm44PvohXg= 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 4.9 100/159] RDMA/rxe: Fix "kernel NULL pointer dereference" error Date: Mon, 24 Oct 2022 13:30:54 +0200 Message-Id: <20221024112953.091682892@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569915342550949?= X-GMAIL-MSGID: =?utf-8?q?1747569915342550949?= 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 5fa1442fd4f1..d41728397bd2 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -825,7 +825,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);