aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2006-12-06 23:31:53 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:20 -0500
commitcd54e7e54318d333227b13186f9a464bf1f68d27 (patch)
tree75bf795ab6c3805f318b2d3040321ba31ef35c6a
parentf2a2a7108aa0039ba7a5fe7a0d2ecef2219a7584 (diff)
[PATCH] mm: incorrect VM_FAULT_OOM returns from drivers
Some drivers are returning OOM when it is not in response to a memory shortage. Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: Dave Airlie <airlied@linux.ie> Cc: Jaroslav Kysela <perex@suse.cz> Cc: Takashi Iwai <tiwai@suse.de> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/char/drm/drm_vm.c8
-rw-r--r--sound/core/pcm_native.c10
-rw-r--r--sound/oss/via82cxxx_audio.c4
-rw-r--r--sound/usb/usx2y/usX2Yhwdep.c2
4 files changed, 12 insertions, 12 deletions
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index b40ae438f531..ae2691942ddb 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -147,14 +147,14 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
147 if (address > vma->vm_end) 147 if (address > vma->vm_end)
148 return NOPAGE_SIGBUS; /* Disallow mremap */ 148 return NOPAGE_SIGBUS; /* Disallow mremap */
149 if (!map) 149 if (!map)
150 return NOPAGE_OOM; /* Nothing allocated */ 150 return NOPAGE_SIGBUS; /* Nothing allocated */
151 151
152 offset = address - vma->vm_start; 152 offset = address - vma->vm_start;
153 i = (unsigned long)map->handle + offset; 153 i = (unsigned long)map->handle + offset;
154 page = (map->type == _DRM_CONSISTENT) ? 154 page = (map->type == _DRM_CONSISTENT) ?
155 virt_to_page((void *)i) : vmalloc_to_page((void *)i); 155 virt_to_page((void *)i) : vmalloc_to_page((void *)i);
156 if (!page) 156 if (!page)
157 return NOPAGE_OOM; 157 return NOPAGE_SIGBUS;
158 get_page(page); 158 get_page(page);
159 159
160 DRM_DEBUG("shm_nopage 0x%lx\n", address); 160 DRM_DEBUG("shm_nopage 0x%lx\n", address);
@@ -272,7 +272,7 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
272 if (address > vma->vm_end) 272 if (address > vma->vm_end)
273 return NOPAGE_SIGBUS; /* Disallow mremap */ 273 return NOPAGE_SIGBUS; /* Disallow mremap */
274 if (!dma->pagelist) 274 if (!dma->pagelist)
275 return NOPAGE_OOM; /* Nothing allocated */ 275 return NOPAGE_SIGBUS; /* Nothing allocated */
276 276
277 offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ 277 offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
278 page_nr = offset >> PAGE_SHIFT; 278 page_nr = offset >> PAGE_SHIFT;
@@ -310,7 +310,7 @@ static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma,
310 if (address > vma->vm_end) 310 if (address > vma->vm_end)
311 return NOPAGE_SIGBUS; /* Disallow mremap */ 311 return NOPAGE_SIGBUS; /* Disallow mremap */
312 if (!entry->pagelist) 312 if (!entry->pagelist)
313 return NOPAGE_OOM; /* Nothing allocated */ 313 return NOPAGE_SIGBUS; /* Nothing allocated */
314 314
315 offset = address - vma->vm_start; 315 offset = address - vma->vm_start;
316 map_offset = map->offset - (unsigned long)dev->sg->virtual; 316 map_offset = map->offset - (unsigned long)dev->sg->virtual;
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 66e24b5da469..6ea67b16c676 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3027,7 +3027,7 @@ static struct page * snd_pcm_mmap_status_nopage(struct vm_area_struct *area,
3027 struct page * page; 3027 struct page * page;
3028 3028
3029 if (substream == NULL) 3029 if (substream == NULL)
3030 return NOPAGE_OOM; 3030 return NOPAGE_SIGBUS;
3031 runtime = substream->runtime; 3031 runtime = substream->runtime;
3032 page = virt_to_page(runtime->status); 3032 page = virt_to_page(runtime->status);
3033 get_page(page); 3033 get_page(page);
@@ -3070,7 +3070,7 @@ static struct page * snd_pcm_mmap_control_nopage(struct vm_area_struct *area,
3070 struct page * page; 3070 struct page * page;
3071 3071
3072 if (substream == NULL) 3072 if (substream == NULL)
3073 return NOPAGE_OOM; 3073 return NOPAGE_SIGBUS;
3074 runtime = substream->runtime; 3074 runtime = substream->runtime;
3075 page = virt_to_page(runtime->control); 3075 page = virt_to_page(runtime->control);
3076 get_page(page); 3076 get_page(page);
@@ -3131,18 +3131,18 @@ static struct page *snd_pcm_mmap_data_nopage(struct vm_area_struct *area,
3131 size_t dma_bytes; 3131 size_t dma_bytes;
3132 3132
3133 if (substream == NULL) 3133 if (substream == NULL)
3134 return NOPAGE_OOM; 3134 return NOPAGE_SIGBUS;
3135 runtime = substream->runtime; 3135 runtime = substream->runtime;
3136 offset = area->vm_pgoff << PAGE_SHIFT; 3136 offset = area->vm_pgoff << PAGE_SHIFT;
3137 offset += address - area->vm_start; 3137 offset += address - area->vm_start;
3138 snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM); 3138 snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_SIGBUS);
3139 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); 3139 dma_bytes = PAGE_ALIGN(runtime->dma_bytes);
3140 if (offset > dma_bytes - PAGE_SIZE) 3140 if (offset > dma_bytes - PAGE_SIZE)
3141 return NOPAGE_SIGBUS; 3141 return NOPAGE_SIGBUS;
3142 if (substream->ops->page) { 3142 if (substream->ops->page) {
3143 page = substream->ops->page(substream, offset); 3143 page = substream->ops->page(substream, offset);
3144 if (! page) 3144 if (! page)
3145 return NOPAGE_OOM; 3145 return NOPAGE_OOM; /* XXX: is this really due to OOM? */
3146 } else { 3146 } else {
3147 vaddr = runtime->dma_area + offset; 3147 vaddr = runtime->dma_area + offset;
3148 page = virt_to_page(vaddr); 3148 page = virt_to_page(vaddr);
diff --git a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c
index 17837d4b5ed3..c96cc8c68b3b 100644
--- a/sound/oss/via82cxxx_audio.c
+++ b/sound/oss/via82cxxx_audio.c
@@ -2120,8 +2120,8 @@ static struct page * via_mm_nopage (struct vm_area_struct * vma,
2120 return NOPAGE_SIGBUS; /* Disallow mremap */ 2120 return NOPAGE_SIGBUS; /* Disallow mremap */
2121 } 2121 }
2122 if (!card) { 2122 if (!card) {
2123 DPRINTK ("EXIT, returning NOPAGE_OOM\n"); 2123 DPRINTK ("EXIT, returning NOPAGE_SIGBUS\n");
2124 return NOPAGE_OOM; /* Nothing allocated */ 2124 return NOPAGE_SIGBUS; /* Nothing allocated */
2125 } 2125 }
2126 2126
2127 pgoff = vma->vm_pgoff + ((address - vma->vm_start) >> PAGE_SHIFT); 2127 pgoff = vma->vm_pgoff + ((address - vma->vm_start) >> PAGE_SHIFT);
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c
index 4b52d18dcd53..b76b3dd9df25 100644
--- a/sound/usb/usx2y/usX2Yhwdep.c
+++ b/sound/usb/usx2y/usX2Yhwdep.c
@@ -48,7 +48,7 @@ static struct page * snd_us428ctls_vm_nopage(struct vm_area_struct *area, unsign
48 48
49 offset = area->vm_pgoff << PAGE_SHIFT; 49 offset = area->vm_pgoff << PAGE_SHIFT;
50 offset += address - area->vm_start; 50 offset += address - area->vm_start;
51 snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM); 51 snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_SIGBUS);
52 vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->us428ctls_sharedmem + offset; 52 vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->us428ctls_sharedmem + offset;
53 page = virt_to_page(vaddr); 53 page = virt_to_page(vaddr);
54 get_page(page); 54 get_page(page);