From patchwork Mon Oct 24 11:30:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10129 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp633776wru; Mon, 24 Oct 2022 13:15:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4P+gf4n6O/LP9XXNlBmPsL7f5hAXt99AcdC8ZZfvv+ViHcI3bURXFkbAH8qikXDyeOj57/ X-Received: by 2002:a17:90b:1e49:b0:20b:36a3:aba6 with SMTP id pi9-20020a17090b1e4900b0020b36a3aba6mr77876722pjb.2.1666642515685; Mon, 24 Oct 2022 13:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666642515; cv=none; d=google.com; s=arc-20160816; b=lU7W7KSx7wZZssgQ5JS+1ReliT11pUZqiXd9U1BVEmzA8+nCkg6voYa9cSXL0CSc7W zWNMPFA99lGWytaS9+janW1wT+euvrslDy1RK5uSlDb/81iQSLtdIw0xKI6Dd1iCyFx8 ROTPGV3tTrrkKV5Qnw145sRtjFiaOkOGGBWAiIojtaunCuAVBB/XzVPMZmFi8WGFE27S tgVUCXg+bDVOxUcXp5gKeuRwt9NU7y6zpHgEwydpY80h68gj9//Fyu/xo/wAkUb9aW2L vYhg3fjvlJE7IWfcEM+HEoTKdJvM4KzioMHqC7dG5rvIbk2DWclWAzBmemZfU09KZQVz h4lQ== 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=bvt+gBVt2M41fCO97h/HV9at+0dcEiqKXYQHRNEFnhs=; b=gmIeCuYJEXsqfDq6CKJs86kVCW4L0bjRfWHuIO8rn+nZm1yAzl+imW+3zgwbVi+iDA ogNMqVqEtW3X7k0HH1f3pnKFz/YvSk9/8gD1jPShSpgkRzQ4f1nCHFT8gxkbwKTh23Sb MFJxR16yaOLGWqnNoReayRLHAxm4nKXzY+AOs4+wFz2jYw/GfhI+t+J9FXOXA8wud8Gm gqemWnxSawuSNBKaGdGFWLFSJ5FjU0cIuqB7G+RePK/3NkHRnrX4MGAUfiPGycHWZ1lg TA/Xi4yiYKu5ZQ7CU1baayfy+DnFVsYmif0IKwP6islJnkdWf7JPBfwAl2phR2dt422W rHEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0A0643p5; 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 x21-20020aa78f15000000b0056bae3f63b5si671467pfr.327.2022.10.24.13.15.02; Mon, 24 Oct 2022 13:15:15 -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=0A0643p5; 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 S229865AbiJXUG1 (ORCPT + 99 others); Mon, 24 Oct 2022 16:06:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233762AbiJXUFj (ORCPT ); Mon, 24 Oct 2022 16:05:39 -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 7ADD0125039; Mon, 24 Oct 2022 11:26:25 -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 BFDBBCE132C; Mon, 24 Oct 2022 11:50:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B375AC433B5; Mon, 24 Oct 2022 11:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612250; bh=UE9sMwDTAJgVqIX4DJkGduS61a4DnxqfODhdLtbgDOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0A0643p5Ew+k0ut+THYTrPCQ0+BchGdTiLqmHe0xDVpnhPV6jT9yxfOAMgHLEERpd eTbfVJqMU1bHgMwuBfLQqbq1lDkMHQqfdH/WrycBq6x1yGEDjyLAv/Y2uywgqBBQPI YDmpeUaSKzlKCxV7FFzp15iCcGGx3a9OJltCEFNo= 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.14 126/210] RDMA/rxe: Fix "kernel NULL pointer dereference" error Date: Mon, 24 Oct 2022 13:30:43 +0200 Message-Id: <20221024113001.067795236@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@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?1747601342416272770?= X-GMAIL-MSGID: =?utf-8?q?1747601342416272770?= 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 6964e843bbae..6647a1628953 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -829,7 +829,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);