Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3248f7ad authored by Dundi Raviteja's avatar Dundi Raviteja Committed by Madan Koyyalamudi
Browse files

qcacmn: Avoid possible out of array access

In function wbuff_buff_put(), there is a possibility to
access array out of boundaries for module slot and pool slot.

Add condition to check for array boundaries.

Change-Id: Iaf5a0ef6b2e712804717abf27d0c0d06862a04f5
CRs-Fixed: 3086342
parent b05e3040
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
 * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -345,6 +346,10 @@ qdf_nbuf_t wbuff_buff_put(qdf_nbuf_t buf)

	mslot = (slot_info & WBUFF_MSLOT_BITMASK) >> WBUFF_MSLOT_SHIFT;
	pslot = (slot_info & WBUFF_PSLOT_BITMASK) >> WBUFF_PSLOT_SHIFT;

	if (mslot >= WBUFF_MAX_MODULES || pslot >= WBUFF_MAX_POOLS)
		return NULL;

	qdf_nbuf_reset(buffer, wbuff.mod[mslot].reserve, wbuff.mod[mslot].
		       align);
	qdf_spin_lock_bh(&wbuff.mod[mslot].lock);