Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ifb: fix oops when loading the ifb failed

If __rtnl_link_register() return faild when loading the ifb, it will
take the wrong path and get oops, so fix it just like dummy.

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

dingtianhong and committed by
David S. Miller
f2966cd5 2c8a0189

+4
+4
drivers/net/ifb.c
··· 291 291 292 292 rtnl_lock(); 293 293 err = __rtnl_link_register(&ifb_link_ops); 294 + if (err < 0) 295 + goto out; 294 296 295 297 for (i = 0; i < numifbs && !err; i++) { 296 298 err = ifb_init_one(i); ··· 300 298 } 301 299 if (err) 302 300 __rtnl_link_unregister(&ifb_link_ops); 301 + 302 + out: 303 303 rtnl_unlock(); 304 304 305 305 return err;