Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2510112pxb; Sun, 23 Jan 2022 07:01:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzv0YLm9vO9aTu5GJbcf1hcErZLpb+EXrXB88smMykyDxRXNImEAMaKz+l1ai15xrJor34z X-Received: by 2002:a17:902:6901:b0:149:4e89:2d45 with SMTP id j1-20020a170902690100b001494e892d45mr10763721plk.22.1642950119020; Sun, 23 Jan 2022 07:01:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642950119; cv=none; d=google.com; s=arc-20160816; b=bLkN8Sb0EiwxMEMJB2+XbMeHiivGdmG92a5aMkkelqww1FZuMUNo8wkW0IOF9Hs68t iUuR8fuxOendlSKO8fE3TvdUclCPiDSBuyl3BZGN1N0edzlaUDefsDPTQ7u49Qz/LYyP XIPE6PsoE+sb598iUECE0+oo7NdKJeRhEpG/rkchmOgxh6D3jRgap10PwNKO7kAWquMr Tu6ZjQnMYMH6P5sdcmpCUN92cCS5XZcehicv4XohaDyBvxKL4gF6WTrXqb/4tZH/mAKl cL06CzOoPAobrjYDwn7kop3dzLSifuTDoFsO66igg3ICX2tdwRlSQL2ADqwc6fkG2RuE cq9w== 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 :message-id:date:subject:cc:to:from; bh=w5yfLYV3nMBes/c4VGTs5EPLO0ISY2Abizl8ebyy8hI=; b=f3rB5MU8XHXFON1MAAPDRKdaK2BhyW8X8FAdQsVem+rHwrO2q/8fdPOPXVY0IxcXC/ J5FYJTvR2e7ySfHlIIEqhfOeAWvmdYV3FYG+oVv2AXn4Al+FM7oq0uD5zEsmHNFCt8QN lksQBfjktfyMF7O5K6E4TujMixj2pVDN54cPVh4GfjxhscAbsqhJe+XjAXljv8xU6/8c cPea37tFHhdtR32zqb+4IaXS5TvvW7WYBioxUOhmVaRhrg93tUJxmzVfbtPsrdCZy98R +P5XcHfORSXEYUkX+/saa5GX4AaDv/RLCQn3jNNbeROOb7DXkDLNCxAc/AkWNPdrpx11 qvyw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p24si10033876plo.435.2022.01.23.07.01.46; Sun, 23 Jan 2022 07:01:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231260AbiAVJtS (ORCPT + 99 others); Sat, 22 Jan 2022 04:49:18 -0500 Received: from mail.hust.edu.cn ([202.114.0.240]:58590 "EHLO hust.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229773AbiAVJtR (ORCPT ); Sat, 22 Jan 2022 04:49:17 -0500 Received: from localhost.localdomain ([172.16.0.254]) (user=dzm91@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 20M9mYeN013481-20M9mYeQ013481 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Sat, 22 Jan 2022 17:48:39 +0800 From: Dongliang Mu To: Jiri Kosina , Benjamin Tissoires , Salah Triki Cc: Dongliang Mu , syzkaller , Jiri Kosina , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] hid: elo: fix memory leak in elo_probe Date: Sat, 22 Jan 2022 17:48:26 +0800 Message-Id: <20220122094827.684542-1-dzm91@hust.edu.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-FEAS-AUTH-USER: dzm91@hust.edu.cn Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.25.1