Re: [PATCH v4 3/3] cred: change keyctl_session_to_parent() to usetask_work_add()

From: Oleg Nesterov
Date: Tue Apr 17 2012 - 12:36:49 EST


On 04/17, David Howells wrote:
>
> Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
>
> > - int ret;
> > + struct cred *cred;
> > + int err;
>
> There's no need to change ret to be err. It produces slightly less churn if
> you don't.

OK, I'll change it back.

>
> > + err = -ENOMEM;
> > + newwork = kmalloc(sizeof(struct task_work), GFP_KERNEL);
> > + if (!newwork)
> > + goto error_keyring;
>
> This passes unnecessarily through kfree(newwork).

but harmless, newwork == NULL in this case,

> Please add a new goto label
> and go to that.

OK, probably this is more clear, will do.

> > -/*
> > - * Replace a process's session keyring on behalf of one of its children when
> > - * the target process is about to resume userspace execution.
> > - */
>
> Please don't delete the banner comment saying what the function does.

OOPS, sorry, this was unintentional.

> > -void key_replace_session_keyring(void)
> > +void key_change_session_keyring(struct task_work *twork)
>
> There's no particular need to change the name of the function.

There is.

Until we cleanup arch/* do_notify_resume() still does

if (current->replacement_session_keyring)
key_replace_session_keyring();

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/