From patchwork Tue Jan 8 19:11:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 1947591 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 8158CDF23A for ; Tue, 8 Jan 2013 18:54:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756934Ab3AHSyU (ORCPT ); Tue, 8 Jan 2013 13:54:20 -0500 Received: from mail.dev.rtsoft.ru ([213.79.90.226]:52193 "EHLO wasted.dev.rtsoft.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756641Ab3AHSyU (ORCPT ); Tue, 8 Jan 2013 13:54:20 -0500 X-Greylist: delayed 2462 seconds by postgrey-1.27 at vger.kernel.org; Tue, 08 Jan 2013 13:54:19 EST Received: from wasted.dev.rtsoft.ru (localhost.localdomain [127.0.0.1]) by wasted.dev.rtsoft.ru (8.14.4/8.14.4) with ESMTP id r08JBFAh008079; Tue, 8 Jan 2013 22:11:15 +0300 Received: (from headless@localhost) by wasted.dev.rtsoft.ru (8.14.4/8.14.4/Submit) id r08JBEMK008077; Tue, 8 Jan 2013 22:11:14 +0300 X-Authentication-Warning: wasted.dev.rtsoft.ru: headless set sender to sshtylyov@ru.mvista.com using -f To: linux-usb@vger.kernel.org, balbi@ti.com Subject: [PATCH 1/2] omap2430: fix wrong devm_kzalloc() result check Cc: gregkh@linuxfoundation.org, linux-omap@vger.kernel.org From: Sergei Shtylyov Organization: MontaVista Software LLC Date: Tue, 8 Jan 2013 22:11:14 +0300 MIME-Version: 1.0 Message-Id: <201301082211.14413.sshtylyov@ru.mvista.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Commit 00a0b1d58af873d842580dcac55f3b156c3a4077 (usb: musb: omap: Add device tree support for omap musb glue) assigns result of devm_kzalloc() call to the 'config' variable but then checks for NULL the 'data' variable (already checked after previous call). Thus we risk a kernel oops further when data pointed by 'config' is written to by subsequent of_property_read_u32() calls iff the allocation happens to fail... Signed-off-by: Sergei Shtylyov --- This patch is atop of 'musb' branch of Felipe's tree but can also be applied to the 'fixes' branch. drivers/usb/musb/omap2430.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: usb/drivers/usb/musb/omap2430.c =================================================================== --- usb.orig/drivers/usb/musb/omap2430.c +++ usb/drivers/usb/musb/omap2430.c @@ -545,7 +545,7 @@ static int __devinit omap2430_probe(stru } config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL); - if (!data) { + if (!config) { dev_err(&pdev->dev, "failed to allocate musb hdrc config\n"); goto err2;