Message ID | CANaxB-yAhV9WW6gEBswPTH5R65wpRoxm_ygOn5Vj6Pzg2RSwLw@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [dhowells/mount-api] general protection fault in mqueue_get_tree | expand |
Andrei Vagin <avagin@gmail.com> wrote:
> + ns->mq_mnt = NULL;
Should I instead be allocating the namespace with kzalloc()?
David
On Tue, Sep 11, 2018 at 1:21 PM David Howells <dhowells@redhat.com> wrote: > > Andrei Vagin <avagin@gmail.com> wrote: > > > + ns->mq_mnt = NULL; > > Should I instead be allocating the namespace with kzalloc()? The ipc_namespace structure is big, so I am not sure about kzalloc(). ns->mq_mnt can be initialized in mq_init_ns, it looks better than my previous patch. diff --git a/ipc/mqueue.c b/ipc/mqueue.c index ab1fe762baa8..e05147b5ea39 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -1618,6 +1618,7 @@ int mq_init_ns(struct ipc_namespace *ns) ns->mq_msg_default = DFLT_MSG; ns->mq_msgsize_default = DFLT_MSGSIZE; + ns->mq_mnt = NULL; m = mq_create_mount(ns); if (IS_ERR(m)) return PTR_ERR(m); > > David
Andrei Vagin <avagin@gmail.com> wrote: > The ipc_namespace structure is big, so I am not sure about kzalloc(). > ns->mq_mnt can be initialized in mq_init_ns, it looks better than my > previous patch. I sincerely hope that ipc_namespace creation isn't a particularly hot path, so I wouldn't've thought that preclearing the struct (which is nearly 2K in my build) shouldn't add too much overhead. David
diff --git a/ipc/namespace.c b/ipc/namespace.c index 21607791d62c..17de21d62b4d 100644 --- a/ipc/namespace.c +++ b/ipc/namespace.c @@ -50,6 +50,7 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns, if (err) goto fail_free; ns->ns.ops = &ipcns_operations; + ns->mq_mnt = NULL; refcount_set(&ns->count, 1);