diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-11-18 14:37:46 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-12-02 20:29:12 -0500 |
commit | 9a949e8ff92246c0753b2805c2a001cb991fffe5 (patch) | |
tree | ee3c6802218a06231e165e862abf17f1c064ac84 | |
parent | c803c9c6c9e591977635b7868e45fabb1e243f98 (diff) |
cris: switch to get_user_pages_fast()
no point holding ->mmap_sem over both calls.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | arch/cris/arch-v32/drivers/cryptocop.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c index d688fe117dca..a3c353472a8c 100644 --- a/arch/cris/arch-v32/drivers/cryptocop.c +++ b/arch/cris/arch-v32/drivers/cryptocop.c | |||
@@ -2717,37 +2717,28 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig | |||
2717 | } | 2717 | } |
2718 | } | 2718 | } |
2719 | 2719 | ||
2720 | /* Acquire the mm page semaphore. */ | 2720 | err = get_user_pages_fast((unsigned long)(oper.indata + prev_ix), |
2721 | down_read(¤t->mm->mmap_sem); | ||
2722 | |||
2723 | err = get_user_pages((unsigned long int)(oper.indata + prev_ix), | ||
2724 | noinpages, | 2721 | noinpages, |
2725 | 0, /* read access only for in data */ | 2722 | false, /* read access only for in data */ |
2726 | inpages, | 2723 | inpages); |
2727 | NULL); | ||
2728 | 2724 | ||
2729 | if (err < 0) { | 2725 | if (err < 0) { |
2730 | up_read(¤t->mm->mmap_sem); | ||
2731 | nooutpages = noinpages = 0; | 2726 | nooutpages = noinpages = 0; |
2732 | DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages indata\n")); | 2727 | DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages indata\n")); |
2733 | goto error_cleanup; | 2728 | goto error_cleanup; |
2734 | } | 2729 | } |
2735 | noinpages = err; | 2730 | noinpages = err; |
2736 | if (oper.do_cipher){ | 2731 | if (oper.do_cipher) { |
2737 | err = get_user_pages((unsigned long int)oper.cipher_outdata, | 2732 | err = get_user_pages_fast((unsigned long)oper.cipher_outdata, |
2738 | nooutpages, | 2733 | nooutpages, |
2739 | FOLL_WRITE, /* write access for out data */ | 2734 | true, /* write access for out data */ |
2740 | outpages, | 2735 | outpages); |
2741 | NULL); | ||
2742 | up_read(¤t->mm->mmap_sem); | ||
2743 | if (err < 0) { | 2736 | if (err < 0) { |
2744 | nooutpages = 0; | 2737 | nooutpages = 0; |
2745 | DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages outdata\n")); | 2738 | DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages outdata\n")); |
2746 | goto error_cleanup; | 2739 | goto error_cleanup; |
2747 | } | 2740 | } |
2748 | nooutpages = err; | 2741 | nooutpages = err; |
2749 | } else { | ||
2750 | up_read(¤t->mm->mmap_sem); | ||
2751 | } | 2742 | } |
2752 | 2743 | ||
2753 | /* Add 6 to nooutpages to make room for possibly inserted buffers for storing digest and | 2744 | /* Add 6 to nooutpages to make room for possibly inserted buffers for storing digest and |