From patchwork Fri Mar 4 02:24:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 8497691 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CF1909F38C for ; Fri, 4 Mar 2016 02:25:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CCB3A20268 for ; Fri, 4 Mar 2016 02:25:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F0F2D20260 for ; Fri, 4 Mar 2016 02:25:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755503AbcCDCZE (ORCPT ); Thu, 3 Mar 2016 21:25:04 -0500 Received: from mailout.easymail.ca ([64.68.201.169]:60117 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753967AbcCDCZD (ORCPT ); Thu, 3 Mar 2016 21:25:03 -0500 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id A9854E6F7; Thu, 3 Mar 2016 21:25:01 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at mailout.easymail.ca X-Spam-Score: -3.69 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (easymail-mailout.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gzi49kEP612u; Thu, 3 Mar 2016 21:25:00 -0500 (EST) Received: from mail.gonehiking.org (c-73-181-52-62.hsd1.co.comcast.net [73.181.52.62]) by mailout.easymail.ca (Postfix) with ESMTPA id DC520E6F4; Thu, 3 Mar 2016 21:25:00 -0500 (EST) Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 3DD539F154; Thu, 3 Mar 2016 19:25:00 -0700 (MST) From: Shuah Khan To: mchehab@osg.samsung.com, olli.salonen@iki.fi Cc: Shuah Khan , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: fix null pointer dereference in v4l_vb2q_enable_media_source() Date: Thu, 3 Mar 2016 19:24:58 -0700 Message-Id: <1457058298-7782-1-git-send-email-shuahkh@osg.samsung.com> X-Mailer: git-send-email 2.5.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix the null pointer dereference in v4l_vb2q_enable_media_source(). DVB only drivers don't have valid struct v4l2_fh pointer. [ 548.443272] BUG: unable to handle kernel NULL pointer dereference at 0000000000000010 [ 548.452036] IP: [] v4l_vb2q_enable_media_source+0x9/0x50 [videodev] [ 548.460792] PGD b820e067 PUD bb3df067 PMD 0 [ 548.465582] Oops: 0000 [#1] SMP Signed-off-by: Shuah Khan Reported-by: Olli Salonen Tested-by: Olli Salonen --- drivers/media/v4l2-core/v4l2-mc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-mc.c b/drivers/media/v4l2-core/v4l2-mc.c index 643686d..a39a3cd 100644 --- a/drivers/media/v4l2-core/v4l2-mc.c +++ b/drivers/media/v4l2-core/v4l2-mc.c @@ -214,6 +214,8 @@ int v4l_vb2q_enable_media_source(struct vb2_queue *q) { struct v4l2_fh *fh = q->owner; - return v4l_enable_media_source(fh->vdev); + if (fh && fh->vdev) + return v4l_enable_media_source(fh->vdev); + return 0; } EXPORT_SYMBOL_GPL(v4l_vb2q_enable_media_source);