All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaswinder Singh Rajput <jaswinder@kernel.org>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Takashi Iwai <tiwai@suse.de>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [PATCH] SOUND: OSS sequencer should be initialized after snd_seq_system_client_init
Date: Mon, 20 Jul 2009 10:32:01 +0530	[thread overview]
Message-ID: <1248066121.2626.7.camel@ht.satnam> (raw)
In-Reply-To: <1248041987.4302.6.camel@toshiba-laptop>

Hello Catalin,

On Sun, 2009-07-19 at 23:19 +0100, Catalin Marinas wrote:
> On Sun, 2009-07-19 at 21:58 +0530, Jaswinder Singh Rajput wrote:
> > [PATCH] SOUND: OSS sequencer should be initialized after snd_seq_system_client_init
> > 
> > When build SND_SEQUENCER in kernel then OSS sequencer(alsa_seq_oss_init)
> > is initialized before System (snd_seq_system_client_init) which leads to
> > memory leak :
> 
> Thanks for investigating this. I haven't looked at the code in detail
> but I find it a bit weird that initialisation order fixes the memory
> leak. Shouldn't the memory allocation logic change slightly to avoid the
> leak as well (that's in case someone manually inserts the modules in the
> wrong order)?
> 

No, you cannot change the order of modules because 
'insmod sound/core/seq/oss/snd-seq-oss.ko' need following symbols :

[  385.258252] snd_seq_oss: Unknown symbol snd_seq_kernel_client_enqueue
[  385.258435] snd_seq_oss: Unknown symbol snd_seq_set_queue_tempo
[  385.258639] snd_seq_oss: Unknown symbol snd_seq_delete_kernel_client
[  385.258751] snd_seq_oss: Unknown symbol snd_seq_autoload_lock
[  385.258871] snd_seq_oss: Unknown symbol snd_seq_kernel_client_dispatch
[  385.259782] snd_seq_oss: Unknown symbol snd_seq_kernel_client_enqueue_blocking
[  385.260191] snd_seq_oss: Unknown symbol snd_seq_autoload_unlock
[  385.260418] snd_seq_oss: Unknown symbol snd_seq_device_register_driver
[  385.260537] snd_seq_oss: Unknown symbol snd_midi_event_free
[  385.260701] snd_seq_oss: Unknown symbol snd_midi_event_no_status
[  385.260964] snd_seq_oss: Unknown symbol snd_use_lock_sync_helper
[  385.261469] snd_seq_oss: Unknown symbol snd_seq_device_unregister_driver
[  385.261659] snd_seq_oss: Unknown symbol snd_seq_event_port_detach
[  385.261768] snd_seq_oss: Unknown symbol snd_midi_event_new
[  385.261910] snd_seq_oss: Unknown symbol snd_midi_event_decode
[  385.262067] snd_seq_oss: Unknown symbol snd_seq_create_kernel_client
[  385.262233] snd_seq_oss: Unknown symbol snd_seq_kernel_client_write_poll
[  385.262432] snd_seq_oss: Unknown symbol snd_midi_event_encode_byte
[  385.262963] snd_seq_oss: Unknown symbol snd_seq_kernel_client_ctl

And we can get these symbols in this way :

1. insmod sound/core/seq/snd-seq-device.ko
[  385.258751] snd_seq_oss: Unknown symbol snd_seq_autoload_lock
[  385.260191] snd_seq_oss: Unknown symbol snd_seq_autoload_unlock
[  385.260418] snd_seq_oss: Unknown symbol snd_seq_device_register_driver
[  385.261469] snd_seq_oss: Unknown symbol snd_seq_device_unregister_driver

2. insmod sound/core/seq/snd-seq.ko
[  385.258252] snd_seq_oss: Unknown symbol snd_seq_kernel_client_enqueue
[  385.258435] snd_seq_oss: Unknown symbol snd_seq_set_queue_tempo
[  385.258639] snd_seq_oss: Unknown symbol snd_seq_delete_kernel_client
[  385.258871] snd_seq_oss: Unknown symbol snd_seq_kernel_client_dispatch
[  385.259782] snd_seq_oss: Unknown symbol snd_seq_kernel_client_enqueue_blocking
[  385.260964] snd_seq_oss: Unknown symbol snd_use_lock_sync_helper
[  385.261659] snd_seq_oss: Unknown symbol snd_seq_event_port_detach
[  385.262067] snd_seq_oss: Unknown symbol snd_seq_create_kernel_client
[  385.262233] snd_seq_oss: Unknown symbol snd_seq_kernel_client_write_poll
[  385.262963] snd_seq_oss: Unknown symbol snd_seq_kernel_client_ctl

3. insmod sound/core/seq/snd-seq-midi-event.ko
[  385.260701] snd_seq_oss: Unknown symbol snd_midi_event_no_status
[  385.260537] snd_seq_oss: Unknown symbol snd_midi_event_free
[  385.261768] snd_seq_oss: Unknown symbol snd_midi_event_new
[  385.261910] snd_seq_oss: Unknown symbol snd_midi_event_decode
[  385.262432] snd_seq_oss: Unknown symbol snd_midi_event_encode_byte

So the only order is :

1. insmod sound/core/seq/snd-seq-device.ko
2. insmod sound/core/seq/snd-seq.ko
3. insmod sound/core/seq/snd-seq-midi-event.ko
4. insmod sound/core/seq/oss/snd-seq-oss.ko

which is correct, if you change the order like we was getting in
build-in kernel, which leads to improper initialization and memory leak
was the side-effect.

Thanks,
--
JSR


      reply	other threads:[~2009-07-20  5:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-17 20:14 kmemleak issues in alsa Jaswinder Singh Rajput
2009-07-19 12:07 ` Takashi Iwai
2009-07-19 15:26   ` Jaswinder Singh Rajput
2009-07-19 16:02     ` Takashi Iwai
2009-07-19 16:28       ` [PATCH] SOUND: OSS sequencer should be initialized after snd_seq_system_client_init Jaswinder Singh Rajput
2009-07-19 17:10         ` Takashi Iwai
2009-07-19 22:19         ` Catalin Marinas
2009-07-20  5:02           ` Jaswinder Singh Rajput [this message]

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=1248066121.2626.7.camel@ht.satnam \
    --to=jaswinder@kernel.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.