Эх сурвалжийг харах

nfc driver: Added mutex lock

Added mutex loc in the fucntion ese_cold_reset_ioctl
to avoid double free issues

Change-Id: I1ba7187f8339a6de5a31ef009b45556ceab46989
Signed-off-by: PRANAY BHARGAV BHAVARAJU <[email protected]>
PRANAY BHARGAV BHAVARAJU 2 жил өмнө
parent
commit
6de117e3c9
1 өөрчлөгдсөн 3 нэмэгдсэн , 0 устгасан
  1. 3 0
      nfc/ese_cold_reset.c

+ 3 - 0
nfc/ese_cold_reset.c

@@ -222,6 +222,7 @@ int ese_cold_reset_ioctl(struct nfc_dev *nfc_dev, unsigned long arg)
 	if (!cold_reset_arg)
 		return -ENOMEM;
 
+	mutex_lock(&nfc_dev->write_mutex);
 	ret = copy_struct_from_user(cold_reset_arg,
 				sizeof(struct ese_cold_reset_arg),
 				u64_to_user_ptr(ioctl_arg.buf),
@@ -394,5 +395,7 @@ err:
 	kfree(cold_reset_arg);
 	cold_reset_arg = NULL;
 
+	mutex_unlock(&nfc_dev->write_mutex);
+
 	return ret;
 }