Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4726569pxb; Thu, 14 Oct 2021 10:42:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtu07BCdyHL8anG0HBGOl9rqJ2tYwDI5A+5paJm7OC2HwB1XyPcHemFENLUayciyUdBBVX X-Received: by 2002:a65:6187:: with SMTP id c7mr5245098pgv.317.1634233376188; Thu, 14 Oct 2021 10:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634233376; cv=none; d=google.com; s=arc-20160816; b=nnA/yWMDPBO4islMuIJdwNd67t/mdCpRZqoCxR0oxX0pe95wUlEIOX5MlnronaDlQP 39z7zo8pZfmGrMd3SP6A+u8r4tj+YBX4KzB/MbjImp8nJcBmyxc1GSWV8QshBrqvU9st OL2AMQdZYgmrrzAC+V0WxPif8OzPJNX59wIOq+Hhfk7ERO99DsRfQUTF838Wc9MJzjqJ JwtkT8uZY4t5QLYpk1WvCenYLFk7ByK5eittGNKzZEGv1898INyCwduBS3TkMCWnK0Wy y8W6hxqVYJ78mT5J9fFfONZ26pBRsXck8aLjkZrLAZm1tvU6oGHEFsmD/JddBntWY1Wl iQuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WCWfOMnjPvJTfk5yl1JFMT2YcZXPhwNtaVSfaIoW9zI=; b=QtwYhV+nAjVZ1kkW2FIpKNtCsyuKzPFDSutW0zBdGVdGAZvXkmxi0bqlEKBvPXxWwc uwOJvOLpaOUvykmO0eo/XGsHVEcGArG75Yqoeoa/lbJAXzuJ2Xg0kLG7UO2lInDumqK8 qStaH5zYEGpiuimOj9CzXu3MLQUCmhmyNu3NVhO2lbfo+h/DGHyCgDtgFD5j+ngcaiDf 7enq8m0CO5ksZo56FKjwZxN6YQ1cO0BwsLPey7zyvtz9BRsdlZXEI9pIEkse010pewzw BHGmIy28XsD+nhHZbaP2CSWIym4iLV7WoWBzNUhUHrj4c3f5CX2CHn11aQOZ0RXbFkik fk1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XmAi6Rys; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k70si2592949pgd.620.2021.10.14.10.42.40; Thu, 14 Oct 2021 10:42:56 -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=@linuxfoundation.org header.s=korg header.b=XmAi6Rys; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233286AbhJNPCg (ORCPT + 99 others); Thu, 14 Oct 2021 11:02:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:44512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232764AbhJNPBC (ORCPT ); Thu, 14 Oct 2021 11:01:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C23C361184; Thu, 14 Oct 2021 14:58:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634223518; bh=gEGYKIOMjySowZ5CHtGQ2IJh4exknbxozB6VcYgt9jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XmAi6RyszkurvEFbtf76KKbPoz5UlugXA7yE+HOtCC032NsUcYB8fzoziqE8A3yjp g6g7ffc6byxWH23l4mZhwJp4ymLyYxVQ22l91/cY3ju7gJPgnIP4nRwbb69r8QF1WI csVAXPbTrMrJHtMO2KT3UEJRFa6sPXQmEZg57AJE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, MichelleJin , Johannes Berg , Sasha Levin Subject: [PATCH 4.19 07/12] mac80211: check return value of rhashtable_init Date: Thu, 14 Oct 2021 16:54:07 +0200 Message-Id: <20211014145206.797805715@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211014145206.566123760@linuxfoundation.org> References: <20211014145206.566123760@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: MichelleJin [ Upstream commit 111461d573741c17eafad029ac93474fa9adcce0 ] When rhashtable_init() fails, it returns -EINVAL. However, since error return value of rhashtable_init is not checked, it can cause use of uninitialized pointers. So, fix unhandled errors of rhashtable_init. Signed-off-by: MichelleJin Link: https://lore.kernel.org/r/20210927033457.1020967-4-shjy180909@gmail.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/mesh_pathtbl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 6dc5f93b1e4d..06b44c3c831a 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c @@ -63,7 +63,10 @@ static struct mesh_table *mesh_table_alloc(void) atomic_set(&newtbl->entries, 0); spin_lock_init(&newtbl->gates_lock); spin_lock_init(&newtbl->walk_lock); - rhashtable_init(&newtbl->rhead, &mesh_rht_params); + if (rhashtable_init(&newtbl->rhead, &mesh_rht_params)) { + kfree(newtbl); + return NULL; + } return newtbl; } -- 2.33.0