Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4299331pxu; Mon, 12 Oct 2020 15:24:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9xNDGK6tsa9P/01OWjMP2K7HxKR9NYhDczHvXC2ijkzQqKQKoTKlh/KCtJtTOQ/P1vMr2 X-Received: by 2002:a17:907:43c3:: with SMTP id i3mr28674124ejs.231.1602541479694; Mon, 12 Oct 2020 15:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602541479; cv=none; d=google.com; s=arc-20160816; b=xFWy/i+DdGhtD7CZvumhhfaCagLW9J9VqFBi2F6IUtNHFojlQUCWhcv5MrUGHTC9dN iSDj8jadCwoUjCrYVqYJO7dw9sMmlhlNCBbXnsKcjVB1E2yK7G3CKLSW26EAyYF/a9Yi U9B7AJkx2UTumuuTZ9BmCJ5Q9SmnMz8IpVWDcuXNcwPbT08oFUPdvDhFUpQduBHj14Un C2KdMf9CO2ZJKJAzDS6+pAKz0f4FIG42JY1LkqPnmPHyXuuT63q1dBducX4Dt82Q2soJ WVkTwWwOav/pXuD4FbOCDir0OvbahqlIf7O225teP4Bzgjd+j3rBBJPKyIeGrAebBagt Q0VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lJVIBjAcX4lGI4yNhOSrqZoNpCS6oEbTcCHPGCWXEiQ=; b=Sz828bFf4nhGcwWlnMELYroEV9tNBYIhEvmcDiTd7JjiGaMxP97app50yhbUS1rAS2 +H1UTnp9JNs1R+bUSXmmCmFTQTCvupUuvZLZgSfNhWMVtUmTq/nK7J0mYbb2SWPDoc1/ 6zRXSTh7xUcKRLZjiVAp3Ho9/nirwSHYqw0fAIulHnP/U50F9dSwh/8d34/MBRt+4lWG EAWcOm1jq5l34y8fJV3Rbqn51hNaPuXLiPJi7YEob/xzS2xO7uGaDXmx7fsgctLUyujz /vt6lwWLHnmoLTTQqvldWC57PR3qlE3hxwFEuW0wpynhy98h700Y5Gg4cBcTeuNedX/l 2Yuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JCTsfky4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m27si13951286eji.326.2020.10.12.15.24.17; Mon, 12 Oct 2020 15:24:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JCTsfky4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388573AbgJLNj6 (ORCPT + 99 others); Mon, 12 Oct 2020 09:39:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:43220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731370AbgJLNjZ (ORCPT ); Mon, 12 Oct 2020 09:39:25 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7EE14221FE; Mon, 12 Oct 2020 13:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602509965; bh=xfPx18DR1Yo1IeyBOmicVze493qZfk5VFd3DR5Muv9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JCTsfky4SZ7rjzPz8734OX9/65ovFiFsYvb9M37kARVnpG3oZ+UtYqDVLq5soQdwU jSxzCLHYUzbbfWaM3TLahlZag/1c+AR6KS07WBS/kWmF1zmdYCcfeEVgTA4NHn8Ewj pmuppFYybANZVNW1CjWxqMdlnAY7CLreq57nQLT4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Karol Herbst , dri-devel , Dave Airlie Subject: [PATCH 4.19 06/49] drm/nouveau/mem: guard against NULL pointer access in mem_del Date: Mon, 12 Oct 2020 15:26:52 +0200 Message-Id: <20201012132629.739034353@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012132629.469542486@linuxfoundation.org> References: <20201012132629.469542486@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Karol Herbst commit d10285a25e29f13353bbf7760be8980048c1ef2f upstream. other drivers seems to do something similar Signed-off-by: Karol Herbst Cc: dri-devel Cc: Dave Airlie Cc: stable@vger.kernel.org Signed-off-by: Dave Airlie Link: https://patchwork.freedesktop.org/patch/msgid/20201006220528.13925-2-kherbst@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_mem.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c @@ -176,6 +176,8 @@ void nouveau_mem_del(struct ttm_mem_reg *reg) { struct nouveau_mem *mem = nouveau_mem(reg); + if (!mem) + return; nouveau_mem_fini(mem); kfree(reg->mm_node); reg->mm_node = NULL;