Re: [PATCH v1 1/4] ipc: Remove extra1 field abuse to pass ipc namespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alexey Gladkov <legion@xxxxxxxxxx> writes:

> Eric Biederman pointed out that using .extra1 to pass ipc namespace
> looks like an ugly hack and there is a better solution.
>
> Link: https://lore.kernel.org/lkml/87czib9g38.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
> Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
> Signed-off-by: Alexey Gladkov <legion@xxxxxxxxxx>
> ---
>  ipc/ipc_sysctl.c | 26 ++++++++------------------
>  1 file changed, 8 insertions(+), 18 deletions(-)
>
> diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
> index 15210ac47e9e..eb7ba8e0a355 100644
> @@ -55,20 +50,15 @@ static int proc_ipc_auto_msgmni(struct ctl_table *table, int write,
>  static int proc_ipc_sem_dointvec(struct ctl_table *table, int write,
>  	void *buffer, size_t *lenp, loff_t *ppos)
>  {
> -	struct ipc_namespace *ns = table->extra1;
> -	struct ctl_table ipc_table;
> +	struct ipc_namespace *ns =
> +		container_of(table->data, struct ipc_namespace, sem_ctls);
>  	int ret, semmni;
>  
> -	memcpy(&ipc_table, table, sizeof(ipc_table));
> -
> -	ipc_table.extra1 = NULL;
> -	ipc_table.extra2 = NULL;
> -
>  	semmni = ns->sem_ctls[3];
>  	ret = proc_dointvec(table, write, buffer, lenp, ppos);
>  
>  	if (!ret)
> -		ret = sem_check_semmni(current->nsproxy->ipc_ns);
> +		ret = sem_check_semmni(ns);
		^^^^^^^^^^^^^^^^^^^^^^^^^^^

Can you break this one line change into a separate patch?

It is a bug fix so that the entire function uses the same
ns value.  I expect the change would read easier if the
change was separate.

>  
>  	/*
>  	 * Reset the semmni value if an error happens.

Eric




[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux