From: Takashi Iwai <tiwai@suse.de>
To: Karsten Wiese <annabellesgarden@yahoo.de>
Cc: linux-kernel@vger.kernel.org, alsa-devel@lists.sourceforge.net,
mingo@elte.hu
Subject: Re: [PATCH] Reset file->f_op in snd_card_file_remove(). Take 2
Date: Wed, 04 Oct 2006 16:18:08 +0200 [thread overview]
Message-ID: <s5h1wpokvvj.wl%tiwai@suse.de> (raw)
In-Reply-To: <200610041247.19624.annabellesgarden@yahoo.de>
At Wed, 4 Oct 2006 12:47:19 +0200,
Karsten Wiese wrote:
>
> Am Mittwoch, 4. Oktober 2006 11:22 schrieb Takashi Iwai:
> >
> > It should call snd_card_free_when_closed() instead.
> >
> IMHO, that would just make sure that the bug happens.
> Please see my annotations, starting with // in:
>
> void fastcall __fput(struct file *file)
> {
> struct dentry *dentry = file->f_dentry;
> struct vfsmount *mnt = file->f_vfsmnt;
> struct inode *inode = dentry->d_inode;
>
> might_sleep();
>
> fsnotify_close(file);
> /*
> * The function eventpoll_release() should be the first called
> * in the file cleanup chain.
> */
> eventpoll_release(file);
> locks_remove_flock(file);
>
> if (file->f_op && file->f_op->release)
> file->f_op->release(inode, file);
> // Here snd_hwdep_release() is called.
> // snd_hwdep_release() calls snd_card_file_remove().
> // snd_card_file_remove() sees card->free_on_last_close ist set,
> // calls snd_card_do_free().
> // snd_card_do_free frees file->f_op but doesn't set it NULL.
> //
> security_file_free(file);
> if (unlikely(inode->i_cdev != NULL))
> cdev_put(inode->i_cdev);
> fops_put(file->f_op);
> // file->f_op has already been freeed!
> // fops_put(file->f_op) is likely to oops.
Yes, this looks like an invalid access.
The problem is that we use kmalloc for allocating a dummy f_op.
IMO, the simlest solution is to use a static dummy f_op.
Takashi
next prev parent reply other threads:[~2006-10-04 14:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-28 20:28 Karsten Wiese
2006-09-29 10:48 ` Takashi Iwai
2006-09-29 12:29 ` Karsten Wiese
2006-09-29 12:26 ` Ingo Molnar
2006-09-29 12:45 ` Takashi Iwai
2006-10-01 18:29 ` Karsten Wiese
2006-10-04 9:22 ` Takashi Iwai
[not found] ` <200610041247.19624.annabellesgarden@yahoo.de>
2006-10-04 14:18 ` Takashi Iwai [this message]
2006-10-04 15:36 ` Karsten Wiese
2006-10-04 15:57 ` Takashi Iwai
2006-10-04 20:01 ` Karsten Wiese
2006-10-04 20:15 ` Takashi Iwai
2006-10-04 23:41 ` Karsten Wiese
2006-10-05 10:43 ` [Alsa-devel] " Takashi Iwai
2006-10-05 11:33 ` Karsten Wiese
2006-10-05 14:12 ` Karsten Wiese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5h1wpokvvj.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@lists.sourceforge.net \
--cc=annabellesgarden@yahoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®