• Tobin C. Harding's avatar
    bridge: Fix error path for kobject_init_and_add() · 100b03e8
    Tobin C. Harding authored
    [ Upstream commit bdfad5aec1392b93495b77b864d58d7f101dc1c1 ]
    
    Currently error return from kobject_init_and_add() is not followed by a
    call to kobject_put().  This means there is a memory leak.  We currently
    set p to NULL so that kfree() may be called on it as a noop, the code is
    arguably clearer if we move the kfree() up closer to where it is
    called (instead of after goto jump).
    
    Remove a goto label 'err1' and jump to call to kobject_put() in error
    return from kobject_init_and_add() fixing the memory leak.  Re-name goto
    label 'put_back' to 'err1' now that we don't use err1, following current
    nomenclature (err1, err2 ...).  Move call to kfree out of the error
    code at bottom of function up to closer to where memory was allocated.
    Add comment to clarify call to kfree().
    Signed-off-by: 's avatarTobin C. Harding <tobin@kernel.org>
    Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    100b03e8
Name
Last commit
Last update
..
netfilter Loading commit data...
Kconfig Loading commit data...
Makefile Loading commit data...
br.c Loading commit data...
br_device.c Loading commit data...
br_fdb.c Loading commit data...
br_forward.c Loading commit data...
br_if.c Loading commit data...
br_input.c Loading commit data...
br_ioctl.c Loading commit data...
br_mdb.c Loading commit data...
br_multicast.c Loading commit data...
br_netfilter_hooks.c Loading commit data...
br_netfilter_ipv6.c Loading commit data...
br_netlink.c Loading commit data...
br_netlink_tunnel.c Loading commit data...
br_nf_core.c Loading commit data...
br_private.h Loading commit data...
br_private_stp.h Loading commit data...
br_private_tunnel.h Loading commit data...
br_stp.c Loading commit data...
br_stp_bpdu.c Loading commit data...
br_stp_if.c Loading commit data...
br_stp_timer.c Loading commit data...
br_switchdev.c Loading commit data...
br_sysfs_br.c Loading commit data...
br_sysfs_if.c Loading commit data...
br_vlan.c Loading commit data...
br_vlan_tunnel.c Loading commit data...