From patchwork Mon Mar 22 15:53:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 406429 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=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 841D8C433E1 for ; Mon, 22 Mar 2021 15:53:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 573BF61924 for ; Mon, 22 Mar 2021 15:53:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230142AbhCVPxT (ORCPT ); Mon, 22 Mar 2021 11:53:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:49034 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230401AbhCVPxP (ORCPT ); Mon, 22 Mar 2021 11:53:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BA01D619AB; Mon, 22 Mar 2021 15:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616428394; bh=iahYK4r7WtNOdjL/Bg1oM/WoYw/NIOXasi54gp8KbEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q2sJ7slOeIHlf3Q8GdYebQNBIiz8WkOMIYxta7kN3IgOWQD9AVjhaSEpowsbSHW4t BAnmOlKCt+GZRle1GLEy+DbP4+eEDWUChRNmQSf4VfVRRU6VARgZOzomWsVTMmx5z8 yNG0lOMFoNT2UZ5vIhu+CqFB8e+AJ7vb1v9wTMtSILBcywhbiXar0TP19M16ttLZZm evVYGqFjiZApflVk6GYa/hX6qsY+UCb3U77LdMzHo0mklDgMblLCJfMyHCS+ojLl0h 2Cz6i3wY7RKHxzOsiOG865+JJTbc9uK+WDyU52jm6vZR8tIjGlEu9nEUQANEHwtJZU uEaelfClbCqFA== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1lOMs0-0002ZY-IJ; Mon, 22 Mar 2021 16:53:32 +0100 From: Johan Hovold To: Oliver Neukum , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Jaejoong Kim Subject: [PATCH v2 1/8] USB: cdc-acm: fix double free on probe failure Date: Mon, 22 Mar 2021 16:53:11 +0100 Message-Id: <20210322155318.9837-2-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210322155318.9837-1-johan@kernel.org> References: <20210322155318.9837-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org If tty-device registration fails the driver copy of any Country Selection functional descriptor would end up being freed twice; first explicitly in the error path and then again in the tty-port destructor. Drop the first erroneous free that was left when fixing a tty-port resource leak. Fixes: cae2bc768d17 ("usb: cdc-acm: Decrement tty port's refcount if probe() fail") Cc: stable@vger.kernel.org # 4.19 Cc: Jaejoong Kim Acked-by: Oliver Neukum Signed-off-by: Johan Hovold --- drivers/usb/class/cdc-acm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 39ddb5585ded..d75a78ad464d 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -1508,7 +1508,6 @@ static int acm_probe(struct usb_interface *intf, &dev_attr_wCountryCodes); device_remove_file(&acm->control->dev, &dev_attr_iCountryCodeRelDate); - kfree(acm->country_codes); } device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); alloc_fail5: