From patchwork Tue Mar 11 21:11:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 3814211 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5D4AC9F38E for ; Tue, 11 Mar 2014 21:11:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3D3F520211 for ; Tue, 11 Mar 2014 21:11:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D75CD2020E for ; Tue, 11 Mar 2014 21:11:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755286AbaCKVLS (ORCPT ); Tue, 11 Mar 2014 17:11:18 -0400 Received: from mx11.netapp.com ([216.240.18.76]:31396 "EHLO mx11.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753644AbaCKVLR (ORCPT ); Tue, 11 Mar 2014 17:11:17 -0400 X-IronPort-AV: E=Sophos;i="4.97,633,1389772800"; d="scan'208";a="108492087" Received: from vmwexceht03-prd.hq.netapp.com ([10.106.76.241]) by mx11-out.netapp.com with ESMTP; 11 Mar 2014 14:11:17 -0700 Received: from smtp2.corp.netapp.com (10.57.159.114) by VMWEXCEHT03-PRD.hq.netapp.com (10.106.76.241) with Microsoft SMTP Server id 14.3.123.3; Tue, 11 Mar 2014 14:11:16 -0700 Received: from davros.com ([10.63.235.40]) by smtp2.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id s2BLBFqO014054; Tue, 11 Mar 2014 14:11:16 -0700 (PDT) From: Anna Schumaker To: , Subject: [PATCH] nfs: Don't assume we have a security structure Date: Tue, 11 Mar 2014 17:11:14 -0400 Message-ID: <1394572274-16474-1-git-send-email-Anna.Schumaker@netapp.com> X-Mailer: git-send-email 1.9.0 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 If the i_security field isn't set then security_dentry_init_security() won't initialize some of the values used by the security label. This causes my client to hit a BUG_ON() while encoding a label of size -2128927414. I hit this bug while testing on a client without SELinux installed. Signed-off-by: Anna Schumaker --- fs/nfs/nfs4proc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index b8cd560..994ccc2 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -105,6 +105,9 @@ nfs4_label_init_security(struct inode *dir, struct dentry *dentry, if (nfs_server_capable(dir, NFS_CAP_SECURITY_LABEL) == 0) return NULL; + if (!dir->i_security) + return NULL; + err = security_dentry_init_security(dentry, sattr->ia_mode, &dentry->d_name, (void **)&label->label, &label->len); if (err == 0)