From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C138C433E0 for ; Mon, 29 Jun 2020 19:57:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 67916206F1 for ; Mon, 29 Jun 2020 19:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593460628; bh=APLxcwDGeZ9hfuIkU4SGCga+WTEhWX0SpFSyYDeFI1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dEEbswENy9zFo9ndO7gy+06IeFWpf+kUpwPpcVFooav/YTQjKqbBhfao6ElG8KXok L/HYt6Sw4AUgmzkitEb+J8nNvNICZFb/siAMUHB8QDCOMyrQ8UKQFKk/OFLHDfdyxK fzCUmO6KgmznPsq9KuYwn+o9uegr1MjY/MwksG5w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387634AbgF2T5G (ORCPT ); Mon, 29 Jun 2020 15:57:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:47654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387636AbgF2TkY (ORCPT ); Mon, 29 Jun 2020 15:40:24 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C106E248CD; Mon, 29 Jun 2020 15:27:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593444424; bh=APLxcwDGeZ9hfuIkU4SGCga+WTEhWX0SpFSyYDeFI1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LxRc0/J7hWHrAf/Z1kOJFnNujOc2xCEbzGxrKwhCvmUnBsxqCHyNZTfQgnTmnwVuv 0uF07zhyeOpYWXWWF97A8QVtHzNPrw/lEQi41ZLP4D1+e1S54MCWPWJHYJAapfCQMP ghB+oljO4u7vttQ10AYpVIBLOq5xbW7LWnepiz3k= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dan Carpenter , Felipe Balbi , Sasha Levin Subject: [PATCH 5.4 102/178] usb: gadget: udc: Potential Oops in error handling code Date: Mon, 29 Jun 2020 11:24:07 -0400 Message-Id: <20200629152523.2494198-103-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629152523.2494198-1-sashal@kernel.org> References: <20200629152523.2494198-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.50-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.4.50-rc1 X-KernelTest-Deadline: 2020-07-01T15:25+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit e55f3c37cb8d31c7e301f46396b2ac6a19eb3a7c ] If this is in "transceiver" mode the the ->qwork isn't required and is a NULL pointer. This can lead to a NULL dereference when we call destroy_workqueue(udc->qwork). Fixes: 3517c31a8ece ("usb: gadget: mv_udc: use devm_xxx for probe") Signed-off-by: Dan Carpenter Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/gadget/udc/mv_udc_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c index cafde053788bb..80a1b52c656e0 100644 --- a/drivers/usb/gadget/udc/mv_udc_core.c +++ b/drivers/usb/gadget/udc/mv_udc_core.c @@ -2313,7 +2313,8 @@ static int mv_udc_probe(struct platform_device *pdev) return 0; err_create_workqueue: - destroy_workqueue(udc->qwork); + if (udc->qwork) + destroy_workqueue(udc->qwork); err_destroy_dma: dma_pool_destroy(udc->dtd_pool); err_free_dma: -- 2.25.1