diff options
| -rw-r--r-- | fs/fuse/dev.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index c4a3d9bbdaa8..ba76b68c52ff 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
| @@ -826,16 +826,21 @@ static int fuse_notify_poll(struct fuse_conn *fc, unsigned int size, | |||
| 826 | struct fuse_copy_state *cs) | 826 | struct fuse_copy_state *cs) |
| 827 | { | 827 | { |
| 828 | struct fuse_notify_poll_wakeup_out outarg; | 828 | struct fuse_notify_poll_wakeup_out outarg; |
| 829 | int err; | 829 | int err = -EINVAL; |
| 830 | 830 | ||
| 831 | if (size != sizeof(outarg)) | 831 | if (size != sizeof(outarg)) |
| 832 | return -EINVAL; | 832 | goto err; |
| 833 | 833 | ||
| 834 | err = fuse_copy_one(cs, &outarg, sizeof(outarg)); | 834 | err = fuse_copy_one(cs, &outarg, sizeof(outarg)); |
| 835 | if (err) | 835 | if (err) |
| 836 | return err; | 836 | goto err; |
| 837 | 837 | ||
| 838 | fuse_copy_finish(cs); | ||
| 838 | return fuse_notify_poll_wakeup(fc, &outarg); | 839 | return fuse_notify_poll_wakeup(fc, &outarg); |
| 840 | |||
| 841 | err: | ||
| 842 | fuse_copy_finish(cs); | ||
| 843 | return err; | ||
| 839 | } | 844 | } |
| 840 | 845 | ||
| 841 | static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, | 846 | static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, |
| @@ -846,6 +851,7 @@ static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, | |||
| 846 | return fuse_notify_poll(fc, size, cs); | 851 | return fuse_notify_poll(fc, size, cs); |
| 847 | 852 | ||
| 848 | default: | 853 | default: |
| 854 | fuse_copy_finish(cs); | ||
| 849 | return -EINVAL; | 855 | return -EINVAL; |
| 850 | } | 856 | } |
| 851 | } | 857 | } |
| @@ -924,7 +930,6 @@ static ssize_t fuse_dev_write(struct kiocb *iocb, const struct iovec *iov, | |||
| 924 | */ | 930 | */ |
| 925 | if (!oh.unique) { | 931 | if (!oh.unique) { |
| 926 | err = fuse_notify(fc, oh.error, nbytes - sizeof(oh), &cs); | 932 | err = fuse_notify(fc, oh.error, nbytes - sizeof(oh), &cs); |
| 927 | fuse_copy_finish(&cs); | ||
| 928 | return err ? err : nbytes; | 933 | return err ? err : nbytes; |
| 929 | } | 934 | } |
| 930 | 935 | ||
