From patchwork Fri Nov 16 17:36:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1756711 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 565704005F for ; Fri, 16 Nov 2012 17:37:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752105Ab2KPRhF (ORCPT ); Fri, 16 Nov 2012 12:37:05 -0500 Received: from mail-vb0-f46.google.com ([209.85.212.46]:40592 "EHLO mail-vb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751837Ab2KPRhF (ORCPT ); Fri, 16 Nov 2012 12:37:05 -0500 Received: by mail-vb0-f46.google.com with SMTP id ff1so3102555vbb.19 for ; Fri, 16 Nov 2012 09:37:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=jHG0+5huphZBIAGV4xPJ2WfI7gH7Mm0X8Cve+/rz/p4=; b=VMoHzn8AcIAvPOODmM76XeCAlg3rzdS77je7d6dlMBRzTS+FtMa39HVndy2SvdlY9g pSJeah3ELarRX9bAgNNQ+FScO1uyPSNiqZVCzkWbKXYf7UaOsAJy84C/j7IR55F7UDC+ a20/mT6DD2natPpau4YZeSKkjbkb+DqLzVfc2PUjKZiBPSks31VdDKeRj6kbEJNkxmny 7rEOjPoE8froGKOvf5qHYxToMpQtZ9f+YtAcBiOcP9eSMmQhFmJ2t+DXHCiJ9GD4VZET goPMIx/T7b20+LKVaOuxiTFUGwlsZJ/OyeSJnnH8Ed58rUY57HjKsBxJ0+EwEMpWBnp4 m9MQ== Received: by 10.58.116.212 with SMTP id jy20mr7888659veb.5.1353087424545; Fri, 16 Nov 2012 09:37:04 -0800 (PST) Received: from salusa.poochiereds.net (cpe-107-015-110-129.nc.res.rr.com. [107.15.110.129]) by mx.google.com with ESMTPS id u6sm1189621vdi.20.2012.11.16.09.37.02 (version=SSLv3 cipher=OTHER); Fri, 16 Nov 2012 09:37:03 -0800 (PST) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, fsauter@innominate.com, almiller_1@yahoo.co.uk Subject: [PATCH 1/6] cifs: make error on lack of a unc= option more explicit Date: Fri, 16 Nov 2012 12:36:49 -0500 Message-Id: <1353087414-32152-2-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1353087414-32152-1-git-send-email-jlayton@redhat.com> References: <1353087414-32152-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQl/CePcn5bLVzPDBsSwzvGIZSBLt5SD0+FeJ5GOiTt93OCIqBWh8DghT1c/4yX/ItH+swSc Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Error out with a clear error message if there is no unc= option. The existing code doesn't handle this in a clear fashion, and the check for a UNCip option with no UNC string is just plain wrong. Later, we'll fix the code to not require a unc= option, but for now we need this to at least clarify why people are getting errors about DFS parsing. With this change we can also get rid of some later NULL pointer checks since we know the UNC and UNCip will never be NULL there. Signed-off-by: Jeff Layton Acked-by: Pavel Shilovsky --- fs/cifs/connect.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 5c670b9..b9849ac 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -1799,6 +1799,11 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, goto cifs_parse_mount_err; } #endif + if (!vol->UNC) { + cERROR(1, "CIFS mount error: No UNC path (e.g. -o " + "unc=\\\\192.168.1.100\\public) specified"); + goto cifs_parse_mount_err; + } if (vol->UNCip == NULL) vol->UNCip = &vol->UNC[2]; @@ -2070,17 +2075,6 @@ cifs_get_tcp_session(struct smb_vol *volume_info) rc = -EINVAL; goto out_err; } - } else if (volume_info->UNCip) { - /* BB using ip addr as tcp_ses name to connect to the - DFS root below */ - cERROR(1, "Connecting to DFS root not implemented yet"); - rc = -EINVAL; - goto out_err; - } else /* which tcp_sess DFS root would we conect to */ { - cERROR(1, "CIFS mount error: No UNC path (e.g. -o " - "unc=//192.168.1.100/public) specified"); - rc = -EINVAL; - goto out_err; } /* see if we already have a matching tcp_ses */ @@ -2736,9 +2730,6 @@ cifs_match_super(struct super_block *sb, void *data) volume_info = mnt_data->vol; - if (!volume_info->UNCip || !volume_info->UNC) - goto out; - rc = cifs_fill_sockaddr((struct sockaddr *)&addr, volume_info->UNCip, strlen(volume_info->UNCip),