Skip to content

Commit ebe6976

Browse files
author
Al Viro
committed
pcm_native: result of put_user() needs to be checked
... and no, __put_user() doesn't help here - skipping access_ok() on the second call does not remove the possibility of page having become unmapped or r/o in the meanwhile Signed-off-by: Al Viro <[email protected]>
1 parent a656d47 commit ebe6976

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

sound/core/pcm_native.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3093,7 +3093,8 @@ static int snd_pcm_xferi_frames_ioctl(struct snd_pcm_substream *substream,
30933093
result = snd_pcm_lib_write(substream, xferi.buf, xferi.frames);
30943094
else
30953095
result = snd_pcm_lib_read(substream, xferi.buf, xferi.frames);
3096-
__put_user(result, &_xferi->result);
3096+
if (put_user(result, &_xferi->result))
3097+
return -EFAULT;
30973098
return result < 0 ? result : 0;
30983099
}
30993100

@@ -3122,7 +3123,8 @@ static int snd_pcm_xfern_frames_ioctl(struct snd_pcm_substream *substream,
31223123
else
31233124
result = snd_pcm_lib_readv(substream, bufs, xfern.frames);
31243125
kfree(bufs);
3125-
__put_user(result, &_xfern->result);
3126+
if (put_user(result, &_xfern->result))
3127+
return -EFAULT;
31263128
return result < 0 ? result : 0;
31273129
}
31283130

@@ -3137,7 +3139,8 @@ static int snd_pcm_rewind_ioctl(struct snd_pcm_substream *substream,
31373139
if (put_user(0, _frames))
31383140
return -EFAULT;
31393141
result = snd_pcm_rewind(substream, frames);
3140-
__put_user(result, _frames);
3142+
if (put_user(result, _frames))
3143+
return -EFAULT;
31413144
return result < 0 ? result : 0;
31423145
}
31433146

@@ -3152,7 +3155,8 @@ static int snd_pcm_forward_ioctl(struct snd_pcm_substream *substream,
31523155
if (put_user(0, _frames))
31533156
return -EFAULT;
31543157
result = snd_pcm_forward(substream, frames);
3155-
__put_user(result, _frames);
3158+
if (put_user(result, _frames))
3159+
return -EFAULT;
31563160
return result < 0 ? result : 0;
31573161
}
31583162

0 commit comments

Comments
 (0)