Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/810126/?format=api
{ "id": 810126, "url": "http://patchwork.ozlabs.org/api/patches/810126/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/1504615144-29770-16-git-send-email-gilad@benyossef.com/", "project": { "id": 12, "url": "http://patchwork.ozlabs.org/api/projects/12/?format=api", "name": "Linux CIFS Client", "link_name": "linux-cifs-client", "list_id": "linux-cifs.vger.kernel.org", "list_email": "linux-cifs@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1504615144-29770-16-git-send-email-gilad@benyossef.com>", "list_archive_url": null, "date": "2017-09-05T12:38:54", "name": "[v8,15/20] ima: move to generic async completion", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "15356e1dc7cf1835de78d30828486b7cd7cf11fa", "submitter": { "id": 11198, "url": "http://patchwork.ozlabs.org/api/people/11198/?format=api", "name": "Gilad Ben-Yossef", "email": "gilad@benyossef.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/1504615144-29770-16-git-send-email-gilad@benyossef.com/mbox/", "series": [ { "id": 1572, "url": "http://patchwork.ozlabs.org/api/series/1572/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=1572", "date": "2017-09-05T12:38:39", "name": "simplify crypto wait for async op", "version": 8, "mbox": "http://patchwork.ozlabs.org/series/1572/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/810126/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810126/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-cifs-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.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-cifs-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmmbH6Zfdz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 5 Sep 2017 22:43:07 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752017AbdIEMnF (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tTue, 5 Sep 2017 08:43:05 -0400", "from foss.arm.com ([217.140.101.70]:39748 \"EHLO foss.arm.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1752143AbdIEMm6 (ORCPT <rfc822;linux-cifs@vger.kernel.org>);\n\tTue, 5 Sep 2017 08:42:58 -0400", "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249])\n\tby usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 18299165D;\n\tTue, 5 Sep 2017 05:42:58 -0700 (PDT)", "from gby.kfn.arm.com (unknown [10.45.48.140])\n\tby usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id\n\t0DF643F3E1; Tue, 5 Sep 2017 05:42:48 -0700 (PDT)" ], "From": "Gilad Ben-Yossef <gilad@benyossef.com>", "To": "Herbert Xu <herbert@gondor.apana.org.au>,\n\t\"David S. Miller\" <davem@davemloft.net>,\n\tJonathan Corbet <corbet@lwn.net>, David Howells <dhowells@redhat.com>,\n\tTom Lendacky <thomas.lendacky@amd.com>, Gary Hook <gary.hook@amd.com>,\n\tBoris Brezillon <boris.brezillon@free-electrons.com>,\n\tArnaud Ebalard <arno@natisbad.org>,\n\tMatthias Brugger <matthias.bgg@gmail.com>,\n\tAlasdair Kergon <agk@redhat.com>,\n\tMike Snitzer <snitzer@redhat.com>, dm-devel@redhat.com,\n\tShaohua Li <shli@kernel.org>, Steve French <sfrench@samba.org>,\n\t\"Theodore Y. Ts'o\" <tytso@mit.edu>, Jaegeuk Kim <jaegeuk@kernel.org>,\n\tSteffen Klassert <steffen.klassert@secunet.com>,\n\tAlexey Kuznetsov <kuznet@ms2.inr.ac.ru>,\n\tHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,\n\tMimi Zohar <zohar@linux.vnet.ibm.com>,\n\tDmitry Kasatkin <dmitry.kasatkin@gmail.com>,\n\tJames Morris <james.l.morris@oracle.com>,\n\t\"Serge E. Hallyn\" <serge@hallyn.com>, linux-crypto@vger.kernel.org,\n\tlinux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tkeyrings@vger.kernel.org, linux-arm-kernel@lists.infradead.org,\n\tlinux-mediatek@lists.infradead.org, linux-raid@vger.kernel.org,\n\tlinux-cifs@vger.kernel.org, samba-technical@lists.samba.org,\n\tlinux-fscrypt@vger.kernel.org, netdev@vger.kernel.org,\n\tlinux-ima-devel@lists.sourceforge.net,\n\tlinux-ima-user@lists.sourceforge.net,\n\tlinux-security-module@vger.kernel.org", "Cc": "Ofir Drang <ofir.drang@arm.com>", "Subject": "[PATCH v8 15/20] ima: move to generic async completion", "Date": "Tue, 5 Sep 2017 15:38:54 +0300", "Message-Id": "<1504615144-29770-16-git-send-email-gilad@benyossef.com>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1504615144-29770-1-git-send-email-gilad@benyossef.com>", "References": "<1504615144-29770-1-git-send-email-gilad@benyossef.com>", "Sender": "linux-cifs-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-cifs.vger.kernel.org>", "X-Mailing-List": "linux-cifs@vger.kernel.org" }, "content": "ima starts several async crypto ops and waits for their completions.\nMove it over to generic code doing the same.\n\nSigned-off-by: Gilad Ben-Yossef <gilad@benyossef.com>\nAcked-by: Mimi Zohar <zohar@linux.vnet.ibm.com>\n---\n security/integrity/ima/ima_crypto.c | 56 +++++++++++--------------------------\n 1 file changed, 17 insertions(+), 39 deletions(-)", "diff": "diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c\nindex a856d8c..9057b16 100644\n--- a/security/integrity/ima/ima_crypto.c\n+++ b/security/integrity/ima/ima_crypto.c\n@@ -27,11 +27,6 @@\n \n #include \"ima.h\"\n \n-struct ahash_completion {\n-\tstruct completion completion;\n-\tint err;\n-};\n-\n /* minimum file size for ahash use */\n static unsigned long ima_ahash_minsize;\n module_param_named(ahash_minsize, ima_ahash_minsize, ulong, 0644);\n@@ -196,30 +191,13 @@ static void ima_free_atfm(struct crypto_ahash *tfm)\n \t\tcrypto_free_ahash(tfm);\n }\n \n-static void ahash_complete(struct crypto_async_request *req, int err)\n+static inline int ahash_wait(int err, struct crypto_wait *wait)\n {\n-\tstruct ahash_completion *res = req->data;\n \n-\tif (err == -EINPROGRESS)\n-\t\treturn;\n-\tres->err = err;\n-\tcomplete(&res->completion);\n-}\n+\terr = crypto_wait_req(err, wait);\n \n-static int ahash_wait(int err, struct ahash_completion *res)\n-{\n-\tswitch (err) {\n-\tcase 0:\n-\t\tbreak;\n-\tcase -EINPROGRESS:\n-\tcase -EBUSY:\n-\t\twait_for_completion(&res->completion);\n-\t\treinit_completion(&res->completion);\n-\t\terr = res->err;\n-\t\t/* fall through */\n-\tdefault:\n+\tif (err)\n \t\tpr_crit_ratelimited(\"ahash calculation failed: err: %d\\n\", err);\n-\t}\n \n \treturn err;\n }\n@@ -233,7 +211,7 @@ static int ima_calc_file_hash_atfm(struct file *file,\n \tint rc, read = 0, rbuf_len, active = 0, ahash_rc = 0;\n \tstruct ahash_request *req;\n \tstruct scatterlist sg[1];\n-\tstruct ahash_completion res;\n+\tstruct crypto_wait wait;\n \tsize_t rbuf_size[2];\n \n \thash->length = crypto_ahash_digestsize(tfm);\n@@ -242,12 +220,12 @@ static int ima_calc_file_hash_atfm(struct file *file,\n \tif (!req)\n \t\treturn -ENOMEM;\n \n-\tinit_completion(&res.completion);\n+\tcrypto_init_wait(&wait);\n \tahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG |\n \t\t\t\t CRYPTO_TFM_REQ_MAY_SLEEP,\n-\t\t\t\t ahash_complete, &res);\n+\t\t\t\t crypto_req_done, &wait);\n \n-\trc = ahash_wait(crypto_ahash_init(req), &res);\n+\trc = ahash_wait(crypto_ahash_init(req), &wait);\n \tif (rc)\n \t\tgoto out1;\n \n@@ -288,7 +266,7 @@ static int ima_calc_file_hash_atfm(struct file *file,\n \t\t\t * read/request, wait for the completion of the\n \t\t\t * previous ahash_update() request.\n \t\t\t */\n-\t\t\trc = ahash_wait(ahash_rc, &res);\n+\t\t\trc = ahash_wait(ahash_rc, &wait);\n \t\t\tif (rc)\n \t\t\t\tgoto out3;\n \t\t}\n@@ -304,7 +282,7 @@ static int ima_calc_file_hash_atfm(struct file *file,\n \t\t\t * read/request, wait for the completion of the\n \t\t\t * previous ahash_update() request.\n \t\t\t */\n-\t\t\trc = ahash_wait(ahash_rc, &res);\n+\t\t\trc = ahash_wait(ahash_rc, &wait);\n \t\t\tif (rc)\n \t\t\t\tgoto out3;\n \t\t}\n@@ -318,7 +296,7 @@ static int ima_calc_file_hash_atfm(struct file *file,\n \t\t\tactive = !active; /* swap buffers, if we use two */\n \t}\n \t/* wait for the last update request to complete */\n-\trc = ahash_wait(ahash_rc, &res);\n+\trc = ahash_wait(ahash_rc, &wait);\n out3:\n \tif (read)\n \t\tfile->f_mode &= ~FMODE_READ;\n@@ -327,7 +305,7 @@ static int ima_calc_file_hash_atfm(struct file *file,\n out2:\n \tif (!rc) {\n \t\tahash_request_set_crypt(req, NULL, hash->digest, 0);\n-\t\trc = ahash_wait(crypto_ahash_final(req), &res);\n+\t\trc = ahash_wait(crypto_ahash_final(req), &wait);\n \t}\n out1:\n \tahash_request_free(req);\n@@ -537,7 +515,7 @@ static int calc_buffer_ahash_atfm(const void *buf, loff_t len,\n {\n \tstruct ahash_request *req;\n \tstruct scatterlist sg;\n-\tstruct ahash_completion res;\n+\tstruct crypto_wait wait;\n \tint rc, ahash_rc = 0;\n \n \thash->length = crypto_ahash_digestsize(tfm);\n@@ -546,12 +524,12 @@ static int calc_buffer_ahash_atfm(const void *buf, loff_t len,\n \tif (!req)\n \t\treturn -ENOMEM;\n \n-\tinit_completion(&res.completion);\n+\tcrypto_init_wait(&wait);\n \tahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG |\n \t\t\t\t CRYPTO_TFM_REQ_MAY_SLEEP,\n-\t\t\t\t ahash_complete, &res);\n+\t\t\t\t crypto_req_done, &wait);\n \n-\trc = ahash_wait(crypto_ahash_init(req), &res);\n+\trc = ahash_wait(crypto_ahash_init(req), &wait);\n \tif (rc)\n \t\tgoto out;\n \n@@ -561,10 +539,10 @@ static int calc_buffer_ahash_atfm(const void *buf, loff_t len,\n \tahash_rc = crypto_ahash_update(req);\n \n \t/* wait for the update request to complete */\n-\trc = ahash_wait(ahash_rc, &res);\n+\trc = ahash_wait(ahash_rc, &wait);\n \tif (!rc) {\n \t\tahash_request_set_crypt(req, NULL, hash->digest, 0);\n-\t\trc = ahash_wait(crypto_ahash_final(req), &res);\n+\t\trc = ahash_wait(crypto_ahash_final(req), &wait);\n \t}\n out:\n \tahash_request_free(req);\n", "prefixes": [ "v8", "15/20" ] }