diff options
| -rw-r--r-- | fs/fuse/dev.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index ea8237513dfa..24ea19cfe07e 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
| @@ -1317,6 +1317,16 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, | |||
| 1317 | unsigned reqsize; | 1317 | unsigned reqsize; |
| 1318 | unsigned int hash; | 1318 | unsigned int hash; |
| 1319 | 1319 | ||
| 1320 | /* | ||
| 1321 | * Require sane minimum read buffer - that has capacity for fixed part | ||
| 1322 | * of any request header + negotated max_write room for data. If the | ||
| 1323 | * requirement is not satisfied return EINVAL to the filesystem server | ||
| 1324 | * to indicate that it is not following FUSE server/client contract. | ||
| 1325 | * Don't dequeue / abort any request. | ||
| 1326 | */ | ||
| 1327 | if (nbytes < max_t(size_t, FUSE_MIN_READ_BUFFER, 4096 + fc->max_write)) | ||
| 1328 | return -EINVAL; | ||
| 1329 | |||
| 1320 | restart: | 1330 | restart: |
| 1321 | spin_lock(&fiq->waitq.lock); | 1331 | spin_lock(&fiq->waitq.lock); |
| 1322 | err = -EAGAIN; | 1332 | err = -EAGAIN; |
