From patchwork Sat Oct 22 07:24: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: 7450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098484wrr; Sat, 22 Oct 2022 01:10:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65LSiTuGn6aYN27TSkt5dPUUQ+FphpjE+/dvvgmSX3s1hgQfY6YBtleON/2niE7m6TGu7s X-Received: by 2002:a17:903:1110:b0:178:9f67:b543 with SMTP id n16-20020a170903111000b001789f67b543mr23021345plh.131.1666426259091; Sat, 22 Oct 2022 01:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426259; cv=none; d=google.com; s=arc-20160816; b=eDFLRvfXMNveruAjrOVvhV/ag7whKoNxm/c9NULtynXyYZDHg+gbrEgLDaBVp8xmQn XQBM4s6D6DuqLDMJ345gJ2CCuu2N5v+jU7iB6wlB1BPNoi5mxPAuUpaD7/w6PiIl3LOs AHAut1n2a52jCVEakCDQ9osrdcxKDwZQCJvQmkLxBjGGrE0Am2vBH58XGYOxF8WsxTEP CPVbQiTjaWkCgK+q8B2NCr0vpfKpGaB43u1DLfcax3hCKSNR5ZfGoEr8ZsMR2IAM7Jy6 MmXtQthZj2XKSujtijPQXp6xHmCwNW/6EW+/+2TkfFvIQGbUfXXcf82DCrfLdtBLwQk0 GqoQ== 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=MHOZcZ+/nSkBk0GaA9CqWCnOOrJFKrGLMdhAcImCEtc=; b=mtiaM4R1EyGv8KkcI7UnGdKJgbrwJNbC7nt6k5eLN9UrhFNV4oAu8lTojz9kgEPiiH GKT5cwUeqZTf1H2FPd1JeVG7EYQn2L46U9nyNBcQG25l3AoV1rtSRqnexSUNwSbWv9Mx XZHqrc2nGa+OjMwmAlB9ctKTfNzZwrkjvwNfdZM94BV3ijxVt+wzK9zhFCeDg/VlGhY3 Om41AyK207y4TIhzH5GF29WGFQE2EE8itEq5oNQH9wQTBe0ROKol5PuS0/pcBv9ZMUYh It0W4gLz21Lu7ibhZT9RzLYVQQ+/WgyDG1vRI7niLhfsTpc8glMjL3/YxRNd3yrvMj3F BaKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Jgf2xstF; 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 l27-20020a63ba5b000000b00434b19dc958si1648957pgu.349.2022.10.22.01.10.45; Sat, 22 Oct 2022 01:10:59 -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=Jgf2xstF; 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 S233463AbiJVIJx (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232629AbiJVIFf (ORCPT ); Sat, 22 Oct 2022 04:05:35 -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 D936F2C6E1E; Sat, 22 Oct 2022 00:52:49 -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 A58BAB82E07; Sat, 22 Oct 2022 07:52:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F33ECC43140; Sat, 22 Oct 2022 07:52:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425140; bh=AaZSzvYv1XZWsFuV8C2YDIeqSY8bFZR2WRCjfZv866Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jgf2xstFq8DdLz5BsW9nEnU0v4PnDS0AO0Vv4pHbTWuPMsiirSL7oW4+zR8LYa+2+ xhatT/G52Owl11qQA4REiDDe/QGHBLW3UhNOIgyAIiud2k8Y9gnMcCscJc3yKjyjoh 1Zwjp79BRo2oAg8dqGGj4/gz+/Mw+JtCeZp3sAbc= 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.19 404/717] RDMA/rxe: Fix "kernel NULL pointer dereference" error Date: Sat, 22 Oct 2022 09:24:43 +0200 Message-Id: <20221022072515.791526756@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374580914638633?= X-GMAIL-MSGID: =?utf-8?q?1747374580914638633?= 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 fd706dc3009d..173a4253406b 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -794,7 +794,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);