Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: Fix yet another race in disconnection
  ALSA: asihpi - Update verbose debug print macros
  ALSA: asihpi - Improve non-busmaster adapter operation
  ALSA: asihpi - Support single-rate no-SRC cards
  ALSA: HDA: New AD1984A model for Dell Precision R5500
  ALSA: vmalloc buffers should use normal mmap
  ALSA: hda - Fix SPDIF out regression on ALC889
  ALSA: usb-audio - Support for Boss JS-8 Jam Station
  ALSA: usb-audio: add Cakewalk UM-1G support
  sound/oss/opl3: validate voice and channel indexes
  sound/oss: remove offset from load_patch callbacks
  • Loading branch information
Linus Torvalds committed Mar 28, 2011
2 parents 551b0bd + a45e3d6 commit 7b724a2
Show file tree
Hide file tree
Showing 12 changed files with 230 additions and 114 deletions.
4 changes: 1 addition & 3 deletions include/sound/pcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1031,9 +1031,7 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_s
#define snd_pcm_lib_mmap_iomem NULL
#endif

int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream,
struct vm_area_struct *area);
#define snd_pcm_lib_mmap_vmalloc snd_pcm_lib_mmap_noncached
#define snd_pcm_lib_mmap_vmalloc NULL

static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
{
Expand Down
4 changes: 4 additions & 0 deletions sound/core/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file)
return -ENOMEM;
mfile->file = file;
mfile->disconnected_f_op = NULL;
INIT_LIST_HEAD(&mfile->shutdown_list);
spin_lock(&card->files_lock);
if (card->shutdown) {
spin_unlock(&card->files_lock);
Expand Down Expand Up @@ -883,6 +884,9 @@ int snd_card_file_remove(struct snd_card *card, struct file *file)
list_for_each_entry(mfile, &card->files_list, list) {
if (mfile->file == file) {
list_del(&mfile->list);
spin_lock(&shutdown_lock);
list_del(&mfile->shutdown_list);
spin_unlock(&shutdown_lock);
if (mfile->disconnected_f_op)
fops_put(mfile->disconnected_f_op);
found = mfile;
Expand Down
9 changes: 0 additions & 9 deletions sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -3201,15 +3201,6 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream,
EXPORT_SYMBOL(snd_pcm_lib_mmap_iomem);
#endif /* SNDRV_PCM_INFO_MMAP */

/* mmap callback with pgprot_noncached */
int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream,
struct vm_area_struct *area)
{
area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
return snd_pcm_default_mmap(substream, area);
}
EXPORT_SYMBOL(snd_pcm_lib_mmap_noncached);

/*
* mmap DMA buffer
*/
Expand Down
2 changes: 1 addition & 1 deletion sound/oss/dev_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ struct synth_operations
void (*reset) (int dev);
void (*hw_control) (int dev, unsigned char *event);
int (*load_patch) (int dev, int format, const char __user *addr,
int offs, int count, int pmgr_flag);
int count, int pmgr_flag);
void (*aftertouch) (int dev, int voice, int pressure);
void (*controller) (int dev, int voice, int ctrl_num, int value);
void (*panning) (int dev, int voice, int value);
Expand Down
30 changes: 13 additions & 17 deletions sound/oss/midi_synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ EXPORT_SYMBOL(midi_synth_hw_control);

int
midi_synth_load_patch(int dev, int format, const char __user *addr,
int offs, int count, int pmgr_flag)
int count, int pmgr_flag)
{
int orig_dev = synth_devs[dev]->midi_dev;

Expand All @@ -491,33 +491,29 @@ midi_synth_load_patch(int dev, int format, const char __user *addr,
if (!prefix_cmd(orig_dev, 0xf0))
return 0;

/* Invalid patch format */
if (format != SYSEX_PATCH)
{
/* printk("MIDI Error: Invalid patch format (key) 0x%x\n", format);*/
return -EINVAL;
}

/* Patch header too short */
if (count < hdr_size)
{
/* printk("MIDI Error: Patch header too short\n");*/
return -EINVAL;
}

count -= hdr_size;

/*
* Copy the header from user space but ignore the first bytes which have
* been transferred already.
* Copy the header from user space
*/

if(copy_from_user(&((char *) &sysex)[offs], &(addr)[offs], hdr_size - offs))
if (copy_from_user(&sysex, addr, hdr_size))
return -EFAULT;

if (count < sysex.len)
{
/* printk(KERN_WARNING "MIDI Warning: Sysex record too short (%d<%d)\n", count, (int) sysex.len);*/

/* Sysex record too short */
if ((unsigned)count < (unsigned)sysex.len)
sysex.len = count;
}
left = sysex.len;
src_offs = 0;

left = sysex.len;
src_offs = 0;

for (i = 0; i < left && !signal_pending(current); i++)
{
Expand Down
2 changes: 1 addition & 1 deletion sound/oss/midi_synth.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int midi_synth_open (int dev, int mode);
void midi_synth_close (int dev);
void midi_synth_hw_control (int dev, unsigned char *event);
int midi_synth_load_patch (int dev, int format, const char __user * addr,
int offs, int count, int pmgr_flag);
int count, int pmgr_flag);
void midi_synth_panning (int dev, int channel, int pressure);
void midi_synth_aftertouch (int dev, int channel, int pressure);
void midi_synth_controller (int dev, int channel, int ctrl_num, int value);
Expand Down
23 changes: 15 additions & 8 deletions sound/oss/opl3.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ static void opl3_hw_control(int dev, unsigned char *event)
}

static int opl3_load_patch(int dev, int format, const char __user *addr,
int offs, int count, int pmgr_flag)
int count, int pmgr_flag)
{
struct sbi_instrument ins;

Expand All @@ -830,11 +830,7 @@ static int opl3_load_patch(int dev, int format, const char __user *addr,
return -EINVAL;
}

/*
* What the fuck is going on here? We leave junk in the beginning
* of ins and then check the field pretty close to that beginning?
*/
if(copy_from_user(&((char *) &ins)[offs], addr + offs, sizeof(ins) - offs))
if (copy_from_user(&ins, addr, sizeof(ins)))
return -EFAULT;

if (ins.channel < 0 || ins.channel >= SBFM_MAXINSTR)
Expand All @@ -849,6 +845,10 @@ static int opl3_load_patch(int dev, int format, const char __user *addr,

static void opl3_panning(int dev, int voice, int value)
{

if (voice < 0 || voice >= devc->nr_voice)
return;

devc->voc[voice].panning = value;
}

Expand Down Expand Up @@ -1066,8 +1066,15 @@ static int opl3_alloc_voice(int dev, int chn, int note, struct voice_alloc_info

static void opl3_setup_voice(int dev, int voice, int chn)
{
struct channel_info *info =
&synth_devs[dev]->chn_info[chn];
struct channel_info *info;

if (voice < 0 || voice >= devc->nr_voice)
return;

if (chn < 0 || chn > 15)
return;

info = &synth_devs[dev]->chn_info[chn];

opl3_set_instr(dev, voice, info->pgm_num);

Expand Down
2 changes: 1 addition & 1 deletion sound/oss/sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ int sequencer_write(int dev, struct file *file, const char __user *buf, int coun
return -ENXIO;

fmt = (*(short *) &event_rec[0]) & 0xffff;
err = synth_devs[dev]->load_patch(dev, fmt, buf, p + 4, c, 0);
err = synth_devs[dev]->load_patch(dev, fmt, buf + p, c, 0);
if (err < 0)
return err;

Expand Down
Loading

0 comments on commit 7b724a2

Please sign in to comment.