diff options
author | Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> | 2010-01-21 07:55:16 -0500 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2010-01-28 08:15:51 -0500 |
commit | b23ff0e9330e4b11e18af984d50573598e10e7f9 (patch) | |
tree | e170892469ddbcb2ee249271e52264f961c58476 /kernel | |
parent | 7f5102ca4b8a8e598dbfa154322ea684bc98da96 (diff) |
hw_breakpoints: Release the bp slot if arch_validate_hwbkpt_settings() fails.
On a given architecture, when hardware breakpoint registration fails
due to un-supported access type (read/write/execute), we lose the bp
slot since register_perf_hw_breakpoint() does not release the bp slot
on failure.
Hence, any subsequent hardware breakpoint registration starts failing
with 'no space left on device' error.
This patch introduces error handling in register_perf_hw_breakpoint()
function and releases bp slot on error.
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: K. Prasad <prasad@linux.vnet.ibm.com>
Cc: Maneesh Soni <maneesh@in.ibm.com>
LKML-Reference: <20100121125516.GA32521@in.ibm.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/hw_breakpoint.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c index 50dbd5999588..c030ae657f20 100644 --- a/kernel/hw_breakpoint.c +++ b/kernel/hw_breakpoint.c | |||
@@ -296,6 +296,10 @@ int register_perf_hw_breakpoint(struct perf_event *bp) | |||
296 | if (!bp->attr.disabled || !bp->overflow_handler) | 296 | if (!bp->attr.disabled || !bp->overflow_handler) |
297 | ret = arch_validate_hwbkpt_settings(bp, bp->ctx->task); | 297 | ret = arch_validate_hwbkpt_settings(bp, bp->ctx->task); |
298 | 298 | ||
299 | /* if arch_validate_hwbkpt_settings() fails then release bp slot */ | ||
300 | if (ret) | ||
301 | release_bp_slot(bp); | ||
302 | |||
299 | return ret; | 303 | return ret; |
300 | } | 304 | } |
301 | 305 | ||