Netdev List
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: <dan.carpenter@oracle.com>, <andy@greyhouse.net>,
	<netdev@vger.kernel.org>, <kernel-janitors@vger.kernel.org>
Subject: Re: [patch] tehuti: using uninitialized data in bdx_ioctl_priv()
Date: Mon, 24 Jun 2013 21:24:12 +0100	[thread overview]
Message-ID: <1372105452.1896.45.camel@bwh-desktop.uk.level5networks.com> (raw)
In-Reply-To: <20130624.130145.1513695698751905735.davem@davemloft.net>

On Mon, 2013-06-24 at 13:01 -0700, David Miller wrote:
> From: Dan Carpenter <dan.carpenter@oracle.com>
> Date: Mon, 24 Jun 2013 19:05:03 +0300
> 
> > If we "cmd == SIOCDEVPRIVATE" then we use data[] without initializing
> > it.  The most common case is that we would return -EOPNOTSUPP.  The
> > other case is that we'd end up reading and writing to randomish places.
> > This requires CAP_SYS_RAWIO so it's not very bad.
> > 
> > The fix is to not allow SIOCDEVPRIVATE because it doesn't work.  I
> > returned -EOPNOTSUPP instead of -ENOTTY because that's what is used in
> > the rest of the file.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> I think the intention is to only allow SIOCDEVPRIVATE, rather than
> accept any and all values other than it which are inside of the
> private ioctl range.
> 
> The 'cmd' validation is one step, and it determines the interpretation
> of data[0].

But data is only initialised on the error path.  So this whole function
is useless.  It might as well be removed entirely.

(Also, drivers generally should not assign SIOCDEVPRIVATE+{0,1,2}, as
those numbers used to be conventionally used for MII operations.)

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


  reply	other threads:[~2013-06-24 20:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24 16:05 [patch] tehuti: using uninitialized data in bdx_ioctl_priv() Dan Carpenter
2013-06-24 20:01 ` David Miller
2013-06-24 20:24   ` Ben Hutchings [this message]
2013-06-24 23:27     ` David Miller

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=1372105452.1896.45.camel@bwh-desktop.uk.level5networks.com \
    --to=bhutchings@solarflare.com \
    --cc=andy@greyhouse.net \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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