All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Andrey Konovalov <andreyknvl@google.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>,
	Oleh Kravchenko <oleg@kaa.org.ua>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dmitry Vyukov <dvyukov@google.com>,
	Kostya Serebryany <kcc@google.com>,
	syzkaller@googlegroups.com, Johan Hovold <johan@kernel.org>,
	stable <stable@vger.kernel.org>,
	Sri Deevi <Srinivasa.Deevi@conexant.com>
Subject: [PATCH] [media] cx231xx-cards: fix NULL-deref on missing association descriptor
Date: Thu, 21 Sep 2017 10:40:18 +0200	[thread overview]
Message-ID: <20170921084018.30510-1-johan@kernel.org> (raw)
In-Reply-To: <20170921083739.GI3198@localhost>

Make sure to check that we actually have an Interface Association
Descriptor before dereferencing it during probe to avoid dereferencing a
NULL-pointer.

Fixes: e0d3bafd0258 ("V4L/DVB (10954): Add cx231xx USB driver")
Cc: stable <stable@vger.kernel.org>     # 2.6.30
Cc: Sri Deevi <Srinivasa.Deevi@conexant.com>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/media/usb/cx231xx/cx231xx-cards.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c
index e0daa9b6c2a0..9b742d569fb5 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -1684,7 +1684,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
 	nr = dev->devno;
 
 	assoc_desc = udev->actconfig->intf_assoc[0];
-	if (assoc_desc->bFirstInterface != ifnum) {
+	if (!assoc_desc || assoc_desc->bFirstInterface != ifnum) {
 		dev_err(d, "Not found matching IAD interface\n");
 		retval = -ENODEV;
 		goto err_if;
-- 
2.14.1

  reply	other threads:[~2017-09-21  8:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20 18:54 usb/media/cx231xx: null-ptr-deref in cx231xx_usb_probe Andrey Konovalov
2017-09-21  8:37 ` Johan Hovold
2017-09-21  8:40   ` Johan Hovold [this message]
2017-09-21 14:00     ` [PATCH] [media] cx231xx-cards: fix NULL-deref on missing association descriptor 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=20170921084018.30510-1-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=Srinivasa.Deevi@conexant.com \
    --cc=andreyknvl@google.com \
    --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=oleg@kaa.org.ua \
    --cc=stable@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.