|
Message-ID: <201909301535.60601A26@keescook> Date: Mon, 30 Sep 2019 15:35:42 -0700 From: Kees Cook <keescook@...omium.org> To: Romain Perier <romain.perier@...il.com> Cc: kernel-hardening@...ts.openwall.com Subject: Re: [PRE-REVIEW PATCH 02/16] crypto: ccp - Prepare to use the new tasklet API On Sun, Sep 29, 2019 at 06:30:14PM +0200, Romain Perier wrote: > 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); Why not switch to tasklet_setup() here to avoid changing this again later? -Kees > > 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 > -- Kees Cook
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.