projects/linux·commit 6a88231f

[PATCH] ibmasm: use after free fix

6a88231f · Max Asbock <[email protected]> · 2006-03-09 17:33:48 -08:00

The kobject_put() can free the memory at *cmd, but cmd->lock points to a
persistent lock that is not freed with cmd.

Signed-off-by: Max Asbock <[email protected]>
Cc: Vernon Mauery <[email protected]>
Cc: Srihari Vijayaraghavan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
6a88231fc7da311e4da4ce2011d1a132c80c145a
Parents
a6bf5270

Changes

1 files changed · +5 −4

FileStatusAddDelContent
drivers/misc/ibmasm/ibmasm.hmodified+5−4View file

drivers/misc/ibmasm/ibmasm.h

View file
diff --git a/drivers/misc/ibmasm/ibmasm.h b/drivers/misc/ibmasm/ibmasm.h
index 1cef238..6aba419 100644
--- a/drivers/misc/ibmasm/ibmasm.h
+++ b/drivers/misc/ibmasm/ibmasm.h
@@ -101,15 +101,16 @@ struct command {
static inline void command_put(struct command *cmd)
{
unsigned long flags;
+ spinlock_t *lock = cmd->lock;
- spin_lock_irqsave(cmd->lock, flags);
- kobject_put(&cmd->kobj);
- spin_unlock_irqrestore(cmd->lock, flags);
+ spin_lock_irqsave(lock, flags);
+ kobject_put(&cmd->kobj);
+ spin_unlock_irqrestore(lock, flags);
}
static inline void command_get(struct command *cmd)
{
- kobject_get(&cmd->kobj);
+ kobject_get(&cmd->kobj);
}