From patchwork Thu Apr 6 19:25:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helen Mae Koike Fornazier X-Patchwork-Id: 9668303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3D0B660364 for ; Thu, 6 Apr 2017 19:25:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F066285C8 for ; Thu, 6 Apr 2017 19:25:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13634285D4; Thu, 6 Apr 2017 19:25:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2606285C8 for ; Thu, 6 Apr 2017 19:25:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753259AbdDFTZj (ORCPT ); Thu, 6 Apr 2017 15:25:39 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54830 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752951AbdDFTZi (ORCPT ); Thu, 6 Apr 2017 15:25:38 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: koike) with ESMTPSA id 4C9B8265764 From: Helen Koike To: linux-media@vger.kernel.org Subject: [PATCH] [media] media-entity: only call dev_dbg_obj if mdev is not NULL Date: Thu, 6 Apr 2017 16:25:15 -0300 Message-Id: <1491506715-24317-1-git-send-email-helen.koike@collabora.com> X-Mailer: git-send-email 2.7.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix kernel Oops NULL pointer deference Call dev_dbg_obj only after checking if gobj->mdev is not NULL Signed-off-by: Helen Koike --- drivers/media/media-entity.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 5640ca2..bc44193 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -199,12 +199,12 @@ void media_gobj_create(struct media_device *mdev, void media_gobj_destroy(struct media_gobj *gobj) { - dev_dbg_obj(__func__, gobj); - /* Do nothing if the object is not linked. */ if (gobj->mdev == NULL) return; + dev_dbg_obj(__func__, gobj); + gobj->mdev->topology_version++; /* Remove the object from mdev list */