aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShuah Khan <shuahkh@osg.samsung.com>2016-03-17 02:58:06 (GMT)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-03-29 20:26:59 (GMT)
commit8d5255640b5abae5e8b49819a8502e543b66feaa (patch)
tree83542e2312e9251e5a3d960914e129456dad09e3
parent1182bdab0a2775c49e22279c48132e0b66f1f8b1 (diff)
sound/usb: Fix memory leak in media_snd_stream_delete() during unbindmedia/v4.6-2
media_snd_stream_delete() fails to release resources during unbind. This leads to use-after-free in media_gobj_create() on a subsequent bind. [ 1445.086410] BUG: KASAN: use-after-free in media_gobj_create+0x3a1/0x470 [media] at addr ffff8801ead49998 [ 1445.086771] Call Trace: [ 1445.086779] [<ffffffff81ade373>] dump_stack+0x67/0x94 [ 1445.086785] [<ffffffff81523c29>] print_trailer+0xf9/0x150 [ 1445.086790] [<ffffffff81529644>] object_err+0x34/0x40 [ 1445.086796] [<ffffffff8152b9e1>] kasan_report_error+0x221/0x530 [ 1445.086803] [<ffffffff8152bfb3>] __asan_report_store8_noabort+0x43/0x50 [ 1445.086813] [<ffffffffa0a79341>] ? media_gobj_create+0x3a1/0x470 [media] [ 1445.086822] [<ffffffffa0a79341>] media_gobj_create+0x3a1/0x470 [media] [ 1445.086831] [<ffffffffa0a705a9>] media_device_register_entity+0x259/0x6f0 [media] [ 1445.086841] [<ffffffffa0a70350>] ? media_device_unregister_entity_notify+0x100/0x100 [media] [ 1445.086846] [<ffffffff81526232>] ? ___slab_alloc+0x172/0x500 [ 1445.086854] [<ffffffff81203548>] ? mark_held_locks+0xc8/0x120 [ 1445.086859] [<ffffffff81526610>] ? __slab_alloc+0x50/0x70 [ 1445.086878] [<ffffffffa0fe711c>] ? media_snd_mixer_init+0x16c/0x500 [snd_usb_audio] [ 1445.086884] [<ffffffff8152b086>] ? kasan_unpoison_shadow+0x36/0x50 [ 1445.086890] [<ffffffff8152b086>] ? kasan_unpoison_shadow+0x36/0x50 [ 1445.086895] [<ffffffff8152b0fe>] ? kasan_kmalloc+0x5e/0x70 Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Acked-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--sound/usb/media.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/usb/media.c b/sound/usb/media.c
index 44a5de9..0d03773 100644
--- a/sound/usb/media.c
+++ b/sound/usb/media.c
@@ -135,7 +135,7 @@ void media_snd_stream_delete(struct snd_usb_substream *subs)
if (mctl && mctl->media_dev) {
struct media_device *mdev;
- mdev = subs->stream->chip->media_dev;
+ mdev = mctl->media_dev;
if (mdev && media_devnode_is_registered(&mdev->devnode)) {
media_devnode_remove(mctl->intf_devnode);
media_device_unregister_entity(&mctl->media_entity);

Privacy Policy