Skip to content

Commit 9c7066a

Browse files
cladischtiwai
authored andcommitted
ALSA: core: fix 64-bit SNDRV_PCM_IOCTL_STATUS ABI breakage
Commit 4eeaaea (ALSA: core: add hooks for audio timestamps) added the new audio_tstamp field to struct snd_pcm_status. However, struct timespec requires 64-bit alignment, so the 64-bit compiler would insert 32 bits of padding before this field, which broke SNDRV_PCM_IOCTL_STATUS with error messages like this: kernel: unknown ioctl = 0x80984120 To solve this, insert the padding explicitly so that it can be taken into account when calculating the ABI structure size. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 7dd7a2f commit 9c7066a

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎include/uapi/sound/asound.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,9 @@ struct snd_pcm_status {
407407
snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */
408408
snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
409409
snd_pcm_state_t suspended_state; /* suspended stream state */
410+
__u32 reserved_alignment; /* must be filled with zero */
410411
struct timespec audio_tstamp; /* from sample counter or wall clock */
411-
unsigned char reserved[60-sizeof(struct timespec)]; /* must be filled with zero */
412+
unsigned char reserved[56-sizeof(struct timespec)]; /* must be filled with zero */
412413
};
413414

414415
struct snd_pcm_mmap_status {

‎sound/core/pcm_compat.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,9 @@ struct snd_pcm_status32 {
190190
u32 avail_max;
191191
u32 overrange;
192192
s32 suspended_state;
193+
u32 reserved_alignment;
193194
struct compat_timespec audio_tstamp;
194-
unsigned char reserved[60-sizeof(struct compat_timespec)];
195+
unsigned char reserved[56-sizeof(struct compat_timespec)];
195196
} __attribute__((packed));
196197

197198

0 commit comments

Comments
 (0)