From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B86221C26 for ; Wed, 23 Nov 2022 09:10:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BA2DC433C1; Wed, 23 Nov 2022 09:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1669194606; bh=Gl5dXThFyGS/dzj5jXnQ+RjsRo13WKeJIIfYniAAcDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NAEWRoPr83e80hWrJbdpmxQpJN4RTlF5dzUCmSZCx72oLH4cpo1UH3REQjvjFhN8O PPge6LwFxgYuMcvff+Yugg5IUhB9zutA7uoWFxp07yJaqAXBYO1qpwAWbx0+KstS3M B9Id7S+Knh/Xu0POe6Fd3+Z52YV39MuyoNIkc9TA= 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 5.4 011/156] HID: hyperv: fix possible memory leak in mousevsc_probe() Date: Wed, 23 Nov 2022 09:49:28 +0100 Message-Id: <20221123084558.277954290@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123084557.816085212@linuxfoundation.org> References: <20221123084557.816085212@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 79a28fc91521..5928e934d734 100644 --- a/drivers/hid/hid-hyperv.c +++ b/drivers/hid/hid-hyperv.c @@ -492,7 +492,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