Subject: Re: linux-next: manual merge of the akpm-current tree with the arm tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 6 Sep 2021 14:46:17 +1000

Hi all,

On Tue, 24 Aug 2021 19:10:39 +1000 Stephen Rothwell <[email-masked]> wrote:
> 
> Today's linux-next merge of the akpm-current tree got a conflict in:
> 
>   ipc/sem.c
> 
> between commit:
> 
>   bdec0145286f ("ARM: 9114/1: oabi-compat: rework sys_semtimedop emulation")
> 
> from the arm tree and commit:
> 
>   7a4207f02a96 ("memcg: enable accounting of ipc resources")
> 
> from the akpm-current tree.
> 
> I fixed it up (I think, see below) and can carry the fix as
> necessary. This is now fixed as far as linux-next is concerned, but any
> non trivial conflicts should be mentioned to your upstream maintainer
> when your tree is submitted for merging.  You may also want to consider
> cooperating with the maintainer of the conflicting tree to minimise any
> particularly complex conflicts.
> 
> diff --cc ipc/sem.c
> index ae8d9104b0a0,1a8b9f0ac047..000000000000
> --- a/ipc/sem.c
> +++ b/ipc/sem.c
> @@@ -2216,40 -2229,9 +2216,40 @@@ long __do_semtimedop(int semid, struct 
>   
>   	unlink_queue(sma, &queue);
>   
>  -out_unlock_free:
>  +out_unlock:
>   	sem_unlock(sma, locknum);
>   	rcu_read_unlock();
>  +out:
>  +	return error;
>  +}
>  +
>  +static long do_semtimedop(int semid, struct sembuf __user *tsops,
>  +		unsigned nsops, const struct timespec64 *timeout)
>  +{
>  +	struct sembuf fast_sops[SEMOPM_FAST];
>  +	struct sembuf *sops = fast_sops;
>  +	struct ipc_namespace *ns;
>  +	int ret;
>  +
>  +	ns = current->nsproxy->ipc_ns;
>  +	if (nsops > ns->sc_semopm)
>  +		return -E2BIG;
>  +	if (nsops < 1)
>  +		return -EINVAL;
>  +
>  +	if (nsops > SEMOPM_FAST) {
> - 		sops = kvmalloc_array(nsops, sizeof(*sops), GFP_KERNEL);
> ++		sops = kvmalloc_array(nsops, sizeof(*sops), GFP_KERNEL_ACCOUNT);
>  +		if (sops == NULL)
>  +			return -ENOMEM;
>  +	}
>  +
>  +	if (copy_from_user(sops, tsops, nsops * sizeof(*tsops))) {
>  +		ret =  -EFAULT;
>  +		goto out_free;
>  +	}
>  +
>  +	ret = __do_semtimedop(semid, sops, nsops, timeout, ns);
>  +
>   out_free:
>   	if (sops != fast_sops)
>   		kvfree(sops);

This is now a conflict between the arm tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell