From patchwork Mon Feb 4 12:29:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommi Rantala X-Patchwork-Id: 217893 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 7FCAF2C0297 for ; Mon, 4 Feb 2013 23:29:08 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754336Ab3BDM3E (ORCPT ); Mon, 4 Feb 2013 07:29:04 -0500 Received: from mail-vc0-f172.google.com ([209.85.220.172]:43609 "EHLO mail-vc0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752478Ab3BDM3D (ORCPT ); Mon, 4 Feb 2013 07:29:03 -0500 Received: by mail-vc0-f172.google.com with SMTP id l6so3827971vcl.31 for ; Mon, 04 Feb 2013 04:29:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=PVSZtnPTEeJ6fwjq2RPzZ5Q6ZxvoH+aafFHuLL8g2Yk=; b=VHIgLWoxNbYl0v79s9z/6eYGhFNUslFk3obx62zL3ANJqku0VH/F3Yk0Ooq8oD1J0l vCIcW270v+5cYS/l1ftWxSzbUVoWqC99ieFwwVpiWvm9xe9c0jwAxfVj8c3zULmC0ix+ opfP0Q/3Dt3M1C+V5V41LVER4KJaB8FL4i/5ax90Q5EFoiNl/9dJ3KywgVWIGNvojv12 4N5sCzfsrvbZOaItV8W856sD77ZCb2p9Kdw94ibCzj/XMiGcbgqmqbvMCIaJOmSXuq+t qFuLXGAvAe207PMYDhfbNwBSkBj1H3vG1HQk2iEHvLMrF5Lb8NyO0Tr7Gci4WzaZ3Pq9 zNAg== MIME-Version: 1.0 X-Received: by 10.221.0.79 with SMTP id nl15mr21919606vcb.41.1359980941824; Mon, 04 Feb 2013 04:29:01 -0800 (PST) Received: by 10.58.190.201 with HTTP; Mon, 4 Feb 2013 04:29:01 -0800 (PST) Date: Mon, 4 Feb 2013 14:29:01 +0200 Message-ID: Subject: ip6gre_tunnel_xmit() leaking an skb? From: Tommi Rantala To: "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , netdev@vger.kernel.org, Dmitry Kozlov Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hello, kmemleak is giving me some complaints on boot: # echo scan > /sys/kernel/debug/kmemleak # echo scan > /sys/kernel/debug/kmemleak [ 13.084513] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak) # cat /sys/kernel/debug/kmemleak unreferenced object 0xffff88003b4e3c00 (size 256): comm "dhcpcd", pid 1661, jiffies 4294670402 (age 15.097s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 80 4a 3b 00 88 ff ff ..........J;.... backtrace: [] kmemleak_alloc+0x26/0x50 [] kmem_cache_alloc_node+0xb4/0x180 [] __alloc_skb+0x60/0x2a0 [] sock_alloc_send_pskb+0x1d1/0x340 [] packet_sendmsg+0xa88/0xd40 [] sock_sendmsg+0xb0/0xe0 [] sys_sendto+0x11e/0x160 [] system_call_fastpath+0x16/0x1b [] 0xffffffffffffffff unreferenced object 0xffff88003af07800 (size 1024): comm "dhcpcd", pid 1661, jiffies 4294670402 (age 15.097s) hex dump (first 32 bytes): 00 74 f0 3a 00 88 ff ff fe ed ca fe 28 00 00 00 .t.:........(... 28 00 00 00 ad 00 00 00 f0 03 1d b7 7b cb c5 ee (...........{... backtrace: [] kmemleak_alloc+0x26/0x50 [] __kmalloc_node_track_caller+0xe0/0x1e0 [] __kmalloc_reserve+0x3c/0xa0 [] __alloc_skb+0x91/0x2a0 [] sock_alloc_send_pskb+0x1d1/0x340 [] packet_sendmsg+0xa88/0xd40 [] sock_sendmsg+0xb0/0xe0 [] sys_sendto+0x11e/0x160 [] system_call_fastpath+0x16/0x1b [] 0xffffffffffffffff # Patching ip6gre_tunnel_xmit() to not return -1 fixes the kmemleak complaint, but I have no clue if the patch is otherwise correct: $ git diff net/ipv6/ip6_gre.c $ Tested with v3.8-rc6. Tommi --- 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 --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index c727e47..131dd09 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -960,7 +960,7 @@ static netdev_tx_t ip6gre_tunnel_xmit(struct sk_buff *skb, int ret; if (!ip6_tnl_xmit_ctl(t)) - return -1; + goto tx_err; switch (skb->protocol) { case htons(ETH_P_IP):