From patchwork Thu Feb 23 01:35:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Cvek X-Patchwork-Id: 9587643 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 041A160578 for ; Thu, 23 Feb 2017 01:36:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E75FC286D1 for ; Thu, 23 Feb 2017 01:36:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC06728723; Thu, 23 Feb 2017 01:36:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D8E09286D1 for ; Thu, 23 Feb 2017 01:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:To:References:Subject:From:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jwiGXkztFExUgRJGzK67T33nzKKzZugRDvkv/4hNsqc=; b=ptGlu4PwWc0yDh y8Jy2BSuCcjjeuz0+VqbJYNd/YHskyjg7vT9iRR0iZEre27QHIDp4ZNz8EROOy7kT2ZhsBMKkefwa veqf+VJLD2GRip23eNKzqasIG4ytCHZ9aZUHp+Og+C7wkgC7KQ5f22Y+bxrIoMp2QbRxVu5SIt7JA eZBxZ9eDoRf73cBCyMX9PKWaNwHu9Fb7bncWh5Is+P88qB6daQtK86HyXv6hp6jGm4mjazZPkSDdl PoKushVCpK+97RVG1O7lu7d5YAMMY4LVEVY6PWLjV7ciFvuJnCgtR10WeCctljB+dEZW5o7vydQcR PrzdEaPtGKLSt60s9DLw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cgiKi-0000Ue-F2; Thu, 23 Feb 2017 01:36:36 +0000 Received: from bubo.tul.cz ([2001:718:1c01:16::aa]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cgiJ7-0006dJ-GR for linux-arm-kernel@lists.infradead.org; Thu, 23 Feb 2017 01:34:59 +0000 X-Virus-Scanned: amavisd-new at tul.cz Received: from [IPv6:2001:1ae9:ff1:f191:a1d1:ce8d:e5ab:154c] (unknown [IPv6:2001:1ae9:ff1:f191:a1d1:ce8d:e5ab:154c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by bubo.tul.cz (Postfix) with ESMTPSA id 995A0180383C3; Thu, 23 Feb 2017 02:34:32 +0100 (CET) From: Petr Cvek Subject: [PATCH 2/2] usb: gadget: Add test if argument pointer has a valid value in pxa27x_udc References: To: Daniel Mack , Haojian Zhuang , balbi@kernel.org, robert.jarzmik@free.fr Message-ID: <3c2b75a6-55ec-bf5e-1f84-4c9a50e04660@tul.cz> Date: Thu, 23 Feb 2017 02:35:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170222_173457_808397_55AA6354 X-CRM114-Status: GOOD ( 10.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Move call usb_put_phy(udc->transceiver) inside a valid pointer test. Reported-by: robert.jarzmik@free.fr Signed-off-by: Petr Cvek Reported-by: Robert Jarzmik Acked-by: Robert Jarzmik --- drivers/usb/gadget/udc/pxa27x_udc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c index 6fa675bf2c6f..9d2e1a8aa69d 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -2531,9 +2531,10 @@ static int pxa_udc_remove(struct platform_device *_dev) usb_del_gadget_udc(&udc->gadget); pxa_cleanup_debugfs(udc); - if (!IS_ERR_OR_NULL(udc->transceiver)) + if (!IS_ERR_OR_NULL(udc->transceiver)) { usb_unregister_notifier(udc->transceiver, &pxa27x_udc_phy); - usb_put_phy(udc->transceiver); + usb_put_phy(udc->transceiver); + } udc->transceiver = NULL; the_controller = NULL;