public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
To: Akihiro TSUKADA <tskd08@gmail.com>
Cc: Colin Ian King <colin.king@canonical.com>,
	linux-media@vger.kernel.org, Antti Palosaari <crope@iki.fi>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	mika.batsman@gmail.com
Subject: Re: media: dvb-usb-v2/gl861: ensure USB message buffers DMA'able
Date: Wed, 25 Jul 2018 10:57:01 -0300	[thread overview]
Message-ID: <20180725105701.4f3b429b@coco.lan> (raw)
In-Reply-To: <d2465376-4b3e-7d3d-86d2-0cd8d7543520@gmail.com>

Em Tue, 3 Jul 2018 21:07:07 +0900
Akihiro TSUKADA <tskd08@gmail.com> escreveu:

> Hi,
> thanks for the report.
> 
> >  47        buf = NULL;
> > 
> > Condition rlen > 0, taking false branch.
> > 
> >  48        if (rlen > 0) {
> >  49                buf = kmalloc(rlen, GFP_KERNEL);
> >  50                if (!buf)
> >  51                        return -ENOMEM;
> >  52        }
> > 
> >  53        usleep_range(1000, 2000); /* avoid I2C errors */
> >  54
> >    CID 1470241 (#1 of 1): Explicit null dereferenced (FORWARD_NULL).
> > var_deref_model: Passing null pointer buf to usb_control_msg, which
> > dereferences it.
> > 
> >  55        ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0),
> > req, type,
> >  56                              value, index, buf, rlen, 2000);
> > 
> > 
> > The assignment of buf = NULL means a null buffer is passed down the usb
> > control message stack until it eventually gets dereferenced. This only
> > occurs when rlen <= 0.   I was unsure how to fix this for the case when
> > rlen <= 0, so I am flagging this up as an issue that needs fixing.
> >   
> 
> Since rlen is an u16, null pointer is passed only when rlen == 0,
> so I think it is not a problem,
> but I am OK to add a guard in order to make scan result clean.

There was another patch proposed to fix this issue with does the
right thing when rlen == 0. I rebased it on the top of the current
tree:
	https://git.linuxtv.org/media_tree.git/commit/?id=0b666e1c8120c0b17a8a68aaed58e22011f06ab3

That should cover both cases.

Thanks,
Mauro

  reply	other threads:[~2018-07-25 13:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-02 12:58 media: dvb-usb-v2/gl861: ensure USB message buffers DMA'able Colin Ian King
2018-07-03 12:07 ` Akihiro TSUKADA
2018-07-25 13:57   ` Mauro Carvalho Chehab [this message]
2018-07-27  2:00     ` Akihiro TSUKADA

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=20180725105701.4f3b429b@coco.lan \
    --to=mchehab+samsung@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=crope@iki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mika.batsman@gmail.com \
    --cc=tskd08@gmail.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