]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.7.7/i40iw-do-not-set-self-referencing-pointer-to-null-after-kfree.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.7.7 / i40iw-do-not-set-self-referencing-pointer-to-null-after-kfree.patch
1 From 7eaf8313b1cfe93417a22bdc3f7380cac2a3dc6d Mon Sep 17 00:00:00 2001
2 From: Mustafa Ismail <mustafa.ismail@intel.com>
3 Date: Mon, 22 Aug 2016 19:01:47 -0500
4 Subject: i40iw: Do not set self-referencing pointer to NULL after kfree
5
6 From: Mustafa Ismail <mustafa.ismail@intel.com>
7
8 commit 7eaf8313b1cfe93417a22bdc3f7380cac2a3dc6d upstream.
9
10 In i40iw_free_virt_mem(), do not set mem->va to NULL
11 after freeing it as mem->va is a self-referencing pointer
12 to mem.
13
14 Fixes: 4e9042e647ff ("i40iw: add hw and utils files")
15
16 Reported-by: Stefan Assmann <sassmann@redhat.com>
17 Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
18 Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
19 Signed-off-by: Doug Ledford <dledford@redhat.com>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22 ---
23 drivers/infiniband/hw/i40iw/i40iw_utils.c | 5 ++++-
24 1 file changed, 4 insertions(+), 1 deletion(-)
25
26 --- a/drivers/infiniband/hw/i40iw/i40iw_utils.c
27 +++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c
28 @@ -673,8 +673,11 @@ enum i40iw_status_code i40iw_free_virt_m
29 {
30 if (!mem)
31 return I40IW_ERR_PARAM;
32 + /*
33 + * mem->va points to the parent of mem, so both mem and mem->va
34 + * can not be touched once mem->va is freed
35 + */
36 kfree(mem->va);
37 - mem->va = NULL;
38 return 0;
39 }
40