From patchwork Sun Jan 27 06:13:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wang yanqing X-Patchwork-Id: 2051271 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 2DD223FD49 for ; Sun, 27 Jan 2013 06:13:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755899Ab3A0GNu (ORCPT ); Sun, 27 Jan 2013 01:13:50 -0500 Received: from mail-pb0-f52.google.com ([209.85.160.52]:47054 "EHLO mail-pb0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755727Ab3A0GNt (ORCPT ); Sun, 27 Jan 2013 01:13:49 -0500 Received: by mail-pb0-f52.google.com with SMTP id uo5so902047pbc.25 for ; Sat, 26 Jan 2013 22:13:49 -0800 (PST) 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=Wyq83VU0Ll5D9/4B9NPFtYvU98VFlgvYl/xm+GpeUI2wQ7PJ7U92llCKJCxGAiWNxc eTc6aukDx1T2zOD0rnGbqxUnunN0FXbg6ohIN34ZUJLxU9UDcKFu5zUb43O1nADanQjI urS7IwEkl4Ytm7GPjSItNJA1Xr0NNSW+PEZn5w+T8/X4AQp9COz2cdcM/Mz/hfWuhP8z 7mPgywYw2J/Y3ojmvQ+NZO0Zm3TiSFbspjpZ6WVeEEgjw5jlP/AuqEhpiuR2QSLXJ+Dn IKitegE4wlj8u/iQUCdT7cT/kHAHJP7jrz75XP0Xs8bxBfayHfpHJ7gjat+srvDFibjB Kvcw== X-Received: by 10.68.132.10 with SMTP id oq10mr27750502pbb.18.1359267229268; Sat, 26 Jan 2013 22:13:49 -0800 (PST) Received: from udknight.localhost ([27.154.55.226]) by mx.google.com with ESMTPS id hc4sm3836074pbc.30.2013.01.26.22.13.20 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 26 Jan 2013 22:13:48 -0800 (PST) Received: from udknight.localhost (udknight.localhost [127.0.0.1]) by udknight.localhost (8.14.4/8.14.4) with ESMTP id r0R6DmIm004343; Sun, 27 Jan 2013 14:13:53 +0800 Received: (from root@localhost) by udknight.localhost (8.14.4/8.14.4/Submit) id r0R6DWLP004332; Sun, 27 Jan 2013 14:13:32 +0800 Date: Sun, 27 Jan 2013 14:13:32 +0800 From: Wang YanQing To: FlorianSchandinat@gmx.de Cc: spock@gentoo.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH]video:uvesafb: Fix dereference NULL pointer code path Message-ID: <20130127061331.GA4314@udknight> Mail-Followup-To: Wang YanQing , FlorianSchandinat@gmx.de, spock@gentoo.org, linux-fbdev@vger.kernel.org, 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;