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

Commit 80b5294d authored by Xiaojun Sang's avatar Xiaojun Sang Committed by Banajit Goswami
Browse files

ASoC: qdsp6v2: prevent null pointer dereference for _vol_cmds



In case of memory allocation failure, _vol_cmd_cnt is not reset.
In _volume_cmds_free, null pointer dereference would happen for
_vol_cmds[i].
To prevent it, reset _vol_cmd_cnt when memory allocation fails.

CRs-Fixed: 1089598
Change-Id: Icb998549cdb999c6db2fd52aef505f200e630da5
Signed-off-by: default avatarXiaojun Sang <xsang@codeaurora.org>
parent 4dd00411
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -236,7 +236,8 @@ static s32 _volume_cmds_alloc1(s32 size)
	if (_vol_cmds) {
		_vol_cmds_d = kzalloc(_vol_cmd_cnt * sizeof(struct vol_cmds_d),
					GFP_KERNEL);
	}
	} else
		_vol_cmd_cnt = 0;
	if (_vol_cmds_d)
		return 0;
	_volume_cmds_free();