Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
linux
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martyn Welch
linux
Commits
59b69ac2
Commit
59b69ac2
authored
12 years ago
by
James Morris
Browse files
Options
Downloads
Plain Diff
Merge branch 'tpmdd-next-v3.6' of
git://github.com/shpedoikal/linux
into for-linus
parents
bb95a0d7
abce9ac2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
drivers/char/tpm/tpm.c
+14
-7
14 additions, 7 deletions
drivers/char/tpm/tpm.c
with
14 additions
and
7 deletions
drivers/char/tpm/tpm.c
+
14
−
7
View file @
59b69ac2
...
...
@@ -1182,17 +1182,20 @@ ssize_t tpm_write(struct file *file, const char __user *buf,
size_t
size
,
loff_t
*
off
)
{
struct
tpm_chip
*
chip
=
file
->
private_data
;
size_t
in_size
=
size
,
out_size
;
size_t
in_size
=
size
;
ssize_t
out_size
;
/* cannot perform a write until the read has cleared
either via tpm_read or a user_read_timer timeout
*/
while
(
atomic_read
(
&
chip
->
data_pending
)
!=
0
)
msleep
(
TPM_TIMEOUT
);
mutex_lock
(
&
chip
->
buffer_mutex
)
;
either via tpm_read or a user_read_timer timeout
.
This also prevents splitted buffered writes from blocking here.
*/
if
(
atomic_read
(
&
chip
->
data_pending
)
!=
0
)
return
-
EBUSY
;
if
(
in_size
>
TPM_BUFSIZE
)
in_size
=
TPM_BUFSIZE
;
return
-
E2BIG
;
mutex_lock
(
&
chip
->
buffer_mutex
);
if
(
copy_from_user
(
chip
->
data_buffer
,
(
void
__user
*
)
buf
,
in_size
))
{
...
...
@@ -1202,6 +1205,10 @@ ssize_t tpm_write(struct file *file, const char __user *buf,
/* atomic tpm command send and result receive */
out_size
=
tpm_transmit
(
chip
,
chip
->
data_buffer
,
TPM_BUFSIZE
);
if
(
out_size
<
0
)
{
mutex_unlock
(
&
chip
->
buffer_mutex
);
return
out_size
;
}
atomic_set
(
&
chip
->
data_pending
,
out_size
);
mutex_unlock
(
&
chip
->
buffer_mutex
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment