Message ID | 1390580075-14342-1-git-send-email-hanjun.guo@linaro.org |
---|---|
State | New |
Headers | show
Return-Path: <patchwork-forward+bncBDWLZTMOWUARBE5DRKLQKGQEBN5VPDI@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BE6EF20307 for <linaro@patches.linaro.org>; Fri, 24 Jan 2014 16:15:25 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id fa1sf8095267pad.8 for <linaro@patches.linaro.org>; Fri, 24 Jan 2014 08:15:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=jWwVTZK5/OofJ4LJeIrR7JlF2vHHRElU+YIOh9yt0Os=; b=GV8smoG0dFr0Wcqq/Jy5k55mrNJz2W5SFhmSjBywfqD3d2nNXe9cmdA9ISHPMgLNbx uOaZNU5X0e1H2dM2JQcFrneSkFPhJvZUFfZSBoLAJxtvgdXbI+OHolfrprjhYRuewhdt pow6TpF1NqbqxtraND3rX9MW3CNCkx23f66wKs79TebSaysDCdJ2GXbdCra67d0b8r8j 5uy3oROl3A5PExtu6dUo4AIjGSceN22HPvhQ6r82PRSF8pUNM4ELiwgn8rtBJsfKEqs8 j9RLi6ElFJ9Cff16xoZcKOWMTu0FyGUvmHo8+dMeQsgLWzPAaRPlRdLIb6aHZyOqa1UL IHFw== X-Gm-Message-State: ALoCoQndnkryCNX76tnnjEdUb52C28/fbsDfAT+cRu2iBmL9fmxfIopqIzA02T/ONi71XUMfXseJ X-Received: by 10.66.228.67 with SMTP id sg3mr5430691pac.25.1390580115653; Fri, 24 Jan 2014 08:15:15 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.102 with SMTP id k93ls705607qgd.73.gmail; Fri, 24 Jan 2014 08:15:15 -0800 (PST) X-Received: by 10.220.103.141 with SMTP id k13mr8035032vco.25.1390580115492; Fri, 24 Jan 2014 08:15:15 -0800 (PST) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id bi4si761127vec.113.2014.01.24.08.15.15 for <patchwork-forward@linaro.org> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Jan 2014 08:15:15 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id oz11so2091085veb.32 for <patchwork-forward@linaro.org>; Fri, 24 Jan 2014 08:15:15 -0800 (PST) X-Received: by 10.58.227.38 with SMTP id rx6mr8231337vec.10.1390580115408; Fri, 24 Jan 2014 08:15:15 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp113658vcz; Fri, 24 Jan 2014 08:15:14 -0800 (PST) X-Received: by 10.66.27.72 with SMTP id r8mr15219100pag.62.1390580113823; Fri, 24 Jan 2014 08:15:13 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ef2si1646441pbb.281.2014.01.24.08.15.11; Fri, 24 Jan 2014 08:15:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751433AbaAXQPJ (ORCPT <rfc822;patch@linaro.org> + 8 others); Fri, 24 Jan 2014 11:15:09 -0500 Received: from mail-pd0-f174.google.com ([209.85.192.174]:60301 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751050AbaAXQPI (ORCPT <rfc822; linux-acpi@vger.kernel.org>); Fri, 24 Jan 2014 11:15:08 -0500 Received: by mail-pd0-f174.google.com with SMTP id z10so3307971pdj.33 for <linux-acpi@vger.kernel.org>; Fri, 24 Jan 2014 08:15:07 -0800 (PST) X-Received: by 10.68.130.130 with SMTP id oe2mr15131715pbb.135.1390580107510; Fri, 24 Jan 2014 08:15:07 -0800 (PST) Received: from localhost ([39.181.43.174]) by mx.google.com with ESMTPSA id sy2sm4459589pbc.28.2014.01.24.08.15.04 for <multiple recipients> (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 24 Jan 2014 08:15:06 -0800 (PST) From: Hanjun Guo <hanjun.guo@linaro.org> To: Matthew Garrett <matthew.garrett@nebula.com> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>, linux-acpi@vger.kernel.org, patches@linaro.org, linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, linaro-acpi@lists.linaro.org, platform-driver-x86@vger.kernel.org, Hanjun Guo <hanjun.guo@linaro.org> Subject: [PATCH] Platform / wmi: Fix potential memory leak in parse_wdg() Date: Sat, 25 Jan 2014 00:14:35 +0800 Message-Id: <1390580075-14342-1-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-acpi-owner@vger.kernel.org Precedence: list List-ID: <patchwork-forward.linaro.org> X-Mailing-List: linux-acpi@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Unsubscribe: <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe>, <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com> |
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 43d1329..e1338b5 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -797,8 +797,11 @@ static int parse_wdg(acpi_handle handle) wmi_dump_wdg(&gblock[i]); wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL); - if (!wblock) - return -ENOMEM; + if (!wblock) { + wmi_free_devices(); + retval = -ENOMEM; + goto out_free_pointer; + } wblock->handle = handle; wblock->gblock = gblock[i];
we forgot to call wmi_free_devices() and free out.pointer when alloc mamory failed. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> --- drivers/platform/x86/wmi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)