Return-Path: Date: Mon, 8 Oct 2018 10:34:12 +0100 From: Mark Brown To: Sasha Levin Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org, Yu Zhao , Sasha Levin , tiwai@suse.de Subject: Re: [PATCH AUTOSEL 4.18 27/48] sound: enable interrupt after dma buffer initialization Message-ID: <20181008093412.GA5684@sirena.org.uk> References: <20181005161424.20521-1-sashal@kernel.org> <20181005161424.20521-27-sashal@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Q68bSM7Ycu6FN28Q" Content-Disposition: inline In-Reply-To: <20181005161424.20521-27-sashal@kernel.org> List-ID: --Q68bSM7Ycu6FN28Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 05, 2018 at 12:14:03PM -0400, Sasha Levin wrote: > From: Yu Zhao >=20 > [ Upstream commit b61749a89f826eb61fc59794d9e4697bd246eb61 ] >=20 > 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. CCing Takashi who's the maintainer here for review. >=20 > Fix the problem by postponing enabling irq after dma buffer > initialization. And warn once on null dma buffer pointer during the > initialization. >=20 > Reviewed-by: Takashi Iwai > Signed-off-by: Yu Zhao > Signed-off-by: Mark Brown > Signed-off-by: Sasha Levin > --- > sound/hda/hdac_controller.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) >=20 > diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c > index 560ec0986e1a..11057d9f84ec 100644 > --- a/sound/hda/hdac_controller.c > +++ b/sound/hda/hdac_controller.c > @@ -40,6 +40,8 @@ static void azx_clear_corbrp(struct hdac_bus *bus) > */ > 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 =3D bus->rb.addr; > @@ -479,13 +481,15 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, b= ool full_reset) > /* reset controller */ > azx_reset(bus, full_reset); > =20 > - /* initialize interrupts */ > + /* clear interrupts */ > azx_int_clear(bus); > - azx_int_enable(bus); > =20 > /* initialize the codec command I/O */ > snd_hdac_bus_init_cmd_io(bus); > =20 > + /* 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); > --=20 > 2.17.1 >=20 --Q68bSM7Ycu6FN28Q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlu7JJEACgkQJNaLcl1U h9BH2wf/SsO9sS9MzMpH82DoMKFDQ1OgquP8eRx8I/p0ekol9xQfI/4tV9GzDVzs DcRjFaa0ZIILdjK78kwzxoYaxhg65kcyyPiS9rxjZZVMu1rU9NhHZcJXQ/kmdSK+ QnXs2HuksClh8VYv10tB4toGAYUXqGbjnWE+rHRSS6I3JXfrsNp8Gnb2sJaBluA5 q5mc5jwL4b1V+zI+uo797nnAVh+6QytfCm3TrL3kug0yUmLQD+2SAfJL/PQ8M24r UNWcY36fPfufkseNDSGOAkMi79pS7rlHBeTke+j6Lk9HdsPgcajo37R/2/0r2xC1 jMO/1mGTpmgZLnrovq5HdiPY0dClWQ== =eF1n -----END PGP SIGNATURE----- --Q68bSM7Ycu6FN28Q--