From patchwork Mon Feb 29 12:13:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 8452581 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A1FD6C0553 for ; Mon, 29 Feb 2016 12:14:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D2F4D2027D for ; Mon, 29 Feb 2016 12:14:18 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9DFD020212 for ; Mon, 29 Feb 2016 12:14:14 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 235D1261A5E; Mon, 29 Feb 2016 13:14:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 05B6B2606A9; Mon, 29 Feb 2016 13:14:05 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0BEDA2606B4; Mon, 29 Feb 2016 13:14:04 +0100 (CET) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by alsa0.perex.cz (Postfix) with ESMTP id DDF47260535 for ; Mon, 29 Feb 2016 13:13:56 +0100 (CET) Received: by mail-pa0-f46.google.com with SMTP id fl4so91401082pad.0 for ; Mon, 29 Feb 2016 04:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=iXSE/yg78IzvnbwHb027tAmEke2ZKkGNoXRi4ih1VFM=; b=baZuS4CZ8IxSU6F8+yL7TcB7PewRAZ5vX9yo9U694x4gWspVjQPs2hDebZ+b+qFIaq sA+hmHHuNEBSrrwvkNQo340QjERaY1sovWCrZumvNztOZoOdFCWbXEp3IsazBeXu1BjW NO7IGyWxh4ZbSV4HnQB3YIbL5d5rrivsye42sHtA7gszyktmqNGY1FEyZFLVeKiQkjdW T6FhV39H4reAmsMg5JEGvsvZM89aa3jNx8PUe6ztgQeJoJ2czUNT9veHlMQVIwDd3tAX jjvbNBTF3Du5eP+wZgEJF8uEb0sgz3Kv22SYz3w0lSwo4dzccyUinsAkt4fOtSI4ykHe sHTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=iXSE/yg78IzvnbwHb027tAmEke2ZKkGNoXRi4ih1VFM=; b=irBp/jQbWAxcH9aqaeKDOSS8HG+QqR3Lwu2DKHMdVhaKBAhBniE3pVNpxlmvTwq3SH uKHwYvfEcxxxHtDJejgVqa1exrZulgUTN8+bKrjUE2pmPggDo9oQ1oKYS/54MAQMMr6z yAZ46kCPdGpULVTQIqjnYALBqeaU6XZyRiQU3Kab28qfu5mI9HtLxpSNpxNcJ4u3WK2d t+PmB+NpC+bS377IBYb/ta0o4xdAfbSDTGZRhKM0xnYU8EBbgY7lgnOUL7Cb9SixZurk O4ifo3AX2hq7JyI2F5yMPkDKYx1EdDr5mbApHI01PENHWIxZaB0d4zyD9ECLX6PafShA 76Nw== X-Gm-Message-State: AD7BkJJnrCkDsRGBBy03ZArvwBnYe+v7Fw4Nc9F9Q2C7lmMgWitzQT0Vkc/zcrNEqDT+1A== X-Received: by 10.66.120.202 with SMTP id le10mr21158026pab.155.1456748035460; Mon, 29 Feb 2016 04:13:55 -0800 (PST) Received: from localhost.localdomain ([103.24.124.195]) by smtp.gmail.com with ESMTPSA id p8sm37752406pfi.34.2016.02.29.04.13.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Feb 2016 04:13:54 -0800 (PST) From: Sudip Mukherjee To: Jaroslav Kysela , Takashi Iwai Date: Mon, 29 Feb 2016 17:43:30 +0530 Message-Id: <1456748010-17038-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Sudip Mukherjee Subject: [alsa-devel] [PATCH] ALSA: mts64: fix NULL pointer dereference X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP While registering pardev, the irq_func was also registered. As a result when we tried to probe for the card, an interrupt was generated and in the ISR we tried to dereference private_data. But private_data is still NULL as we have not yet done snd_mts64_create(). Lets probe for the card after mts64 is created. Reported-by: Fengguang Wu Fixes: 94a573500d48 ("ALSA: mts64: use new parport device model") Signed-off-by: Sudip Mukherjee --- sound/drivers/mts64.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c index c76bd87..fd4d18d 100644 --- a/sound/drivers/mts64.c +++ b/sound/drivers/mts64.c @@ -964,11 +964,6 @@ static int snd_mts64_probe(struct platform_device *pdev) err = -EIO; goto free_pardev; } - err = mts64_probe(p); - if (err) { - err = -EIO; - goto release_pardev; - } if ((err = snd_mts64_create(card, pardev, &mts)) < 0) { snd_printd("Cannot create main component\n"); @@ -976,6 +971,12 @@ static int snd_mts64_probe(struct platform_device *pdev) } card->private_data = mts; card->private_free = snd_mts64_card_private_free; + + err = mts64_probe(p); + if (err) { + err = -EIO; + goto __err; + } if ((err = snd_mts64_rawmidi_create(card)) < 0) { snd_printd("Creating Rawmidi component failed\n");