linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arvind Yadav <arvind.yadav.cs@gmail.com>
To: mchehab@kernel.org, sean@mess.org, hans.verkuil@cisco.com,
	sakari.ailus@linux.intel.com, andi.shyti@samsung.com,
	andreyknvl@google.com, arnd@arndb.de, dvyukov@google.com,
	kcc@google.com
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	syzkaller@googlegroups.com
Subject: [PATCH] media: imon: Fix null-ptr-deref in imon_probe
Date: Mon,  9 Oct 2017 23:44:48 +0530	[thread overview]
Message-ID: <71782d84353db85a9fb9e45ac09f1c2b53c5a04a.1507572539.git.arvind.yadav.cs@gmail.com> (raw)

It seems that the return value of usb_ifnum_to_if() can be NULL and
needs to be checked.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
This bug report by Andrey Konovalov usb/media/imon: null-ptr-deref
in imon_probe

 drivers/media/rc/imon.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 7b3f31c..0c46155 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -2517,6 +2517,11 @@ static int imon_probe(struct usb_interface *interface,
 	mutex_lock(&driver_lock);
 
 	first_if = usb_ifnum_to_if(usbdev, 0);
+	if (!first_if) {
+		ret = -ENODEV;
+		goto fail;
+	}
+
 	first_if_ctx = usb_get_intfdata(first_if);
 
 	if (ifnum == 0) {
-- 
2.7.4

             reply	other threads:[~2017-10-09 18:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 18:14 Arvind Yadav [this message]
2017-10-10 11:26 ` [PATCH] media: imon: Fix null-ptr-deref in imon_probe Andrey Konovalov

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=71782d84353db85a9fb9e45ac09f1c2b53c5a04a.1507572539.git.arvind.yadav.cs@gmail.com \
    --to=arvind.yadav.cs@gmail.com \
    --cc=andi.shyti@samsung.com \
    --cc=andreyknvl@google.com \
    --cc=arnd@arndb.de \
    --cc=dvyukov@google.com \
    --cc=hans.verkuil@cisco.com \
    --cc=kcc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sean@mess.org \
    --cc=syzkaller@googlegroups.com \
    /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).