hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/crypto/rockchip/cryptodev_linux/ioctl.c
....@@ -682,19 +682,6 @@
682682 return 0;
683683 }
684684
685
-static int
686
-clonefd(struct file *filp)
687
-{
688
- int ret;
689
- ret = get_unused_fd_flags(0);
690
- if (ret >= 0) {
691
- get_file(filp);
692
- fd_install(ret, filp);
693
- }
694
-
695
- return ret;
696
-}
697
-
698685 #ifdef ENABLE_ASYNC
699686 /* enqueue a job for asynchronous completion
700687 *
....@@ -961,18 +948,19 @@
961948 case CIOCASYMFEAT:
962949 return put_user(0, p);
963950 case CRIOGET:
964
- fd = clonefd(filp);
951
+ fd = get_unused_fd_flags(0);
952
+ if (unlikely(fd < 0))
953
+ return fd;
954
+
965955 ret = put_user(fd, p);
966956 if (unlikely(ret)) {
967
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0))
968
- sys_close(fd);
969
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
970
- ksys_close(fd);
971
-#else
972
- close_fd(fd);
973
-#endif
957
+ put_unused_fd(fd);
974958 return ret;
975959 }
960
+
961
+ get_file(filp);
962
+ fd_install(fd, filp);
963
+
976964 return ret;
977965 case CIOCGSESSION:
978966 if (unlikely(copy_from_user(&sop, arg, sizeof(sop))))