From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: hverkuil@xs4all.nl
Cc: emamd001@umn.edu, smccaman@umn.edu, kjlu@umn.edu,
Navid Emamdoost <navid.emamdoost@gmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Richard Fontana <rfontana@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Allison Randal <allison@lohutok.net>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] media: usb: fix memory leak in af9005_identify_state
Date: Wed, 9 Oct 2019 10:01:47 -0500 [thread overview]
Message-ID: <20191009150150.1087-1-navid.emamdoost@gmail.com> (raw)
In-Reply-To: <6de2396d-eaa4-5cb4-9a1d-f253503bcf48@xs4all.nl>
In af9005_identify_state when returning -EIO the allocated buffer should
be released. Replace the "return -EIO" with assignment into ret and move
deb_info() under a check.
Fixes: af4e067e1dcf ("V4L/DVB (5625): Add support for the AF9005 demodulator from Afatech")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
Changes in v2:
-- Reused the error handling to release buf
-- Added Fixes tag
---
drivers/media/usb/dvb-usb/af9005.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c
index 02697d86e8c1..bc6e7659c37b 100644
--- a/drivers/media/usb/dvb-usb/af9005.c
+++ b/drivers/media/usb/dvb-usb/af9005.c
@@ -975,9 +975,10 @@ static int af9005_identify_state(struct usb_device *udev,
*cold = 1;
else if (reply == 0x02)
*cold = 0;
- else
- return -EIO;
- deb_info("Identify state cold = %d\n", *cold);
+ else
+ ret = -EIO;
+ if (!ret)
+ deb_info("Identify state cold = %d\n", *cold);
err:
kfree(buf);
--
2.17.1
prev parent reply other threads:[~2019-10-09 15:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-13 23:55 [PATCH] " Navid Emamdoost
2019-10-09 12:42 ` Hans Verkuil
2019-10-09 15:00 ` Navid Emamdoost
2019-10-09 15:01 ` Navid Emamdoost [this message]
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=20191009150150.1087-1-navid.emamdoost@gmail.com \
--to=navid.emamdoost@gmail.com \
--cc=allison@lohutok.net \
--cc=emamd001@umn.edu \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil@xs4all.nl \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rfontana@redhat.com \
--cc=smccaman@umn.edu \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®