* [bug report] tpm: add support for nonblocking operation
@ 2019-10-22 13:15 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2019-10-22 13:15 UTC (permalink / raw)
To: tadeusz.struk; +Cc: Jason Gunthorpe, linux-integrity
Hello Tadeusz Struk,
The patch 9e1b74a63f77: "tpm: add support for nonblocking operation"
from Sep 10, 2018, leads to the following static checker warning:
drivers/char/tpm/tpm-dev-common.c:222 tpm_common_write()
warn: inconsistent returns 'priv->chip->tpm_mutex'.
drivers/char/tpm/tpm-dev-common.c
184
185 /* atomic tpm command send and result receive. We only hold the ops
186 * lock during this period so that the tpm can be unregistered even if
187 * the char dev is held open.
188 */
189 if (tpm_try_get_ops(priv->chip)) {
190 ret = -EPIPE;
191 goto out;
192 }
193
194 priv->response_length = 0;
195 priv->response_read = false;
196 *off = 0;
197
198 /*
199 * If in nonblocking mode schedule an async job to send
200 * the command return the size.
201 * In case of error the err code will be returned in
202 * the subsequent read call.
203 */
204 if (file->f_flags & O_NONBLOCK) {
205 priv->command_enqueued = true;
206 queue_work(tpm_dev_wq, &priv->async_work);
207 mutex_unlock(&priv->buffer_mutex);
208 return size;
^^^^^^^^^^^
Don't we need to do a tpm_put_ops(priv->chip) before returning?
209 }
210
211 ret = tpm_dev_transmit(priv->chip, priv->space, priv->data_buffer,
212 sizeof(priv->data_buffer));
213 tpm_put_ops(priv->chip);
214
215 if (ret > 0) {
216 priv->response_length = ret;
217 mod_timer(&priv->user_read_timer, jiffies + (120 * HZ));
218 ret = size;
219 }
220 out:
221 mutex_unlock(&priv->buffer_mutex);
222 return ret;
223 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-10-22 13:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-22 13:15 [bug report] tpm: add support for nonblocking operation Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).