Re: [PATCH] ASoC: rockchip: i2s: Fix NULL pointer dereference when pinctrl is not found

From: Alexandru Elisei
Date: Mon Jul 11 2022 - 09:39:41 EST


Hi Mark,

On Mon, Jul 11, 2022 at 02:23:59PM +0100, Mark Brown wrote:
> On Mon, Jul 11, 2022 at 02:05:22PM +0100, Alexandru Elisei wrote:
> > Commit a5450aba737d ("ASoC: rockchip: i2s: switch BCLK to GPIO") switched
> > BCLK to GPIO functions when probing the i2s bus interface, but missed
> > adding a check for when devm_pinctrl_get() returns an error. This can lead
> > to the following NULL pointer dereference on a rockpro64-v2 if there are no
> > "pinctrl" properties in the i2s device tree node:
> >
> > [ 0.658381] rockchip-i2s ff880000.i2s: failed to find i2s default state
> > [ 0.658993] rockchip-i2s ff880000.i2s: failed to find i2s gpio state
> > [ 0.660072] rockchip-i2s ff890000.i2s: failed to find i2s default state
> > [ 0.660670] rockchip-i2s ff890000.i2s: failed to find i2s gpio state
>
> Please think hard before including complete backtraces in upstream
> reports, they are very large and contain almost no useful information

I'm at a loss here. Are you saying that those 4 lines represent a complete
backtrace and they are very large? Or are you talking about the panic log
that I've included in the commit message?

> relative to their size so often obscure the relevant content in your
> message. If part of the backtrace is usefully illustrative (it often is
> for search engines if nothing else) then it's usually better to pull out
> the relevant sections.

Would you mind pointing out what you think the relevant sections are? I
would also find it very useful (for future patches) if you can explain why
they are relevant, and why those parts you've left out aren't. It's not
very easy to figure out what is relevant when you're not familiar with a
subsystem.

Thanks,
Alex