From patchwork Sat Mar 30 02:53:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wang yanqing X-Patchwork-Id: 2367071 Return-Path: X-Original-To: patchwork-linux-fbdev@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 BF4E1DFB79 for ; Sat, 30 Mar 2013 02:54:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757688Ab3C3Cxp (ORCPT ); Fri, 29 Mar 2013 22:53:45 -0400 Received: from mail-da0-f52.google.com ([209.85.210.52]:37171 "EHLO mail-da0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757680Ab3C3Cxo (ORCPT ); Fri, 29 Mar 2013 22:53:44 -0400 Received: by mail-da0-f52.google.com with SMTP id f10so408348dak.39 for ; Fri, 29 Mar 2013 19:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:mail-followup-to :mime-version:content-type:content-disposition:user-agent; bh=ENU7a43QCoT+uZ/NXoM+10okIDidejfz1aAdI/GZDSU=; b=DamHaPf5thoQcXbulA1G+5uq+cR05XEYhY0aF9dNuzIWw81CFnr+qp9+YBkUw7zPJ6 GCvIQb46WVLbYJmE1+bD3KCVeNiHw1eCHvcIUtlYs75WUlE+ZGKqwnSPL4IKL4axSkyM S85YclsyGAW4mZ0CUZ9SChI6EsBe+UNybKvY9phoXki7P1eLNldFKIs9pLMyJxJI9GRt oORFLwlQ2m+IGuZY5tRHQT1868Ic2tz72gqVAo2R3MUcZyizyfZcJewBZeKrgP+PPQem 9jKnSJcIYgzu6CGlZxnJxh1xqZv9/nCuTOsRU8aBi9MOZClV/FwFpH0ttMvrRegKFO8y +KCA== X-Received: by 10.66.174.143 with SMTP id bs15mr7535555pac.17.1364612023768; Fri, 29 Mar 2013 19:53:43 -0700 (PDT) Received: from udknight.localhost ([218.66.126.118]) by mx.google.com with ESMTPS id ti8sm4847778pbc.12.2013.03.29.19.53.39 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Mar 2013 19:53:42 -0700 (PDT) Received: from udknight.localhost (udknight.localhost [127.0.0.1]) by udknight.localhost (8.14.4/8.14.4) with ESMTP id r2U2rUcB025299; Sat, 30 Mar 2013 10:53:31 +0800 Received: (from root@localhost) by udknight.localhost (8.14.4/8.14.4/Submit) id r2U2rUOL025296; Sat, 30 Mar 2013 10:53:30 +0800 Date: Sat, 30 Mar 2013 10:53:30 +0800 From: Wang YanQing To: tomi.valkeinen@ti.com Cc: spock@gentoo.org, linux-fbdev@vger.kernel.org, FlorianSchandinat@gmx.de, linux-kernel@vger.kernel.org Subject: [PATCH]video:uvesafb: Fix dereference NULL pointer code path Message-ID: <20130330025330.GA25246@udknight> Mail-Followup-To: Wang YanQing , tomi.valkeinen@ti.com, spock@gentoo.org, linux-fbdev@vger.kernel.org, FlorianSchandinat@gmx.de, linux-kernel@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org platform_device_alloc could failed and return NULL, we should check this before call platform_device_put. Signed-off-by: Wang YanQing --- drivers/video/uvesafb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index 2f8f82d..230bd45 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c @@ -1975,7 +1975,8 @@ static int __devinit uvesafb_init(void) err = -ENOMEM; if (err) { - platform_device_put(uvesafb_device); + if (uvesafb_device) + platform_device_put(uvesafb_device); platform_driver_unregister(&uvesafb_driver); cn_del_callback(&uvesafb_cn_id); return err;