aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/pcm_compat.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-03-23 08:14:02 -0400
committerTakashi Iwai <tiwai@suse.de>2015-03-23 08:14:02 -0400
commit3372dbdd8ca11f51be8c6a30b2bc79eb04c4a902 (patch)
treed4499bf5a5665b4820ffaf96bce55bf6b895195e /sound/core/pcm_compat.c
parentbc465aa9d045feb0e13b4a8f32cc33c1943f62d6 (diff)
parent967b1307b69b8ada8b331e01046ad1ef83742e99 (diff)
Merge branch 'for-next' into topic/hda-core
Diffstat (limited to 'sound/core/pcm_compat.c')
-rw-r--r--sound/core/pcm_compat.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index 2d957ba63557..b48b434444ed 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -194,18 +194,30 @@ struct snd_pcm_status32 {
194 u32 avail_max; 194 u32 avail_max;
195 u32 overrange; 195 u32 overrange;
196 s32 suspended_state; 196 s32 suspended_state;
197 u32 reserved_alignment; 197 u32 audio_tstamp_data;
198 struct compat_timespec audio_tstamp; 198 struct compat_timespec audio_tstamp;
199 unsigned char reserved[56-sizeof(struct compat_timespec)]; 199 struct compat_timespec driver_tstamp;
200 u32 audio_tstamp_accuracy;
201 unsigned char reserved[52-2*sizeof(struct compat_timespec)];
200} __attribute__((packed)); 202} __attribute__((packed));
201 203
202 204
203static int snd_pcm_status_user_compat(struct snd_pcm_substream *substream, 205static int snd_pcm_status_user_compat(struct snd_pcm_substream *substream,
204 struct snd_pcm_status32 __user *src) 206 struct snd_pcm_status32 __user *src,
207 bool ext)
205{ 208{
206 struct snd_pcm_status status; 209 struct snd_pcm_status status;
207 int err; 210 int err;
208 211
212 memset(&status, 0, sizeof(status));
213 /*
214 * with extension, parameters are read/write,
215 * get audio_tstamp_data from user,
216 * ignore rest of status structure
217 */
218 if (ext && get_user(status.audio_tstamp_data,
219 (u32 __user *)(&src->audio_tstamp_data)))
220 return -EFAULT;
209 err = snd_pcm_status(substream, &status); 221 err = snd_pcm_status(substream, &status);
210 if (err < 0) 222 if (err < 0)
211 return err; 223 return err;
@@ -222,7 +234,10 @@ static int snd_pcm_status_user_compat(struct snd_pcm_substream *substream,
222 put_user(status.avail_max, &src->avail_max) || 234 put_user(status.avail_max, &src->avail_max) ||
223 put_user(status.overrange, &src->overrange) || 235 put_user(status.overrange, &src->overrange) ||
224 put_user(status.suspended_state, &src->suspended_state) || 236 put_user(status.suspended_state, &src->suspended_state) ||
225 compat_put_timespec(&status.audio_tstamp, &src->audio_tstamp)) 237 put_user(status.audio_tstamp_data, &src->audio_tstamp_data) ||
238 compat_put_timespec(&status.audio_tstamp, &src->audio_tstamp) ||
239 compat_put_timespec(&status.driver_tstamp, &src->driver_tstamp) ||
240 put_user(status.audio_tstamp_accuracy, &src->audio_tstamp_accuracy))
226 return -EFAULT; 241 return -EFAULT;
227 242
228 return err; 243 return err;
@@ -457,6 +472,7 @@ enum {
457 SNDRV_PCM_IOCTL_HW_PARAMS32 = _IOWR('A', 0x11, struct snd_pcm_hw_params32), 472 SNDRV_PCM_IOCTL_HW_PARAMS32 = _IOWR('A', 0x11, struct snd_pcm_hw_params32),
458 SNDRV_PCM_IOCTL_SW_PARAMS32 = _IOWR('A', 0x13, struct snd_pcm_sw_params32), 473 SNDRV_PCM_IOCTL_SW_PARAMS32 = _IOWR('A', 0x13, struct snd_pcm_sw_params32),
459 SNDRV_PCM_IOCTL_STATUS32 = _IOR('A', 0x20, struct snd_pcm_status32), 474 SNDRV_PCM_IOCTL_STATUS32 = _IOR('A', 0x20, struct snd_pcm_status32),
475 SNDRV_PCM_IOCTL_STATUS_EXT32 = _IOWR('A', 0x24, struct snd_pcm_status32),
460 SNDRV_PCM_IOCTL_DELAY32 = _IOR('A', 0x21, s32), 476 SNDRV_PCM_IOCTL_DELAY32 = _IOR('A', 0x21, s32),
461 SNDRV_PCM_IOCTL_CHANNEL_INFO32 = _IOR('A', 0x32, struct snd_pcm_channel_info32), 477 SNDRV_PCM_IOCTL_CHANNEL_INFO32 = _IOR('A', 0x32, struct snd_pcm_channel_info32),
462 SNDRV_PCM_IOCTL_REWIND32 = _IOW('A', 0x46, u32), 478 SNDRV_PCM_IOCTL_REWIND32 = _IOW('A', 0x46, u32),
@@ -517,7 +533,9 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l
517 case SNDRV_PCM_IOCTL_SW_PARAMS32: 533 case SNDRV_PCM_IOCTL_SW_PARAMS32:
518 return snd_pcm_ioctl_sw_params_compat(substream, argp); 534 return snd_pcm_ioctl_sw_params_compat(substream, argp);
519 case SNDRV_PCM_IOCTL_STATUS32: 535 case SNDRV_PCM_IOCTL_STATUS32:
520 return snd_pcm_status_user_compat(substream, argp); 536 return snd_pcm_status_user_compat(substream, argp, false);
537 case SNDRV_PCM_IOCTL_STATUS_EXT32:
538 return snd_pcm_status_user_compat(substream, argp, true);
521 case SNDRV_PCM_IOCTL_SYNC_PTR32: 539 case SNDRV_PCM_IOCTL_SYNC_PTR32:
522 return snd_pcm_ioctl_sync_ptr_compat(substream, argp); 540 return snd_pcm_ioctl_sync_ptr_compat(substream, argp);
523 case SNDRV_PCM_IOCTL_CHANNEL_INFO32: 541 case SNDRV_PCM_IOCTL_CHANNEL_INFO32: