Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757580AbdIIPVQ (ORCPT ); Sat, 9 Sep 2017 11:21:16 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:37727 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757545AbdIIPVM (ORCPT ); Sat, 9 Sep 2017 11:21:12 -0400 X-Google-Smtp-Source: ADKCNb4F8v7vFaFUs96Y54Jiy/zhaau60NliEckB02ATYh/q4c4Tdx3FBVWaIqTvn5FSUqC16vSmyA== From: Gargi Sharma To: linux-kernel@vger.kernel.org Cc: riel@surriel.com, julia.lawall@lip6.fr, akpm@linux-foundation.org, mingo@kernel.org, pasha.tatashin@oracle.com, ktkhai@virtuozzo.com, oleg@redhat.com, wangkefeng.wang@park.jinmi.com, Gargi Sharma Subject: [RFC 1/2] proc: Return if nothing to unmount Date: Sat, 9 Sep 2017 18:03:16 +0530 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 811 Lines: 27 If a task exits before procfs is mounted, proc_flush_task_mnt will be called with a NULL mnt parameter. In that case, not only is there nothing to unhash, but trying to do so will oops the kernel with a null pointer dereference. Signed-off-by: Gargi Sharma --- fs/proc/base.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/proc/base.c b/fs/proc/base.c index e5d89a0..7b83c21 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3021,6 +3021,10 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid) char buf[PROC_NUMBUF]; struct qstr name; + /* procfs is not mounted. There is nothing to unhash. */ + if (!mnt) + return; + name.name = buf; name.len = snprintf(buf, sizeof(buf), "%d", pid); /* no ->d_hash() rejects on procfs */ -- 2.7.4