From patchwork Fri Oct 30 23:06:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 7529911 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 680BBBEEA4 for ; Fri, 30 Oct 2015 23:06:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 450AC2075F for ; Fri, 30 Oct 2015 23:06:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 402EE2075A for ; Fri, 30 Oct 2015 23:06:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760111AbbJ3XGe (ORCPT ); Fri, 30 Oct 2015 19:06:34 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:32793 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760101AbbJ3XGd (ORCPT ); Fri, 30 Oct 2015 19:06:33 -0400 Received: by lfbf136 with SMTP id f136so27715116lfb.0 for ; Fri, 30 Oct 2015 16:06:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded_com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :in-reply-to:references:mime-version:content-transfer-encoding :content-type; bh=7Vz/bRFDvSkk1gGJP0bHJPO+xmzPw6gQKqsJEWP9f84=; b=vwyPf+MlOn1mVCqZp2BP4z5+FzGMqd6deJAbuPxfXhJ1OQfjektL42GiGi2LWpTij5 RHmpgjYf3BcRzKtdDvy+F0ggnIH0eGjTbMT/eiuemBykIKVMs9NQxe0XqBNWG4r6qxyA 09ulpw/TtA9O4+oMR/gPUHWkFhT4nUwDvFnbt4/+Pz2vfQOJZrXBGsKqTXvrQJ516vDY LvcgVURE7nWmdp6amCE+QaGmbQOFfp1iizSJPemL+jSEzV6qg7kwzCWpvH3OzyqfCum/ F72489WcGBicHdd9+9ub5HrfHHLrh92yDBGvdE1AzGL6LjRFp3rPVsjFMwdABiWGDdqO n63Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=7Vz/bRFDvSkk1gGJP0bHJPO+xmzPw6gQKqsJEWP9f84=; b=fulNUnKo1+Gd8C14brkcAJQzdxaNaPqcz2up1CcalNE7SpUFaB8K9kRBpDrLF7V7/Q MAUClIR+XH6SWvQFUvjqnph2RUV4bQ4ba8cx1GxfLBSPrZ0vckHAuIChx68Lud/gZzN+ 5dOOo3NZttIcD7HsVHsyP+rt38GOqM6MAtdXXYDJcKudZxJ44qNgVll+hO48ZhmshbQc d1cGsh5wuYzRz0wr6jAyQT8jamtl25127ms5gKdEKDv+brCHjzkkIQQ0ToaUDdO/cb5q JoZk/djzbSM2igTcWKjexZCYlJAluUzSOGwJ5nN29mQSoVLEHMV80Nyd/utf9+UHlVwW J5Pg== X-Gm-Message-State: ALoCoQk28Gf92hG27m2InFzvbByRvKCwKCBcg3N/wNHRQUGJYfHAnlZcAmX6I6LSvvFQUfWWvbMW X-Received: by 10.25.206.16 with SMTP id e16mr3336158lfg.39.1446246391773; Fri, 30 Oct 2015 16:06:31 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.80.141]) by smtp.gmail.com with ESMTPSA id dp1sm1643752lbc.34.2015.10.30.16.06.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Oct 2015 16:06:31 -0700 (PDT) From: Sergei Shtylyov To: netdev@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH v2 2/2] sh_eth: fix WARNING in dma_common_free_remap() Date: Sat, 31 Oct 2015 02:06:29 +0300 Message-ID: <26794140.C2D7kzBE0h@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.9 (Linux/4.1.8-100.fc21.x86_64; KDE/4.14.11; x86_64; ; ) In-Reply-To: <3291270.dPgp9opalf@wasted.cogentembedded.com> References: <3291270.dPgp9opalf@wasted.cogentembedded.com> MIME-Version: 1.0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Iff the first dma_alloc_coherent() call fails in sh_eth_ring_init(), the following is printed to the kernel console: WARNING: CPU: 0 PID: 1 at drivers/base/dma-mapping.c:334 dma_common_free_remap+0x48/0x6c() trying to free invalid coherent area: (null) Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.3.0-rc7-dirty #969 Hardware name: Generic R8A7791 (Flattened Device Tree) Backtrace: [] (dump_backtrace) from [] (show_stack+0x18/0x1c) r6:c0662856 r5:00000009 r4:00000000 r3:00204140 [] (show_stack) from [] (dump_stack+0x74/0x90) [] (dump_stack) from [] (warn_slowpath_common+0x8c/0xb8) r4:ee84dce0 r3:c0712774 [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x38/0x40) r8:ee7f8000 r7:c0734520 r6:00001000 r5:20000008 r4:00000000 [] (warn_slowpath_fmt) from [] (dma_common_free_remap+0x48/0x6c) r3:00000000 r2:c0662871 [] (dma_common_free_remap) from [] (__arm_dma_free+0xb8/0xd4) r6:00000001 r5:00000000 r4:00001000 r3:ee8c5584 [] (__arm_dma_free) from [] (arm_dma_free+0x24/0x2c) r10:0000016b r8:00000000 r7:ee9bc830 r6:00000000 r5:00000400 r4:ee9bc800 [] (arm_dma_free) from [] (sh_eth_ring_init+0x110/0x138) [] (sh_eth_ring_init) from [] (sh_eth_open+0x94/0x1f4) r6:00000000 r5:ee9bcd18 r4:ee9bc800 [] (sh_eth_open) from [] (__dev_open+0x84/0x104) r6:c0565c50 r5:00000000 r4:ee9bc800 [] (__dev_open) from [] (__dev_change_flags+0x94/0x13c) r7:00001002 r6:00000001 r5:00001003 r4:ee9bc800 [] (__dev_change_flags) from [] (dev_change_flags+0x20/0x50) r7:c072c8a0 r6:00000138 r5:00001002 r4:ee9bc800 [] (dev_change_flags) from [] (ip_auto_config+0x174/0xf7c) r8:00001002 r7:c072c8a0 r6:c0700040 r5:00000001 r4:ee9bc800 r3:00000101 [] (ip_auto_config) from [] (do_one_initcall+0x100/0x1c8) r10:c06f883c r9:00000000 r8:c06e8bd8 r7:c0734000 r6:c070e918 r5:c070e918 r4:ee083640 [] (do_one_initcall) from [] (kernel_init_freeable+0x11c/0x1ec) r10:c06f883c r9:00000000 r8:00000099 r7:c0734000 r6:c070372c r5:c06f8834 r4:00000007 [] (kernel_init_freeable) from [] (kernel_init+0x14/0xec) r10:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c0514d64 r4:c0734000 [] (kernel_init) from [] (ret_from_fork+0x14/0x3c) r4:00000000 r3:ee84c000 This is because the code jumps to a wrong label and so tries to free yet unallocated coherent memory. Fix the *goto* in question. Signed-off-by: Sergei Shtylyov --- Changes in version 2: - fixed the function name in the summary. drivers/net/ethernet/renesas/sh_eth.c | 2 +- drivers/net/ethernet/renesas/sh_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: net/drivers/net/ethernet/renesas/sh_eth.c =================================================================== --- net.orig/drivers/net/ethernet/renesas/sh_eth.c +++ net/drivers/net/ethernet/renesas/sh_eth.c @@ -1232,7 +1232,7 @@ static int sh_eth_ring_init(struct net_d GFP_KERNEL); if (!mdp->rx_ring) { ret = -ENOMEM; - goto desc_ring_free; + goto skb_ring_free; } mdp->dirty_rx = 0;