From patchwork Thu Feb 23 23:56:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roderick Colenbrander X-Patchwork-Id: 9589127 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 8EC6260471 for ; Thu, 23 Feb 2017 23:56:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77C7E27031 for ; Thu, 23 Feb 2017 23:56:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CC7B279E0; Thu, 23 Feb 2017 23:56:21 +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=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 6F33327EED for ; Thu, 23 Feb 2017 23:56:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751516AbdBWX4U (ORCPT ); Thu, 23 Feb 2017 18:56:20 -0500 Received: from mail-pf0-f171.google.com ([209.85.192.171]:33352 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751505AbdBWX4T (ORCPT ); Thu, 23 Feb 2017 18:56:19 -0500 Received: by mail-pf0-f171.google.com with SMTP id 2so512287pfz.0 for ; Thu, 23 Feb 2017 15:56:19 -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=3x2jRpm75ffM+pakorkKNWLVzik3pCe2NYv+K8Qxm5A=; b=Dx+lj5G7Nhcu1cgyUT3v3SjYgS58IdEkUWp53ObLp1wV/LHbm3RbruQREIZ1Yzggff slWeon6MKDZKWZQtGXxueI0RfsSWk0P/9qKWcZjV3Vm7WgU+J3Rv4sHtd6nCGLWTqUjU B188S0UOFPBfUhjPn0ktwXNGNGOkMV22kIQ2bTHFu+c44HCfxXnaakcxKBhplAbVNCYM 5F2a2EMxZLSLPW22HtJoTx6p5GrDCQZAnJj8BP5HVGASXdzI8TzojhIkxp5IAWvw7ZqF oCnfIB74OZcQp2E2CgJFNWTfsNWAWB3phSFxAXbDaWpV3ehydAhoTj3Umx/4StbHvYNO B0lw== 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=3x2jRpm75ffM+pakorkKNWLVzik3pCe2NYv+K8Qxm5A=; b=tIjNL0XSnB0okffrFuAwZ5Uo5QZIOqzxTlfby5N80463LqW2W4WyCZ2NuMLLbV7jL2 WiPcGiqa9MeKFRY35pqPLWDu7ouzr6TC4TQ2OyS5QtPw1jY8+7xwQvzC44Y7hko5m9cc G5OurFSh0ZMTFs1ftL8Ata0E5Ai0DNXJ9emnn1AfroLxXpYtXsflIx4VQDn0u8kO16fO zaEFtp8c9vaUL+BRV2qhrVzbyRZxieCo38SsVhas03gJ+2oskOgGRty/45utJoBrAKZs gZmSKpfWEDl0tXzlchTQDFHHZtf13nA41ZR8GxEBP/WSHWapnO+oX8aqA3AnwRoyufxT L33Q== X-Gm-Message-State: AMke39lxTZoDuG9VZgKKB1yeqr/jxe6ZDHSMvw8ZhSCx7Sb2ZjO6nDPsKhaxje4GFA9ZlM3Z X-Received: by 10.99.241.83 with SMTP id o19mr50549030pgk.195.1487894178532; Thu, 23 Feb 2017 15:56:18 -0800 (PST) Received: from roderick.ad.gaikai.biz ([100.42.98.197]) by smtp.gmail.com with ESMTPSA id o66sm11646908pfa.119.2017.02.23.15.56.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Feb 2017 15:56:18 -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] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT Date: Thu, 23 Feb 2017 15:56:13 -0800 Message-Id: <20170223235613.5112-2-roderick@gaikai.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170223235613.5112-1-roderick@gaikai.com> References: <20170223235613.5112-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. --- 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);