From patchwork Mon Dec 11 07:05:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Korenblit, Miriam Rachel" X-Patchwork-Id: 13486404 X-Patchwork-Delegate: johannes@sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Q0tXvTtc" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 236AC106 for ; Sun, 10 Dec 2023 05:06:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702213605; x=1733749605; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KreBiLuQGquSgy/UVsC9UojUd1ufeB/JDzNnIs0CQj0=; b=Q0tXvTtc49WuygpHhA+Ixjmefzd7lv03oz5mvl0agwZRoKQzFBAhb2nz +dprH+JoYWrsFBBe/H2WtUgkzLK8rryiytlFj0WuWPqEwe15WIli1+iIk 7c4UAIl59fuiycb/ugYnenH3XyqeMBVyPvovaHEBKUHoBKQ809aNXkruX AO4wPejL3841LQn37pVkOaZcp9kp3K6GlFmSgNH3NDl59yU5i6w5BFeSf SdPnkfbWk8wLfjx7FPR6HB7bWGMiau35pio8pEDcs4QlE1uYp0hxNTgKd sun74NB2HOKUKRg8GgUByyIsRoqIYvAPuNVPofKyWdWsY1V1iXJFYktp/ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10919"; a="480746186" X-IronPort-AV: E=Sophos;i="6.04,265,1695711600"; d="scan'208";a="480746186" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2023 05:06:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10919"; a="748926503" X-IronPort-AV: E=Sophos;i="6.04,265,1695711600"; d="scan'208";a="748926503" Received: from unknown (HELO WEIS0040.iil.intel.com) ([10.12.217.108]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2023 05:06:41 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 14/14] wifi: mac80211: mesh: check element parsing succeeded Date: Mon, 11 Dec 2023 09:05:32 +0200 Message-Id: <20231211085121.93dea364f3d3.Ie87781c6c48979fb25a744b90af4a33dc2d83a28@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231211070532.2458539-1-miriam.rachel.korenblit@intel.com> References: <20231211070532.2458539-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited From: Johannes Berg ieee802_11_parse_elems() can return NULL, so we must check for the return value. Fixes: 5d24828d05f3 ("mac80211: always allocate struct ieee802_11_elems") Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- net/mac80211/mesh_plink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index efffde7e5695..28bf794f67f8 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c @@ -1247,6 +1247,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, return; } elems = ieee802_11_parse_elems(baseaddr, len - baselen, true, NULL); - mesh_process_plink_frame(sdata, mgmt, elems, rx_status); - kfree(elems); + if (elems) { + mesh_process_plink_frame(sdata, mgmt, elems, rx_status); + kfree(elems); + } }