From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F77BC4332F for ; Wed, 23 Nov 2022 09:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237004AbiKWJDh (ORCPT ); Wed, 23 Nov 2022 04:03:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237014AbiKWJDV (ORCPT ); Wed, 23 Nov 2022 04:03:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65BE2102E4D for ; Wed, 23 Nov 2022 01:03:20 -0800 (PST) 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 0F4D5B81ECB for ; Wed, 23 Nov 2022 09:03:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ABF4C433B5; Wed, 23 Nov 2022 09:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1669194197; bh=Q8GKH6npxOTHbpp9AtDFm9zTce04gQ2PI5lFMHlGQe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DWhnQPZApYYJq2qgmcNi1jQ8680Ptob0Uq4VkajNKtX49n7r/CknwFRzrMtMxPx8V Yz916ux8L/sTEjvBsmCt6kEz0c5zmQquXiotCHrfSQBejH679khCbB7lyvkfeyjZD3 ImWEcwEACLPz3xt+iRSR1rJnBwIh2wDJFyR6f0p0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yang Yingliang , Wei Liu , Jiri Kosina , Sasha Levin Subject: [PATCH 4.19 003/114] HID: hyperv: fix possible memory leak in mousevsc_probe() Date: Wed, 23 Nov 2022 09:49:50 +0100 Message-Id: <20221123084551.987334504@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123084551.864610302@linuxfoundation.org> References: <20221123084551.864610302@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yang Yingliang [ Upstream commit b5bcb94b0954a026bbd671741fdb00e7141f9c91 ] If hid_add_device() returns error, it should call hid_destroy_device() to free hid_dev which is allocated in hid_allocate_device(). Fixes: 74c4fb058083 ("HID: hv_mouse: Properly add the hid device") Signed-off-by: Yang Yingliang Reviewed-by: Wei Liu Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-hyperv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c index 4d1496f60071..8f2bf70218bf 100644 --- a/drivers/hid/hid-hyperv.c +++ b/drivers/hid/hid-hyperv.c @@ -500,7 +500,7 @@ static int mousevsc_probe(struct hv_device *device, ret = hid_add_device(hid_dev); if (ret) - goto probe_err1; + goto probe_err2; ret = hid_parse(hid_dev); -- 2.35.1