From patchwork Mon May 9 10:32:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huzaifa Sidhpurwala X-Patchwork-Id: 768902 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p49AWWfJ003789 for ; Mon, 9 May 2011 10:32:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751720Ab1EIKc3 (ORCPT ); Mon, 9 May 2011 06:32:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1083 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751431Ab1EIKc3 (ORCPT ); Mon, 9 May 2011 06:32:29 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p49AWMaC023008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 9 May 2011 06:32:22 -0400 Received: from babylon.pnq.redhat.com (babylon.pnq.redhat.com [10.65.192.182]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p49AWLgj019407; Mon, 9 May 2011 06:32:21 -0400 Received: by babylon.pnq.redhat.com (Postfix, from userid 500) id E07D123DE0; Mon, 9 May 2011 16:02:25 +0530 (IST) From: Huzaifa Sidhpurwala To: linux-media@vger.kernel.org Cc: mchehab@infradead.org, hverkuil@xs4all.nl, hdegoede@redhat.com, joe@perches.com, Huzaifa Sidhpurwala Subject: [PATCH] Prevent null pointer derefernce of pdev Date: Mon, 9 May 2011 16:02:24 +0530 Message-Id: <1304937144-15806-1-git-send-email-huzaifas@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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.6 (demeter2.kernel.org [140.211.167.43]); Mon, 09 May 2011 10:32:32 +0000 (UTC) Make sure pdev is not dereferenced when it is null Signed-off-by: Huzaifa Sidhpurwala --- drivers/media/video/pwc/pwc-if.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 780af5f..356cd42 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -1850,7 +1850,6 @@ static void usb_pwc_disconnect(struct usb_interface *intf) } else { /* Device is closed, so we can safely unregister it */ PWC_DEBUG_PROBE("Unregistering video device in disconnect().\n"); - pwc_cleanup(pdev); disconnect_out: /* search device_hint[] table if we occupy a slot, by any chance */ @@ -1860,6 +1859,7 @@ disconnect_out: } mutex_unlock(&pdev->modlock); + pwc_cleanup(pdev); }