mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Vasilyev <vasilyev@ispras.ru>
To: James Ban <James.Ban.opensource@diasemi.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org
Subject: Buffer overread in pv88090-regulator.ko
Date: Tue, 1 Aug 2017 19:05:41 +0300	[thread overview]
Message-ID: <f9ef2a3b-0e8d-199c-bc44-423ef6e963fc@ispras.ru> (raw)

Hello.

While searching for memory errors in Linux kernel I've come across
drivers/regulator/pv88090-regulator.ko module.

Buffer overread could occur at pv88090_i2c_probe():

If read from malicious device such values for conf2 and range
(e.g. 0x10000000 and 0x1000 for PV88090_ID_BUCK2) that
             conf2 = (conf2 >> PV88090_BUCK_VDAC_RANGE_SHIFT) &
                 PV88090_BUCK_VDAC_RANGE_MASK;
and
             range = (range >>
                  (PV88080_BUCK_VRANGE_GAIN_SHIFT + i - 1)) &
                 PV88080_BUCK_VRANGE_GAIN_MASK;
become 1 then
             index = ((range << 1) | conf2);
become 3, but index is used for dereference pv88090_buck_vol[3].

Should be index=3 considered as incorrect value and pv88090_i2c_probe() 
must return error,
or pv88090_buck_vol[] should be expanded?

Found by Linux Driver Verification project (linuxtesting.org).

--
Anton Vasilyev
Linux Verification Center, ISPRAS
web: http://linuxtesting.org
e-mail: vasilyev@ispras.ru

             reply	other threads:[~2017-08-01 16:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01 16:05 Anton Vasilyev [this message]
2017-08-02  2:44 ` James Seong-Won Ban

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=f9ef2a3b-0e8d-199c-bc44-423ef6e963fc@ispras.ru \
    --to=vasilyev@ispras.ru \
    --cc=James.Ban.opensource@diasemi.com \
    --cc=broonie@kernel.org \
    --cc=ldv-project@linuxtesting.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®