From patchwork Sat Jul 22 19:40:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 9858181 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1C891600F5 for ; Sat, 22 Jul 2017 19:41:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FD1828475 for ; Sat, 22 Jul 2017 19:41:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1373B2847A; Sat, 22 Jul 2017 19:41:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96ADB28475 for ; Sat, 22 Jul 2017 19:41:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751314AbdGVTlD (ORCPT ); Sat, 22 Jul 2017 15:41:03 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:36330 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750865AbdGVTlC (ORCPT ); Sat, 22 Jul 2017 15:41:02 -0400 Received: by mail-wm0-f42.google.com with SMTP id w191so30095051wmw.1 for ; Sat, 22 Jul 2017 12:41:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6YZ6kAwQkEAIlMBx/ZJm15GvRduzN6nyaJVEzqNYHv0=; b=MHLwoJVbeb8Cy0yInglNn2GB7/dC+q8AlPTLgK7o/fwp7DEs2B6c9q0jpAg+6wlCoL 3AMggLX8VBXkZYus9hnJKt5W2ilrn6P4BvW7oqq7qWGTg+pzX2yA3F55Hsphj09mybEO a6pGofXPlW9C3kMHQXRRXAyZDNxtEtAwr+Wjs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6YZ6kAwQkEAIlMBx/ZJm15GvRduzN6nyaJVEzqNYHv0=; b=PhFmSJRzJq6SFsl10C/uQSIQuBDLkbo98iSdOtG0fyIlvUPgeTd4rUIcsUIGWT+0WD va0fQDRWFiBMfk6pAk3SMCyRHRPi7l8GaZBwY1R68cYSzsyD3/bMYX7p4bG0TOnFJLxr PvX9sF16tjEYSAMmKjjvEUAQhS5sG8/mL3QwyHOGin8ol14edSJ6scBVxLxus3rffUHY 69sXYTbpfQUPZHLNTAsCWwqmd5uxxlmg4a94/i+jeKiHVuLJIhU9VrhyJdbae+REba6h UjWNiCb8w9TgHuAf53l36AqTevPIZs0I1nX6ik7h0lsQULlOg/yXxA2E8hTL8imM1OJl FgCg== X-Gm-Message-State: AIVw113GReK8Okxmx3901olkLyW+KTBLHtKSgFgsct9rqhvVzd+73XB2 vUo7T2o7uFNgg6Kr/s4acw== X-Received: by 10.80.225.3 with SMTP id h3mr9198844edl.222.1500752461106; Sat, 22 Jul 2017 12:41:01 -0700 (PDT) Received: from [192.168.178.39] (f140230.upc-f.chello.nl. [80.56.140.230]) by smtp.gmail.com with ESMTPSA id k16sm3511271ede.33.2017.07.22.12.40.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Jul 2017 12:41:00 -0700 (PDT) Subject: Re: brcmfmac: Possible memleak brcmf_sdiod_sgtable_alloc To: Stefan Wahren , hante.meuleman@broadcom.com, pieter-paul.giesberts@broadcom.com, franky.lin@broadcom.com, kvalo@codeaurora.org Cc: brcm80211-dev-list.pdl@broadcom.com, linux-wireless@vger.kernel.org References: <1442361688.41682.1500729531173@email.1und1.de> From: Arend van Spriel Message-ID: <325e5f1a-2752-6004-a460-a59e8e2c702d@broadcom.com> Date: Sat, 22 Jul 2017 21:40:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1442361688.41682.1500729531173@email.1und1.de> Content-Language: en-US Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 22-07-17 15:18, Stefan Wahren wrote: > Hi, > > with enabled memleak detector on 4.13-rc1 (Raspberry Pi Zero W) i get the following: > > root@raspberrypi:/sys/kernel/debug# cat kmemleak > unreferenced object 0xd824e400 (size 1024): > comm "kworker/0:0", pid 3, jiffies 4294939822 (age 873.420s) > 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 00 00 00 00 00 00 00 ................ > backtrace: > [] kmemleak_alloc+0x60/0xc8 > [] __kmalloc+0x184/0x2f4 > [] sg_kmalloc+0x48/0x4c > [] __sg_alloc_table+0x78/0x11c > [] sg_alloc_table+0x2c/0x5c > [] brcmf_sdiod_sgtable_alloc+0xc0/0x110 [brcmfmac] > [] brcmf_sdio_probe+0x24c/0x970 [brcmfmac] > [] brcmf_ops_sdio_probe+0x17c/0x244 [brcmfmac] > [] sdio_bus_probe+0xb4/0x124 > [] driver_probe_device+0x1d8/0x438 > [] __driver_attach+0xa4/0x108 > [] bus_for_each_dev+0x84/0x98 > [] driver_attach+0x28/0x30 > [] bus_add_driver+0xe4/0x24c > [] driver_register+0xac/0xf0 > [] sdio_register_driver+0x2c/0x34 Hi Stefan, Thanks for the report. Checking elixir it shows two call sites to brcmf_sdiod_sgtable_alloc() [1]. This is rather unexpected. We did move the call so this might be a merge issue. 4d7928959 sdio.c (Hante Meuleman 2016-02-17 11:27:07 +0100: 3867) brcmf_sdiod_sgtable_alloc(sdiodev); e0045bf80 sdio.c (Hante Meuleman 2016-01-19 12:39:24 +0100: 4180) brcmf_sdiod_sgtable_alloc(bus->sdiodev); The most recent change is: commit 4d7928959832 ("brcmfmac: switch to new platform data") found in patchwork [2], which shows the added call, but no removal so the merge issue is probably internal with us (me :-( ). Again thanks for the report. Below change should fix the issue. Regards, Arend [1] http://elixir.free-electrons.com/linux/latest/ident/brcmf_sdiod_sgtable_alloc [2] https://patchwork.kernel.org/patch/8336231/ --- bus->roundup = min(max_roundup, bus->blocksize); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index fbcbb43..ed2c693 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -4174,11 +4174,6 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) goto fail; } - /* allocate scatter-gather table. sg support - * will be disabled upon allocation failure. - */ - brcmf_sdiod_sgtable_alloc(bus->sdiodev); - /* Query the F2 block size, set roundup accordingly */ bus->blocksize = bus->sdiodev->func[2]->cur_blksize;