Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7012489imm; Tue, 28 Aug 2018 05:08:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZKfN90LaltSGdyxQxtSJVBOdA2BSZ3TNTODdIriOuOhdX2rDPLwNJWU8sn4xMxUr7rkX5i X-Received: by 2002:a63:f849:: with SMTP id v9-v6mr1272240pgj.71.1535458089569; Tue, 28 Aug 2018 05:08:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535458089; cv=none; d=google.com; s=arc-20160816; b=HmjzIRor7/x6naBQLraOUd9qdEfc0zTxpeWss4633AEIHK80MfjzFCcEfyJUKNcwju tkhpcVbQnXXNfmeM1xY8oRJQKkDN0UmnbxTqdFPnIp5A794kFyue5vsisgp0/pbJX+nE BQRyG9GZHlF/etGb65jSlg/v232K0AlYgBRsXftv0I5zzqYkMFmNGjVHKGCaU7Ui7jcv EdlUmnoKtlbwceblamsiIDxMsPfXvYl0izoqk7A5a4VIOfXGmpPYdAXhU1zyj3YIWNGi HOfNo2kFdrOZCMkn/AbJS0SDUHQQjh19LlZLtPq4nOg9H3YYtOBO+K/8D91iey+flaFv p95A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=BKu0Mmrlc2Oc9r/b9YLv1NLvppyjhUt8D/qnoNgGlKY=; b=0KJkvIPyyTVa/BPucPiqkrVDd/uj6vqxPSUTKlDCggRezugTtAdZYZ4S/0Ft/iS1VY vWF3E8Ak+r/sEym5trzbzrFCRkyzWYqd8YTm5C4B8ppoUHNnZg4r6WAlQaJcUJL8zhev IbGSYer8+X3mkGA8M2D+a8Mq7PljPXOUnieAUMZWrdeAjWNNsz4l+ZnNTS1RnB1ZmLMY x2YXxbDLPpJKtcGPwAKfg6h4CEwekf1bWn3Mrbf+GGie9qkYxbywqkn8xwJbbAk/ygJ6 iZOqHEw3s34flVcKySGOYm9ekyeqgbV+b982eVjFbrNx3e6nIvknX/gQ2dhKVhH5Blbl NSAw== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k3-v6si884400pld.6.2018.08.28.05.07.54; Tue, 28 Aug 2018 05:08:09 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727468AbeH1P6K (ORCPT + 99 others); Tue, 28 Aug 2018 11:58:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:56746 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727067AbeH1P6K (ORCPT ); Tue, 28 Aug 2018 11:58:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 76098AF7E; Tue, 28 Aug 2018 12:06:47 +0000 (UTC) Date: Tue, 28 Aug 2018 14:06:46 +0200 (CEST) From: Jiri Kosina To: Stefan Agner cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] HID: input: fix leaking custom input node name In-Reply-To: <20180828112955.11318-2-stefan@agner.ch> Message-ID: References: <20180828112955.11318-1-stefan@agner.ch> <20180828112955.11318-2-stefan@agner.ch> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 28 Aug 2018, Stefan Agner wrote: > Make sure to free the custom input node name on disconnect. > > Cc: stable@vger.kernel.org # v4.18+ > Fixes: c554bb045511 ("HID: input: append a suffix matching the application") > Signed-off-by: Stefan Agner > --- > Found with kmemleak, after unplugging a Logitech Unifying receiver: > > unreferenced object 0xc2345b80 (size 64): > comm "kworker/0:1", pid 20, jiffies 4294955181 (age 320.740s) > hex dump (first 32 bytes): > 4c 6f 67 69 74 65 63 68 20 55 53 42 20 52 65 63 Logitech USB Rec > 65 69 76 65 72 20 53 79 73 74 65 6d 20 43 6f 6e eiver System Con > backtrace: > [<8fec5a71>] __kmalloc_track_caller+0x1dc/0x300 > [<5b926275>] kvasprintf+0x60/0xcc > [<21fc360f>] kasprintf+0x38/0x54 > [<3b6ce9f0>] hidinput_connect+0x23a8/0x4c60 > [] hid_connect+0x30c/0x38c > [<5a28f7c9>] hid_hw_start+0x44/0x64 > [<267d70e8>] hid_generic_probe+0x34/0x38 > [] hid_device_probe+0xdc/0x13c > [<09414e91>] really_probe+0x1d8/0x2c4 > [] driver_probe_device+0x68/0x184 > [<1def17c8>] __device_attach_driver+0xa0/0xd4 > [] bus_for_each_drv+0x60/0xc0 > [<379d02f8>] __device_attach+0xdc/0x144 > [<7026ace5>] device_initial_probe+0x14/0x18 > [<44527d01>] bus_probe_device+0x90/0x98 > [] device_add+0x424/0x62c > > drivers/hid/hid-input.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c > index 4e94ea3e280a..ac201817a2dd 100644 > --- a/drivers/hid/hid-input.c > +++ b/drivers/hid/hid-input.c > @@ -1815,6 +1815,7 @@ void hidinput_disconnect(struct hid_device *hid) > input_unregister_device(hidinput->input); > else > input_free_device(hidinput->input); > + kfree(hidinput->name); > kfree(hidinput); Applied for 4.19, thanks. -- Jiri Kosina SUSE Labs