From patchwork Wed Jul 24 14:14:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Bruce Fields" X-Patchwork-Id: 2832794 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 CC65DC0319 for ; Wed, 24 Jul 2013 14:15:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 773132024F for ; Wed, 24 Jul 2013 14:15:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A34520209 for ; Wed, 24 Jul 2013 14:15:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752196Ab3GXOO5 (ORCPT ); Wed, 24 Jul 2013 10:14:57 -0400 Received: from fieldses.org ([174.143.236.118]:42982 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750863Ab3GXOOz (ORCPT ); Wed, 24 Jul 2013 10:14:55 -0400 Received: from bfields by fieldses.org with local (Exim 4.76) (envelope-from ) id 1V1zq9-0000Mu-4O; Wed, 24 Jul 2013 10:14:53 -0400 Date: Wed, 24 Jul 2013 10:14:53 -0400 To: Trond Myklebust Cc: linux-nfs@vger.kernel.org Subject: [PATCH] NFSv4: Fix attribute length Message-ID: <20130724141453.GG23378@fieldses.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) From: "J. Bruce Fields" Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 From: "J. Bruce Fields" The calculation of attribute length fields is too high by four because it incorrectly includes the length field itself. This regression was introduced by b4a2cf76ab7c08628c62b2062dacefa496b59dfd "NFSv4: Fix a regression against the FreeBSD server" and causes OPENs to the Linux NFS server to fail with BADXDR errors (translated by the client into EIO). Signed-off-by: J. Bruce Fields --- fs/nfs/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) I thought you guys had automated testing against the Linux server? How did this slip through into upstream? --b. diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index c74d616..d6d6754 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -1118,7 +1118,7 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, len, ((char *)p - (char *)q) + 4); BUG(); } - len = (char *)p - (char *)q - (bmval_len << 2); + len = (char *)p - (char *)q - (bmval_len + 1 << 2); *q++ = htonl(bmval0); *q++ = htonl(bmval1); if (bmval_len == 3)