summaryrefslogtreecommitdiffstats
path: root/sound/ac97
diff options
context:
space:
mode:
authorDing Xiang <dingxiang@cmss.chinamobile.com>2019-07-23 15:44:41 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-31 07:27:11 +0200
commit602744097b2ed21b133586d8bd937b2ce79c1949 (patch)
tree466a42226b644bf9ae89590bb75e875688bfa471 /sound/ac97
parent9845fb5a3f9069111244f6aa9438f1f5d7392df6 (diff)
downloadlinux-stable-602744097b2ed21b133586d8bd937b2ce79c1949.tar.gz
linux-stable-602744097b2ed21b133586d8bd937b2ce79c1949.tar.bz2
linux-stable-602744097b2ed21b133586d8bd937b2ce79c1949.zip
ALSA: ac97: Fix double free of ac97_codec_device
commit 607975b30db41aad6edc846ed567191aa6b7d893 upstream. put_device will call ac97_codec_release to free ac97_codec_device and other resources, so remove the kfree and other redundant code. Fixes: 74426fbff66e ("ALSA: ac97: add an ac97 bus") Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/ac97')
-rw-r--r--sound/ac97/bus.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/sound/ac97/bus.c b/sound/ac97/bus.c
index 9cbf6927abe9..ca50ff444796 100644
--- a/sound/ac97/bus.c
+++ b/sound/ac97/bus.c
@@ -125,17 +125,12 @@ static int ac97_codec_add(struct ac97_controller *ac97_ctrl, int idx,
vendor_id);
ret = device_add(&codec->dev);
- if (ret)
- goto err_free_codec;
+ if (ret) {
+ put_device(&codec->dev);
+ return ret;
+ }
return 0;
-err_free_codec:
- of_node_put(codec->dev.of_node);
- put_device(&codec->dev);
- kfree(codec);
- ac97_ctrl->codecs[idx] = NULL;
-
- return ret;
}
unsigned int snd_ac97_bus_scan_one(struct ac97_controller *adrv,