Re: [PATCH 1/2] New virtual device snd_disconnected rc3

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

 



Am Donnerstag, 5. Oktober 2006 16:13 schrieb Takashi Iwai:
> At Thu, 5 Oct 2006 15:54:47 +0200,
> Karsten Wiese wrote:
> > 
> > snd_disconnected_file, virtual device
> > 
> > On response to "usb disconnect" an usb-soundcard manipulates
> > that snd_card's file's f_ops to only allow release
> > by calling this virtual device's 
> >    void snd_disconnect_file(struct file *file).
> > After release is actually called, the virtual device instance is freed.
> > 
> > Signed-off-by: Karsten Wiese <fzu@xxxxxxxxxxxxxxxxxxxxx>
> 
> Thanks, the code looks better.
> 
> > +void snd_disconnect_file(struct file *file)
> > +{
> > +	struct snd_disconnected_file *df;
> > +	df = kmalloc(sizeof(struct snd_disconnected_file), GFP_KERNEL);
> > +	if (df == NULL)
> > +		panic("Atomic allocation failed for snd_disconnected_file!");
> 
> The message doesn't match...
> Some people prefer "if (!df)" although I myself don't mind at all.

Me neither. I remember Al Viro preferring the "== NULL".

> 
> > +
> > +	df->file = file;
> > +	df->f_op = file->f_op;
> > +
> > +	mutex_lock(&mutex);
> > +	list_add(&df->list, &disconnected_files);
> > +	mutex_unlock(&mutex);
> > +
> > +	fops_get(&snd_disconnect_f_ops);
> > +	file->f_op = &snd_disconnect_f_ops;
> > +	printk(KERN_INFO "%s rc3\n", __FUNCTION__);
> 
> This will be removed in the final version, right?

right.

> 
> > +}
> 
> My only concern is whether the release of the old f_op can be called
> at the same time during snd_disconnect_file().  If this can happen,
> it's racy and results in a memory leak.

Uiuiui, good point!
rc4 will merge with init.c.

      Karsten

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

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

  Powered by Linux