History log of /drivers/char/tpm/tpm.c
Revision Date Author Comments
3ab1aff89477dafb1aaeafe8c8669114a02b7226 06-Dec-2011 Tim Gardner <tim.gardner@canonical.com> TPM: Zero buffer whole after copying to userspace

Commit 3321c07ae5068568cd61ac9f4ba749006a7185c9 correctly clears the TPM
buffer if the user specified read length is >= the TPM buffer length. However,
if the user specified read length is < the TPM buffer length, then part of the
TPM buffer is left uncleared.

Reported-by: Seth Forshee <seth.forshee@canonical.com>
Cc: Debora Velarde <debora@linux.vnet.ibm.com>
Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Cc: Marcel Selhorst <m.selhorst@sirrix.com>
Cc: tpmdd-devel@lists.sourceforge.net
Cc: stable@vger.kernel.org
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
be405411f712489f2f780ab085e1069e8fb85f19 18-Jan-2012 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm: fix (ACPI S3) suspend regression

This patch fixes an (ACPI S3) suspend regression introduced in commit
68d6e6713fcb ("tpm: Introduce function to poll for result of self test")
and occurring with an Infineon TPM and tpm_tis and tpm_infineon drivers
active.

The suspend problem occurred if the TPM was disabled and/or deactivated
and therefore the TPM_PCRRead checking the result of the (asynchronous)
self test returned an error code which then caused the tpm_tis driver to
become inactive and this then seemed to have negatively influenced the
suspend support by the tpm_infineon driver... Besides that the tpm_tis
drive may stay active even if the TPM is disabled and/or deactivated.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Tested-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b9e3238aa36db33aa0d0bd44ef85297c45627aac 01-Nov-2011 Rajiv Andrade <srajiv@linux.vnet.ibm.com> TPM: fix transmit_cmd error logic

It's incorrect to assume that buffers returned by the TPM
10 bytes long are always error reports. This patches
parses the error field in its header instead. The error report
is now being printed using dev_err() instead of dev_dbg(), making
it easier for users to provide more detailed bug reports.

Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
fd04886660208ab2e35baaca55588afa57d52c9c 16-Sep-2011 Rajiv Andrade <srajiv@linux.vnet.ibm.com> TPM: Export wait_for_stat for other vendor specific drivers

Moved wait_for_stat to tpm.c so that other drivers can use it.
Also renamed it to avoid future namespace conflicts.

Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
68d6e6713fcb2ea6278661aaaf5f1c9c821b3751 11-Nov-2011 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm: Introduce function to poll for result of self test

This patch introduces a function that runs the TPM_ContinueSelfTest()
function and then polls the TPM to check whether it finished the selftest
and can receive new commands.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
d97c6ade5926afb6d52df36c33a3491d62cd0dc0 11-Nov-2011 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm: Cleanup tpm_continue_selftest

Cleanup the tpm_continue_selftest function.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2b30a90f6c358714b9d6e628ac92e514917f93a1 11-Nov-2011 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm: Have tpm_get_timeouts return an error code

Have the tpm_get_timeouts function return an error code.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
3321c07ae5068568cd61ac9f4ba749006a7185c9 15-Sep-2011 Peter Huewe <huewe.external.infineon@googlemail.com> TPM: Zero buffer after copying to userspace

Since the buffer might contain security related data it might be a good idea to
zero the buffer after we have copied it to userspace.

This got assigned CVE-2011-1162.

Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Cc: Stable Kernel <stable@kernel.org>
Signed-off-by: James Morris <jmorris@namei.org>
6b07d30aca7e52f2881b8c8c20c8a2cd28e8b3d3 15-Sep-2011 Peter Huewe <huewe.external.infineon@googlemail.com> TPM: Call tpm_transmit with correct size

This patch changes the call of tpm_transmit by supplying the size of the
userspace buffer instead of TPM_BUFSIZE.

This got assigned CVE-2011-1161.

[The first hunk didn't make sense given one could expect
way less data than TPM_BUFSIZE, so added tpm_transmit boundary
check over bufsiz instead
The last parameter of tpm_transmit() reflects the amount
of data expected from the device, and not the buffer size
being supplied to it. It isn't ideal to parse it directly,
so we just set it to the maximum the input buffer can handle
and let the userspace API to do such job.]

Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Cc: Stable Kernel <stable@kernel.org>
Signed-off-by: James Morris <jmorris@namei.org>
403d1d0319ad73b5ccf251745af4c7000331a76b 23-Aug-2011 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm: suppress durations sysfs output if not read

Suppress the output in the 'durations' sysfs entry if they were not read
during driver initialization. This is similar to other sysfs entries
that return nothing if for some reason sending the commands to the TPM
fails.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
c9206693457a946698e1d67db2b424e1d101493d 30-Mar-2011 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm: Fix a typo

This patch fixes a typo.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
5a79444f24cb169b79f0f346482a42ab28329bae 30-Mar-2011 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm: Fix display of data in pubek sysfs entry

This patch fixes the TPM's pubek sysfs entry that is accessible as long
as the TPM doesn't have an owner. It was necessary to shift the access to the
data by -10 -- the first byte immediately follows the 10 byte header. The
line

data = tpm_cmd.params.readpubek_out_buffer;

sets it at the offset '10' in the packet, so we can read the data array
starting at offset '0'.

Before:

Algorithm: 00 0C 00 00
Encscheme: 08 00
Sigscheme: 00 00
Parameters: 00 00 00 00 01 00 AC E2 5E 3C A0 78
Modulus length: -563306801
Modulus:
28 21 08 0F 82 CD F2 B1 E7 49 F7 74 70 BE 59 8C
43 78 B1 24 EA 52 E2 FE 52 5C 3A 12 3B DC 61 71
[...]

