From patchwork Wed Jul 9 13:51:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 4516191 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 196B7BEEAA for ; Wed, 9 Jul 2014 13:52:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D24EA2015D for ; Wed, 9 Jul 2014 13:52:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7BD1D2015A for ; Wed, 9 Jul 2014 13:52:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755152AbaGINv7 (ORCPT ); Wed, 9 Jul 2014 09:51:59 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:47852 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753076AbaGINv6 (ORCPT ); Wed, 9 Jul 2014 09:51:58 -0400 Received: by mail-pd0-f175.google.com with SMTP id v10so8935917pde.6 for ; Wed, 09 Jul 2014 06:51:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=3vJ9JhtUNSMiSrK3VJV9cnE1102V3QSVbKdTppe5/WA=; b=0ziz3igQoiyhyd7DYWnJLWOpSorbKyxhgm+OvPqNLPMYI7nvL+eG6SzJfrGOaRLmEm cvjXz2CQ1nrPWvvLrwheI9k54N5xrKR3ZRSORnwUX0wxg77FHNkxbQDttnv9u/s4kbzr AForKGtC+tC+mbOVVNwdl9sjr4WQzHa1wvKSYkOy4K+1dHG1WTVz8Mm+bZvIHMqBeT0u 2PEAt+SuPrJsEo/5MW/l9DIg4OMD4ejbPHD6sJrjx/zXmeKvCJDs8Y9rAVhRkGuwbAhA 9zTPE4u2NPyKIZnIvDfCtrNuYXZ0GqAmEjR/ITLDVvowAF5VvQyKcDoPSFirBnO5UfKX uycQ== X-Received: by 10.70.88.230 with SMTP id bj6mr11464585pdb.40.1404913918540; Wed, 09 Jul 2014 06:51:58 -0700 (PDT) Received: from [192.168.0.100] ([61.157.216.74]) by mx.google.com with ESMTPSA id op3sm59000376pbc.40.2014.07.09.06.51.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Jul 2014 06:51:57 -0700 (PDT) Message-ID: <53BD48DF.2050506@gmail.com> Date: Wed, 09 Jul 2014 21:51:27 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: "J. Bruce Fields" CC: Linux NFS Mailing List , kinglongmee@gmail.com Subject: [PATCH] NFSD: Fix bad checking of space for padding in splice read Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix commit dc97618ddd (nfsd4: separate splice and readv cases). xdr->end and xdr->p are type of __be32 *, so padding needs one here. Signed-off-by: Kinglong Mee --- fs/nfsd/nfs4xdr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 523c666..8a2fbb2 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3067,11 +3067,8 @@ static __be32 nfsd4_encode_splice_read( __be32 nfserr; __be32 *p = xdr->p - 2; - /* - * Don't inline pages unless we know there's room for eof, - * count, and possible padding: - */ - if (xdr->end - xdr->p < 3) + /* Make sure there will be room for padding if needed */ + if (xdr->end - xdr->p < 1) return nfserr_resource; nfserr = nfsd_splice_read(read->rd_rqstp, file,