Skip to content

Commit cd54e7e

Browse files
Nick PigginLinus Torvalds
authored andcommitted
[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 <[email protected]> Cc: Dave Airlie <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Takashi Iwai <[email protected]> Cc: Greg KH <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent f2a2a71 commit cd54e7e

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

drivers/char/drm/drm_vm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
147147
if (address > vma->vm_end)
148148
return NOPAGE_SIGBUS; /* Disallow mremap */
149149
if (!map)
150-
return NOPAGE_OOM; /* Nothing allocated */
150+
return NOPAGE_SIGBUS; /* Nothing allocated */
151151

152152
offset = address - vma->vm_start;
153153
i = (unsigned long)map->handle + offset;
154154
page = (map->type == _DRM_CONSISTENT) ?
155155
virt_to_page((void *)i) : vmalloc_to_page((void *)i);
156156
if (!page)
157-
return NOPAGE_OOM;
157+
return NOPAGE_SIGBUS;
158158
get_page(page);
159159

160160
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,
272272
if (address > vma->vm_end)
273273
return NOPAGE_SIGBUS; /* Disallow mremap */
274274
if (!dma->pagelist)
275-
return NOPAGE_OOM; /* Nothing allocated */
275+
return NOPAGE_SIGBUS; /* Nothing allocated */
276276

277277
offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
278278
page_nr = offset >> PAGE_SHIFT;
@@ -310,7 +310,7 @@ static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma,
310310
if (address > vma->vm_end)
311311
return NOPAGE_SIGBUS; /* Disallow mremap */
312312
if (!entry->pagelist)
313-
return NOPAGE_OOM; /* Nothing allocated */
313+
return NOPAGE_SIGBUS; /* Nothing allocated */
314314

315315
offset = address - vma->vm_start;
316316
map_offset = map->offset - (unsigned long)dev->sg->virtual;

sound/core/pcm_native.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3027,7 +3027,7 @@ static struct page * snd_pcm_mmap_status_nopage(struct vm_area_struct *area,
30273027
struct page * page;
30283028

30293029
if (substream == NULL)
3030-
return NOPAGE_OOM;
3030+
return NOPAGE_SIGBUS;
30313031
runtime = substream->runtime;
30323032
page = virt_to_page(runtime->status);
30333033
get_page(page);
@@ -3070,7 +3070,7 @@ static struct page * snd_pcm_mmap_control_nopage(struct vm_area_struct *area,
30703070
struct page * page;
30713071

30723072
if (substream == NULL)
3073-
return NOPAGE_OOM;
3073+
return NOPAGE_SIGBUS;
30743074
runtime = substream->runtime;
30753075
page = virt_to_page(runtime->control);
30763076
get_page(page);
@@ -3131,18 +3131,18 @@ static struct page *snd_pcm_mmap_data_nopage(struct vm_area_struct *area,
31313131
size_t dma_bytes;
31323132

31333133
if (substream == NULL)
3134-
return NOPAGE_OOM;
3134+
return NOPAGE_SIGBUS;
31353135
runtime = substream->runtime;
31363136
offset = area->vm_pgoff << PAGE_SHIFT;
31373137
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);
31393139
dma_bytes = PAGE_ALIGN(runtime->dma_bytes);
31403140
if (offset > dma_bytes - PAGE_SIZE)
31413141
return NOPAGE_SIGBUS;
31423142
if (substream->ops->page) {
31433143
page = substream->ops->page(substream, offset);
31443144
if (! page)
3145-
return NOPAGE_OOM;
3145+
return NOPAGE_OOM; /* XXX: is this really due to OOM? */
31463146
} else {
31473147
vaddr = runtime->dma_area + offset;
31483148
page = virt_to_page(vaddr);

sound/oss/via82cxxx_audio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2120,8 +2120,8 @@ static struct page * via_mm_nopage (struct vm_area_struct * vma,
21202120
return NOPAGE_SIGBUS; /* Disallow mremap */
21212121
}
21222122
if (!card) {
2123-
DPRINTK ("EXIT, returning NOPAGE_OOM\n");
2124-
return NOPAGE_OOM; /* Nothing allocated */
2123+
DPRINTK ("EXIT, returning NOPAGE_SIGBUS\n");
2124+
return NOPAGE_SIGBUS; /* Nothing allocated */
21252125
}
21262126

21272127
pgoff = vma->vm_pgoff + ((address - vma->vm_start) >> PAGE_SHIFT);

sound/usb/usx2y/usX2Yhwdep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static struct page * snd_us428ctls_vm_nopage(struct vm_area_struct *area, unsign
4848

4949
offset = area->vm_pgoff << PAGE_SHIFT;
5050
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);
5252
vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->us428ctls_sharedmem + offset;
5353
page = virt_to_page(vaddr);
5454
get_page(page);

0 commit comments

Comments
 (0)