From patchwork Thu Sep 6 18:44:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Vagin X-Patchwork-Id: 10590943 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D93B139B for ; Thu, 6 Sep 2018 18:44:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C6C52AFDF for ; Thu, 6 Sep 2018 18:44:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FB2A2AFF3; Thu, 6 Sep 2018 18:44:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F82A2AFDF for ; Thu, 6 Sep 2018 18:44:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730502AbeIFXVU (ORCPT ); Thu, 6 Sep 2018 19:21:20 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42029 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728890AbeIFXVT (ORCPT ); Thu, 6 Sep 2018 19:21:19 -0400 Received: by mail-pf1-f193.google.com with SMTP id l9-v6so5714876pff.9 for ; Thu, 06 Sep 2018 11:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=MTFeFhEvbCtb/rEjgV7UhWU32em36fcEiYis9D33aN4=; b=Y9xEIxU3k77umZwKPTQ6GZFEFQTRbKnggdgU7Mi03YlQ7LGcXci9vLNkGM4kr10Lob 3VVivv/sWtksl16lENVRXE3Uioa/soioNgP6kEnky+ivATMvNZlyrlLIMMlB7aC2fLKk tCBnEI7Eunah0y8t7if6jAcA4IBSTZdypLUj8lq9MT7ybS7VKHGpLEG0nKkgTEc7t5OW zV4mwOsl3trkAIanqFDqXllDeVPyt1F810WbhV7F25cPlqHw5tAhvABQSLUEg5dMaOyO Skvojnd+GNfSWDRxNEje+lTsseTPwUkpxrNeYBW1YlXS73l7m8JyrgqCQjG6OgZuhJt8 EaOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=MTFeFhEvbCtb/rEjgV7UhWU32em36fcEiYis9D33aN4=; b=mc/8MT6Ziae/aOJbjh3iiHrEaiFnf+w2fv/WIst3bEw+U7gOWndcw2HtRoKkqPh2xE 6QCahjVXaZAtI99IFpRHqVCYOLwZXXmANzOlyWF1eTGNlKbiw5xlTexco8NsLN/oRurm GfMwN/WGbVtlSIRXRbNOPOc8ZlqD5Pzh561mb1hf5YZYVF5Cze23H5FUD37JtnDID1dl jGEY8v59pdSq3ze+60m04d3qkqxQ/qiqIImzd2HHWQ82kz72VZ1g1csbfYbxGvxN7LFB TUimEQpo6/Xa12ml1BPyoMGmGSu5ZrVXojiLJheEyxN3fG1bCS7ypSz6pVIxur8vdGO9 K/5w== X-Gm-Message-State: APzg51Ds8zmDEkjdScsanCS1XK1Pq4JOh9z65VNyjFrjEoVZyJhAzU28 dqQfag1fdZJ+NqDQFlj3/2UHzIaw X-Google-Smtp-Source: ANB0VdZ4VKXq0UDWeHdjsBNE2nkmexpbJH0OYAhioTVYfSNp0GimpJbo/lM03QDEhJbrBrqkdil2Hg== X-Received: by 2002:a63:d857:: with SMTP id k23-v6mr4285634pgj.106.1536259473397; Thu, 06 Sep 2018 11:44:33 -0700 (PDT) Received: from localhost.localdomain ([4.16.175.162]) by smtp.gmail.com with ESMTPSA id h4-v6sm6152547pgp.13.2018.09.06.11.44.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Sep 2018 11:44:32 -0700 (PDT) From: Andrei Vagin To: David Howells Cc: linux-fsdevel@vger.kernel.org, Andrei Vagin Subject: [PATCH dhowells/mount-api] fs: return -ENOPARAM from security_fs_context_parse_param by default Date: Thu, 6 Sep 2018 11:44:26 -0700 Message-Id: <20180906184426.32413-1-avagin@openvz.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <18703.1536228984@warthog.procyon.org.uk> References: <18703.1536228984@warthog.procyon.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andrei Vagin It returns 0 to indicate that it processed the argument and that the argument doesn't belong to the filesystem. It returns -ENOPARAM to indicate that the argument should be passed along to the filesystem. Any other error is an actual error. // David Howells Signed-off-by: Andrei Vagin --- include/linux/lsm_hooks.h | 4 ++++ include/linux/security.h | 2 +- security/security.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index ceb487c3fbc7..d333ceebf056 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -103,6 +103,10 @@ * Validate the filesystem context preparatory to applying it. This is * done after all the options have been parsed. * @fc indicates the filesystem context. + * Returns 0 to indicate that it processed the argument and that the argument + * doesn't belong to the filesystem. It returns -ENOPARAM to indicate that + * the argument should be passed along to the filesystem. Any other error is + * an actual error. * @sb_get_tree: * Assign the security to a newly created superblock. * @fc indicates the filesystem context. diff --git a/include/linux/security.h b/include/linux/security.h index dbed5326b45c..bae191a96c73 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -576,7 +576,7 @@ static inline void security_fs_context_free(struct fs_context *fc) static inline int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param) { - return 0; + return -ENOPARAM; } static inline int security_fs_context_validate(struct fs_context *fc) { diff --git a/security/security.c b/security/security.c index 94420f3616a7..64304d20aae1 100644 --- a/security/security.c +++ b/security/security.c @@ -380,7 +380,7 @@ void security_fs_context_free(struct fs_context *fc) int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param) { - return call_int_hook(fs_context_parse_param, 0, fc, param); + return call_int_hook(fs_context_parse_param, -ENOPARAM, fc, param); } int security_fs_context_validate(struct fs_context *fc)