After:

Algorithm: 00 00 00 01
Encscheme: 00 03
Sigscheme: 00 01
Parameters: 00 00 08 00 00 00 00 02 00 00 00 00
Modulus length: 256
Modulus:
AC E2 5E 3C A0 78 DE 6C 9E CF 28 21 08 0F 82 CD
F2 B1 E7 49 F7 74 70 BE 59 8C 43 78 B1 24 EA 52
[...]

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
6259210176510c64251a314ffb74834a790f09a0 30-Mar-2011 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm_tis: Add timeouts sysfs entry

Display the TPM's interface timeouts in a 'timeouts' sysfs entry. Display
the entries as having been adjusted when they were scaled due to their values
being reported in milliseconds rather than microseconds.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
e3e1a1e169d4e7f73c60ded937ebe24526bc6427 30-Mar-2011 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm: Adjust interface timeouts if they are too small

Adjust the interface timeouts if they are found to be too small, i.e., if
they are returned in milliseconds rather than microseconds as we heared
from Infineon that some (old) Infineon TPMs do.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
829bf0675272d24ba0056f5f79e09544464f0c8d 30-Mar-2011 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm: Use interface timeouts returned from the TPM

The TPM driver currently discards the interface timeout values returned
from the TPM. The check of the response packet needs to consider that
the return_code field is 0 on success and the size of the expected
packet is equivalent to the header size + u32 length indicator for the
TPM_GetCapability() result + 4 interface timeout indicators of type u32.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
04ab2293bbd36fc04060da93058cef7789414585 30-Mar-2011 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm_tis: Introduce durations sysfs entry

Display the TPM's command timeouts in a 'durations' sysfs entry. Display
the entries as having been adjusted when they were scaled due to their values
being reported in milliseconds rather than microseconds.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Tested-by: Guillaume Chazarain <guichaz@gmail.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
e934acca1ee993e1d99d7dc203569a6e5cdfb392 30-Mar-2011 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm: Adjust the durations if they are too small

Adjust the durations if they are found to be too small, i.e., if they are
returned in milliseconds rather than microseconds as some Infineon TPMs are
reported to do.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
979b140614a5459f340f5f8b1641ef77c863d899 30-Mar-2011 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm: Use durations returned from TPM

The TPM driver currently discards the durations values returned
from the TPM. The check of the response packet needs to consider that
the return_code field is 0 on success and the size of the expected
packet is equivalent to the header size + u32 length indicator for the
TPM_GetCapability() result + 3 timeout indicators of type u32.

v4:
- sysfs entry 'durations' is now a patch of its own
- the work-around for TPMs reporting durations in milliseconds is now in a
patch of its own

v3:
- sysfs entry now called 'durations' to resemble TPM-speak (previously
was called 'timeouts')

v2:
- adjusting all timeouts for TPM devices reporting timeouts in msec rather
than usec
- also displaying in sysfs whether the timeouts are 'original' or 'adjusted'

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Tested-by: Guillaume Chazarain <guichaz@gmail.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
1309d7afbed112f0e8e90be9af975550caa0076b 29-Mar-2011 Peter Huewe <huewe.external.infineon@googlemail.com> char/tpm: Fix unitialized usage of data buffer

This patch fixes information leakage to the userspace by initializing
the data buffer to zero.

