From patchwork Tue May 30 16:25:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 9754891 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 45EC560390 for ; Tue, 30 May 2017 16:29:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3918026538 for ; Tue, 30 May 2017 16:29:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DB3B27CEA; Tue, 30 May 2017 16:29:56 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC7A126E49 for ; Tue, 30 May 2017 16:29:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751189AbdE3Q0w (ORCPT ); Tue, 30 May 2017 12:26:52 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:33640 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751088AbdE3Q0t (ORCPT ); Tue, 30 May 2017 12:26:49 -0400 Received: by mail-lf0-f67.google.com with SMTP id m18so9326487lfj.0; Tue, 30 May 2017 09:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=JNa3W6jTuZ6h8Fs+h4LqkRImldOHDgCGFcfYsacqQ14=; b=uCjvyzIeS9xLlMtRd6gVro9GfMFanO8Idb0ppK+GVsv+W301+m9vuC80RDf75kuMW9 QLDDtE7gKDxgblbuWRRCg9k2fhzaCnlvTb2rQFuXH9y9fXrIrzVLLjAjXaLP0Ti/b8DZ WILOdt5RHMesOkqJ3fMAbtj7efLUaN+H5IFeU0INvKLTbx7R4Mye7vfrga7MiyFCfQjn k5y1Fd4MzN3CUgyxJKcDoo5FmDRs52dC2+kqUA0djLEGXLcXaH+GRgADjJ7nHAhcItfM SohspYJTaFD1zrDu+GcDJmeGKePatf+DddYMHBjpl4KvgFEVe9+5Dy8QRF5Vqy8ZvNDd c7lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=JNa3W6jTuZ6h8Fs+h4LqkRImldOHDgCGFcfYsacqQ14=; b=AVyqgt+B5GqvAsb/51Nri46VH2KWrHJyaPCPXEaUDb2c0klDLuKWZPNveesKowxqJk N0XxsOHqnnFt+A0EdSwwiKKGmU87Am7lgovgSSAyH/gpURpXY6nV4nxJ4oO++a2jt0/l 4Ag9KO2eUHPAKVSM2uGngp+kNKA4JRj764+OddZ1sd9flboZg/mrJm4pS9opXiJfIdkD Hd+222ZzG/8yEfkZcuXYhX2f5hj5I5mCiU75GzRvvaE640K6XzXnd/Bx/kow5UChPe9s r37fpLzxkkk8KuOshJCT/OM6xxluuBjIHZ1Ihe3EQLNjwgMAMHlhHFH7wNf5sSkGuLOu xdOg== X-Gm-Message-State: AODbwcBVSr4qG2PXPLCbky3uorBi1bHtjBIQBFcZ4/Gkgidf6yjLPBCH qA533Hq6NkrLkA== X-Received: by 10.25.156.138 with SMTP id f132mr6031476lfe.4.1496161607126; Tue, 30 May 2017 09:26:47 -0700 (PDT) Received: from xi.terra (c-42c8e255.07-184-6d6c6d4.cust.bredbandsbolaget.se. [85.226.200.66]) by smtp.gmail.com with ESMTPSA id m23sm2827206lfj.37.2017.05.30.09.26.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 May 2017 09:26:46 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.89) (envelope-from ) id 1dFjyr-0006op-2i; Tue, 30 May 2017 18:26:49 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Linus Walleij , Peter Chen , Rob Herring , Arnd Bergmann , Sricharan R , Zhang Rui , Eduardo Valentin , linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable , Peter Chen Subject: [PATCH 1/7] USB: core: fix device node leak Date: Tue, 30 May 2017 18:25:48 +0200 Message-Id: <20170530162554.26159-2-johan@kernel.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170530162554.26159-1-johan@kernel.org> References: <20170530162554.26159-1-johan@kernel.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make sure to release any OF device-node reference taken when creating the USB device. Note that we currently do not hold a reference to the root hub device-tree node (i.e. the parent controller node). Fixes: 69bec7259853 ("USB: core: let USB device know device node") Cc: stable # v4.6 Cc: Peter Chen Signed-off-by: Johan Hovold Acked-by: Peter Chen --- drivers/usb/core/usb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 28b053cacc90..62e1906bb2f3 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -416,6 +416,8 @@ static void usb_release_dev(struct device *dev) usb_destroy_configuration(udev); usb_release_bos_descriptor(udev); + if (udev->parent) + of_node_put(dev->of_node); usb_put_hcd(hcd); kfree(udev->product); kfree(udev->manufacturer);