mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Russ Dill <russ.dill@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: snd_card_disconnect race (sound/core/init.c)
Date: Thu, 24 Mar 2011 07:43:52 +0100	[thread overview]
Message-ID: <s5hzkoluifr.wl%tiwai@suse.de> (raw)
In-Reply-To: <AANLkTin1kqjSgh8R5zzt_tkJAsTV_LxDjpPf5ngUHEr1@mail.gmail.com>

At Wed, 23 Mar 2011 18:40:58 -0700,
Russ Dill wrote:
> 
> With slub poisoning on, I'm seeing an oops in snd_disconnect_release
> with slub poison (6b6b6b6b). Investigating, snd_card_disconnect looks
> to be the possible culprit:
> 
> 333         spin_lock(&card->files_lock);
> 334         mfile = card->files;
> 335         while (mfile) {
> 336                 file = mfile->file;
> 337
> 338                 /* it's critical part, use endless loop */
> 339                 /* we have no room to fail */
> 340                 mfile->disconnected_f_op = mfile->file->f_op;
> 341
> 342                 spin_lock(&shutdown_lock);
> 343                 list_add(&mfile->shutdown_list, &shutdown_files);
> 344                 spin_unlock(&shutdown_lock);
> 345
> 346                 mfile->file->f_op = &snd_shutdown_f_ops;
> 347                 fops_get(mfile->file->f_op);
> 348
> 349                 mfile = mfile->next;
> 350         }
> 351         spin_unlock(&card->files_lock);
> 
> I'm not aware of any locking that would prevent the original release
> function running concurrently if it were started before line 346 was
> executed. The original release functions (such as snd_hwdep_release)
> call snd_card_remove_file which frees the mfile object which would
> have been just added to the shutdown_files list leading to a use of
> freed (or in my case poisoned) memory later on down the line when the
> shutdown_files gets walked again.
> 
> It seems that 118dd6bf (ALSA: Clean up snd_monitor_file management,
> v2.6.30) may have either introduced this problem or made it worse
> since snd_card_file_remove previously removed items from the
> shutdown_files list before freeing them.
> 
> I'm currently experiencing these crashes on 2.6.32.26, but I can't
> find any changes that would cause them not to occur on later kernel
> versions.

Which device are you using?  USB-audio had a known problem at
disconnection, for example, and it was fixed recently.


Takashi

  reply	other threads:[~2011-03-24  6:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-24  1:40 Russ Dill
2011-03-24  6:43 ` Takashi Iwai [this message]
2011-03-24  8:19   ` Russ Dill
2011-03-24  8:58     ` Takashi Iwai
2011-03-24 17:23       ` Russ Dill
2011-03-25 17:40         ` Russ Dill
2011-03-25 18:24           ` Takashi Iwai

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=s5hzkoluifr.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=russ.dill@gmail.com \
    /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®