Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2110234iof; Tue, 7 Jun 2022 20:04:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1cYHMBR/wCFjchAx89sS0+h1SUKkpRNB5PHkYijXafZElMpeA++Sc4e826MywPn8RC2YI X-Received: by 2002:a17:90b:388f:b0:1e8:5df5:b2a3 with SMTP id mu15-20020a17090b388f00b001e85df5b2a3mr21408428pjb.70.1654657470589; Tue, 07 Jun 2022 20:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654657470; cv=none; d=google.com; s=arc-20160816; b=IdRC0R32WqtLoTOSClYwZ5HTBPOsDFiD1ljxeEY9HzRQNFxoSfx1QnI6xWodQGR21H n4iDZV//Kq6oBSx16aV+rHbUk9RPNliFqu5ox8tnO0HdFS2syDzJRLGHs1O7W19sVZyD Du5IxtwBIOCGdIvW07CHSGrd3TmWtfzukZyS2BJZcPEO99SLu6+iTQQBn7cNjvO37eUb J3qvMi+y+BIu/KFpadyHGAl+Fl8mu6nYhUlxWW2+SjYyA8wARKpSLtHyRoxDnFVRjQ36 yyrtTv2GpLzeBXaS0I/pFG+vTH3nQRaFlzY+5+JQ+zZruPOtn4JU7yXmLYXdvNLAcss6 UUTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NVXuSZpBSum5kk0PNdkFKjlGY7YDGLpW+i183PRrk28=; b=cLJ6X3yx5LvlLV2C0JiGjK5DPu69LfG5Hm4Sd0acX2qob4AJtGDrgD4T1lz4xA4sUZ b3lZis4zxZcm3qSaHIT9e7vQi21fP8AsTxw1XzTzTmAKRXQJohb4VLbQtIA6Nm2A5jA/ I8kIrT3rXLZ59gZvxfDyGowRvZkRh4sciTckEDw/9I006+OqtDehCk1+F3ireuD7IAcm IgkcboRsd/8lV9U4n8SrSf1FB/2ipPQVoZxzCWMz7EGjA4aD73DdkjxS7Wd/Sz9qVgDI +YbAu/gw0OWwX+6fnn13+uSig3qY+bB4ZrsfAdZLmy4KacVx40FDdhFO/DxaxZCuT/C9 rmVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SvAjbVcV; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h6-20020a654806000000b003aaa7c6cf64si27252314pgs.216.2022.06.07.20.04.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 20:04:30 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SvAjbVcV; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CE3AE3D8B99; Tue, 7 Jun 2022 19:23:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378061AbiFGWhA (ORCPT + 99 others); Tue, 7 Jun 2022 18:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377823AbiFGVX4 (ORCPT ); Tue, 7 Jun 2022 17:23:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E12A222737B; Tue, 7 Jun 2022 12:00:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 80A2AB8239F; Tue, 7 Jun 2022 19:00:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC1BCC385A2; Tue, 7 Jun 2022 19:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628448; bh=ZcruHj1kOgQZVF2d3vZPOn0QPi+u8OfiQpOvLGafu9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SvAjbVcVvpjqyr/06uX9gKjdD6ehB7xfe1Sk5BWTWwiYxbaNKOiABvLOGvLz7KVD5 GspyP2EJSPo0dkOHMKTuGDRXK45d4JwONEdJk4+21bni763/zP5FWrc0nXyn9w+i32 El54xYT72OUHiEVdh16M2d6txbhtH7vT97EAA2Sk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Benjamin Tissoires , Jiri Kosina , Sasha Levin Subject: [PATCH 5.18 326/879] HID: elan: Fix potential double free in elan_input_configured Date: Tue, 7 Jun 2022 18:57:24 +0200 Message-Id: <20220607165012.316355326@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaoqian Lin [ Upstream commit 1af20714fedad238362571620be0bd690ded05b6 ] 'input' is a managed resource allocated with devm_input_allocate_device(), so there is no need to call input_free_device() explicitly or there will be a double free. According to the doc of devm_input_allocate_device(): * Managed input devices do not need to be explicitly unregistered or * freed as it will be done automatically when owner device unbinds from * its driver (or binding fails). Fixes: b7429ea53d6c ("HID: elan: Fix memleak in elan_input_configured") Fixes: 9a6a4193d65b ("HID: Add driver for USB ELAN Touchpad") Signed-off-by: Miaoqian Lin Acked-by: Benjamin Tissoires Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-elan.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/hid/hid-elan.c b/drivers/hid/hid-elan.c index 3091355d48df..8e4a5528e25d 100644 --- a/drivers/hid/hid-elan.c +++ b/drivers/hid/hid-elan.c @@ -188,7 +188,6 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi) ret = input_mt_init_slots(input, ELAN_MAX_FINGERS, INPUT_MT_POINTER); if (ret) { hid_err(hdev, "Failed to init elan MT slots: %d\n", ret); - input_free_device(input); return ret; } @@ -200,7 +199,6 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi) hid_err(hdev, "Failed to register elan input device: %d\n", ret); input_mt_destroy_slots(input); - input_free_device(input); return ret; } -- 2.35.1