From patchwork Wed Oct 19 08:29:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5103 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250273wrs; Wed, 19 Oct 2022 03:48:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5O28aRtNucW2UMiwIBtzw7DhDhECdA8V88xxR56QMocTeGJcm9bCwOiZRgIBt+D6HTJfUj X-Received: by 2002:a05:6402:26d2:b0:45d:280b:5878 with SMTP id x18-20020a05640226d200b0045d280b5878mr6924488edd.385.1666176516315; Wed, 19 Oct 2022 03:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176516; cv=none; d=google.com; s=arc-20160816; b=FG+fVh89LtgKXBdQdQRhDqtXdJVssBeCfjWHnPqUk4mlCr57cEcHX5hfI4EId/ximu FfT5gdj3J4guz3/6ZKM6M2aWbVosqDILhVVTBWb1tzGZr8cQGtkyQ16NBsIXZET3b/4A nTrIxex/dc7QjBL/T0ChqzxSf2K/uhdr3Ucq526QiJBL/JHxT8Mb4eVrdzDWprIqlc43 SvqheSiY0jLcZo2B3X/EuuLD/9YJdWuYDjxo06IUPyiHSULNoJAFtNFjT3JKcntTv6LH I2A/l+zrzyTb8DVjDlNYjQFQcWoSMqbAK1xZTLuavMSVG8+VLyBxhJbOEHWqNEpUr8Wj FVCQ== 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=bkC/k9faFxlzrpikTd5TDYYnXiTHEkvjN8lsHpDZtH4=; b=mPd7EWhbMN2ZqrG/pM65JtHU10Ip9vGeWlWdRdH62YhSwdma4ishfL3Nd0QvLhSAC3 aU0ZrywLqAtMW42yzBwG2xAxqi0TvqPyhvgx673HduN7rI5RbPUFuUs+Z0PpI+oxbFmX td7kKPHPt8/SEVEzd3TRDItvELZOep48Q5o3i+E2YRbKW/RSwHYlJupvgJCdqi0Ta2BL 70t5IqqWaKuaqe5+HzwGvD275presN74px9mrE1knEaY0CQXHeI48GJTK9OjxaaOdq4G 5mxZ2vWKwyWxFwwS3I0K9r3BiCJK6TcbAZ3ElkuyFdYIndcvT+/PZtldqZchi4D12yjZ DGgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=grG3kNlj; 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 sa24-20020a1709076d1800b0078deaf6b447si13998984ejc.624.2022.10.19.03.48.11; Wed, 19 Oct 2022 03:48:36 -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=grG3kNlj; 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 S233234AbiJSKrr (ORCPT + 99 others); Wed, 19 Oct 2022 06:47:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232556AbiJSKpa (ORCPT ); Wed, 19 Oct 2022 06:45:30 -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 94F4715A30D; Wed, 19 Oct 2022 03:21:23 -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 7362FB82457; Wed, 19 Oct 2022 09:00:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9181C433C1; Wed, 19 Oct 2022 09:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170022; bh=abjXBVOG+cxNl04C7+6if84CIxXflluCsmaCoO0qdos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=grG3kNljpn6Ds0+Oq18ekcV2g+ZV4jTStEXpZfndH/2oauq+zO7WM+ovugcmoovYG Cxj2r5vO8VeR291Zqr7TPkM9ngsJ1dy3yo4BMiGHqlOAVSVoyJezfXb9e4JtUnk+bV IbMHAc7A/fZHFiEUFktb32VzRWZI7fYP2HQvmoLw= 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 6.0 498/862] RDMA/rxe: Fix "kernel NULL pointer dereference" error Date: Wed, 19 Oct 2022 10:29:45 +0200 Message-Id: <20221019083311.980763099@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747112706682943857?= X-GMAIL-MSGID: =?utf-8?q?1747112706682943857?= 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 516bf9b95e48..fda03f9f03ed 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -797,7 +797,9 @@ static void rxe_qp_do_cleanup(struct work_struct *work) 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);