Merge "usb: gadget: f_midi: Fix use after free bug"

This commit is contained in:
Linux Build Service Account 2016-10-18 03:25:00 -07:00 committed by Gerrit - the friendly Code Review server
commit 1f7a8f328d

View file

@ -1139,6 +1139,7 @@ static void f_midi_free(struct usb_function *f)
mutex_lock(&opts->lock); mutex_lock(&opts->lock);
for (i = opts->in_ports - 1; i >= 0; --i) for (i = opts->in_ports - 1; i >= 0; --i)
kfree(midi->in_port[i]); kfree(midi->in_port[i]);
opts->func_inst.f = NULL;
kfree(midi); kfree(midi);
--opts->refcnt; --opts->refcnt;
mutex_unlock(&opts->lock); mutex_unlock(&opts->lock);