• Alain Knaff's avatar
    vfs: lseek(fd, 0, SEEK_CUR) race condition · 5b6f1eb9
    Alain Knaff authored
    This patch fixes a race condition in lseek. While it is expected that
    unpredictable behaviour may result while repositioning the offset of a
    file descriptor concurrently with reading/writing to the same file
    descriptor, this should not happen when merely *reading* the file
    descriptor's offset.
    Unfortunately, the only portable way in Unix to read a file
    descriptor's offset is lseek(fd, 0, SEEK_CUR); however executing this
    concurrently with read/write may mess up the position.
    [with fixes from akpm]
    Signed-off-by: default avatarAlain Knaff <alain@knaff.lu>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>