From patchwork Mon Jul 18 23:24:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 9235673 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 CE1B96075D for ; Mon, 18 Jul 2016 23:24:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C088D212CF for ; Mon, 18 Jul 2016 23:24:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4D3F26B4A; Mon, 18 Jul 2016 23:24:56 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 6ECA9265F9 for ; Mon, 18 Jul 2016 23:24:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752203AbcGRXYy (ORCPT ); Mon, 18 Jul 2016 19:24:54 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36423 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752184AbcGRXYw (ORCPT ); Mon, 18 Jul 2016 19:24:52 -0400 Received: by mail-pf0-f193.google.com with SMTP id y134so115278pfg.3 for ; Mon, 18 Jul 2016 16:24:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=haJiegDN7QaIUotQP5hUtKsm3GCrfNdT+8icMXc49oM=; b=qxUjhQ6i5YwMhqYiY8/pbxqQIR/8F6lzYeStR0E52p+QbnwF4hCPpvC+xiMgB2bWYf bpP7ahe8nf5KGXhcWo/MNI5o+0J0wCUMvdQ7Na2zdQ9E4Ps5QBREMcaTWnqTlIBd5hCA DWA6GevwO3wy/JYXJ3YAZ7xEE8ko53HBSmoP6EIaYI2Q9wxVy7uaHq0+/6WDVItLji+B qyDv0P7Hsk/qCYFvHJulktv5NP1piUuTlOQ7EhHqjJePRvWFRNwOAuGj8IvMUnR6BNLC PDRTvNEJ+cctXoSwukSjsJUC1FxOEQnoveCmljBimRWKJAAiV98shKfxMCoB75wxMPAo HbjQ== 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:in-reply-to :references; bh=haJiegDN7QaIUotQP5hUtKsm3GCrfNdT+8icMXc49oM=; b=a65sZOeuMDQsBlinvFdnauLi4eVONyT4ih3R0789NH+AlwYMAhWMxcDSF3/6wuEHf0 CXzKEZcNWNnbUq3x4Ll3KbwYycmqWbL98AmWF1OrFgMnKhZBD2LrcMZjbxTtXRtqHXUQ a9Ako/PbxTzOcbTUBc/ojFxTigjJYBZT2+pCmimdyWqHmoiVjA72LZg6/U/3F3jmtPFL 3jJZH+6yYMpNppbQWAyWv6WohFomMHyzLXVXed//BgvUl+DTDbM5Q/QpREJ9IgS5RuvA SJ3vgBkCGuM57VV3gt86JRCVEgWuTVZTJHVbBjYe5Ori7YyYelgbrXl2lw5wxHEXWFR+ Smww== X-Gm-Message-State: ALyK8tKQbCGW48IwIrjA9tuKhIJtsgS/TfaQzP08i7BgTqk6MRcWDKWr8Jgy2xJ7ZzeqBA== X-Received: by 10.98.23.134 with SMTP id 128mr49903720pfx.96.1468884291528; Mon, 18 Jul 2016 16:24:51 -0700 (PDT) Received: from fainelli-desktop.broadcom.com (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by smtp.gmail.com with ESMTPSA id dz13sm6934659pac.44.2016.07.18.16.24.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jul 2016 16:24:51 -0700 (PDT) From: Florian Fainelli To: brcm80211-dev-list.pdl@broadcom.com Cc: linux-wireless@vger.kernel.org, pieterpg@broadcom.com, kvalo@codeaurora.org, arend.vanspriel@broadcom.com, hante.meuleman@broadcom.com, Florian Fainelli Subject: [PATCH 1/4] brcmfmac: Fix glob_skb leak in brcmf_sdiod_recv_chain Date: Mon, 18 Jul 2016 16:24:34 -0700 Message-Id: <1468884277-18606-2-git-send-email-f.fainelli@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1468884277-18606-1-git-send-email-f.fainelli@gmail.com> References: <1468884277-18606-1-git-send-email-f.fainelli@gmail.com> 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 In case brcmf_sdiod_recv_chain() cannot complete a succeful call to brcmf_sdiod_buffrw, we would be leaking glom_skb and not free it as we should, fix this. Reported-by: coverity (CID 1164856) Fixes: a413e39a38573 ("brcmfmac: fix brcmf_sdcard_recv_chain() for host without sg support") Signed-off-by: Florian Fainelli Acked-by: Arend van Spriel --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c index c4b89d27e2e8..f549c25608d6 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c @@ -726,8 +726,10 @@ int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev, return -ENOMEM; err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr, glom_skb); - if (err) + if (err) { + brcmu_pkt_buf_free_skb(glom_skb); goto done; + } skb_queue_walk(pktq, skb) { memcpy(skb->data, glom_skb->data, skb->len);