From: Insu Yun <wuninsu@gmail.com>
To: sean@mess.org, mchehab@osg.samsung.com,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: taesoo@gatech.edu, yeongjin.jang@gatech.edu, insu@gatech.edu,
changwoo@gatech.edu, Insu Yun <wuninsu@gmail.com>
Subject: [PATCH] rc: correctly handling failed allocation
Date: Mon, 15 Feb 2016 21:33:11 -0500 [thread overview]
Message-ID: <1455589991-7795-1-git-send-email-wuninsu@gmail.com> (raw)
Since rc_allocate_device() uses kmalloc,
it can returns NULL, so need to check,
otherwise, NULL derefenrece can be happened.
Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
drivers/media/rc/igorplugusb.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c
index b36e515..df37cd5 100644
--- a/drivers/media/rc/igorplugusb.c
+++ b/drivers/media/rc/igorplugusb.c
@@ -191,6 +191,8 @@ static int igorplugusb_probe(struct usb_interface *intf,
usb_make_path(udev, ir->phys, sizeof(ir->phys));
rc = rc_allocate_device();
+ if (!rc)
+ goto fail;
rc->input_name = DRIVER_DESC;
rc->input_phys = ir->phys;
usb_to_input_id(udev, &rc->input_id);
@@ -213,6 +215,7 @@ static int igorplugusb_probe(struct usb_interface *intf,
ir->rc = rc;
ret = rc_register_device(rc);
if (ret) {
+fail:
dev_err(&intf->dev, "failed to register rc device: %d", ret);
rc_free_device(rc);
usb_free_urb(ir->urb);
--
1.9.1
next reply other threads:[~2016-02-16 2:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 2:33 Insu Yun [this message]
2016-02-16 10:54 ` [PATCH] rc: correctly handling failed allocation Sean Young
2016-03-03 13:02 ` Mauro Carvalho Chehab
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=1455589991-7795-1-git-send-email-wuninsu@gmail.com \
--to=wuninsu@gmail.com \
--cc=changwoo@gatech.edu \
--cc=insu@gatech.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
--cc=sean@mess.org \
--cc=taesoo@gatech.edu \
--cc=yeongjin.jang@gatech.edu \
/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;
as well as URLs for NNTP newsgroup(s).