Reported-by: Peter Huewe <huewe.external@infineon.com>
Signed-off-by: Peter Huewe <huewe.external@infineon.com>
Signed-off-by: Marcel Selhorst <m.selhorst@sirrix.com>
[ Also removed the silly "* sizeof(u8)". If that isn't 1, we have way
deeper problems than a simple multiplication can fix. - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8d1dc20e8d689c7e6a0a4d2c94e36a99d5793ecb 01-Mar-2011 Linus Torvalds <torvalds@linux-foundation.org> Revert "TPM: Long default timeout fix"

This reverts commit c4ff4b829ef9e6353c0b133b7adb564a68054979.

Ted Ts'o reports:

"TPM is working for me so I can log into employer's network in 2.6.37.
It broke when I tried 2.6.38-rc6, with the following relevant lines
from my dmesg:

[ 11.081627] tpm_tis 00:0b: 1.2 TPM (device-id 0x0, rev-id 78)
[ 25.734114] tpm_tis 00:0b: Operation Timed out
[ 78.040949] tpm_tis 00:0b: Operation Timed out

This caused me to get suspicious, especially since the _other_ TPM
commit in 2.6.38 had already been reverted, so I tried reverting
commit c4ff4b829e: "TPM: Long default timeout fix". With this commit
reverted, my TPM on my Lenovo T410 is once again working."

Requested-and-tested-by: Theodore Ts'o <tytso@mit.edu>
Acked-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
e58713724059da7d2982d6ad945192c8fca5b729 20-Feb-2011 Linus Torvalds <torvalds@linux-foundation.org> Revert "tpm_tis: Use timeouts returned from TPM"

This reverts commit 9b29050f8f75916f974a2d231ae5d3cd59792296.

It has caused hibernate regressions, for example Juri Sladby's report:

"I'm unable to hibernate 2.6.37.1 unless I rmmod tpm_tis:
[10974.074587] Suspending console(s) (use no_console_suspend to debug)
[10974.103073] tpm_tis 00:0c: Operation Timed out
[10974.103089] legacy_suspend(): pnp_bus_suspend+0x0/0xa0 returns -62
[10974.103095] PM: Device 00:0c failed to freeze: error -62"

and Rafael points out that some of the new conditionals in that commit
seem to make no sense. This commit needs more work and testing, let's
revert it for now.

Reported-by: Norbert Preining <preining@logic.at>
Reported-and-requested-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: Guillaume Chazarain <guichaz@gmail.com>
Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9b29050f8f75916f974a2d231ae5d3cd59792296 11-Jan-2011 Stefan Berger <stefanb@linux.vnet.ibm.com> tpm_tis: Use timeouts returned from TPM

The current TPM TIS driver in git discards the timeout values returned
from the TPM. The check of the response packet needs to consider that
the return_code field is 0 on success and the size of the expected
packet is equivalent to the header size + u32 length indicator for the
TPM_GetCapability() result + 3 timeout indicators of type u32.

I am also adding a sysfs entry 'timeouts' showing the timeouts that are
being used.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Tested-by: Guillaume Chazarain <guichaz@gmail.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
c4ff4b829ef9e6353c0b133b7adb564a68054979 12-Nov-2010 Rajiv Andrade <srajiv@linux.vnet.ibm.com> TPM: Long default timeout fix

If duration variable value is 0 at this point, it's because
chip->vendor.duration wasn't filled by tpm_get_timeouts() yet.
This patch sets then the lowest timeout just to give enough
time for tpm_get_timeouts() to further succeed.

This fix avoids long boot times in case another entity attempts
to send commands to the TPM when the TPM isn't accessible.

Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
2e5c44c92046c41607794666ffc0d6945945acb0 24-Dec-2010 Tejun Heo <tj@kernel.org> tpm: don't use flush_scheduled_work()

flush_scheduled_work() is deprecated and scheduled to be removed.
Directly flush chip->work instead.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Debora Velarde <debora@linux.vnet.ibm.com>
Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
c749ba912e87ccebd674ae24b97462176c63732e 24-Nov-2010 Mimi Zohar <zohar@linux.vnet.ibm.com> key: add tpm_send command

Add internal kernel tpm_send() command used to seal/unseal keys.

Changelog:
- replaced module_put in tpm_send() with new tpm_chip_put() wrapper
(suggested by David Howells)
- Make tpm_send() cmd argument a 'void *' (suggested by David Howells)

Signed-off-by: David Safford <safford@watson.ibm.com>
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: Serge E. Hallyn <serge.hallyn@canonical.com>
Signed-off-by: James Morris <jmorris@namei.org>
a0e39349d80d8b5deeb264fb190bd064f7063252 23-Nov-2010 Mimi Zohar <zohar@linux.vnet.ibm.com> tpm: add module_put wrapper

For readability, define a tpm_chip_put() wrapper to call module_put().
Replace existing module_put() calls with the wrapper.

(Change based on trusted/encrypted patchset review by David Howells.)

Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: David Safford <safford@watson.ibm.com>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: Serge E. Hallyn <serge.hallyn@canonical.com>
Signed-off-by: James Morris <jmorris@namei.org>
9b3056cca09529d34af2d81305b2a9c6b622ca1b 01-Oct-2010 Dmitry Torokhov <dmitry.torokhov@gmail.com> tpm: change 'tpm_suspend_pcr' to be module parameter

Fix the following warning:

drivers/char/tpm/tpm.c:1085: warning: `tpm_suspend_setup' defined but not used

and make the workaround operable in case when TPM is compiled as a module.
As a side-effect the option will be called tpm.suspend_pcr.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Cc: David Safford <safford@watson.ibm.com>
Cc: James Morris <jmorris@namei.org>
Cc: Debora Velarde <debora@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Morris <jmorris@namei.org>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
225a9be24d799aa16d543c31fb09f0c9ed1d9caa 25-Mar-2010 Rajiv Andrade <srajiv@linux.vnet.ibm.com> TPM: workaround to enforce PCR updates across suspends

Add a workaround for TPM's which fail to flush last written
PCR values in a TPM_SaveState, in preparation for suspend.

Signed-off-by: David Safford <safford@watson.ibm.com>
Acked-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
15d031c394e7bef9da4ec764e6b0330d701a0126 30-Sep-2009 Rajiv Andrade <srajiv@linux.vnet.ibm.com> TPM: fix pcrread

The previously sent patch:

http://marc.info/?l=tpmdd-devel&m=125208945007834&w=2

Had its first hunk cropped when merged, submitting only this first hunk
again.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Debora Velarde <debora@linux.vnet.ibm.com>
Cc: Marcel Selhorst <m.selhorst@sirrix.com>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Acked-by: Mimi Zohar <zohar@us.ibm.com>
Tested-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
23acb98de5a4109a60b5fe3f0439389218b039d7 30-Sep-2009 Rajiv Andrade <srajiv@linux.vnet.ibm.com> TPM: fix pcrread

The previously sent patch:

http://marc.info/?l=tpmdd-devel&m=125208945007834&w=2

Had its first hunk cropped when merged, submitting only this first hunk
again.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Debora Velarde <debora@linux.vnet.ibm.com>
Cc: Marcel Selhorst <m.selhorst@sirrix.com>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Acked-by: Mimi Zohar <zohar@us.ibm.com>
Tested-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
7f366784f5c2b8fc0658b5b374f4c63ee42c789f 24-Sep-2009 Rajiv Andrade <srajiv@linux.vnet.ibm.com> TPM: increase default TPM buffer

The TPM Working Group requested this communication buffer increase given that a
particular TPM vendor can support a TPM_SHA1Start command input bigger than the
current size.

Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
0afd9056f1b43c9fcbfdf933b263d72023d382fe 18-Sep-2009 Jason Gunthorpe <jgunthorpe@obsidianresearch.com> tpm-fixup-pcrs-sysfs-file-update

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Debora Velarde <debora@linux.vnet.ibm.com>
Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Cc: Marcel Selhorst <m.selhorst@sirrix.com>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Morris <jmorris@namei.org>
8c87df457cb58fe75b9b893007917cf8095660a0 23-Sep-2009 Jan Beulich <JBeulich@novell.com> BUILD_BUG_ON(): fix it and a couple of bogus uses of it

gcc permitting variable length arrays makes the current construct used for
BUILD_BUG_ON() useless, as that doesn't produce any diagnostic if the
controlling expression isn't really constant. Instead, this patch makes
it so that a bit field gets used here. Consequently, those uses where the
condition isn't really constant now also need fixing.

Note that in the gfp.h, kmemcheck.h, and virtio_config.h cases
MAYBE_BUILD_BUG_ON() really just serves documentation purposes - even if
the expression is compile time constant (__builtin_constant_p() yields
true), the array is still deemed of variable length by gcc, and hence the
whole expression doesn't have the intended effect.

[akpm@linux-foundation.org: make arch/sparc/include/asm/vio.h compile]
[akpm@linux-foundation.org: more nonsensical assertions in tpm.c..]
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Cc: Mimi Zohar <zohar@us.ibm.com>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
405f55712dfe464b3240d7816cc4fe4174831be2 11-Jul-2009 Alexey Dobriyan <adobriyan@gmail.com> headers: smp_lock.h redux

* Remove smp_lock.h from files which don't need it (including some headers!)
* Add smp_lock.h to files which do need it
* Make smp_lock.h include conditional in hardirq.h
It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT

This will make hardirq.h inclusion cheaper for every PREEMPT=n config
(which includes allmodconfig/allyesconfig, BTW)

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8920d5ad6ba74ae8ab020e90cc4d976980e68701 05-Feb-2009 Rajiv Andrade <srajiv@linux.vnet.ibm.com> TPM: integrity fix

Fix to function which is called by IMA, now tpm_chip_find_get() considers the case in which the machine doesn't have a TPM or, if it has, its TPM isn't enabled.

Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
659aaf2bb5496a425ba14036b5b5900f593e4484 02-Feb-2009 Rajiv Andrade <srajiv@linux.vnet.ibm.com> TPM: integrity interface

This patch adds internal kernel support for:
- reading/extending a pcr value
- looking up the tpm_chip for a given chip number

Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
0883743825e34b81f3ff78aaee3a97cba57586c5 02-Feb-2009 Rajiv Andrade <srajiv@linux.vnet.ibm.com> TPM: sysfs functions consolidation

According to Dave Hansen's comments on the tpm_show_*, some of these functions
present a pattern when allocating data[] memory space and also when setting its
content. A new function was created so that this pattern could be consolidated.
Also, replaced the data[] command vectors and its indexes by meaningful structures
as pointed out by Matt Helsley too.

Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
cbb2ed4ac61f3e3d1656db141cfced6ed38861d5 19-Oct-2008 Stephen Rothwell <sfr@canb.auug.org.au> tpm: don't export static functions

Today's linux-next build (powerpc_allyesconfig) failed like this:

drivers/char/tpm/tpm.c:1162: error: __ksymtab_tpm_dev_release causes a section type conflict

Caused by commit 253115b71fa06330bd58afbe01ccaf763a8a0cf1 ("The
tpm_dev_release function is only called for platform devices, not pnp")
which exported a static function.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
dd78c9439fc1e031835bccb934d27b978c72c536 16-Oct-2008 Andrew Morton <akpm@linux-foundation.org> drivers/char/tpm/tpm.c: fix error-path memory leak

tpm_register_hardware() leaks devname on an error path.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=11425

Reported-by: Daniel Marjamki <danielm77@spray.se>
Cc: Debora Velarde <debora@linux.vnet.ibm.com>
Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Cc: Marcel Selhorst <tpm@selhorst.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
292cf4a8a989cb564a6a5f0ba7a66e08a095afa1 16-Oct-2008 Valdis Kletnieks <valdis.kletnieks@vt.edu> tpm: work around bug in Broadcom BCM0102 chipset

Patch tpm-correct-tpm-timeouts-to-jiffies-conversion reveals a bug in the
Broadcom BCM0102 TPM chipset used in the Dell Latitude D820 - although
most of the timeouts are returned in usecs as per the spec, one is
apparently returned in msecs, which results in a too-small value leading
to a timeout when the code treats it as usecs. To prevent a regression,
we check for the known too-short value and adjust it to a value that makes
things work.

Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Cc: Marcin Obara <marcin_obara@users.sourceforge.net>
Cc: Marcel Selhorst <tpm@selhorst.net>
Cc: Kylene Jo Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9e5b1b12226d5a501fbc6706ca090e00d18a01ad 16-Oct-2008 Marcin Obara <marcin_obara@users.sourceforge.net> tpm: correct tpm timeouts to jiffies conversion

This patch fixes timeouts conversion to jiffies, by replacing
msecs_to_jiffies() calls with usecs_to_jiffies(). According to TCG TPM
Specification Version 1.2 Revision 103 (pages 166, 167) TPM timeouts and
durations are returned in microseconds (usec) not in miliseconds (msec).

This fixes a long hang while loading TPM driver, if TPM chip starts in
"Idle" state instead of "Ready" state. Without this patch - 'modprobe'
may hang for 30 seconds or more.

Signed-off-by: Marcin Obara <marcin_obara@users.sourceforge.net>
Cc: Marcel Selhorst <tpm@selhorst.net>
Cc: Kylene Jo Hall <kjhall@us.ibm.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
4bdec11f560b8f405a011288a50e65b1a81b3654 11-Oct-2008 Rajiv Andrade <srajiv@linux.vnet.ibm.com> As pointed out by Jonathan Corbet, the timer must be deleted before
flushing the work queue in order to avoid a job being submitted after the
chip had been released.

Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Morris <jmorris@namei.org>
253115b71fa06330bd58afbe01ccaf763a8a0cf1 11-Oct-2008 Rajiv Andrade <srajiv@linux.vnet.ibm.com> The tpm_dev_release function is only called for platform devices, not pnp
devices, so we implemented the .remove function for pnp ones. Since it's
code is very similar to the one inside tpm_dev_release, we've created a
helper function tpm_dev_vendor_release, which is called by both.

Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Morris <jmorris@namei.org>
f02a93645e6200a9da0f26dac8ced28c612f5e86 11-Oct-2008 Rajiv Andrade <srajiv@linux.vnet.ibm.com> Protect tpm_chip_list when transversing it.

Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Acked-by: Serge E. Hallyn <serue@us.ibm.com>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Morris <jmorris@namei.org>
dc36d32cc5bea5e985294c79995e10a159c3019a 11-Oct-2008 Rajiv Andrade <srajiv@linux.vnet.ibm.com> Renames num_open to is_open, as only one process can open the file at a time.

Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Morris <jmorris@namei.org>
f89c5edb86abfac4c914f4eb808b07684164eca0 11-Oct-2008 Rajiv Andrade <srajiv@linux.vnet.ibm.com> Remove the BKL calls from the TPM driver, which were added in the overall
misc-char-dev-BKL-pushdown.patch, as they are not needed.

Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Morris <jmorris@namei.org>
0147600172b4a5d261165d1aa5ef818d84da1557 26-Jul-2008 Michael Halcrow <mhalcrow@us.ibm.com> tpm: Use correct data types for sizes in tpm_write() and tpm_read()

Use the correct data types for the size parameters in tpm_write() and
tpm_read(). Note that rw_verify_area() makes sure that this bug cannot
be exploited to produce a buffer overrun.

Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com>
Cc: Marcel Selhorst <tpm@selhorst.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ec288bd37e1925f513db40871bc46115cf7fb733 26-Jul-2008 Marcin Obara <marcin_obara@users.sourceforge.net> tpm: increase size of internal TPM response buffers

This patch increases size of driver internal response buffers. Some TPM
responses defined in TCG TPM Specification Version 1.2 Revision 103 have
increased size and do not fit previously defined buffers. Some TPM
responses do not have fixed size, so bigger response buffers have to be
allocated. 200B buffers should be enough.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Marcin Obara <marcin_obara@users.sourceforge.net>
Cc: Marcel Selhorst <tpm@selhorst.net>
Cc: Kylene Jo Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
25368ca579905efe7f7dda43c252eb7b371de98c 20-May-2008 Arnd Bergmann <arnd@arndb.de> tpm-tpm: BKL pushdown

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
5bd91f18be2fc0dd0384fbfca6d3cdd79a8050dd 06-Feb-2008 Richard MUSIL <richard.musil@st.com> tpm.c: fix crash during device removal

The clean up procedure now uses platform device "release" callback to
handle memory clean up. For this purpose "release" function callback was
added to struct tpm_vendor_specific, so hw device driver provider can get
called when it is safe to remove all allocated resources.

This is supposed to fix a bug in device removal, where device while in
receive function (waiting on timeout) was prone to segfault, if the
tpm_chip struct was unallocated before the timeout expired (in
tpm_remove_hardware).

Acked-by: Marcel Selhorst <tpm@selhorst.net>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2490c681ea3d7f5ac3fb876f14567bf1a9e0aa87 14-Jan-2008 David Smith <dds@google.com> TPM: fix suspend and resume failure

The savestate command structure was being overwritten by the result of
running the TPM_SaveState command after one run, so make it a local
variable to the function instead of a global variable that gets
overwritten.

Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: Kent Yoder <shpedoikal@gmail.com>
Cc: Marcel Selhorst <tpm@selhorst.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8e81cc13a88ce486a6b0a6ca56aba6985824917a 22-Aug-2007 Kent Yoder <shpedoikal@gmail.com> tpmdd maintainers

Fix up the maintainers info in the tpm drivers. Kylene will be out for
some time, so copying the sourceforge list is the best way to get some
attention.

Cc: Marcel Selhorst <tpm@selhorst.net>
Cc: Kylene Jo Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d081d470446900473f2f32b9203827809b8134f0 08-May-2007 Matthias Kaehlcke <matthias.kaehlcke@gmail.com> use mutex instead of semaphore in TPM driver

The TPM driver uses two semaphores as mutexes. Use the mutex API instead of
the (binary) semaphores.

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Cc: Kylene Hall <kjhall@us.ibm.com>
Cc: Marcel Selhorst <tpm@selhorst.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8e39c933b1b7df501dbb68879fb1640e277b8a5c 08-May-2007 Parag Warudkar <pwarudkar@aol.com> tpm: fix sleep-in-spinlock

flush_scheduled_work() can sleep, and we're calling it under spinlock.

AFAICS, moving flush_scheduled_work before spin_lock() should not cause any
problems.

Reason being - The only thing that can race against tpm_release is tpm_open
(tpm_release is called when last reference to the file is closed and only
thing that can happen after that is tpm_open??) and tpm_open acquires
driver_lock and more over it bails out with EBUSY if chip->num_opens is
greater than 0.

I also moved chip->num_pending-- to after deleting timer and setting data
pending as it looks more correct for the paranoid although it probably doesn't
matter as it is guarded by driver_lock. None the less this change should not
cause problems.

While I was at it I noticed a missing NULL check in tpm_register_hardware
which is fixed with this patch as well.

Signed-off-by: Parag Warudkar <parag.warudkar@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
cd354f1ae75e6466a7e31b727faede57a1f89ca5 14-Feb-2007 Tim Schmielau <tim@physik3.uni-rostock.de> [PATCH] remove many unneeded #includes of sched.h

After Al Viro (finally) succeeded in removing the sched.h #include in module.h
recently, it makes sense again to remove other superfluous sched.h includes.
There are quite a lot of files which include it but don't actually need
anything defined in there. Presumably these includes were once needed for
macros that used to live in sched.h, but moved to other header files in the
course of cleaning it up.

To ease the pain, this time I did not fiddle with any header files and only
removed #includes from .c-files, which tend to cause less trouble.

Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
configs in arch/arm/configs on arm. I also checked that no new warnings were
introduced by the patch (actually, some warnings are removed that were emitted
by unnecessarily included header files).

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
40565f1962c5be9b9e285e05af01ab7771534868 12-Feb-2007 Jiri Slaby <jirislaby@gmail.com> [PATCH] Char: timers cleanup

- Use timer macros to set function and data members and to modify
expiration time.
- Use DEFINE_TIMER for global timers and do not init them at run-time in
these cases.
- del_timer_sync is common in most cases -- we want to wait for timer
function if it's still running.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Dave Airlie <airlied@linux.ie>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Paul Fulghum <paulkf@microgate.com>
Cc: Kylene Jo Hall <kjhall@us.ibm.com>
Cc: Wim Van Sebroeck <wim@iguana.be>
Acked-by: Dmitry Torokhov <dtor@mail.ru> (Input bits)
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
5d469ec0f40d65b2a0a704402990a43b2dafe197 07-Dec-2006 Neil Horman <nhorman@tuxdriver.com> [PATCH] Correct misc_register return code handling in several drivers

Clean up several code points in which the return code from misc_register is
not handled properly.

Several modules failed to deregister various hooks when misc_register fails,
and this patch cleans them up. Also there are a few modules that legitimately
don't care about the failure status of misc register. These drivers however
unilaterally call misc_deregister on module unload.

Since misc_register doesn't initialize the list_head in the init_routine if it
fails, the deregister operation is at risk for oopsing when list_del is
called. The initial solution was to manually init the list in the miscdev
structure in each of those modules, but the consensus in this thread was to
consolodate and do that universally inside misc_register.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Kylene Jo Hall <kjhall@us.ibm.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Olaf Hering <olh@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
94fbcded4ea0dc14cbfb222a5c68372f150d1476 28-Jul-2006 Greg Kroah-Hartman <gregkh@suse.de> Driver core: change misc class_devices to be real devices

This also ment that some of the misc drivers had to also be fixed
up as they were assuming the device was a class_device.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
c4028958b6ecad064b1a6303a6a5906d4fe48d73 22-Nov-2006 David Howells <dhowells@redhat.com> WorkStruct: make allyesconfig

Fix up for make allyesconfig.

Signed-Off-By: David Howells <dhowells@redhat.com>
f33d9bd50478c9a969b65f58feb6b69a3ad478cb 11-Oct-2006 Jeff Garzik <jeff@garzik.org> [PATCH] tpm: fix error handling

- handle sysfs error
- handle driver model errors
- de-obfuscate platform_device_register_simple() call, which included an
assignment in between two function calls, in the same C statement.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2e82636a3dd8d3cf1ba87380608da4f6a0f6ec47 14-Jul-2006 Randy Dunlap <rdunlap@xenotime.net> [PATCH] TPM: fix failure path leak

kfree(devname) on the misc_register() failure path. Otherwise it is lost
forever.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Cc: Kylene Jo Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
10685a95301d02fde2b10f6047e405c69d2af82a 22-Apr-2006 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: use clear_bit

Use set_bit() and clear_bit() for dev_mask manipulation.

Signed-off-by: Kylie Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
36b20020e537036c4f9eb5b69140c88ead5da7dc 22-Apr-2006 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: msecs_to_jiffies cleanups

The timeout and duration values used in the tpm driver are not exposed to
userspace. This patch converts the storage units to jiffies with
msecs_to_jiffies. They were always being used in jiffies so this
simplifies things removing the need for calculation all over the place.
The change necessitated a type change in the tpm_chip struct to hold
jiffies.

Signed-off-by: Kylie Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
27084efee0c3dc0eb15b5ed750aa9f1adb3983c3 22-Apr-2006 Leendert van Doorn <leendert@watson.ibm.com> [PATCH] tpm: driver for next generation TPM chips

The driver for the next generation of TPM chips version 1.2 including support
for interrupts. The Trusted Computing Group has written the TPM Interface
Specification (TIS) which defines a common interface for all manufacturer's
1.2 TPM's thus the name tpm_tis.

Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
08e96e486dd1345ae0ad70247387d0d4fd346889 22-Apr-2006 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: new 1.2 sysfs files

Many of the sysfs files were calling the TPM_GetCapability command with array.
Since for 1.2 more sysfs files of this type are coming I am generalizing the
array so there can be one array and the unique parts can be filled in just
before the command is called.

This updated version of the patch breaks the multi-value sysfs file into
separate files pointed out by Greg. It also addresses the code redundancy and
ugliness in the tpm_show_* functions pointed out on another patch by Dave
Hansen.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
9e18ee19179a7742999d0e2d4bfcba75b5562439 22-Apr-2006 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: command duration update

With the TPM 1.2 Specification, each command is classified as short, medium or
long and the chip tells you the maximum amount of time for a response to each
class of command. This patch provides and array of the classifications and a
function to determine how long the response should be waited for. Also, it
uses that information in the command processing to determine how long to poll
for. The function is exported so the 1.2 driver can use the functionality to
determine how long to wait for a DataAvailable interrupt if interrupts are
being used.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
e0dd03caf20d040a0a86b6bd74028ec9bda545f5 22-Apr-2006 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: return chip from tpm_register_hardware

Changes in the 1.2 TPM Specification make it necessary to update some fields
of the chip structure in the initialization function after it is registered
with tpm.c thus tpm_register_hardware was modified to return a pointer to the
structure. This patch makes that change and the associated changes in
tpm_atmel and tpm_nsc. The changes to tpm_infineon will be coming in a patch
from Marcel Selhorst.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
90dda520c1962d55a0e1d2571deed0d75fd6d6f1 22-Apr-2006 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: chip struct update

To assist with chip management and better support the possibility of having
multiple TPMs in the system of the same kind, the struct tpm_vendor_specific
member of the tpm_chip was changed from a pointer to an instance. This patch
changes that declaration and fixes up all accesses to the structure member
except in tpm_infineon which is coming in a patch from Marcel Selhorst.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
beed53a1aaeaae4eb93297c23f1598a726716adf 22-Apr-2006 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: reorganize sysfs files

Many of the sysfs files were calling the TPM_GetCapability command with array.
Since for 1.2 more sysfs files of this type are coming I am generalizing the
array so there can be one array and the unique parts can be filled in just
before the command is called.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
3c2f606a098b07f053904ec8b8f4d0e101c28b35 22-Apr-2006 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: spacing cleanups

The following patch set contains numerous changes to the base tpm driver
(tpm.c) to support the next generation of TPM chips. The changes include new
sysfs files because of more relevant data being available, a function to
access the timeout and duration values for the chip, and changes to make use
of those duration values. Duration in the TPM specification is defined as the
maximum amount of time the chip could take to return the results. Commands
are in one of three categories short, medium and long. Also included are
cleanups of how the commands for the sysfs files are composed to reduce a
bunch of redundant arrays.

This patch:

Fix minor spacing issues.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
55a82ab3181be039c6440d3f2f69260ad6fe2988 08-Jan-2006 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: add bios measurement log

According to the TCG specifications measurements or hashes of the BIOS code
and data are extended into TPM PCRS and a log is kept in an ACPI table of
these extensions for later validation if desired. This patch exports the
values in the ACPI table through a security-fs seq_file.

Signed-off-by: Seiji Munetoh <munetoh@jp.ibm.com>
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Signed-off-by: Reiner Sailer <sailer@us.ibm.com>
Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
ba3961152e7016237e15e3dfc18f08c1853d156b 18-Nov-2005 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: use flush_scheduled_work()

Add the necessary flush_schedule_work calls when canceling the timer.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
09e12f9f6bcd9af516d901223cebdbae58b32c9f 14-Nov-2005 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: locking fix

Use schedule_work() to avoid down()-in-timer-handler problem.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
f6a2382cec3ed9b67b01febfa85d7d72b254844a 14-Nov-2005 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: dev_mask handling fix

- Use ~, not !

- Remove unneeded cast

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
b888c87b7498557d1dbb9de3d4b8402b1bb89193 31-Oct-2005 Andrew Morton <akpm@osdl.org> [PATCH] tpm-tidies

- Various whitespace fixes

- Use kzalloc()

Acked-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
ce2c87d4f733b6fcd7b7fb1d5311c870339c9725 31-Oct-2005 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: change from pci_dev to dev power management functions

This patch is in support of moving away from the lpc bus pci_dev. The power
management prototypes used by platform drivers is different but the
functionality remains the same.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
e659a3fe2027b19ecd8abb7ad79253672763454b 31-Oct-2005 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: remove pci dependency

Since the tpm does not have it's own pci id we have been consuming the lpc
bus. This is not correct and causes problems to support non lpc bus chips.
This patch removes the dependency on pci_dev from tpm.c The subsequent patches
will stop the supported chips from registering as pci drivers.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
b4ed3e3cbb312869929cf4528d71e52629a6cacb 31-Oct-2005 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: add status function to allow non-lpc bus chips

This patch is in preparation of supporting chips that are not necessarily on
the lpc bus and thus are not accessed with inb's and outb's. The patch
replaces the call to get the chip's status in the tpm.c file with a vendor
specific status function. The patch also defines the function for each of the
current supported devices.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
9a936eb928c1a253c2e5d66b947688bdc55094a6 30-Jun-2005 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: fix bug introduced by the /proc/misc

In fixing the /proc/misc problem that was reported last week where the tpm
module name was being obfuscated in /proc/misc I introduced a bug in the
module unloading code. This patch fixes the problem.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
6f9beccb95a47a15e446f64fbb7041dc6edce4d9 25-Jun-2005 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: fix misc name memory problem

I was using invalid memory for the miscdevice.name. This patch fixes the
problem which was manifested by an ugly entry in /proc/misc.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1dda8abe6feb906306a627b170654ddd8addcdac 25-Jun-2005 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: Fix pubek parsing

Fix parsing of the PUBEK for display which was leading to showing the wrong
modulus length and modulus.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
34d6e07570ef74b965131452a862b13dfa779188 24-Jun-2005 Kylene Jo Hall <kjhall@us.ibm.com> [PATCH] tpm: improve output in sysfs files when the TPM fails

Since after reconsideration this is more debug output than an error (the
TPM is operating correctly given the current state) I have changed the
statements to dbg rather than err.

Also this patch corrects a memory leak if the error path is taken in the
tpm_show_pubek function.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
e234bc970451edc4021637fe2979b887da873f9a 24-Jun-2005 Kylene Hall <kjhall@us.ibm.com> [PATCH] tpm: add debugging output

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
e1a23c6671f2bfd6e5e112848f01334ca39ea2b1 24-Jun-2005 Kylene Hall <kjhall@us.ibm.com> [PATCH] tpm: replace odd LPC init function

Realized the tpm_lpc_init function isn't really necessary. Replaced it
with vendor specific logic to find out the address the BIOS mapped the TPM
to. This patch removes the tpm_lpc_init function, enums associated with it
and calls to it. The patch also implements the replacement functionality.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
5e976d5557d3dd1e835b8be52e6201556dcfa052 24-Jun-2005 Kylene Hall <kjhall@us.ibm.com> [PATCH] tpm: locking fixes

Add a missing lock in the register hardware and fix a misplaced lock release
release.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
d9e5b6bf9cf19e6e9f2825228136ea17bc9a051a 24-Jun-2005 Kylene Hall <kjhall@us.ibm.com> [PATCH] tpm: add cancel function

This patch provides the logic to check if an operation has been canceled while
waiting for the response to arrive.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
6659ca2ab6730c3bbb9fa495f2327b95b955decd 24-Jun-2005 Kylene Hall <kjhall@us.ibm.com> [PATCH] tpm: sysfs owernship changes

In the current driver all sysfs files end up owned by the base driver module
rather than the module that actually owns the device this is a problem if the
module is unloaded and the file is open. This patch fixes all that and lumps
the files into an attribute_group.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Yani Ioannou <yani.ioannou@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
81179bb6a54c2c626b4cbcc084ca974bb2d7f2a3 24-Jun-2005 Kylene Hall <kjhall@us.ibm.com> [PATCH] tpm: remove unnecessary __force

Remove the unnecessary use of __force.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
e2fe90666a84e6a11c541424dfa9eec20cfe5fc1 24-Jun-2005 Kylene Hall <kjhall@us.ibm.com> [PATCH] tpm: use to_pci_dev

Changes the container_of calls to 'to_pci_dev' as suggested previously.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fe3fd48384af79e7619d3c6b0a020f801ef63c3b 24-Jun-2005 Kylene Hall <kjhall@us.ibm.com> [PATCH] tpm: fix timer initialization

Fix the timer to be inited and modified properly. This work depends on the
fixing of the msleep stuff which in patch 1 of this set.

Signed-of-by: Kylene Hall <kjhall@us.ibm.com>

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2df7111fc6b0e050b06123379821ece2f8dd5bbc 24-Jun-2005 Kylene Hall <kjhall@us.ibm.com> [PATCH] tpm: large stack objects

Remove some large objects be declared on the the stack.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
5b44bd58063f7839f42a4047843e93e1fbf73cda 24-Jun-2005 Kylene Hall <kjhall@us.ibm.com> [PATCH] tpm: read return code issue

Replace an erroneous return code for the read function when no data is
available.

Signed-of-by: Kylene Hall <kjhall@us.ibm.com>

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
f87ea32ae2a986acc5258ad736ab0b55937c9489 24-Jun-2005 Kylene Hall <kjhall@us.ibm.com> [PATCH] tpm: remove unnecessary module stuff

Description: Remove unnecessary (empty) module definitions.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
dff37e4b0ad7bca3616f829c84bcf4ddd385d2c4 24-Jun-2005 Kylene Hall <kjhall@us.ibm.com> [PATCH] tpm: address missing const defs

Add "const" to several static arrays that were missing it in their
definitions.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
3122a88a242454efe72930e56a3e4d56ee534f3c 24-Jun-2005 Kylene Hall <kjhall@us.ibm.com> [PATCH] tpm: Fix concerns with TPM driver -- use enums

Convert #defines to named enums where that preference has been indicated by
other kernel developers.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
700d8bdcd0fa815b08638b1e4d43b66d60cc6a8d 24-Jun-2005 Nishanth Aravamudan <nacc@us.ibm.com> [PATCH] char/tpm: use msleep(), clean-up timers,

The TPM driver unnecessarily uses timers when it simply needs to maintain a
maximum delay via time_before(). msleep() is used instead of
schedule_timeout() to guarantee the task delays as expected. While
compile-testing, I found a typo in the driver, using tpm_chp instead of
tpm_chip. Remove the now unused timer callback function and change
TPM_TIMEOUT's units to milliseconds. Patch is compile-tested.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Acked-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
74880c063b06efd103c924abfe19d9d8fa4864c4 17-May-2005 Yani Ioannou <yani.ioannou@gmail.com> [PATCH] Driver Core: drivers/base - drivers/i2c/chips/adm1026.c: update device attribute callbacks

Signed-off-by: Yani Ioannou <yani.ioannou@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
b76be681f8b296c00f707220b9891934d5d74778 26-Apr-2005 Al Viro <viro@www.linux.org.uk> [PATCH] tpm 64bit fixes (size_t)

Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
4fd416c14c583ee6ff1e2b17ab05e7e02e170e4c 17-Apr-2005 Pavel Machek <pavel@ucw.cz> [PATCH] Fix u32 vs. pm_message_t in drivers/char

Here are fixes for drivers/char.

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!