| .. | .. |
|---|
| 131 | 131 | return -EINVAL; |
|---|
| 132 | 132 | } |
|---|
| 133 | 133 | |
|---|
| 134 | + memset(&keys, 0x00, sizeof(keys)); |
|---|
| 135 | + |
|---|
| 134 | 136 | switch (sop->cipher) { |
|---|
| 135 | 137 | case 0: |
|---|
| 136 | 138 | break; |
|---|
| .. | .. |
|---|
| 682 | 684 | return 0; |
|---|
| 683 | 685 | } |
|---|
| 684 | 686 | |
|---|
| 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 | | - |
|---|
| 698 | 687 | #ifdef ENABLE_ASYNC |
|---|
| 699 | 688 | /* enqueue a job for asynchronous completion |
|---|
| 700 | 689 | * |
|---|
| .. | .. |
|---|
| 961 | 950 | case CIOCASYMFEAT: |
|---|
| 962 | 951 | return put_user(0, p); |
|---|
| 963 | 952 | case CRIOGET: |
|---|
| 964 | | - fd = clonefd(filp); |
|---|
| 953 | + fd = get_unused_fd_flags(0); |
|---|
| 954 | + if (unlikely(fd < 0)) |
|---|
| 955 | + return fd; |
|---|
| 956 | + |
|---|
| 965 | 957 | ret = put_user(fd, p); |
|---|
| 966 | 958 | 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); |
|---|
| 974 | 960 | return ret; |
|---|
| 975 | 961 | } |
|---|
| 962 | + |
|---|
| 963 | + get_file(filp); |
|---|
| 964 | + fd_install(fd, filp); |
|---|
| 965 | + |
|---|
| 976 | 966 | return ret; |
|---|
| 977 | 967 | case CIOCGSESSION: |
|---|
| 978 | 968 | if (unlikely(copy_from_user(&sop, arg, sizeof(sop)))) |
|---|