Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1342067
| From | Simon Guinot <simon.guinot@sequanux.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] kernel/resource.c: ensure parent is not freed in __request_region() |
| Date | 2016-02-24 15:30 +0100 |
| Message-ID | <r5IBY-5Pl-23@gated-at.bofh.it> (permalink) |
| References | <r5oMV-8vi-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The commit 59ceeaaf355fa0fb16558ef7c24413c804932ada
("kernel/resource.c: fix muxed resource handling in __request_region()")
don't address properly the case where the current parent resource has
been freed while sleeping, waiting for a muxed resource to be available.
This patch fixes the issue by resetting the parent pointer to the root
parent resource when sleeping is needed.
Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
Cc: stable@vger.kernel.org
---
kernel/resource.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/resource.c b/kernel/resource.c
index 3669d1bfc425..14a7f9d66259 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -1052,16 +1052,17 @@ static DECLARE_WAIT_QUEUE_HEAD(muxed_resource_wait);
/**
* __request_region - create a new busy resource region
- * @parent: parent resource descriptor
+ * @root: root resource descriptor
* @start: resource start address
* @n: resource region size
* @name: reserving caller's ID string
* @flags: IO resource flags
*/
-struct resource * __request_region(struct resource *parent,
+struct resource * __request_region(struct resource *root,
resource_size_t start, resource_size_t n,
const char *name, int flags)
{
+ struct resource *parent = root;
DECLARE_WAITQUEUE(wait, current);
struct resource *res = alloc_resource(GFP_KERNEL);
@@ -1089,6 +1090,7 @@ struct resource * __request_region(struct resource *parent,
}
}
if (conflict->flags & flags & IORESOURCE_MUXED) {
+ parent = root;
add_wait_queue(&muxed_resource_wait, &wait);
write_unlock(&resource_lock);
set_current_state(TASK_UNINTERRUPTIBLE);
--
2.1.4
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH] kernel/resource.c: fix muxed resource handling in __request_region() Simon Guinot <simon.guinot@sequanux.org> - 2016-02-23 17:20 +0100
Re: [PATCH] kernel/resource.c: fix muxed resource handling in __request_region() Jesse Barnes <jbarnes@virtuousgeek.org> - 2016-02-23 18:20 +0100
Re: [PATCH] kernel/resource.c: fix muxed resource handling in __request_region() One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-02-23 22:40 +0100
[PATCH] kernel/resource.c: ensure parent is not freed in __request_region() Simon Guinot <simon.guinot@sequanux.org> - 2016-02-24 15:30 +0100
csiph-web