]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
regmap: Fix reversed bounds check in regmap_raw_write()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 8 Feb 2018 07:23:44 +0000 (10:23 +0300)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 6 Jun 2018 15:48:15 +0000 (11:48 -0400)
commit923579723b6cffa864847e418ead0acba763ca55
treec0f0060aa4d1b7f99adb64e1be98106eb0575626
parent4f1870fcb9b857dfb926764b7234cbe4f2b06fa4
regmap: Fix reversed bounds check in regmap_raw_write()

BugLink: http://bugs.launchpad.net/bugs/1773233
commit f00e71091ab92eba52122332586c6ecaa9cd1a56 upstream.

We're supposed to be checking that "val_len" is not too large but
instead we check if it is smaller than the max.

The only function affected would be regmap_i2c_smbus_i2c_write() in
drivers/base/regmap/regmap-i2c.c.  Strangely that function has its own
limit check which returns an error if (count >= I2C_SMBUS_BLOCK_MAX) so
it doesn't look like it has ever been able to do anything except return
an error.

Fixes: c335931ed9d2 ("regmap: Add raw_write/read checks for max_raw_write/read sizes")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/base/regmap/regmap.c