Linux-HyperV List
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-input@vger.kernel.org>, <linux-hyperv@vger.kernel.org>
Cc: <kys@microsoft.com>, <haiyangz@microsoft.com>,
	<sthemmin@microsoft.com>, <wei.liu@kernel.org>, <jkosina@suse.cz>,
	<yangyingliang@huawei.com>
Subject: [PATCH] HID: hyperv: fix possible memory leak in mousevsc_probe()
Date: Fri, 28 Oct 2022 21:40:43 +0800	[thread overview]
Message-ID: <20221028134043.1152629-1-yangyingliang@huawei.com> (raw)

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 <yangyingliang@huawei.com>
---
 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 e0bc73124196..ab57b49a44ed 100644
--- a/drivers/hid/hid-hyperv.c
+++ b/drivers/hid/hid-hyperv.c
@@ -499,7 +499,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.25.1


             reply	other threads:[~2022-10-28 13:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 13:40 Yang Yingliang [this message]
2022-11-01 10:45 ` [PATCH] HID: hyperv: fix possible memory leak in mousevsc_probe() Wei Liu
2022-11-02 13:34 ` Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221028134043.1152629-1-yangyingliang@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=haiyangz@microsoft.com \
    --cc=jkosina@suse.cz \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox