ASoC: codecs: rt*-sdw: fix memory leak in set_sdw_stream()
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fri, 15 May 2020 21:15:30 +0000 (16:15 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:48:47 +0000 (17:48 +0200)
commitcabecf2cb63c9cb7fe0fbaa09a4c026ce5dfa350
tree28f2b8207db96874547a82713d6134eb36fbd6ae
parentc2d6e2d1a3db7f27d7f769afd2d01cd3d5605b45
ASoC: codecs: rt*-sdw: fix memory leak in set_sdw_stream()

[ Upstream commit 07b542fe831cbefce163ad1b3aa7292c8a6332b8 ]

Now that the sdw_stream is allocated in machine driver,
set_sdw_stream() is also called with a NULL argument during the
dailink shutdown.

In this case, the drivers should not allocate any memory, and just
return.

Detected with KASAN/kmemleak.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Cc: Oder Chiou <oder_chiou@realtek.com>
Cc: Shuming Fan <shumingf@realtek.com>
Cc: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200515211531.11416-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/codecs/rt1308-sdw.c
sound/soc/codecs/rt5682.c
sound/soc/codecs/rt700.c
sound/soc/codecs/rt711.c
sound/soc/codecs/rt715.c