Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2254632ybd; Mon, 24 Jun 2019 03:23:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTUylLDiq7nojR/drAjzAeiDYCd5RLrel4OjhcBTqQ3bKtQ/0AVnlRioDT5LF4XBfam7Bk X-Received: by 2002:a63:f50d:: with SMTP id w13mr32149825pgh.411.1561371791661; Mon, 24 Jun 2019 03:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561371791; cv=none; d=google.com; s=arc-20160816; b=Xj8L21zmZuHuftUC40g/zSsHgEznPybEWE/EJQ8l+rhMC9nVImY+j5APnO/o5TzOV8 LlkGBgmBYm0NoWP7ThAX9w1yuJz0oRaDOIen4+0oXQxsJN4NKmBvAG43wxAYBhQuwack wKL9qW6yk4RYHkXOMnUQV/urVb66+d5Jeqzj9JXJm6iGmt+Se85sc+tZM3UPOLkWLqEe sQnFBA5p9X9mrB9pXCE0XDrlMgYpCaSHbREagWxViNf6Y5R5kDhsiVbSMkddouJWMXJ4 EzOOqHwKEkUwcTiO//yK58RhFgNRIJallPU+wggCaS25cx7UEYEgds4Z19/7zrgGL7gk Yw3A== 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=0bwRVZ9wE+goBtHZ5ekExuwGvQ+wDn4Tod3mEJWaPxs=; b=Q0dKMJR4musDs3WcVpj1rtbwaHcPiqCAPQymeaM41gjy5rFImGr/CsIsCmx1BGxCtj R9Wpju6nrk3W/jWclWBDW8+j1ES/OEeTLsorCcC4amnu2c4VleY6AzkBLcorkuC3uSoz Hb3S5AAxmdFxZaMJKzz5ZvOvUaItrzK2ZXLTrsb/DsSVQ9LKu4QWd7Lk+4m1dYQiLTdk TJy5QTVYlPJXEehNbQQoufI99Yxy0+8Lpki3C7Jc6GgDvboSipZjGn4UJOOFHtaVJSQ+ 1hQzQuw7D4KfMx26nq/roXynxtRcfoprEKKmdag/n3tq9V8C19PpildtFLHkWOgMQA7H dWjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="rs9g9i/B"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5si9174240pla.17.2019.06.24.03.22.55; Mon, 24 Jun 2019 03:23:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="rs9g9i/B"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730220AbfFXKWX (ORCPT + 99 others); Mon, 24 Jun 2019 06:22:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:58172 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731094AbfFXKWR (ORCPT ); Mon, 24 Jun 2019 06:22:17 -0400 Received: from localhost (f4.8f.5177.ip4.static.sl-reverse.com [119.81.143.244]) (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 5C06821473; Mon, 24 Jun 2019 10:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561371736; bh=r9qR6vdNFVnaspyC0BjX8Zv4RgKiC6mrDPulvEKLJ4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rs9g9i/BlI+hY1KoPuzbzNhVfz4JaeGFwoUVdQkFScFage88VGlkkTnWkgemLe4pW 4pHjofE1Iog9nNsy4Md9HlFF3UHC70Kp28u6Ihkx0r7JoVM2aGD3PQtuax4VvPpn7L 9vpPhsmskZgwl5i0Yi5FZYBGuRZ2k+6XVjQ9OoHs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+7fddca22578bc67c3fe4@syzkaller.appspotmail.com, Eric Biggers , Johannes Berg Subject: [PATCH 5.1 115/121] cfg80211: fix memory leak of wiphy device name Date: Mon, 24 Jun 2019 17:57:27 +0800 Message-Id: <20190624092326.525035719@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190624092320.652599624@linuxfoundation.org> References: <20190624092320.652599624@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: Eric Biggers commit 4f488fbca2a86cc7714a128952eead92cac279ab upstream. In wiphy_new_nm(), if an error occurs after dev_set_name() and device_initialize() have already been called, it's necessary to call put_device() (via wiphy_free()) to avoid a memory leak. Reported-by: syzbot+7fddca22578bc67c3fe4@syzkaller.appspotmail.com Fixes: 1f87f7d3a3b4 ("cfg80211: add rfkill support") Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/wireless/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -513,7 +513,7 @@ use_default_name: &rdev->rfkill_ops, rdev); if (!rdev->rfkill) { - kfree(rdev); + wiphy_free(&rdev->wiphy); return NULL; }