From patchwork Tue Aug 11 12:41:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Hartkopp X-Patchwork-Id: 31141 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 2F43EB6EDF for ; Tue, 11 Aug 2009 22:49:29 +1000 (EST) Received: by ozlabs.org (Postfix) id 2088ADDD0C; Tue, 11 Aug 2009 22:49:29 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 98331DDD04 for ; Tue, 11 Aug 2009 22:49:28 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754113AbZHKMlg (ORCPT ); Tue, 11 Aug 2009 08:41:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752748AbZHKMld (ORCPT ); Tue, 11 Aug 2009 08:41:33 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.162]:53313 "EHLO mo-p00-ob.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752313AbZHKMla (ORCPT ); Tue, 11 Aug 2009 08:41:30 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1249994489; l=1707; s=domk; d=hartkopp.net; h=Content-Type:Subject:CC:To:MIME-Version:From:Date:X-RZG-CLASS-ID: X-RZG-AUTH; bh=ykRjhP0nVaVhORBKH1Cn905NwS4=; b=hfBLIzA7M5riXHsxK1pXYYTCAQeAQ66OSXVVmVD5qxtrxLfFS1JnTpqLfsOR6nHyqHJ qe6tV35OSeNUvLErdlrZXTBLJF0U5yB3BGVaya1XkzZ3Fu4WJroTCegfKqxsj1naDyk1v 87rrfp23uL8M3eyccb4I5SuMNwDzrWsULHc= X-RZG-AUTH: :I2ANY0W6W/eA95XfH/xfO6gOxLxTty/udEMngcJ/VAKW226kDNBZ04ov1wErELw= X-RZG-CLASS-ID: mo00 Received: from [90.187.31.32] (ip-90-187-31-32.web.vodafone.de [90.187.31.32]) by post.strato.de (fruni mo3) (RZmta 20.4) with ESMTP id g02d92l7BCPuky ; Tue, 11 Aug 2009 14:41:25 +0200 (MEST) Message-ID: <4A8166F4.6040204@hartkopp.net> Date: Tue, 11 Aug 2009 14:41:24 +0200 From: Oliver Hartkopp User-Agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: David Miller CC: Patrick McHardy , Wolfgang Grandegger , Linux Netdev List , Dmitry Eremin-Solenikov Subject: [PATCH 2.6.31-rc5] can: fix oops caused by wrong rtnl newlink usage X-Enigmail-Version: 0.96.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For 'real' hardware CAN devices the netlink interface is used to set CAN specific communication parameters. Real CAN hardware can not be created with the ip tool ... The invocation of 'ip link add type can' lead to an oops as the standard rtnl newlink function was called: http://bugzilla.kernel.org/show_bug.cgi?id=13954 This patch adds a private newlink function for the CAN device driver interface that unconditionally returns -EOPNOTSUPP. Signed-off-by: Oliver Hartkopp Reported-by: Dmitry Eremin-Solenikov CC: Patrick McHardy CC: Wolfgang Grandegger diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 9e4283a..e1a4f82 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c @@ -611,11 +611,18 @@ nla_put_failure: return -EMSGSIZE; } +static int can_newlink(struct net_device *dev, + struct nlattr *tb[], struct nlattr *data[]) +{ + return -EOPNOTSUPP; +} + static struct rtnl_link_ops can_link_ops __read_mostly = { .kind = "can", .maxtype = IFLA_CAN_MAX, .policy = can_policy, .setup = can_setup, + .newlink = can_newlink, .changelink = can_changelink, .fill_info = can_fill_info, .fill_xstats = can_fill_xstats,