ASoC: wm_adsp: For TLV controls only register TLV get/set
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Wed, 28 Feb 2018 10:31:10 +0000 (10:31 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Mar 2018 07:42:44 +0000 (08:42 +0100)
commit57e2eb2d13dbda924b53597a0084fb3c284348b0
treea7cab4497fd322fb109525e7a6842282fe074cc2
parent90442512a6c63ffc57323c8d5038220375115b13
ASoC: wm_adsp: For TLV controls only register TLV get/set

commit d7789f5bcdb298c4a302db471b1b20f74a20de95 upstream.

Normal 512-byte get/set of a TLV isn't supported but we were
registering the normal get/set anyway and relying on omitting
the SNDRV_CTL_ELEM_ACCESS_[READ|WRITE] flags to prevent them
being called.

Trouble is if this gets broken in the core ALSA code - as it has
been since at least 4.14 - the standard get/set can be called
unexpectedly and corrupt memory.

There's no point providing functions that won't be called and
it's a trivial change. The benefit is that if the ALSA core gets
broken again we get a big fat immediate NULL dereference instead
of a memory corruption timebomb.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/codecs/wm_adsp.c