Received: by 10.223.185.116 with SMTP id b49csp830083wrg; Sat, 10 Feb 2018 21:26:04 -0800 (PST) X-Google-Smtp-Source: AH8x227QLEcRKCUCOkByYCi6b4guJ4vJb4Zf2o2JE07yACphGU4zB+w1w+mjXr8w9KT0CJFeForO X-Received: by 10.99.107.73 with SMTP id g70mr6387042pgc.38.1518326764394; Sat, 10 Feb 2018 21:26:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518326764; cv=none; d=google.com; s=arc-20160816; b=05vu215dJMXjNBD945afEJHCaBq52D57Lp2T3xSkNlDqgKuATpKVVY2jYn6kRM4vWD +wCR2cltG1EZd311bRZEoTmCoJfhWDmOqzlG8/xYGBT6vk2512Y/C8CrhiXMm30bznUo sjRZAIESBPkTqfUXKXGn4280uRtOs2jbEz2SOBQPlh8Q5COCsPxtyc5DFBGquD7imBsQ M7jwgGhpq0n6G+PRnSmj06O/BuTtV2ODIRCpl9b+KpLPXNetwpGr6sHZyLqwv8UsnicZ 3H3qt/etK93qc+rzJXcgHRk6wVs8hcNurK4INcH6nohzJIu2AKzYhQPwxeDZKBiylpdy 89lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=+wrRxTYvawYHr1erA8hKk4EDh8RFvJgphf2biJVIVnc=; b=Gep93ALfCfzKlYL4LFGzUX3OGgh9XgYZ3fDmuVmOSI6fwmrh8XzpS3kasW5LeCvoLK Qu3v3cOvMaeF7wLxg63wJ69ukVd5yovZLdGMZaKElz6d1FxFfeEZcK9Kzoz/juO/rNFG Ep/J4SZOvEBcyHU1H+sHiM8IFmrPGnZhmBQGhLaqGFHWX1Iijfc3R2W0CE+3hZxzoNtd 1I3AYn27ESwhSD6QDmHc78Pq95y5sA0BT5scQzuGaoOsOHYN79zlklWApIMCMdmL0rdS Jvmj5gRvj8X09PQnBxkwRL/qdNYYrjPn8hz9YBI3JcmUJ5L3EXNDhBTs5fs78pR4vpLJ U5pw== ARC-Authentication-Results: i=1; mx.google.com; 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 a5-v6si3998157plp.416.2018.02.10.21.25.50; Sat, 10 Feb 2018 21:26:04 -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; 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 S1754188AbeBKFYL (ORCPT + 99 others); Sun, 11 Feb 2018 00:24:11 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41312 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752389AbeBKEdk (ORCPT ); Sat, 10 Feb 2018 23:33:40 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ekjKc-0002hG-8n; Sun, 11 Feb 2018 04:33:38 +0000 Received: from ben by deadeye with local (Exim 4.90) (envelope-from ) id 1ekjKX-0004Ru-3R; Sun, 11 Feb 2018 04:33:33 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Greg Kroah-Hartman" , "Johan Hovold" Date: Sun, 11 Feb 2018 04:20:06 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 06/79] USB: serial: garmin_gps: fix memory leak on probe errors In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.2.99-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 74d471b598444b7f2d964930f7234779c80960a0 upstream. Make sure to free the port private data before returning after a failed probe attempt. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reviewed-by: Greg Kroah-Hartman Signed-off-by: Johan Hovold Signed-off-by: Ben Hutchings --- drivers/usb/serial/garmin_gps.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c @@ -1476,6 +1476,12 @@ static int garmin_attach(struct usb_seri usb_set_serial_port_data(port, garmin_data_p); status = garmin_init_session(port); + if (status) + goto err_free; + + return 0; +err_free: + kfree(garmin_data_p); return status; }