From patchwork Thu Jul 11 11:04:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ding Tianhong X-Patchwork-Id: 258409 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 5324E2C00AF for ; Thu, 11 Jul 2013 21:04:33 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755824Ab3GKLE3 (ORCPT ); Thu, 11 Jul 2013 07:04:29 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:26377 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755031Ab3GKLE2 (ORCPT ); Thu, 11 Jul 2013 07:04:28 -0400 Received: from 172.24.2.119 (EHLO szxeml211-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BEZ70903; Thu, 11 Jul 2013 19:04:17 +0800 (CST) Received: from SZXEML457-HUB.china.huawei.com (10.82.67.200) by szxeml211-edg.china.huawei.com (172.24.2.182) with Microsoft SMTP Server (TLS) id 14.1.323.7; Thu, 11 Jul 2013 19:04:17 +0800 Received: from [127.0.0.1] (10.135.72.199) by szxeml457-hub.china.huawei.com (10.82.67.200) with Microsoft SMTP Server id 14.1.323.7; Thu, 11 Jul 2013 19:04:10 +0800 Message-ID: <51DE9126.5040703@huawei.com> Date: Thu, 11 Jul 2013 19:04:06 +0800 From: Ding Tianhong User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: "David S. Miller" , Patrick McHardy , Eric Dumazet , Netdev Subject: [PATCH 2/2] ifb: fix oops when loading the ifb failed X-Originating-IP: [10.135.72.199] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- drivers/net/ifb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index dc9f6a4..23a33e3 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -291,11 +291,15 @@ static int __init ifb_init_module(void) rtnl_lock(); err = __rtnl_link_register(&ifb_link_ops); + if (err < 0) + goto out; for (i = 0; i < numifbs && !err; i++) err = ifb_init_one(i); if (err) __rtnl_link_unregister(&ifb_link_ops); + +out: rtnl_unlock(); return err;