Commit 0353acec authored by Andrew Morton's avatar Andrew Morton Committed by Dave Jones

[PATCH] add a might_sleep() check to kmap()

kmap() can sleep, but rarely does.  Add a check for kmap() being called from
inappropriate contexts.
parent 507388c9
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
void *kmap(struct page *page) void *kmap(struct page *page)
{ {
if (in_interrupt()) might_sleep();
BUG();
if (page < highmem_start_page) if (page < highmem_start_page)
return page_address(page); return page_address(page);
return kmap_high(page); return kmap_high(page);
......
...@@ -18,7 +18,11 @@ unsigned int nr_free_highpages(void); ...@@ -18,7 +18,11 @@ unsigned int nr_free_highpages(void);
static inline unsigned int nr_free_highpages(void) { return 0; } static inline unsigned int nr_free_highpages(void) { return 0; }
static inline void *kmap(struct page *page) { return page_address(page); } static inline void *kmap(struct page *page)
{
might_sleep();
return page_address(page);
}
#define kunmap(page) do { (void) (page); } while (0) #define kunmap(page) do { (void) (page); } while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment