|
Message-Id: <20190929163028.9665-3-romain.perier@gmail.com> Date: Sun, 29 Sep 2019 18:30:14 +0200 From: Romain Perier <romain.perier@...il.com> To: kernel-hardening@...ts.openwall.com Cc: Kees Cook <keescook@...omium.org>, Romain Perier <romain.perier@...il.com> Subject: [PRE-REVIEW PATCH 02/16] crypto: ccp - Prepare to use the new tasklet API Currently, the tasklet and its "tdata" has no relationship. The future tasklet API, will no longer allow to pass an arbitrary "unsigned long" data parameter. The tasklet data structure will need to be embedded into a data structure that will be retrieved from the tasklet handler (most of the time, it is the driver data structure). This commit prepares the driver to this change. For doing so, it embeds "tasklet" into "tdata". Then, "tdata" will be recoverable from its "tasklet" field, with the tasklet API. Signed-off-by: Romain Perier <romain.perier@...il.com> --- drivers/crypto/ccp/ccp-dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index 73acf0fdb793..d0d180176f45 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c @@ -44,6 +44,7 @@ MODULE_PARM_DESC(max_devs, "Maximum number of CCPs to enable (default: all; 0 di struct ccp_tasklet_data { struct completion completion; struct ccp_cmd *cmd; + struct tasklet_struct tasklet; }; /* Human-readable error strings */ @@ -436,9 +437,8 @@ int ccp_cmd_queue_thread(void *data) struct ccp_cmd_queue *cmd_q = (struct ccp_cmd_queue *)data; struct ccp_cmd *cmd; struct ccp_tasklet_data tdata; - struct tasklet_struct tasklet; - tasklet_init(&tasklet, ccp_do_cmd_complete, (unsigned long)&tdata); + tasklet_init(&tdata.tasklet, ccp_do_cmd_complete, (unsigned long)&tdata); set_current_state(TASK_INTERRUPTIBLE); while (!kthread_should_stop()) { @@ -458,7 +458,7 @@ int ccp_cmd_queue_thread(void *data) /* Schedule the completion callback */ tdata.cmd = cmd; init_completion(&tdata.completion); - tasklet_schedule(&tasklet); + tasklet_schedule(&tdata.tasklet); wait_for_completion(&tdata.completion); } -- 2.23.0
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.