ASoC: max9759: fix underflow in speaker_gain_control_put()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 19 Jan 2022 12:31:01 +0000 (15:31 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Feb 2022 17:30:38 +0000 (18:30 +0100)
commit5a45448ac95b715173edb1cd090ff24b6586d921
tree26ba633768b8e58ca4d2edf46199738a4d17f3e9
parent02f4597198329076f4f02f27906447a90357ae66
ASoC: max9759: fix underflow in speaker_gain_control_put()

commit 4c907bcd9dcd233da6707059d777ab389dcbd964 upstream.

Check for negative values of "priv->gain" to prevent an out of bounds
access.  The concern is that these might come from the user via:
  -> snd_ctl_elem_write_user()
    -> snd_ctl_elem_write()
      -> kctl->put()

Fixes: fa8d915172b8 ("ASoC: max9759: Add Amplifier Driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220119123101.GA9509@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/codecs/max9759.c