[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20200121.104405.1161878965169136462.davem@davemloft.net>
Date: Tue, 21 Jan 2020 10:44:05 +0100 (CET)
From: David Miller <davem@...emloft.net>
To: jouni.hogander@...kie.com
Cc: netdev@...r.kernel.org, gregkh@...uxfoundation.org,
lukas.bulwahn@...il.com
Subject: Re: [PATCH v4] net-sysfs: Fix reference count leak
From: jouni.hogander@...kie.com
Date: Mon, 20 Jan 2020 09:51:03 +0200
> From: Jouni Hogander <jouni.hogander@...kie.com>
>
> Netdev_register_kobject is calling device_initialize. In case of error
> reference taken by device_initialize is not given up.
>
> Drivers are supposed to call free_netdev in case of error. In non-error
> case the last reference is given up there and device release sequence
> is triggered. In error case this reference is kept and the release
> sequence is never started.
>
> Fix this by setting reg_state as NETREG_UNREGISTERED if registering
> fails.
>
> This is the rootcause for couple of memory leaks reported by Syzkaller:
...
> Reported-by: syzbot+ad8ca40ecd77896d51e2@...kaller.appspotmail.com
> Cc: David Miller <davem@...emloft.net>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: Lukas Bulwahn <lukas.bulwahn@...il.com>
> Signed-off-by: Jouni Hogander <jouni.hogander@...kie.com>
Applied and queued up for -stable, thanks.
Powered by blists - more mailing lists