From patchwork Thu Jun 9 03:06:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fengguang Wu X-Patchwork-Id: 863082 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5936Xfk018201 for ; Thu, 9 Jun 2011 03:06:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752839Ab1FIDGc (ORCPT ); Wed, 8 Jun 2011 23:06:32 -0400 Received: from mga03.intel.com ([143.182.124.21]:26260 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752684Ab1FIDGb (ORCPT ); Wed, 8 Jun 2011 23:06:31 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 08 Jun 2011 20:06:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.65,340,1304319600"; d="scan'208";a="9647744" Received: from unknown (HELO localhost.localdomain) ([10.255.20.183]) by azsmga001.ch.intel.com with ESMTP; 08 Jun 2011 20:06:29 -0700 Received: from wfg by localhost.localdomain with local (Exim 4.69) (envelope-from ) id 1QUVZk-0002kb-PS; Thu, 09 Jun 2011 11:06:28 +0800 Date: Thu, 9 Jun 2011 11:06:28 +0800 From: Wu Fengguang To: "Antonino A. Daplas" Cc: Andrew Morton , linux-fbdev@vger.kernel.org, LKML Subject: [RFC] fbmem: reset file->private_data on failed fb_open() Message-ID: <20110609030628.GA10233@localhost> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 09 Jun 2011 03:06:33 +0000 (UTC) I wrote this when looking at NULL dereference bug https://bugzilla.kernel.org/show_bug.cgi?id=18912 Will it help by clearing private_data? I have no idea at all, because for regular files, ->release won't be called on failed ->open. Just in case there are some exceptions in fbmem... --- drivers/video/fbmem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- linux-next.orig/drivers/video/fbmem.c 2011-06-09 10:36:06.000000000 +0800 +++ linux-next/drivers/video/fbmem.c 2011-06-09 10:39:30.000000000 +0800 @@ -1424,26 +1424,28 @@ __releases(&info->lock) file->private_data = info; if (info->fbops->fb_open) { res = info->fbops->fb_open(info,1); if (res) module_put(info->fbops->owner); } #ifdef CONFIG_FB_DEFERRED_IO if (info->fbdefio) fb_deferred_io_open(info, inode, file); #endif out: mutex_unlock(&info->lock); - if (res) + if (res) { + file->private_data = NULL; put_fb_info(info); + } return res; } static int fb_release(struct inode *inode, struct file *file) __acquires(&info->lock) __releases(&info->lock) { struct fb_info * const info = file->private_data; mutex_lock(&info->lock); if (info->fbops->fb_release)