diff mbox

[2.6.31-rc5] can: fix oops caused by wrong rtnl newlink usage

Message ID 4A8166F4.6040204@hartkopp.net
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Oliver Hartkopp Aug. 11, 2009, 12:41 p.m. UTC
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 <oliver@hartkopp.net>
Reported-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
CC: Patrick McHardy <kaber@trash.net>
CC: Wolfgang Grandegger <wg@grandegger.com>

---

Comments

David Miller Aug. 13, 2009, 11:33 p.m. UTC | #1
From: Oliver Hartkopp <oliver@hartkopp.net>
Date: Tue, 11 Aug 2009 14:41:24 +0200

> 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 <oliver@hartkopp.net>
> Reported-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

Applied to net-2.6
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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,