Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp503597ybl; Tue, 28 Jan 2020 07:00:36 -0800 (PST) X-Google-Smtp-Source: APXvYqyY/XNlLleYPW9EnnZhqBVK8LLIhkTgKbf46c2smLSIx+/VP3k2MjmjaY4cy06yD/GcVYv0 X-Received: by 2002:aca:5a04:: with SMTP id o4mr843530oib.71.1580223636039; Tue, 28 Jan 2020 07:00:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580223636; cv=none; d=google.com; s=arc-20160816; b=VZm3L/r/Tx5Bh8qXB3WiqveX2qTQA0uroQvHDpOxvPSTIcJ/lWdBpD+BqgnBA/7s3n +OLgZJytEPrKuXodcgSlvdtvty7cGgdNY2Oie+k43Isx0vT4EzXlS0vRmIllZAANei/X Carnd+/lGTvsCMfpKOEII49tAvA6YAxXKKiMFrpkEpBinMjsw8NQJjUJUIipLKZ7+W4n tJpAadBIrDaXGUefSsjceyBwwFS+QVs6j27qU4/XsVrAh2SWWVvKJFKEKrR70wfTpmDI ha5gfHzW4NNMG8TqEv7z54ywWiZEIvJxvqpx3jtPktj+iHLsXJDaoiUe2lgyQnj8OooH JQ1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=J9dup7HkrusSVVs3WtrZZpcnlSHPtUcbtBH6WbbXS20=; b=EfX/w46/iBmT3yxodQEU7qE7cJJvhPf/kBwzqh+HFsjdowBAiqEiDlKQfrKWF8y9mD I9MakRVhK/Cqb1BPe5h/WICiTCTMhBHK+1sXQQO+nAZmXfIVtHRL36PHs4JUkvED2eGX pInLyqfRdPB8R0z77WV22xF88yAVDNZhF6Rifjp3NkJafVFF3hmJr9QgM/+YE7HZ2JUG 0FN5l9v2YIvmoXLNk4dzWpA4MIi355WETP89yQSj7oezwMYBc6PeWWK4sPJhUF+i0ybU XXLAZ8PuVsWKeIHmO0PF7jywnZu+eZICQlIgRUXcfvw64MmKoM0kn79Wi3FPSWEvxlPS v/WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J30K3AOR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20si7968505otr.64.2020.01.28.07.00.22; Tue, 28 Jan 2020 07:00:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J30K3AOR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726795AbgA1O6y (ORCPT + 99 others); Tue, 28 Jan 2020 09:58:54 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:28911 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726767AbgA1O6x (ORCPT ); Tue, 28 Jan 2020 09:58:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580223532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=J9dup7HkrusSVVs3WtrZZpcnlSHPtUcbtBH6WbbXS20=; b=J30K3AORJ3u894nARd8dIl1Z30S+r4Q/OamxYtefkwp+hkTdfx4+9EZLUGAX0FGGjgvTdp p3dVKHZIYWQiu56NmsW+HJZcuZz1xMLSLUvXxen3u9qD24RmxhHGvNth9qq6AjjgqkCYBs 8KZIF0F/gaXYoVo2IQfEHfgh8EgTqBc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-295-qOK9YP5uP1yGI5aGU72MxA-1; Tue, 28 Jan 2020 09:58:47 -0500 X-MC-Unique: qOK9YP5uP1yGI5aGU72MxA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 879C18010C9; Tue, 28 Jan 2020 14:58:44 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.70]) by smtp.corp.redhat.com (Postfix) with SMTP id A7FC85C290; Tue, 28 Jan 2020 14:58:39 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 28 Jan 2020 15:58:43 +0100 (CET) Date: Tue, 28 Jan 2020 15:58:38 +0100 From: Oleg Nesterov To: Alexey Gladkov Cc: LKML , Kernel Hardening , Linux API , Linux FS Devel , Linux Security Module , Akinobu Mita , Alexander Viro , Alexey Dobriyan , Andrew Morton , Andy Lutomirski , Daniel Micay , Djalal Harouni , "Dmitry V . Levin" , "Eric W . Biederman" , Greg Kroah-Hartman , Ingo Molnar , "J . Bruce Fields" , Jeff Layton , Jonathan Corbet , Kees Cook , Linus Torvalds , Solar Designer , Stephen Rothwell Subject: Re: [PATCH v7 02/11] proc: add proc_fs_info struct to store proc information Message-ID: <20200128145837.GD17943@redhat.com> References: <20200125130541.450409-1-gladkov.alexey@gmail.com> <20200125130541.450409-3-gladkov.alexey@gmail.com> <20200128134337.GC17943@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200128134337.GC17943@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/28, Oleg Nesterov wrote: > > On 01/25, Alexey Gladkov wrote: > > > > static int proc_init_fs_context(struct fs_context *fc) > > { > > struct proc_fs_context *ctx; > > + struct pid_namespace *pid_ns; > > > > ctx = kzalloc(sizeof(struct proc_fs_context), GFP_KERNEL); > > if (!ctx) > > return -ENOMEM; > > > > - ctx->pid_ns = get_pid_ns(task_active_pid_ns(current)); > > + pid_ns = get_pid_ns(task_active_pid_ns(current)); > > + > > + if (!pid_ns->proc_mnt) { > > + ctx->fs_info = kzalloc(sizeof(struct proc_fs_info), GFP_KERNEL); > > + if (!ctx->fs_info) { > > + kfree(ctx); > > + return -ENOMEM; > > + } > > + ctx->fs_info->pid_ns = pid_ns; > > + } else { > > + ctx->fs_info = proc_sb_info(pid_ns->proc_mnt->mnt_sb); > > + } > > + > > it seems that this code lacks put_pid_ns() if pid_ns->proc_mnt != NULL > or if kzalloc() fails? OK, this is fixed in 6/11. Oleg.