Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6551289ybx; Mon, 11 Nov 2019 10:48:59 -0800 (PST) X-Google-Smtp-Source: APXvYqyeqKgpn0hI3Ft2hIO8I6Meau1gHM4fMEeHWrMnFblTCqyGmqg+YlCzPYaCsvIqrO6y2rja X-Received: by 2002:a17:906:3582:: with SMTP id o2mr23901409ejb.54.1573498139471; Mon, 11 Nov 2019 10:48:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573498139; cv=none; d=google.com; s=arc-20160816; b=yn9v03/+A8CqQ3l1fvxcLIE0yFxmRIg+0clw983Yz924pgqrh2HH2Fe+psuMhv4bpf ux1BQswpADXyCxGAmApIkFRmoEgvSJ7ZPYlXFm7yYGU9VYEwB70k2cvKDj4bft0mNZhE n+3mvh0Okxbf4OxZruuTpqun/zU7wBrY5BS+FPB8YXyBTA6FmHgxEC2I0vOcsLT4Xbwi tT1nZnNg6uzNhwz8FttVplU1+cyxb/pLYwBm9vkdpc9SikRBStpd6uPymVKQ0LdFsYkY YdlFJeRlbZx3R8uzKWMTCPVI2C5NWgcY4vDRA1/b4Q9uF0woBrVAVAzC5H2mGc7UC4fc NiTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L2Jr8xbXLNswpK0zY4TKREsmFlnraeDA8AMXR5TUGjI=; b=bGf8L936yZ1SjUFlG6iVdWev1dp5yFnHN82S5rIDO4BQ/AOP50BX1n0itoaBVpI0x2 Zj4oaBkbzs0sqQZe67E9sIFyFUtmcr2vMBeFUdTuPPuHFdFHOi+HZzu99rqQowNDCD77 u/+PJGEu+niKXdSTr9lbT3/0gUwhialkjb+BvsmNfmjgU+EhgYOvQDa0zqCsgaT7ah5n xttRfmi6DyGXiwjyv7BmkmEjdGRQiyfGuxdLVaxfSAFffbP6YxxQydFAD+WsFioxBPqp vPbotPe9+FnJ0X979YyiCRPzpvb0IvaGaZVf/sZhnL7DjD3VVZsiKHIMEtd6Xyov7Nnh /teA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="je/zu3lu"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h56si10052139eda.356.2019.11.11.10.48.35; Mon, 11 Nov 2019 10:48:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="je/zu3lu"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729818AbfKKSpG (ORCPT + 99 others); Mon, 11 Nov 2019 13:45:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:36940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728857AbfKKSpD (ORCPT ); Mon, 11 Nov 2019 13:45:03 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 89298204FD; Mon, 11 Nov 2019 18:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573497902; bh=NAogkW33fSfT/LC/kozI9usm/VdaqyUYpaY1pwI9Gy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=je/zu3lu7Jetmw40JqkHrbhKyqwxqd9RSZzuqD+6Q+dFf+SewyM9JlDElm9vGZP4f LoVOtcHT2e1tcxmIukJVoL5Qvs1FrLyExpHc6tAOPP9W2Bdny5yc9oq9ugxLNNueoW rhbb+Fg+hcAXbAG8CAuXQLsdJDGw7R8YM4Py3IVk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Navid Emamdoost , Felipe Balbi , Sasha Levin Subject: [PATCH 4.19 092/125] usb: dwc3: pci: prevent memory leak in dwc3_pci_probe Date: Mon, 11 Nov 2019 19:28:51 +0100 Message-Id: <20191111181452.221804790@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111181438.945353076@linuxfoundation.org> References: <20191111181438.945353076@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Navid Emamdoost [ Upstream commit 9bbfceea12a8f145097a27d7c7267af25893c060 ] In dwc3_pci_probe a call to platform_device_alloc allocates a device which is correctly put in case of error except one case: when the call to platform_device_add_properties fails it directly returns instead of going to error handling. This commit replaces return with the goto. Fixes: 1a7b12f69a94 ("usb: dwc3: pci: Supply device properties via driver data") Signed-off-by: Navid Emamdoost Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/dwc3/dwc3-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 8cced3609e243..b4e42d597211a 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -256,7 +256,7 @@ static int dwc3_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) ret = platform_device_add_properties(dwc->dwc3, p); if (ret < 0) - return ret; + goto err; ret = dwc3_pci_quirks(dwc); if (ret) -- 2.20.1