From patchwork Fri Mar 22 18:18:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 2322201 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D5D37DFE82 for ; Fri, 22 Mar 2013 18:18:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422830Ab3CVSSa (ORCPT ); Fri, 22 Mar 2013 14:18:30 -0400 Received: from mail-pb0-f44.google.com ([209.85.160.44]:58688 "EHLO mail-pb0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422796Ab3CVSS3 (ORCPT ); Fri, 22 Mar 2013 14:18:29 -0400 Received: by mail-pb0-f44.google.com with SMTP id wz12so3255906pbc.31 for ; Fri, 22 Mar 2013 11:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=yalCcDo3OhX+4vqdMRPUds5rCJTqrECL9oSAfKtLWTM=; b=BNi/OTklUICAPSbaO7dyj8c98wrrzFZbnt9u8xZ95FvVs26UP/xkyCw+oryvJ8FC8/ ACVFFn7XQ0fyIfSLwlz/xnlnvovpcWJJJTC9yagUs0b6egyLT6xdFJn38uMk+bhPCre8 g9tuG8+cJ6fMukk6X7i2Y1pQQ3TCXUJaG9mcNb31bx0fI1UMpKJjB8qYTi9z7HMRC0Jb 9OiwDz041xAB5f9Qu3pZUkXEXs6N+BLyELQO9i86dElTwEdNg58wMeMMzjtvfbI0qMoD YA1U3JBl6HjmUd4fmvy0yKNsbn62jBviSSHXg/P3gW7s6USIsdhq47UmaiIrzMcaYgYI DVfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=yalCcDo3OhX+4vqdMRPUds5rCJTqrECL9oSAfKtLWTM=; b=m0m5xipNDwZrOuM7B5GBohQh/X9izq1/q0Fks/W/6qyG09ket+rPLdG1pl0lMmibGY w6grTFf9vRvu6rQuPivF1kTSldARPb9Cz3BmMoYrPjMCwnAq3XycaGKjnnVVxryOw4QD UCbBloxUsXh0QbyQH4PRhtZ8ZeIwlgxYGPpeuNlNTGT0G7GuE0aWwivCXiby9OHc3XtY x5vqE6t8xGVCR6KhTb6JSAxkxw9M4yI64HgX0AW3oJSlwHfozh/t0lAgN4G1KtAkiHm6 hoTvN2Jh9uhUdGXMRfo0PAb06PcTLfopxfrUgVTYRAeYWfesTUohNWFMQS4TA7iADL6M ZR3A== X-Received: by 10.66.163.197 with SMTP id yk5mr4707992pab.78.1363976309056; Fri, 22 Mar 2013 11:18:29 -0700 (PDT) Received: from formenos.mtv.corp.google.com (formenos.mtv.corp.google.com [172.18.126.133]) by mx.google.com with ESMTPS id li15sm3887556pab.2.2013.03.22.11.18.27 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Mar 2013 11:18:28 -0700 (PDT) From: Kent Overstreet To: linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org Cc: Kent Overstreet , "J. Bruce Fields" , Al Viro , "Eric W. Biederman" , Zach Brown Subject: [PATCH] nfsd: fix bad offset use Date: Fri, 22 Mar 2013 11:18:24 -0700 Message-Id: <1363976304-26093-1-git-send-email-koverstreet@google.com> X-Mailer: git-send-email 1.8.1.3 X-Gm-Message-State: ALoCoQnD7kR6aC0Gjja0neZHDnb3Otm3AbH0+jF4pO2KXBSKyAd0KkS2Cs6k2RTcCU+PfMhe5x8FilW9cpIbxrCCi3vEIdSEZnrzQ8znWGOt26urPPmvwDX04QgRBfOBYjjjUmsFqs75FErqrGXtomiO281pBJwHhQWmt5Pjk1jjkxZ8EZOEKtC4nUsZD5ngiZtsRq26AntSOzEAvYMHntWVQMpSzBYCYg== Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org vfs_writev() updates the offset argument - but the code then passes the offset to vfs_fsync_range(). Since offset now points to the offset after what was just written, this is probably not what was intended Signed-off-by: Kent Overstreet Cc: "J. Bruce Fields" Cc: Al Viro Cc: "Eric W. Biederman" Cc: Zach Brown Reviewed-by: Zach Brown --- fs/nfsd/vfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 2a7eb53..2b2e239 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1013,6 +1013,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, int host_err; int stable = *stablep; int use_wgather; + loff_t pos = offset; dentry = file->f_path.dentry; inode = dentry->d_inode; @@ -1025,7 +1026,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, /* Write the data. */ oldfs = get_fs(); set_fs(KERNEL_DS); - host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset); + host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &pos); set_fs(oldfs); if (host_err < 0) goto out_nfserr;