From patchwork Sat Feb 25 00:14:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roderick Colenbrander X-Patchwork-Id: 9591373 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 2E4DD60471 for ; Sat, 25 Feb 2017 00:22:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 186AE28456 for ; Sat, 25 Feb 2017 00:22:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0954628554; Sat, 25 Feb 2017 00:22:24 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham 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 B916528456 for ; Sat, 25 Feb 2017 00:22:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751291AbdBYAWW (ORCPT ); Fri, 24 Feb 2017 19:22:22 -0500 Received: from mail-pg0-f43.google.com ([74.125.83.43]:33727 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751277AbdBYAWV (ORCPT ); Fri, 24 Feb 2017 19:22:21 -0500 Received: by mail-pg0-f43.google.com with SMTP id z128so17541912pgb.0 for ; Fri, 24 Feb 2017 16:22:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gaikai-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=e7o4WGf//Ia5RdLpzwmsSm238xfm8eTW8SozCWzcQiY=; b=i+DNVMSCBv+ZdKIqCd0qAsZ+gyYQ+oG5/wOGTGl8ylZ092pBlTnkKhLKn8qmPxA4iG TGtCbshDm/T7mj8OsMq383mSfyTKSuLa8iQboIUFo3R4L8zn7rtGNJSkz2RlQwH7IWti olarUdpIoC9XqogkiTbPy6Tg6o0n5pnL2jNo7ikzn9tcAn17FF4RwcoiyF41Qvurfrw7 EfhNgGJAqn1SohQXep4Vn0Aaoxv+jj+yGZDuE/3u2GYObSvs2YRoTWmn9naxH1xtd5vT j2tQ1sc2JhcA7KPmJTwxdhcdJ/wHGG0WelxepzTBHzXh0NIhOaRLP2+GS5LiB3W2RuYp SZww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=e7o4WGf//Ia5RdLpzwmsSm238xfm8eTW8SozCWzcQiY=; b=tr2+lKlPjZceWXH/1f04gwu8G+wPzjwx3eDWs27lagwWbk4swavpV3M1JsDB3RtFa0 B9m3oDzZ2n6wChRS2m9nXq83hYTcMgSoDNPO0ZJVkyEl+E00KZwu67xz24vlysX7a3kp aqY5YoR74G5o/gnEoER3aFUQ2Lha70HfMyenKDxTVL+krntwMm3KHofjra0reFjcacK3 ChULwN+64Bw49CjzH/ms4VBpQNMTXKrs4rA9iDAZ2tTXhIvNqbyMIQCmztKRCd8dUJaR 4kQKVxGVwUyvW1eHBXj+eDAmpSF/vncCfg1C+rKZO+XFSe3FYhd5oLspjsBV8z/30ku5 RNlA== X-Gm-Message-State: AMke39lik34rajyOl+jcz09duA8kjkPDaB+FhhykWzhiL9WMszWHxqOlQhcuL/2x4DqHZ4lC X-Received: by 10.99.50.132 with SMTP id y126mr6995912pgy.8.1487981660081; Fri, 24 Feb 2017 16:14:20 -0800 (PST) Received: from roderick.ad.gaikai.biz ([100.42.98.197]) by smtp.gmail.com with ESMTPSA id w28sm5617885pge.27.2017.02.24.16.14.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 16:14:19 -0800 (PST) From: Roderick Colenbrander To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , Jiri Kosina , Benjamin Tissoires , Simon Wood , Frank Praznik , Tim Bird , Roderick Colenbrander Subject: [PATCH v2] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT Date: Fri, 24 Feb 2017 16:14:15 -0800 Message-Id: <20170225001415.21361-2-roderick@gaikai.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170225001415.21361-1-roderick@gaikai.com> References: <20170225001415.21361-1-roderick@gaikai.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Roderick Colenbrander When a user connects a DS4 twice using USB and BT, we reject the second device connection after the setup work. We then perform a cleanup, but during cleanup we are not removing the touchpad device. This leads to leakage of an input device, which we would never remove. It can likely result into a kernel oops as well when the touchpad evdev node is accessed and the underlaying HID device has been removed from the system. Fixes: ac797b95f532 ("HID: sony: Make the DS4 touchpad a separate device") Signed-off-by: Roderick Colenbrander Reviewed-by: Benjamin Tissoires --- drivers/hid/hid-sony.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index f405b07..740996f 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -2632,6 +2632,8 @@ static int sony_input_configured(struct hid_device *hdev, sony_leds_remove(sc); if (sc->quirks & SONY_BATTERY_SUPPORT) sony_battery_remove(sc); + if (sc->touchpad) + sony_unregister_touchpad(sc); sony_cancel_work_sync(sc); kfree(sc->output_report_dmabuf); sony_remove_dev_list(sc);