From patchwork Sun Mar 21 21:31:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 87299 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2LLVvFK030495 for ; Sun, 21 Mar 2010 21:31:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753744Ab0CUVbK (ORCPT ); Sun, 21 Mar 2010 17:31:10 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:41002 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753612Ab0CUVbI (ORCPT ); Sun, 21 Mar 2010 17:31:08 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id BF22819BCBA; Sun, 21 Mar 2010 22:31:07 +0100 (CET) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 27517-17; Sun, 21 Mar 2010 22:31:06 +0100 (CET) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw2.diku.dk (Postfix) with ESMTP id 87B6819BCB8; Sun, 21 Mar 2010 22:31:06 +0100 (CET) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id 16E6D6DFB75; Sun, 21 Mar 2010 22:25:07 +0100 (CET) Received: by ask.diku.dk (Postfix, from userid 3767) id 6BA9B200B0; Sun, 21 Mar 2010 22:31:06 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id 5E94A200AF; Sun, 21 Mar 2010 22:31:06 +0100 (CET) Date: Sun, 21 Mar 2010 22:31:06 +0100 (CET) From: Julia Lawall To: Mark McClelland , Mauro Carvalho Chehab , linux-usb@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] drivers/media/video: avoid NULL dereference Message-ID: MIME-Version: 1.0 X-Virus-Scanned: amavisd-new at diku.dk Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 21 Mar 2010 21:31:58 +0000 (UTC) diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c index e0bce8d..2357218 100644 --- a/drivers/media/video/ov511.c +++ b/drivers/media/video/ov511.c @@ -5913,14 +5913,12 @@ ov51x_disconnect(struct usb_interface *intf) PDEBUG(3, ""); + if (!ov) + return; + mutex_lock(&ov->lock); usb_set_intfdata (intf, NULL); - if (!ov) { - mutex_unlock(&ov->lock); - return; - } - /* Free device number */ ov511_devused &= ~(1 << ov->nr);