From patchwork Thu Dec 17 01:56:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 7868361 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1543DBEEE5 for ; Thu, 17 Dec 2015 01:58:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 370BB203E3 for ; Thu, 17 Dec 2015 01:58:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 358D7203C0 for ; Thu, 17 Dec 2015 01:58:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755737AbbLQB6Y (ORCPT ); Wed, 16 Dec 2015 20:58:24 -0500 Received: from mx2.suse.de ([195.135.220.15]:56809 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755726AbbLQB6Y (ORCPT ); Wed, 16 Dec 2015 20:58:24 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F0FEFAB12; Thu, 17 Dec 2015 01:58:22 +0000 (UTC) From: NeilBrown To: Steve Dickson Date: Thu, 17 Dec 2015 12:56:34 +1100 Subject: [PATCH 1/2] Fix uninitialised variable usage in nfs_options2pmap Cc: linux-nfs@vger.kernel.org, Andreas Schwab Message-ID: <20151217015634.19978.77514.stgit@noble> In-Reply-To: <20151217015524.19978.63114.stgit@noble> References: <20151217015524.19978.63114.stgit@noble> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 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, T_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: Andreas Schwab Commit 5bea22e33b7a introduced a regression. Prior to that commit nfs_nfs_version would set *version to 0 if NFS version wasn't specified. Since that commit, version.v_mode is set to V_DEFAULT if the NFS version isn't specified, but nfs_options2pmap uses version.major without checking v_mode. This can lead to incorrect behaviour. In particular fall-ack to v3 if server doesn't support v4 can fail. So test v_mode before using version.major. URL: https://bugzilla.opensuse.org/show_bug.cgi?id=956743 Fixes: 5bea22e33b7a ("mount.nfs: Add struct nfs_version and generalize version parsing") Signed-off-by: NeilBrown --- utils/mount/network.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/utils/mount/network.c b/utils/mount/network.c index ebc39d361e2c..8a9bf1476d51 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -1631,7 +1631,10 @@ int nfs_options2pmap(struct mount_options *options, return 0; if (!nfs_nfs_version(options, &version)) return 0; - nfs_pmap->pm_vers = version.major; + if (version.v_mode == V_DEFAULT) + nfs_pmap->pm_vers = 0; + else + nfs_pmap->pm_vers = version.major; if (!nfs_nfs_protocol(options, &nfs_pmap->pm_prot)) return 0; if (!nfs_nfs_port(options, &nfs_pmap->pm_port))