summaryrefslogtreecommitdiff
path: root/block/genhd.c
diff options
context:
space:
mode:
authorKinglong Mee <kinglongmee@gmail.com>2015-10-16 09:22:50 (GMT)
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-10-21 20:55:47 (GMT)
commit15ae2c7bdc9a5a46999319b88a465a64d265dc40 (patch)
tree807ec1b53cd955739de97edabfadd30058f71089 /block/genhd.c
parente0a63c0bfcc6f8283377258b5d892f88abd913c1 (diff)
downloadlinux-15ae2c7bdc9a5a46999319b88a465a64d265dc40.tar.xz
nfs/blocklayout: Fix bad using of page offset in bl_read_pagelist
Blocklayout uses file offset for the read-back page's offset of first writing, it's definitely wrong, it writes data to bad address of page that cause userspace application segment fault. It must be the page base stored in header->args.pgbase. Also, the pg_offset has no influence with isect and extent length. Note: The offset of the non-first page is always zero. Ps: A test program will segment fault at read() as, #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> int main(int argc, char **argv) { char buf[2049]; char *filename = NULL; int fd = -1; if (argc < 2) { printf("Usage: %s filename\n", argv[0]); return 0; } filename = argv[1]; fd = open(filename, O_RDONLY | O_DIRECT); if (fd < 0) { printf("Open %s fail: %m\n", filename); return 1; } lseek(fd, 2048, SEEK_SET); if (read(fd, buf, sizeof(buf) - 1) != (sizeof(buf) - 1)) printf("Read 4096 bityes data from %s fail: %m\n", filename); out: close(fd); return 0; } Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'block/genhd.c')
0 files changed, 0 insertions, 0 deletions