diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2016-06-29 14:03:55 (GMT) |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2016-06-29 14:03:55 (GMT) |
commit | 03bea60409328de54e4ff7ec41672e12a9cb0908 (patch) | |
tree | e63b692eeb24c559c1e9b56369b18751a7bb9d5f /net/l2tp/l2tp_ip6.c | |
parent | a4859d75944a726533ab86d24bb5ffd1b2b7d6cc (diff) | |
download | linux-03bea60409328de54e4ff7ec41672e12a9cb0908.tar.xz |
ovl: get_write_access() in truncate
When truncating a file we should check write access on the underlying
inode. And we should do so on the lower file as well (before copy-up) for
consistency.
Original patch and test case by Aihua Zhang.
- - >o >o - - test.c - - >o >o - -
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
int ret;
ret = truncate(argv[0], 4096);
if (ret != -1) {
fprintf(stderr, "truncate(argv[0]) should have failed\n");
return 1;
}
if (errno != ETXTBSY) {
perror("truncate(argv[0])");
return 1;
}
return 0;
}
- - >o >o - - >o >o - - >o >o - -
Reported-by: Aihua Zhang <zhangaihua1@huawei.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: <stable@vger.kernel.org>
Diffstat (limited to 'net/l2tp/l2tp_ip6.c')
0 files changed, 0 insertions, 0 deletions