android_kernel_motorola_sm6375/net/xfrm
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Khalid Masum 18373ed500 xfrm: Update ipcomp_scratches with NULL when freed
[ Upstream commit 8a04d2fc700f717104bfb95b0f6694e448a4537f ]

Currently if ipcomp_alloc_scratches() fails to allocate memory
ipcomp_scratches holds obsolete address. So when we try to free the
percpu scratches using ipcomp_free_scratches() it tries to vfree non
existent vm area. Described below:

static void * __percpu *ipcomp_alloc_scratches(void)
{
        ...
        scratches = alloc_percpu(void *);
        if (!scratches)
                return NULL;
ipcomp_scratches does not know about this allocation failure.
Therefore holding the old obsolete address.
        ...
}

So when we free,

static void ipcomp_free_scratches(void)
{
        ...
        scratches = ipcomp_scratches;
Assigning obsolete address from ipcomp_scratches

        if (!scratches)
                return;

        for_each_possible_cpu(i)
               vfree(*per_cpu_ptr(scratches, i));
Trying to free non existent page, causing warning: trying to vfree
existent vm area.
        ...
}

Fix this breakage by updating ipcomp_scrtches with NULL when scratches
is freed

Suggested-by: Herbert Xu <[email protected]>
Reported-by: [email protected]
Tested-by: [email protected]
Signed-off-by: Khalid Masum <[email protected]>
Acked-by: Herbert Xu <[email protected]>
Signed-off-by: Steffen Klassert <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
2022-10-26 13:22:49 +02:00
..
Kconfig
Makefile
xfrm_algo.c
xfrm_device.c xfrm: enforce validity of offload input flags 2022-03-08 19:07:47 +01:00
xfrm_hash.c
xfrm_hash.h
xfrm_inout.h
xfrm_input.c
xfrm_interface.c xfrm: fix tunnel model fragmentation behavior 2022-04-15 14:17:56 +02:00
xfrm_ipcomp.c xfrm: Update ipcomp_scratches with NULL when freed 2022-10-26 13:22:49 +02:00
xfrm_output.c
xfrm_policy.c xfrm: fix refcount leak in __xfrm_policy_check() 2022-09-05 10:27:39 +02:00
xfrm_proc.c
xfrm_replay.c
xfrm_state.c ip: Fix data-races around sysctl_ip_no_pmtu_disc. 2022-07-29 17:14:10 +02:00
xfrm_sysctl.c
xfrm_user.c xfrm: Check if_id in xfrm_migrate 2022-03-19 13:40:16 +01:00