From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D34F57D062; Mon, 8 Apr 2024 13:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712581337; cv=none; b=uhPPsFvG/SYJBt8NG6I46LlOvTaMgphhbVMuTNKDW8yC7//Ad+/m0Z2Ms4PY+4vrmg9mGhndvfbehSlHExGu4z/2RAsCVJKbbxZ0YpdDtEYFdwCX7I+U55hRI1PJQAkHfNcbwl3DEJVA7FPCfJczLuBmQjjCAaITAPSXlTgPOrg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712581337; c=relaxed/simple; bh=d5WtnGIwY/ty292BDhUut9H23IG009q8FeeOKUYdjzY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b17/KvO04DLZ0sFiex635re27iDQj9KqAsEswzs27p19mW5/FpkkVibNt+ou3MFgS9axurbMFHMUsd05/d/q55HiePhdE3u5uJo3tdeLteRMXIjPAGtojkKb9MVTWsStBTRY73ixez2sVUZ9i9571HlWYG5aZiULiwmcwfT3eU4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=iwbdQEg/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="iwbdQEg/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57D9EC433C7; Mon, 8 Apr 2024 13:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712581337; bh=d5WtnGIwY/ty292BDhUut9H23IG009q8FeeOKUYdjzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iwbdQEg/5s55erjWOQ7BOqMsiJ9DzzyrVkFZ7AX6SvyZDqhSTIQ+m5UkFulnfl/qr FmZQVwFAIruGWxOsgNm2d+YeUSqHP0G7Kj03TTu45KpcUEm3ZkTxOa9k3kz90Rkluw /DPbbv4jl1CUb4fbhPIO5k2gXjm1Td3r6icAJbLk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Johannes Berg , Miri Korenblit , Sasha Levin , Anjaneyulu Subject: [PATCH 6.1 005/138] wifi: iwlwifi: mvm: rfi: fix potential response leaks Date: Mon, 8 Apr 2024 14:56:59 +0200 Message-ID: <20240408125256.391470964@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240408125256.218368873@linuxfoundation.org> References: <20240408125256.218368873@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johannes Berg [ Upstream commit 06a093807eb7b5c5b29b6cff49f8174a4e702341 ] If the rx payload length check fails, or if kmemdup() fails, we still need to free the command response. Fix that. Fixes: 21254908cbe9 ("iwlwifi: mvm: add RFI-M support") Co-authored-by: Anjaneyulu Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit Link: https://msgid.link/20240319100755.db2fa0196aa7.I116293b132502ac68a65527330fa37799694b79c@changeid Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/mvm/rfi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c b/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c index bb77bc9aa8218..fb2408c0551d2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c @@ -122,14 +122,18 @@ struct iwl_rfi_freq_table_resp_cmd *iwl_rfi_get_freq_table(struct iwl_mvm *mvm) if (ret) return ERR_PTR(ret); - if (WARN_ON_ONCE(iwl_rx_packet_payload_len(cmd.resp_pkt) != resp_size)) + if (WARN_ON_ONCE(iwl_rx_packet_payload_len(cmd.resp_pkt) != + resp_size)) { + iwl_free_resp(&cmd); return ERR_PTR(-EIO); + } resp = kmemdup(cmd.resp_pkt->data, resp_size, GFP_KERNEL); + iwl_free_resp(&cmd); + if (!resp) return ERR_PTR(-ENOMEM); - iwl_free_resp(&cmd); return resp; } -- 2.43.0