From patchwork Mon Oct 15 21:31:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 1596731 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 E1638DFB34 for ; Mon, 15 Oct 2012 21:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755263Ab2JOVcm (ORCPT ); Mon, 15 Oct 2012 17:32:42 -0400 Received: from mx2.netapp.com ([216.240.18.37]:15892 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755255Ab2JOVcl (ORCPT ); Mon, 15 Oct 2012 17:32:41 -0400 X-IronPort-AV: E=Sophos;i="4.80,590,1344236400"; d="scan'208";a="701003004" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 15 Oct 2012 14:32:41 -0700 Received: from lade.trondhjem.org.com ([10.63.228.120]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id q9FLVTtl007211; Mon, 15 Oct 2012 14:32:37 -0700 (PDT) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 09/13] NFS: Remove the BUG_ON() in the mount code Date: Mon, 15 Oct 2012 17:31:03 -0400 Message-Id: <1350336667-18770-11-git-send-email-Trond.Myklebust@netapp.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1350336667-18770-10-git-send-email-Trond.Myklebust@netapp.com> References: <1350336667-18770-1-git-send-email-Trond.Myklebust@netapp.com> <1350336667-18770-2-git-send-email-Trond.Myklebust@netapp.com> <1350336667-18770-3-git-send-email-Trond.Myklebust@netapp.com> <1350336667-18770-4-git-send-email-Trond.Myklebust@netapp.com> <1350336667-18770-5-git-send-email-Trond.Myklebust@netapp.com> <1350336667-18770-6-git-send-email-Trond.Myklebust@netapp.com> <1350336667-18770-7-git-send-email-Trond.Myklebust@netapp.com> <1350336667-18770-8-git-send-email-Trond.Myklebust@netapp.com> <1350336667-18770-9-git-send-email-Trond.Myklebust@netapp.com> <1350336667-18770-10-git-send-email-Trond.Myklebust@netapp.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Signed-off-by: Trond Myklebust --- fs/nfs/mount_clnt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index 8e65c7f..5955181 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c @@ -169,6 +169,9 @@ int nfs_mount(struct nfs_mount_request *info) (info->hostname ? info->hostname : "server"), info->dirpath); + if (strlen(info->dirpath) > MNTPATHLEN) + return -ENAMETOOLONG; + if (info->noresvport) args.flags |= RPC_CLNT_CREATE_NONPRIVPORT; @@ -242,6 +245,9 @@ void nfs_umount(const struct nfs_mount_request *info) struct rpc_clnt *clnt; int status; + if (strlen(info->dirpath) > MNTPATHLEN) + return -ENAMETOOLONG; + if (info->noresvport) args.flags |= RPC_CLNT_CREATE_NONPRIVPORT; @@ -283,7 +289,6 @@ static void encode_mntdirpath(struct xdr_stream *xdr, const char *pathname) const u32 pathname_len = strlen(pathname); __be32 *p; - BUG_ON(pathname_len > MNTPATHLEN); p = xdr_reserve_space(xdr, 4 + pathname_len); xdr_encode_opaque(p, pathname, pathname_len); }