]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
packet: Do not leak dev refcounts on error exit
authorJason Gunthorpe <jgg@mellanox.com>
Tue, 8 Jan 2019 23:27:06 +0000 (23:27 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Jan 2019 07:10:54 +0000 (08:10 +0100)
commit2525133d394f2cf31fc014dcf59704f298c6bc8c
tree83843a845a7fa7f9953aca774aab117c246285f6
parent80711e653b772ae43a7681069652e28c62fc5ad7
packet: Do not leak dev refcounts on error exit

[ Upstream commit d972f3dce8d161e2142da0ab1ef25df00e2f21a9 ]

'dev' is non NULL when the addr_len check triggers so it must goto a label
that does the dev_put otherwise dev will have a leaked refcount.

This bug causes the ib_ipoib module to become unloadable when using
systemd-network as it triggers this check on InfiniBand links.

Fixes: 99137b7888f4 ("packet: validate address length")
Reported-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/packet/af_packet.c