hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/crypto/rockchip/cryptodev_linux/ioctl.c
....@@ -131,6 +131,8 @@
131131 return -EINVAL;
132132 }
133133
134
+ memset(&keys, 0x00, sizeof(keys));
135
+
134136 switch (sop->cipher) {
135137 case 0:
136138 break;
....@@ -682,19 +684,6 @@
682684 return 0;
683685 }
684686
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
-
698687 #ifdef ENABLE_ASYNC
699688 /* enqueue a job for asynchronous completion
700689 *
....@@ -961,18 +950,19 @@
961950 case CIOCASYMFEAT:
962951 return put_user(0, p);
963952 case CRIOGET:
964
- fd = clonefd(filp);
953
+ fd = get_unused_fd_flags(0);
954
+ if (unlikely(fd < 0))
955
+ return fd;
956
+
965957 ret = put_user(fd, p);
966958 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
959
+ put_unused_fd(fd);
974960 return ret;
975961 }
962
+
963
+ get_file(filp);
964
+ fd_install(fd, filp);
965
+
976966 return ret;
977967 case CIOCGSESSION:
978968 if (unlikely(copy_from_user(&sop, arg, sizeof(sop))))