Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755754AbdDFTcY (ORCPT ); Thu, 6 Apr 2017 15:32:24 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54843 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752831AbdDFTcN (ORCPT ); Thu, 6 Apr 2017 15:32:13 -0400 From: Helen Koike To: linux-media@vger.kernel.org Cc: mchehab@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [media] media-entity: only call dev_dbg_obj if mdev is not NULL Date: Thu, 6 Apr 2017 16:32:00 -0300 Message-Id: <1491507120-28112-1-git-send-email-helen.koike@collabora.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 791 Lines: 29 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 */ -- 2.7.4