Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/816546/?format=api
{ "id": 816546, "url": "http://patchwork.ozlabs.org/api/patches/816546/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20170920224605.22030-8-ebiggers3@gmail.com/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/projects/8/?format=api", "name": "Linux ext4 filesystem development", "link_name": "linux-ext4", "list_id": "linux-ext4.vger.kernel.org", "list_email": "linux-ext4@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170920224605.22030-8-ebiggers3@gmail.com>", "list_archive_url": null, "date": "2017-09-20T22:45:47", "name": "[07/25] fscrypt: new helper function - fscrypt_prepare_link()", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "68c39ea88304206ec97dedde22218aaae4697b09", "submitter": { "id": 65202, "url": "http://patchwork.ozlabs.org/api/people/65202/?format=api", "name": "Eric Biggers", "email": "ebiggers3@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20170920224605.22030-8-ebiggers3@gmail.com/mbox/", "series": [ { "id": 4249, "url": "http://patchwork.ozlabs.org/api/series/4249/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=4249", "date": "2017-09-20T22:45:40", "name": "fscrypt: add some higher-level helper functions", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/4249/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/816546/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/816546/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-ext4-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-ext4-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"aa/xwiIY\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyFHJ3G4kz9sRV\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 21 Sep 2017 08:47:08 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751968AbdITWrG (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 20 Sep 2017 18:47:06 -0400", "from mail-pg0-f65.google.com ([74.125.83.65]:38501 \"EHLO\n\tmail-pg0-f65.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751899AbdITWrA (ORCPT\n\t<rfc822; linux-ext4@vger.kernel.org>); Wed, 20 Sep 2017 18:47:00 -0400", "by mail-pg0-f65.google.com with SMTP id m30so2366737pgn.5;\n\tWed, 20 Sep 2017 15:46:59 -0700 (PDT)", "from ebiggers-linuxstation.kir.corp.google.com ([100.66.174.81])\n\tby smtp.gmail.com with ESMTPSA id j2sm6249pgn.26.2017.09.20.15.46.58\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 20 Sep 2017 15:46:58 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=Na+LcD6lqvx6xIGMkP2UyfXEHy8yAmp8/kQocI7xCYc=;\n\tb=aa/xwiIY8GXBx8481C4rZLmDlmE0TeccbXTwb6tmfotlLjUHHvyQ5xuKnn8oCXDkwM\n\ta+D0Dn/vmn2kRwyM185JCrksx8cN8TXTCpaMZVUquMCtcNkclH3OVilCBF43YW98y5rA\n\tfuW0tAckwilTghmbHzeuRhABDmJjKVHtN6GmweUAkDI0gsfNpGNSbchq8Q+u7vpBMRRI\n\tsRn4//MU9ENYTfyylhuTyt7KHfSZ1RubhY8Rn6+x8U8Fx74RpW6dOwyKJ4t9OYdnx5ny\n\tvcz0Jow0Dv1inbvp/jDYjmjYGk5A9rfNZu3Z/47V0oZ67oeDAGLFBf5ohh4DM5pYv53F\n\thX0g==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=Na+LcD6lqvx6xIGMkP2UyfXEHy8yAmp8/kQocI7xCYc=;\n\tb=nlbUcIx9ZMzichKdNqm02GrTdI6jVkQv/hXP7vI043LHKd2BM1+VPGCM1F6FTlg6H2\n\tu0GHbab9GpDvyFfm2MVINlKkgdc986Yv6m7hNrZ8MjGc/3+UuFlS4YGyqeq8ff7Z8YcB\n\tmZXn59fHtXu6dOSFQYasnn+lh+Tkvv62i39YuRi7rMukfxclWO2IramJ151S6KZenh84\n\tm77ZEnvKRDISt/WWuD5tTNiTVTuVfTIHE58R/moER/mStRnFi+VSLu/VeaXf6/N005Ek\n\tehytH5ntbc2SOmhGluSF+rObR7kptLscQ/MAkKA73+3A9rI/HF8BRPaz7pRn1xpYvWE+\n\tqK/A==", "X-Gm-Message-State": "AHPjjUiG8eNWYIbIhdxb4I4CCA4XoawBLNyOo+f/sdsiEfzDos+sal80\n\tCMIUDBK8gnYwJ3BtR9XAiLv4V6F8TdM=", "X-Google-Smtp-Source": "AOwi7QANmLwPyt/7LqNoZvEK8Q+r3p4fDCBZJzr0+cc5omYgnVKLPY9BkIjuQmHk+pfzzACLARwAOg==", "X-Received": "by 10.84.252.144 with SMTP id y16mr3608861pll.113.1505947619063; \n\tWed, 20 Sep 2017 15:46:59 -0700 (PDT)", "From": "Eric Biggers <ebiggers3@gmail.com>", "To": "linux-fscrypt@vger.kernel.org", "Cc": "linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,\n\tlinux-f2fs-devel@lists.sourceforge.net,\n\tlinux-mtd@lists.infradead.org, \"Theodore Y . Ts'o\" <tytso@mit.edu>,\n\tJaegeuk Kim <jaegeuk@kernel.org>, Michael Halcrow <mhalcrow@google.com>,\n\tEric Biggers <ebiggers@google.com>", "Subject": "[PATCH 07/25] fscrypt: new helper function - fscrypt_prepare_link()", "Date": "Wed, 20 Sep 2017 15:45:47 -0700", "Message-Id": "<20170920224605.22030-8-ebiggers3@gmail.com>", "X-Mailer": "git-send-email 2.14.1.821.g8fa685d3b7-goog", "In-Reply-To": "<20170920224605.22030-1-ebiggers3@gmail.com>", "References": "<20170920224605.22030-1-ebiggers3@gmail.com>", "Sender": "linux-ext4-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-ext4.vger.kernel.org>", "X-Mailing-List": "linux-ext4@vger.kernel.org" }, "content": "From: Eric Biggers <ebiggers@google.com>\n\nIntroduce a helper function which prepares to link an inode into a\npossibly-encrypted directory. It handles setting up the target\ndirectory's encryption key, then verifying that the link won't violate\nthe constraint that all files in an encrypted directory tree use the\nsame encryption policy.\n\nSigned-off-by: Eric Biggers <ebiggers@google.com>\n---\n fs/crypto/hooks.c | 15 +++++++++++++++\n include/linux/fscrypt_notsupp.h | 9 +++++++++\n include/linux/fscrypt_supp.h | 29 +++++++++++++++++++++++++++++\n 3 files changed, 53 insertions(+)", "diff": "diff --git a/fs/crypto/hooks.c b/fs/crypto/hooks.c\nindex 069088e91ea9..8b90217320dd 100644\n--- a/fs/crypto/hooks.c\n+++ b/fs/crypto/hooks.c\n@@ -47,3 +47,18 @@ int fscrypt_file_open(struct inode *inode, struct file *filp)\n \treturn err;\n }\n EXPORT_SYMBOL_GPL(fscrypt_file_open);\n+\n+int __fscrypt_prepare_link(struct inode *inode, struct inode *dir)\n+{\n+\tint err;\n+\n+\terr = fscrypt_require_key(dir);\n+\tif (err)\n+\t\treturn err;\n+\n+\tif (!fscrypt_has_permitted_context(dir, inode))\n+\t\treturn -EPERM;\n+\n+\treturn 0;\n+}\n+EXPORT_SYMBOL_GPL(__fscrypt_prepare_link);\ndiff --git a/include/linux/fscrypt_notsupp.h b/include/linux/fscrypt_notsupp.h\nindex 99e8ee6f2ce4..2cb400440be3 100644\n--- a/include/linux/fscrypt_notsupp.h\n+++ b/include/linux/fscrypt_notsupp.h\n@@ -189,4 +189,13 @@ static inline int fscrypt_file_open(struct inode *inode, struct file *filp)\n \treturn 0;\n }\n \n+static inline int fscrypt_prepare_link(struct dentry *old_dentry,\n+\t\t\t\t struct inode *dir,\n+\t\t\t\t struct dentry *dentry)\n+{\n+\tif (IS_ENCRYPTED(dir))\n+\t\treturn -EOPNOTSUPP;\n+\treturn 0;\n+}\n+\n #endif\t/* _LINUX_FSCRYPT_NOTSUPP_H */\ndiff --git a/include/linux/fscrypt_supp.h b/include/linux/fscrypt_supp.h\nindex 521f15adf83c..ebc0cc41aaf9 100644\n--- a/include/linux/fscrypt_supp.h\n+++ b/include/linux/fscrypt_supp.h\n@@ -172,4 +172,33 @@ static inline int fscrypt_require_key(struct inode *inode)\n \n extern int fscrypt_file_open(struct inode *inode, struct file *filp);\n \n+extern int __fscrypt_prepare_link(struct inode *inode, struct inode *dir);\n+\n+/**\n+ * fscrypt_prepare_link - prepare to link an inode into a possibly-encrypted directory\n+ * @old_dentry: an existing dentry for the inode being linked\n+ * @dir: the target directory\n+ * @dentry: negative dentry for the target filename\n+ *\n+ * A new link can only be added to an encrypted directory if the directory's\n+ * encryption key is available --- since otherwise we'd have no way to encrypt\n+ * the filename. Therefore, we first set up the directory's encryption key (if\n+ * not already done) and return an error if it's unavailable.\n+ *\n+ * We also verify that the link will not violate the constraint that all files\n+ * in an encrypted directory tree use the same encryption policy.\n+ *\n+ * Return: 0 on success, -ENOKEY if the directory's encryption key is missing,\n+ * -EPERM if the link would result in an inconsistent encryption policy, or\n+ * another -errno code.\n+ */\n+static inline int fscrypt_prepare_link(struct dentry *old_dentry,\n+\t\t\t\t struct inode *dir,\n+\t\t\t\t struct dentry *dentry)\n+{\n+\tif (IS_ENCRYPTED(dir))\n+\t\treturn __fscrypt_prepare_link(d_inode(old_dentry), dir);\n+\treturn 0;\n+}\n+\n #endif\t/* _LINUX_FSCRYPT_SUPP_H */\n", "prefixes": [ "07/25" ] }