]> rtime.felk.cvut.cz Git - socketcan-devel.git/commitdiff
can: fix WARN_ON dump in net/core/rtnetlink.c:rtmsg_ifinfo()
authorwolf <wolf@030b6a49-0b11-0410-94ab-b0dab22257f2>
Sun, 8 Nov 2009 13:48:06 +0000 (13:48 +0000)
committerwolf <wolf@030b6a49-0b11-0410-94ab-b0dab22257f2>
Sun, 8 Nov 2009 13:48:06 +0000 (13:48 +0000)
On older kernels, e.g. 2.6.27, a WARN_ON dump in rtmsg_ifinfo()
is thrown when the CAN device is registered due to insufficient
skb space, as reported by various users. This patch adds the
rtnl_link_ops "get_size" to fix the problem. I think it's
required for more recent kernels as well, even if no WARN_ON
dumps are triggered. Maybe we also need it for the CAN xstats.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1078 030b6a49-0b11-0410-94ab-b0dab22257f2

kernel/2.6/drivers/net/can/dev.c

index 3be767f6e93a23bb0f141a9a2d6c3907a9c6c2c5..d8be09add410cf61a1eecd815b218d28b62f1597 100644 (file)
@@ -712,6 +712,22 @@ static int can_changelink(struct net_device *dev,
        return 0;
 }
 
+static size_t can_get_size(const struct net_device *dev)
+{
+       struct can_priv *priv = netdev_priv(dev);
+       size_t size;
+
+       size = nla_total_size(sizeof(u32));   /* IFLA_CAN_STATE */
+       size += sizeof(struct can_ctrlmode);  /* IFLA_CAN_CTRLMODE */
+       size += nla_total_size(sizeof(u32));  /* IFLA_CAN_RESTART_MS */
+       size += sizeof(struct can_bittiming); /* IFLA_CAN_BITTIMING */
+       size += sizeof(struct can_clock);     /* IFLA_CAN_CLOCK */
+       if (priv->bittiming_const)            /* IFLA_CAN_BITTIMING_CONST */
+               size += sizeof(struct can_bittiming_const);
+
+       return size;
+}
+
 static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)
 {
        struct can_priv *priv = netdev_priv(dev);
@@ -762,6 +778,7 @@ static struct rtnl_link_ops can_link_ops __read_mostly = {
        .setup          = can_setup,
        .newlink        = can_newlink,
        .changelink     = can_changelink,
+       .get_size       = can_get_size,
        .fill_info      = can_fill_info,
        .fill_xstats    = can_fill_xstats,
 };