Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp849815ybl; Wed, 14 Aug 2019 06:58:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnEw0G78vVIw33ONk53LG26Kc/uVBHVjAP3T50BE5GB6/uFx/iy2WY/fnlPiDVPdlmJkoI X-Received: by 2002:a17:902:b48c:: with SMTP id y12mr42266840plr.202.1565791115668; Wed, 14 Aug 2019 06:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565791115; cv=none; d=google.com; s=arc-20160816; b=zCMA8y/JBxN4Qu6UwIH6Q01Amd9OCTi/ou2PVG4kvVgTojMb/oPjuBEdqheyRzHS6t jyIF2sufYw+NAkqlG0FHwNlLjtWFU3gihyZ6WdjygM5rnity/WSfWHvaxhdZaI2QD7dM 4bQ1jq/Cwlyhcs0r8E8HmLGjR2ZODER+InUaNXlQZezIXV8XA4bkAGR6oCe6a++tKddK T944I+9JBH4wEfoxQ0SUXQiYVnn93aXE0Xi0f1cf5qRg+lz08BmSsDZQTBdI1dU5fZjp ckq1x/4TDMll+RawFoseQN+sjFipgCUDVJg5z3dW29sdI9Vb+YGIHuOVudM55ni03cls /utw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=8QkzPcPvn1/zHg+C+QzCJv7vNnpw8h5jNT5+kHg3XtA=; b=ZHo0lB3VdcnjDk7cN40NU2m1/bhEF0M3HvEZX14vAh/Nv4XEwtjP5VtTZkwj7oUxGJ fLABXsNswjopDAD0SRwz2Lb5v5CwjVZw+wvZretw10GZDpcoP+ndOWCfyEXb3Nfghnw3 CnBTuGtWS2Nnxq/yfVye1vUkNWTfrm0I8AHTF/7nzNhUc4bkb5dzhUG5Pq8xHt1lmRt7 Rr3hrEcDJNRqSXY0+2oCK4Hk/wdY3zY9qIgIq4v+UwbM0Luq6zogCckauKcZtecr/yf6 guMWUSwGqTBHLHtOcirdD3xTgieYJJRMNsW2PQ8BvjNgAAqxP3fHkP6pdZHIw1F9BdgZ 6H1g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9si4491971pgj.19.2019.08.14.06.58.19; Wed, 14 Aug 2019 06:58:35 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727691AbfHNN5o (ORCPT + 99 others); Wed, 14 Aug 2019 09:57:44 -0400 Received: from mga11.intel.com ([192.55.52.93]:22737 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726551AbfHNN5o (ORCPT ); Wed, 14 Aug 2019 09:57:44 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Aug 2019 06:57:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,385,1559545200"; d="scan'208";a="178165545" Received: from mattu-haswell.fi.intel.com (HELO [10.237.72.164]) ([10.237.72.164]) by fmsmga007.fm.intel.com with ESMTP; 14 Aug 2019 06:57:42 -0700 Subject: Re: [PATCH] xhci: fix memleak on setup address fails. To: Ikjoon Jang , Mathias Nyman , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190811082259.48176-1-ikjn@chromium.org> From: Mathias Nyman Message-ID: <5883d03d-31c4-206a-26c1-ca641dbf845c@linux.intel.com> Date: Wed, 14 Aug 2019 16:59:31 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190811082259.48176-1-ikjn@chromium.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11.8.2019 11.22, Ikjoon Jang wrote: > Xhci re-enables a slot on transaction error in set_address using > xhci_disable_slot() + xhci_alloc_dev(). > > But in this case, xhci_alloc_dev() creates debugfs entries upon an > existing device without cleaning up old entries, thus memory leaks. > > So this patch simply moves calling xhci_debugfs_free_dev() from > xhci_free_dev() to xhci_disable_slot(). > Othwerwise this looks good, but xhci_alloc_dev() will call xhci_disable_slot() in some failure cases before the slot debugfs entry is created. In these cases xhci_debugfs_remove_slot() will be called without xhci_debugfs_create_slot() ever being called. This might not be an issue as xhci_debugfs_remove_slot() checks if (!dev || !dev->debugfs_private) before doing anything, but should be checked out. -Mathias