Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2025813pxa; Mon, 3 Aug 2020 05:43:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwh16pWOg51M7lZekmwG5Hsv74dOBRgjjLMrk0c1kzxvq6knDvRj7D7Or/xP6fkaQZFoLIz X-Received: by 2002:a17:906:b248:: with SMTP id ce8mr15935484ejb.85.1596458591749; Mon, 03 Aug 2020 05:43:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596458591; cv=none; d=google.com; s=arc-20160816; b=qW/+ZQvHyt8Vuhta30gDg5SWqvFvP3dKesmuo/WmjYLkYO0ev4GyUjwINKdscC++4/ sSmr8Be7eTP1XQEg6CiTJRR5IgGKp8BI8OxK8Qf+1dLodaty6S8T/5DFF+F1e058zIF9 TZj1bmZFjtk0byG1WH3BSK5WNbGD7ld2LuHoJM2atTn+akZqXHEg1Z75s81ruVfR38b9 M0+DTzRayeIJI6nfQO7V4xex04CEuWALhwtDf3jb2MFdGUokzuWlE6uvaA0m/UndM94/ PsJ5UCo/cayt0AP0Vs3x7zi33pFLUQcw14Ur/bdoedNj4d32XcTda6Rs1ERSFs3s9tyU wkIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zFLD/MUoz8rpu5S129lAJAjwrn0EDUloxtIo4dvI4AA=; b=cctq0/TO4AHcXvcC6MnWxJUI72wHOZp4pq5gGbYxSIAzKEa8bge9LB+AzEq6BFWnz2 MBe4rcuXZ3JqwjlrCY4ZBbzO5SFO2uy8yiVL4xgp1iNBM4PbUBW1CL5D6fIvpsvYoQoA wwoLi2sFMARjVuO++nWYnepOsoGZBvQZja6eQqPH/2JBys4IWjar874RO/mkg2oTO5l2 Ix2VGnerRw87aFYntddH88Ne6gXiIfcatcucAYVWfcQDUL2RbER/Fui3tOw6pdTIpJAw qvCW2FVE2toNllcx2PJyyB0RcXxr28Ses3ihVdy2cmjBFUwMLM2SZ2PSWhzunmEyzhq6 dPpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PWybHHnx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lh27si10806109ejb.545.2020.08.03.05.42.49; Mon, 03 Aug 2020 05:43:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PWybHHnx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728868AbgHCMlj (ORCPT + 99 others); Mon, 3 Aug 2020 08:41:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:60340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729296AbgHCMc0 (ORCPT ); Mon, 3 Aug 2020 08:32:26 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3DBAF2054F; Mon, 3 Aug 2020 12:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596457944; bh=KaCNeaf89Tis8mfvhLI1/BfgusKjtbUmF2IX4MJ3hb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PWybHHnxyeUvXNH3M+do/VwI+W3xpLuidNtMPZnuF1I8AXgPdc0O+ImBu5ALgm1RE 26QORcOBgBn3pGa6TQOOs/CVeIgANsyTjE3xgaUXpxzkBYSn/TpPkXybqV4dML329Z 5O4shJf8ShgSHWi18B5HOJB6EoyUHuxwW38NrxFo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Remi Pommarel , Johannes Berg , Sasha Levin Subject: [PATCH 4.19 39/56] mac80211: mesh: Free ie data when leaving mesh Date: Mon, 3 Aug 2020 14:19:54 +0200 Message-Id: <20200803121852.233315098@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200803121850.306734207@linuxfoundation.org> References: <20200803121850.306734207@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Remi Pommarel [ Upstream commit 6a01afcf8468d3ca2bd8bbb27503f60dcf643b20 ] At ieee80211_join_mesh() some ie data could have been allocated (see copy_mesh_setup()) and need to be cleaned up when leaving the mesh. This fixes the following kmemleak report: unreferenced object 0xffff0000116bc600 (size 128): comm "wpa_supplicant", pid 608, jiffies 4294898983 (age 293.484s) hex dump (first 32 bytes): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 0............... 00 0f ac 08 00 00 00 00 c4 65 40 00 00 00 00 00 .........e@..... backtrace: [<00000000bebe439d>] __kmalloc_track_caller+0x1c0/0x330 [<00000000a349dbe1>] kmemdup+0x28/0x50 [<0000000075d69baa>] ieee80211_join_mesh+0x6c/0x3b8 [mac80211] [<00000000683bb98b>] __cfg80211_join_mesh+0x1e8/0x4f0 [cfg80211] [<0000000072cb507f>] nl80211_join_mesh+0x520/0x6b8 [cfg80211] [<0000000077e9bcf9>] genl_family_rcv_msg+0x374/0x680 [<00000000b1bd936d>] genl_rcv_msg+0x78/0x108 [<0000000022c53788>] netlink_rcv_skb+0xb0/0x1c0 [<0000000011af8ec9>] genl_rcv+0x34/0x48 [<0000000069e41f53>] netlink_unicast+0x268/0x2e8 [<00000000a7517316>] netlink_sendmsg+0x320/0x4c0 [<0000000069cba205>] ____sys_sendmsg+0x354/0x3a0 [<00000000e06bab0f>] ___sys_sendmsg+0xd8/0x120 [<0000000037340728>] __sys_sendmsg+0xa4/0xf8 [<000000004fed9776>] __arm64_sys_sendmsg+0x44/0x58 [<000000001c1e5647>] el0_svc_handler+0xd0/0x1a0 Fixes: c80d545da3f7 (mac80211: Let userspace enable and configure vendor specific path selection.) Signed-off-by: Remi Pommarel Link: https://lore.kernel.org/r/20200704135007.27292-1-repk@triplefau.lt Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/cfg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index cb7076d9a7698..b6670e74aeb7b 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -2011,6 +2011,7 @@ static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev) ieee80211_stop_mesh(sdata); mutex_lock(&sdata->local->mtx); ieee80211_vif_release_channel(sdata); + kfree(sdata->u.mesh.ie); mutex_unlock(&sdata->local->mtx); return 0; -- 2.25.1