Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3499030pxb; Mon, 24 Jan 2022 10:50:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwX6iah4OV/g2lucN2u9KyIOmSVMx1GLUwrza14Xsy1r4H8k1UlSyaXF1leCPBwDrL0Sqiz X-Received: by 2002:a63:8f09:: with SMTP id n9mr12531316pgd.308.1643050205638; Mon, 24 Jan 2022 10:50:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050205; cv=none; d=google.com; s=arc-20160816; b=Zt5lep/4nOmef+q3WGXcvKVD8t9wzwCRvWJcpq/2uTF1tAkFEQmSl7Zp1wtegj5ds+ 03T8yCa4sEjT5DQkzr/wsxH55nfg8O5lF2qxU6+CfEhpkyY6G/PpOcUWa38WG2QBMQ+1 jhw9ewYYZLaUi7Z0xuAiZx0F4lfc7mss6JyOFFAujF7xrAv5gs691Yee2xy029zQDIjY AQm33Exu+5n10AjmHigrxYS5AgeddnUQ/6ehw0OWptvbYpEjiA2o3Ux5jfwuDBAbmxOP JVN0226kfjc6gEt4m5hJmwurmX2phNrhrlKc3PO2pI8sEHoes10FFcPsRD9Jr3DkrdT9 ZDLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=OniziTHytuPG2o/7j9sn41UIA/NxTu6c6Xfe/uMdTGk=; b=GI6IOKx8L3xSHn/EcCzOlH2z6SDaDezTa/ZpMRxf7eqdVXFPikAYJN5EniuPC5ISlH piIGRXQu0D07ixuNt9WLV3yS1FiDJfOoXTdzC7BY62JuaWy1WZVbB1Eo/CAQaPjuegOt 0rCCWAUVN5+sOob6+Wg43w4+P/3BaO1Dn9CkdmGlXk7QYRBKleFY2IPLvId9AVhDnbbj HyEWLSSq7NpcICO1mxVwxuB03yqJ6z31aZgYQPXkqsvOtG3NrsIV1W5GanubHnsQNgYg AE1mfZOEgTSXKaSFVnClxWHmScraPv/2l+Sr+LEZEL9rj9XDLa6C/lUlixzUyRZa4I6f ef9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gw5hfkVi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si7259800pgk.863.2022.01.24.10.49.53; Mon, 24 Jan 2022 10:50:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gw5hfkVi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242020AbiAXIET (ORCPT + 99 others); Mon, 24 Jan 2022 03:04:19 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:32884 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236109AbiAXIES (ORCPT ); Mon, 24 Jan 2022 03:04:18 -0500 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 072A3B80E19; Mon, 24 Jan 2022 08:04:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52A2EC340E1; Mon, 24 Jan 2022 08:04:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643011455; bh=DqPJN/JIB8tHhcVzN32koJJQ0u4X/+E4TGCtyvLCsEg=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=gw5hfkViupjANxqUxsyfCibq9No2Ie5M1NlR3ITDNImLtUQ0olWLryQiOxxDcCCBU SaHz69uKz9gM/Bfbwodd/Ml03jK+HZ6TmWbB0QtPdpNATfIK9M3tHnlUmEkrvXZ102 P1GAt06ME7MvFEDoUctaniKcQg4GPZUXICU4220VWT4IBQzOjHexBNi+sXOlCe3RII W/K1mUgipnR8XqrOGK1ZIz+XlN3YV2vR2DF+Msun+D9xppCAaHqaoL5v/pWx48fn+6 MiEopM+sjDX+wXEvhimQmRzpda68ysH/UriDKE/vAPs7V/DvpjFsl2aO6O8FCpaQgs M4FxVUu2IOGYQ== Date: Mon, 24 Jan 2022 09:04:11 +0100 (CET) From: Jiri Kosina To: Dongliang Mu cc: Benjamin Tissoires , Salah Triki , Dongliang Mu , syzkaller , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] hid: elo: fix memory leak in elo_probe In-Reply-To: <20220122094827.684542-1-dzm91@hust.edu.cn> Message-ID: References: <20220122094827.684542-1-dzm91@hust.edu.cn> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 22 Jan 2022, Dongliang Mu wrote: > From: Dongliang Mu > > When hid_parse in elo_probe fails, it forgets to call usb_put_dev to > decrease the refcount. > > Fix this by adding usb_put_dev in the error handling code of elo_probe > > Fixes: fbf42729d0e9 ("HID: elo: update the reference count of the usb device structure") > Reported-by: syzkaller > Signed-off-by: Dongliang Mu > --- > drivers/hid/hid-elo.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/hid/hid-elo.c b/drivers/hid/hid-elo.c > index 8e960d7b233b..9b42b0cdeef0 100644 > --- a/drivers/hid/hid-elo.c > +++ b/drivers/hid/hid-elo.c > @@ -262,6 +262,7 @@ static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id) > > return 0; > err_free: > + usb_put_dev(udev); > kfree(priv); > return ret; Applied, thank you. -- Jiri Kosina SUSE Labs