Re: [PATCH 1/3] ALSA: pcm: implement the anonymous dup (inode file descriptor)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 04 Feb 2019 18:00:47 +0100,
Takashi Iwai wrote:
> 
> On Mon, 04 Feb 2019 12:28:32 +0100,
> Jaroslav Kysela wrote:
> > 
> > This patch implements new SNDRV_PCM_IOCTL_ANONYMOUS_DUP ioctl which
> > returns the new duplicated anonymous inode file descriptor
> > (anon_inode:snd-pcm) which can be passed to the restricted clients.
> > 
> > This patch is meant to be the alternative for the dma-buf interface. Both
> > implementation have some pros and cons:
> > 
> > anon_inode:dmabuf
> > 
> > - a bit standard export API for the DMA buffers
> > - fencing for the concurrent access [1]
> > - driver/kernel interface for the DMA buffer [1]
> > - multiple attach/detach scheme [1]
> > 
> > [1] the real usage for the sound PCM is unknown at the moment for this feature
> > 
> > anon_inode:snd-pcm
> > 
> > - simple (no problem with ref-counting, non-standard mmap implementation etc.)
> > - allow to use more sound interfaces for the file descriptor like status ioctls
> > - more fine grained security policies (another anon_inode name unshared with
> >   other drivers)
> > 
> > Signed-off-by: Jaroslav Kysela <perex@xxxxxxxx>
> > Reviewed-by: Takashi Iwai <tiwai@xxxxxxx>
> 
> Although I already gave my reviewed-by tag, I found one place to be
> fixed.  Namely:
> 
> > +static int snd_pcm_anonymous_dup(struct file *file,
> > +				 struct snd_pcm_substream *substream,
> > +				 int __user *arg)
> > +{
> ....
> > +	err = snd_card_file_add(pcm->card, nfile);
> > +	if (err < 0)
> > +		goto __error2;
> > +	err = snd_pcm_open_file(nfile, substream->pcm,
> > +				substream->stream, substream->number);
> 
> We need the pcm->open_mutex lock around the snd_pcm_open_file() call
> above for avoiding the racy opens.

Oh, BTW, it'd be appreciated if you mark the version number
(e.g. "v4") in the patches themselves, not only in the cover letter.

I'm usually a creating patch set with --subject-prefix option of
git-format-patch.


thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux