diff options
author | Oleksandr Kozaruk <alkhozar@gmail.com> | 2013-08-29 10:55:48 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-30 12:08:04 -0700 |
commit | 3a2d3d213d7c9bb427cc5bdb0de34fe18a22363e (patch) | |
tree | fbccf835005f082035fd0ab5354e65f456929800 /drivers/misc/ti-st | |
parent | 666b9adc801ef012612c4e43e0f44b2cdc1979cf (diff) | |
download | op-kernel-dev-3a2d3d213d7c9bb427cc5bdb0de34fe18a22363e.zip op-kernel-dev-3a2d3d213d7c9bb427cc5bdb0de34fe18a22363e.tar.gz |
drivers: misc: ti-st: fix potential race if st_kim_start fails
If st_kim_start() fails registered protocols should be removed. This is
done by calling st_reg_complete(), which as comment states is called
with spin lock held. But in st_register() when st_kim_start fails it
is called without holding spin lock, creating possibility of concurrent
access to st_gdata data members.
Hold spin lock while calling st_reg_complete if st_kim_start() fails.
Signed-off-by: Oleksandr Kozaruk <oleksandr.kozaruk@globallogic.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/ti-st')
-rw-r--r-- | drivers/misc/ti-st/st_core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index 0a14280..8d64b68 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -562,7 +562,9 @@ long st_register(struct st_proto_s *new_proto) if ((st_gdata->protos_registered != ST_EMPTY) && (test_bit(ST_REG_PENDING, &st_gdata->st_state))) { pr_err(" KIM failure complete callback "); + spin_lock_irqsave(&st_gdata->lock, flags); st_reg_complete(st_gdata, err); + spin_unlock_irqrestore(&st_gdata->lock, flags); clear_bit(ST_REG_PENDING, &st_gdata->st_state); } return -EINVAL; |