From patchwork Sat Nov 7 09:53:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Grandegger X-Patchwork-Id: 37914 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.176.167]) by ozlabs.org (Postfix) with ESMTP id 17AABB7B78 for ; Sat, 7 Nov 2009 20:53:52 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751352AbZKGJxl (ORCPT ); Sat, 7 Nov 2009 04:53:41 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751348AbZKGJxl (ORCPT ); Sat, 7 Nov 2009 04:53:41 -0500 Received: from mail-out.m-online.net ([212.18.0.10]:42495 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751345AbZKGJxk (ORCPT ); Sat, 7 Nov 2009 04:53:40 -0500 Received: from mail01.m-online.net (mail.m-online.net [192.168.3.149]) by mail-out.m-online.net (Postfix) with ESMTP id C5C161C001A0; Sat, 7 Nov 2009 10:53:44 +0100 (CET) X-Auth-Info: 7VVWTu6aKf74U7aCVt8Kw1pSjaa6BvMxwEz4yntnVX8= Received: from lancy.mylan.de (dslb-088-064-009-241.pools.arcor-ip.net [88.64.9.241]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mnet-online.de (Postfix) with ESMTP id 8E766901DD; Sat, 7 Nov 2009 10:53:44 +0100 (CET) Message-ID: <4AF54389.1090309@grandegger.com> Date: Sat, 07 Nov 2009 10:53:13 +0100 From: Wolfgang Grandegger User-Agent: Thunderbird 2.0.0.23 (X11/20090812) MIME-Version: 1.0 To: Linux Netdev List CC: SocketCAN Core Mailing List Subject: [PATCH] can: fix WARN_ON dump in net/core/rtnetlink.c:rtmsg_ifinfo() X-Enigmail-Version: 0.96.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 this patch is required for more recent kernels as well, even if no WARN_ON dumps are triggered. Maybe we also need "get_xstats_size" for the CAN xstats. Signed-off-by: Wolfgang Grandegger --- drivers/net/can/dev.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 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 Index: net-next-2.6/drivers/net/can/dev.c =================================================================== --- net-next-2.6.orig/drivers/net/can/dev.c +++ net-next-2.6/drivers/net/can/dev.c @@ -637,6 +637,22 @@ static int can_changelink(struct net_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); @@ -687,6 +703,7 @@ static struct rtnl_link_ops can_link_ops .setup = can_setup, .newlink = can_newlink, .changelink = can_changelink, + .get_size = can_get_size, .fill_info = can_fill_info, .fill_xstats = can_fill_xstats, };