Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5457304imm; Tue, 16 Oct 2018 10:30:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV61AhDxqVYiIuWy4aGJMGljyeaT4IzR0LCfD0uqVAV9c4xLznIQeU81OPfxlyGgSGFUApAwA X-Received: by 2002:a62:d206:: with SMTP id c6-v6mr8642402pfg.8.1539711044845; Tue, 16 Oct 2018 10:30:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539711044; cv=none; d=google.com; s=arc-20160816; b=VsbfJ6ZzwFzBmwck7/iyBeQrm166eg7RRf9HrzvISOgmuU1XZLOxUN0qYViDICSk+4 wVv5TLi4HhDtZcm94t5ZwU9zlHeFJxCweVlQcikNNVdHppkbLEo6Vo4e7qZeXw+UX7mP orqKqfy14yEAur9TqT/dRIHZHIE7BCPkSkDG0Vrr4Sw+lS4Y5UBQPMciUUUimBhUF9Gv Bx7/3IYVLGYOgeAFSbMda80M2iwkb/FcbwBNIUqWIjYSoXg/pIYr78rTSRHgrVTEgpr2 CFFd4pW60Zyb4huJaFubbxWA2DU1LprXEtuRYfb0Vitii/GwVtkg4jbRrxkGe5ON5J9O QmAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cjTch5RrLD2X+/OHRzAP2J+Rd9YvFtM7Tvcwxzwm0cA=; b=CLY0Trd+rwLc2KVuBxL4uo/vqhjaOaSv2eJt4gYKZiBpzxSs+/qFzLA1D1wkBdfRtF lzydcuLhcUEBN2z4WeoWkjMOHzo78LKO8X2OAcvy2F5A2uW13PS+GEm5eX5pnuP3KA2l NBQGUAgrVhhJX4lLRt9GiWkSZ0VIe0QxF1ZgowhXYBiHh2HLoP2IKIAb+G4dW2WPU+hF vFedcnRwi9GYBVWeXqy+bYxm6/G8yWLpTAiObhyeyOna6ZJIAYQ4FHrsmv/gnIcQjT7B UB/DoxNv0n1Sq7gN5/TdRAAXn3MwK/z/cERqS0wuyzRa0fltlQJSIeM3Ky6AO2bm48AV HOHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TnfOceVw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6-v6si14613099pge.215.2018.10.16.10.30.28; Tue, 16 Oct 2018 10:30:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TnfOceVw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731536AbeJQBPW (ORCPT + 99 others); Tue, 16 Oct 2018 21:15:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:33934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbeJQBPV (ORCPT ); Tue, 16 Oct 2018 21:15:21 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0B75320866; Tue, 16 Oct 2018 17:23:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710635; bh=5Uhz7ICzyHQrUxKY0etj0nIPZCTIuX+nLaW4/sILvDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TnfOceVwW544u43j63IelkEKeUtFUxxtQg+TGYZLZM0s0p2xrw/peeYoAsTRRVQ+7 V9ytt8LQw/GFzaCDy2QcERcsQblxBpRXn96TdOhSKQEHkrowtYUxUKJLMENXbwYJEV cB8+I7m3kVgLjW/IZpHNxqEQamh789V6VV+82Mro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Yu Zhao , Mark Brown , Sasha Levin Subject: [PATCH 4.9 08/71] sound: enable interrupt after dma buffer initialization Date: Tue, 16 Oct 2018 19:09:05 +0200 Message-Id: <20181016170539.826524425@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170539.315587743@linuxfoundation.org> References: <20181016170539.315587743@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yu Zhao [ Upstream commit b61749a89f826eb61fc59794d9e4697bd246eb61 ] In snd_hdac_bus_init_chip(), we enable interrupt before snd_hdac_bus_init_cmd_io() initializing dma buffers. If irq has been acquired and irq handler uses the dma buffer, kernel may crash when interrupt comes in. Fix the problem by postponing enabling irq after dma buffer initialization. And warn once on null dma buffer pointer during the initialization. Reviewed-by: Takashi Iwai Signed-off-by: Yu Zhao Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- sound/hda/hdac_controller.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/sound/hda/hdac_controller.c +++ b/sound/hda/hdac_controller.c @@ -40,6 +40,8 @@ static void azx_clear_corbrp(struct hdac */ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus) { + WARN_ON_ONCE(!bus->rb.area); + spin_lock_irq(&bus->reg_lock); /* CORB set up */ bus->corb.addr = bus->rb.addr; @@ -478,13 +480,15 @@ bool snd_hdac_bus_init_chip(struct hdac_ /* reset controller */ azx_reset(bus, full_reset); - /* initialize interrupts */ + /* clear interrupts */ azx_int_clear(bus); - azx_int_enable(bus); /* initialize the codec command I/O */ snd_hdac_bus_init_cmd_io(bus); + /* enable interrupts after CORB/RIRB buffers are initialized above */ + azx_int_enable(bus); + /* program the position buffer */ if (bus->use_posbuf && bus->posbuf.addr) { snd_hdac_chip_writel(bus, DPLBASE, (u32)bus->posbuf.addr);