[PATCH -next] usb: gadget: f_ncm: fix missing unlock on error in ncm_alloc()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>

Add the missing unlock before return from function ncm_alloc()
in the error handling case.

Introduced by commit e730660378be92b83288b59b824ccdace5cd2652.
(usb: gadget: f_ncm: add configfs support)

Signed-off-by: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
---
 drivers/usb/gadget/f_ncm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/f_ncm.c b/drivers/usb/gadget/f_ncm.c
index 47a5724..952177f 100644
--- a/drivers/usb/gadget/f_ncm.c
+++ b/drivers/usb/gadget/f_ncm.c
@@ -1403,6 +1403,7 @@ struct usb_function *ncm_alloc(struct usb_function_instance *fi)
 				      sizeof(ncm->ethaddr));
 	if (status < 12) { /* strlen("01234567890a") */
 		kfree(ncm);
+		mutex_unlock(&opts->lock);
 		return ERR_PTR(-EINVAL);
 	}
 	ncm_string_defs[STRING_MAC_IDX].s = ncm->ethaddr;

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux