alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Cc: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH 02/15] ALSA: hda - Fix possible access to uninitialized work struct
Date: Mon, 14 May 2012 17:31:53 +0200	[thread overview]
Message-ID: <1337009526-26256-3-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1337009526-26256-1-git-send-email-tiwai@suse.de>

The work struct must be initialized before the possible call in the
destructor.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_codec.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 393a304..98976c8 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1264,13 +1264,6 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus,
 	snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8);
 	snd_array_init(&codec->conn_lists, sizeof(hda_nid_t), 64);
 	snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16);
-	if (codec->bus->modelname) {
-		codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL);
-		if (!codec->modelname) {
-			snd_hda_codec_free(codec);
-			return -ENODEV;
-		}
-	}
 
 #ifdef CONFIG_SND_HDA_POWER_SAVE
 	INIT_DELAYED_WORK(&codec->power_work, hda_power_work);
@@ -1281,6 +1274,14 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus,
 	hda_keep_power_on(codec);
 #endif
 
+	if (codec->bus->modelname) {
+		codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL);
+		if (!codec->modelname) {
+			snd_hda_codec_free(codec);
+			return -ENODEV;
+		}
+	}
+
 	list_add_tail(&codec->list, &bus->codec_list);
 	bus->caddr_tbl[codec_addr] = codec;
 
-- 
1.7.9.2

  parent reply	other threads:[~2012-05-14 15:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14 15:31 [PATCH 00/15] HD-audio updates for 3.5 Takashi Iwai
2012-05-14 15:31 ` [PATCH 01/15] ALSA: hda/realtek - Call a common helper for alc_spec initialization Takashi Iwai
2012-05-14 15:31 ` Takashi Iwai [this message]
2012-05-14 15:31 ` [PATCH 03/15] ALSA: hda - Always resume the codec immediately Takashi Iwai
2012-05-14 15:31 ` [PATCH 04/15] ALSA: hda - Clear the power-saving states properly at reset Takashi Iwai
2012-05-14 15:31 ` [PATCH 05/15] ALSA: hda - Protect the power-saving count with spinlock Takashi Iwai
2012-05-14 15:31 ` [PATCH 06/15] ALSA: hda - Move up the fixup helper functions to the library module Takashi Iwai
2012-05-14 15:31 ` [PATCH 07/15] ALSA: hda - Move BIOS pin-parser code to hda_auto_parser.c Takashi Iwai
2012-05-14 15:31 ` [PATCH 08/15] ALSA: hda - Remove pre_resume and post_suspend ops Takashi Iwai
2012-05-14 15:32 ` [PATCH 09/15] ALSA: hda - More robustify the power-up/down sequence Takashi Iwai
2012-05-14 15:32 ` [PATCH 10/15] ALSA: hda - Add the support for Creative SoundCore3D Takashi Iwai
2012-05-14 15:32 ` [PATCH 11/15] ALSA: hda - Add Conexant CX20751/2/3/4 codec support Takashi Iwai
2012-05-14 15:32 ` [PATCH 12/15] ALSA: hda - Protect SPDIF-related stuff via spdif_mutex Takashi Iwai
2012-05-14 15:32 ` [PATCH 13/15] ALSA: hda - Fix concurrent hash accesses Takashi Iwai
2012-05-14 15:32 ` [PATCH 14/15] ALSA: hda/conexant - Correct vendor IDs for new codecs Takashi Iwai
2012-05-14 15:32 ` [PATCH 15/15] ALSA: hda - Disable FLOAT format support 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=1337009526-26256-3-git-send-email-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /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;
as well as URLs for NNTP newsgroup(s).