From mboxrd@z Thu Jan 1 00:00:00 1970 From: eero.nurkkala@offcode.fi Subject: [PATCH 3/4] msm: audio: qdsp6v2: fix potential memory corruption Date: Tue, 15 Feb 2011 14:08:40 +0200 Message-ID: <1297771721-17574-3-git-send-email-eero.nurkkala@offcode.fi> References: <1297771721-17574-1-git-send-email-eero.nurkkala@offcode.fi> Return-path: Received: from smtp.nokia.com ([147.243.1.47]:40519 "EHLO mgw-sa01.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754524Ab1BOMF1 (ORCPT ); Tue, 15 Feb 2011 07:05:27 -0500 In-Reply-To: <1297771721-17574-1-git-send-email-eero.nurkkala@offcode.fi> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: linux-arm-msm@vger.kernel.org Cc: Eero Nurkkala From: Eero Nurkkala kzalloc() may fail, which can result in memory corruption later in the code. Signed-off-by: Eero Nurkkala --- branch: android-msm-2.6.35 arch/arm/mach-msm/qdsp6v2/audio_dev_ctl.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-msm/qdsp6v2/audio_dev_ctl.c b/arch/arm/mach-msm/qdsp6v2/audio_dev_ctl.c index 2d848d5..b414f3e 100644 --- a/arch/arm/mach-msm/qdsp6v2/audio_dev_ctl.c +++ b/arch/arm/mach-msm/qdsp6v2/audio_dev_ctl.c @@ -1028,6 +1028,11 @@ void broadcast_event(u32 evt_id, u32 dev_id, u64 session_id) evt_payload = kzalloc(sizeof(union auddev_evt_data), GFP_KERNEL); + if (!evt_payload) { + pr_err("%s:Out of memory\n", __func__); + mutex_unlock(&session_lock); + return; + } list_for_each_entry(callback, &event.list, list) { if (!(evt_id & callback->evt_id)) -- 1.7.0.4