[PATCH] net: allwinner: Fix some resources leak in the error handling path of the probe and in the remove function

Maxime Ripard maxime at cerno.tech
Tue Dec 15 14:08:15 EST 2020


On Tue, Dec 15, 2020 at 07:18:48PM +0100, Christophe JAILLET wrote:
> Le 15/12/2020 à 12:37, Maxime Ripard a écrit :
> > On Tue, Dec 15, 2020 at 12:11:53PM +0300, Dan Carpenter wrote:
> > > On Tue, Dec 15, 2020 at 09:56:55AM +0100, Maxime Ripard wrote:
> > > > Hi,
> > > > 
> > > > On Mon, Dec 14, 2020 at 09:21:17PM +0100, Christophe JAILLET wrote:
> > > > > 'irq_of_parse_and_map()' should be balanced by a corresponding
> > > > > 'irq_dispose_mapping()' call. Otherwise, there is some resources leaks.
> > > > 
> > > > Do you have a source to back that? It's not clear at all from the
> > > > documentation for those functions, and couldn't find any user calling it
> > > > from the ten-or-so random picks I took.
> > > 
> > > It looks like irq_create_of_mapping() needs to be freed with
> > > irq_dispose_mapping() so this is correct.
> > 
> > The doc should be updated first to make that clear then, otherwise we're
> > going to fix one user while multiples will have poped up
> > 
> > Maxime
> > 
> 
> Hi,
> 
> as Dan explained, I think that 'irq_dispose_mapping()' is needed because of
> the 'irq_create_of_mapping()" within 'irq_of_parse_and_map()'.
> 
> As you suggest, I'll propose a doc update to make it clear and more future
> proof.

Thanks :)

And if you feel like it, a coccinelle script would be awesome too so
that other users get fixed over time

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20201215/f861728b/attachment.sig>


More information about the linux-arm-kernel mailing list