]> git.karo-electronics.de Git - linux-beck.git/commit
tpm_i2c_stm_st33: fix oops when i2c client is unavailable
authorKent Yoder <key@linux.vnet.ibm.com>
Fri, 18 Jan 2013 23:42:25 +0000 (17:42 -0600)
committerKent Yoder <key@linux.vnet.ibm.com>
Tue, 5 Feb 2013 15:38:24 +0000 (09:38 -0600)
commit1fbc5e95356a4600fab3a04a82dc8bb49591aedd
treedd1a2e3d7370d592c58fdee2e983d2f80412bb07
parentd459335381eca1cb91fefb87021d3d172342e55a
tpm_i2c_stm_st33: fix oops when i2c client is unavailable

When no i2c bus exists, user-space can cause an oops by triggering a
device probe through a message sent to an i2c "new_device" sysfs entry.
Adding a check for a NULL i2c client structure in the probe function
closes the hole.

This patch also fixes accessing the NULL client struct in the print
function call reporting the error.

Reported-by: Peter Hüwe <PeterHuewe@gmx.de>
Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
drivers/char/tpm/tpm_i2c_stm_st33.c
drivers/char/tpm/tpm_i2c_stm_st33.h