LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* linux-next: manual merge of the net-next tree with the vfs tree
@ 2014-11-25  2:42 Stephen Rothwell
  2014-11-25 11:23 ` Marcelo Ricardo Leitner
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Rothwell @ 2014-11-25  2:42 UTC (permalink / raw)
  To: David Miller, netdev, Al Viro
  Cc: linux-next, linux-kernel, Steven Rostedt (Red Hat),
	Marcelo Leitner, Pablo Neira Ayuso

[-- Attachment #1: Type: text/plain, Size: 2166 bytes --]

Hi all,

Today's linux-next merge of the net-next tree got a conflict in
net/netfilter/nf_log.c between commit e71456ae9871 ("netfilter: Remove
checks of seq_printf() return values") from the vfs tree and commit
0c26ed1c07f1 ("netfilter: nf_log: Introduce nft_log_dereference()
macro") from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc net/netfilter/nf_log.c
index 6e3b9117db1f,49a64174f3f1..000000000000
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@@ -294,39 -303,35 +303,37 @@@ static int seq_show(struct seq_file *s
  {
  	loff_t *pos = v;
  	const struct nf_logger *logger;
 -	int i, ret;
 +	int i;
  	struct net *net = seq_file_net(s);
  
- 	logger = rcu_dereference_protected(net->nf.nf_loggers[*pos],
- 					   lockdep_is_held(&nf_log_mutex));
+ 	logger = nft_log_dereference(net->nf.nf_loggers[*pos]);
  
  	if (!logger)
 -		ret = seq_printf(s, "%2lld NONE (", *pos);
 +		seq_printf(s, "%2lld NONE (", *pos);
  	else
 -		ret = seq_printf(s, "%2lld %s (", *pos, logger->name);
 +		seq_printf(s, "%2lld %s (", *pos, logger->name);
  
 -	if (ret < 0)
 -		return ret;
 +	if (seq_has_overflowed(s))
 +		return -ENOSPC;
  
  	for (i = 0; i < NF_LOG_TYPE_MAX; i++) {
  		if (loggers[*pos][i] == NULL)
  			continue;
  
- 		logger = rcu_dereference_protected(loggers[*pos][i],
- 					   lockdep_is_held(&nf_log_mutex));
+ 		logger = nft_log_dereference(loggers[*pos][i]);
 -		ret = seq_printf(s, "%s", logger->name);
 -		if (ret < 0)
 -			return ret;
 -		if (i == 0 && loggers[*pos][i + 1] != NULL) {
 -			ret = seq_printf(s, ",");
 -			if (ret < 0)
 -				return ret;
 -		}
 +		seq_printf(s, "%s", logger->name);
 +		if (i == 0 && loggers[*pos][i + 1] != NULL)
 +			seq_printf(s, ",");
 +
 +		if (seq_has_overflowed(s))
 +			return -ENOSPC;
  	}
  
 -	return seq_printf(s, ")\n");
 +	seq_printf(s, ")\n");
 +
 +	if (seq_has_overflowed(s))
 +		return -ENOSPC;
 +	return 0;
  }
  
  static const struct seq_operations nflog_seq_ops = {

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: linux-next: manual merge of the net-next tree with the vfs tree
  2014-11-25  2:42 linux-next: manual merge of the net-next tree with the vfs tree Stephen Rothwell
@ 2014-11-25 11:23 ` Marcelo Ricardo Leitner
  2014-11-25 15:56   ` Pablo Neira Ayuso
  0 siblings, 1 reply; 19+ messages in thread
From: Marcelo Ricardo Leitner @ 2014-11-25 11:23 UTC (permalink / raw)
  To: Stephen Rothwell, David Miller, netdev, Al Viro
  Cc: linux-next, linux-kernel, Steven Rostedt (Red Hat), Pablo Neira Ayuso

On 25-11-2014 00:42, Stephen Rothwell wrote:
> Hi all,
>
> Today's linux-next merge of the net-next tree got a conflict in
> net/netfilter/nf_log.c between commit e71456ae9871 ("netfilter: Remove
> checks of seq_printf() return values") from the vfs tree and commit
> 0c26ed1c07f1 ("netfilter: nf_log: Introduce nft_log_dereference()
> macro") from the net-next tree.
>
> I fixed it up (see below) and can carry the fix as necessary (no action
> is required).
>

Looks good to me, thanks Stephen.

Marcelo

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: linux-next: manual merge of the net-next tree with the vfs tree
  2014-11-25 11:23 ` Marcelo Ricardo Leitner
@ 2014-11-25 15:56   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 19+ messages in thread
From: Pablo Neira Ayuso @ 2014-11-25 15:56 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner
  Cc: Stephen Rothwell, David Miller, netdev, Al Viro, linux-next,
	linux-kernel, Steven Rostedt (Red Hat)

On Tue, Nov 25, 2014 at 09:23:52AM -0200, Marcelo Ricardo Leitner wrote:
> On 25-11-2014 00:42, Stephen Rothwell wrote:
> >Hi all,
> >
> >Today's linux-next merge of the net-next tree got a conflict in
> >net/netfilter/nf_log.c between commit e71456ae9871 ("netfilter: Remove
> >checks of seq_printf() return values") from the vfs tree and commit
> >0c26ed1c07f1 ("netfilter: nf_log: Introduce nft_log_dereference()
> >macro") from the net-next tree.
> >
> >I fixed it up (see below) and can carry the fix as necessary (no action
> >is required).
> >
> 
> Looks good to me, thanks Stephen.

Also to me, thanks Stephen and Marcelo.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: linux-next: manual merge of the net-next tree with the vfs tree
  2018-05-17  1:34 Stephen Rothwell
@ 2018-05-17  6:47 ` Christoph Hellwig
  0 siblings, 0 replies; 19+ messages in thread
From: Christoph Hellwig @ 2018-05-17  6:47 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: David Miller, Networking, Al Viro, Linux-Next Mailing List,
	Linux Kernel Mailing List, Christoph Hellwig, Chris Novakovic

> + /* Create a new file under /proc/net/ipconfig */
> + static int ipconfig_proc_net_create(const char *name,
> + 				    const struct file_operations *fops)
> + {
> + 	char *pname;
> + 	struct proc_dir_entry *p;
> + 
> + 	if (!ipconfig_dir)
> + 		return -ENOMEM;
> + 
> + 	pname = kasprintf(GFP_KERNEL, "%s%s", "ipconfig/", name);
> + 	if (!pname)
> + 		return -ENOMEM;
> + 
> + 	p = proc_create(pname, 0444, init_net.proc_net, fops);
> + 	kfree(pname);
> + 	if (!p)
> + 		return -ENOMEM;
> + 
> + 	return 0;

This code doesn't exist in the above mentioned commit.  But event
without knowing the details of the /proc/net code this looks somewhat
bogus.  For one I thought all the /proc/net files should be per-net
namespace.  Second the ntp file really should be using proc_create_net,
to handle all that under the hood - with the merge of the VFS
tree it will take a seq_ops, which is what this code really wants
anyway.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* linux-next: manual merge of the net-next tree with the vfs tree
@ 2018-05-17  1:34 Stephen Rothwell
  2018-05-17  6:47 ` Christoph Hellwig
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Rothwell @ 2018-05-17  1:34 UTC (permalink / raw)
  To: David Miller, Networking, Al Viro
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List,
	Christoph Hellwig, Chris Novakovic

[-- Attachment #1: Type: text/plain, Size: 3612 bytes --]

Hi all,

Today's linux-next merge of the net-next tree got a conflict in:

  net/ipv4/ipconfig.c

between commits:

  3f3942aca6da ("proc: introduce proc_create_single{,_data}")
  c04d2cb2009f ("ipconfig: Write NTP server IPs to /proc/net/ipconfig/ntp_servers")

from the vfs tree and commit:

  4d019b3f80dc ("ipconfig: Create /proc/net/ipconfig directory")

from the net-next tree.

I fixed it up (see below - there may be more to do) 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.

-- 
Cheers,
Stephen Rothwell

diff --cc net/ipv4/ipconfig.c
index bbcbcc113d19,86c9f755de3d..000000000000
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@@ -1282,6 -1317,74 +1317,61 @@@ static int pnp_seq_show(struct seq_fil
  			   &ic_servaddr);
  	return 0;
  }
 -
 -static int pnp_seq_open(struct inode *indoe, struct file *file)
 -{
 -	return single_open(file, pnp_seq_show, NULL);
 -}
 -
 -static const struct file_operations pnp_seq_fops = {
 -	.open		= pnp_seq_open,
 -	.read		= seq_read,
 -	.llseek		= seq_lseek,
 -	.release	= single_release,
 -};
 -
+ /* Create the /proc/net/ipconfig directory */
+ static int __init ipconfig_proc_net_init(void)
+ {
+ 	ipconfig_dir = proc_net_mkdir(&init_net, "ipconfig", init_net.proc_net);
+ 	if (!ipconfig_dir)
+ 		return -ENOMEM;
+ 
+ 	return 0;
+ }
+ 
+ /* Create a new file under /proc/net/ipconfig */
+ static int ipconfig_proc_net_create(const char *name,
+ 				    const struct file_operations *fops)
+ {
+ 	char *pname;
+ 	struct proc_dir_entry *p;
+ 
+ 	if (!ipconfig_dir)
+ 		return -ENOMEM;
+ 
+ 	pname = kasprintf(GFP_KERNEL, "%s%s", "ipconfig/", name);
+ 	if (!pname)
+ 		return -ENOMEM;
+ 
+ 	p = proc_create(pname, 0444, init_net.proc_net, fops);
+ 	kfree(pname);
+ 	if (!p)
+ 		return -ENOMEM;
+ 
+ 	return 0;
+ }
+ 
+ /* Write NTP server IP addresses to /proc/net/ipconfig/ntp_servers */
+ static int ntp_servers_seq_show(struct seq_file *seq, void *v)
+ {
+ 	int i;
+ 
+ 	for (i = 0; i < CONF_NTP_SERVERS_MAX; i++) {
+ 		if (ic_ntp_servers[i] != NONE)
+ 			seq_printf(seq, "%pI4\n", &ic_ntp_servers[i]);
+ 	}
+ 	return 0;
+ }
+ 
+ static int ntp_servers_seq_open(struct inode *inode, struct file *file)
+ {
+ 	return single_open(file, ntp_servers_seq_show, NULL);
+ }
+ 
+ static const struct file_operations ntp_servers_seq_fops = {
+ 	.open		= ntp_servers_seq_open,
+ 	.read		= seq_read,
+ 	.llseek		= seq_lseek,
+ 	.release	= single_release,
+ };
  #endif /* CONFIG_PROC_FS */
  
  /*
@@@ -1356,8 -1459,20 +1446,20 @@@ static int __init ip_auto_config(void
  	int err;
  	unsigned int i;
  
+ 	/* Initialise all name servers and NTP servers to NONE (but only if the
+ 	 * "ip=" or "nfsaddrs=" kernel command line parameters weren't decoded,
+ 	 * otherwise we'll overwrite the IP addresses specified there)
+ 	 */
+ 	if (ic_set_manually == 0) {
+ 		ic_nameservers_predef();
+ 		ic_ntp_servers_predef();
+ 	}
+ 
  #ifdef CONFIG_PROC_FS
 -	proc_create("pnp", 0444, init_net.proc_net, &pnp_seq_fops);
 +	proc_create_single("pnp", 0444, init_net.proc_net, pnp_seq_show);
+ 
+ 	if (ipconfig_proc_net_init() == 0)
+ 		ipconfig_proc_net_create("ntp_servers", &ntp_servers_seq_fops);
  #endif /* CONFIG_PROC_FS */
  
  	if (!ic_enable)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* linux-next: manual merge of the net-next tree with the vfs tree
@ 2018-01-25  6:41 Stephen Rothwell
  0 siblings, 0 replies; 19+ messages in thread
From: Stephen Rothwell @ 2018-01-25  6:41 UTC (permalink / raw)
  To: David Miller, Networking, Al Viro
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Jon Maloy

Hi all,

Today's linux-next merge of the net-next tree got a conflict in:

  net/tipc/socket.c

between commit:

  ade994f4f6c8 ("net: annotate ->poll() instances")

from the vfs tree and commit:

  60c253069632 ("tipc: fix race between poll() and setsockopt()")

from the net-next tree.

I fixed it up (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.

-- 
Cheers,
Stephen Rothwell

diff --cc net/tipc/socket.c
index 2aa46e8cd8fe,473a096b6fba..000000000000
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@@ -715,8 -716,7 +716,7 @@@ static __poll_t tipc_poll(struct file *
  {
  	struct sock *sk = sock->sk;
  	struct tipc_sock *tsk = tipc_sk(sk);
- 	struct tipc_group *grp = tsk->group;
 -	u32 revents = 0;
 +	__poll_t revents = 0;
  
  	sock_poll_wait(file, sk_sleep(sk), wait);
  

^ permalink raw reply	[flat|nested] 19+ messages in thread

* linux-next: manual merge of the net-next tree with the vfs tree
@ 2018-01-09 23:34 Stephen Rothwell
  0 siblings, 0 replies; 19+ messages in thread
From: Stephen Rothwell @ 2018-01-09 23:34 UTC (permalink / raw)
  To: David Miller, Networking, Al Viro
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Jon Maloy

Hi all,

Today's linux-next merge of the net-next tree got a conflict in:

  net/tipc/socket.c

between commit:

  ade994f4f6c8 ("net: annotate ->poll() instances")

from the vfs tree and commit:

  eb929a91b213 ("tipc: improve poll() for group member socket")

from the net-next tree.

I fixed it up (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.

-- 
Cheers,
Stephen Rothwell

diff --cc net/tipc/socket.c
index 2aa46e8cd8fe,1f236271766c..000000000000
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@@ -715,8 -715,8 +715,8 @@@ static __poll_t tipc_poll(struct file *
  {
  	struct sock *sk = sock->sk;
  	struct tipc_sock *tsk = tipc_sk(sk);
- 	struct tipc_group *grp = tsk->group;
+ 	struct tipc_group *grp;
 -	u32 revents = 0;
 +	__poll_t revents = 0;
  
  	sock_poll_wait(file, sk_sleep(sk), wait);
  

^ permalink raw reply	[flat|nested] 19+ messages in thread

* linux-next: manual merge of the net-next tree with the vfs tree
@ 2017-12-08  0:33 Stephen Rothwell
  0 siblings, 0 replies; 19+ messages in thread
From: Stephen Rothwell @ 2017-12-08  0:33 UTC (permalink / raw)
  To: David Miller, Networking, Al Viro
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Ursula Braun

Hi all,

Today's linux-next merge of the net-next tree got a conflict in:

  net/smc/smc_clc.c

between commit:

  d63d271ce2b5 ("smc: switch to sock_recvmsg()")

from the vfs tree and commit:

  e7b7a64a8493 ("smc: support variable CLC proposal messages")

from the net-next tree.

I fixed it up (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.

-- 
Cheers,
Stephen Rothwell

diff --cc net/smc/smc_clc.c
index 511548085d16,abf7ceb6690b..000000000000
--- a/net/smc/smc_clc.c
+++ b/net/smc/smc_clc.c
@@@ -86,12 -129,13 +132,12 @@@ int smc_clc_wait_msg(struct smc_sock *s
  	}
  
  	/* receive the complete CLC message */
 -	vec.iov_base = buf;
 -	vec.iov_len = buflen;
  	memset(&msg, 0, sizeof(struct msghdr));
 +	iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &vec, 1, buflen);
  	krflags = MSG_WAITALL;
  	smc->clcsock->sk->sk_rcvtimeo = CLC_WAIT_TIME;
 -	len = kernel_recvmsg(smc->clcsock, &msg, &vec, 1, datlen, krflags);
 +	len = sock_recvmsg(smc->clcsock, &msg, krflags);
- 	if (len < datlen) {
+ 	if (len < datlen || !smc_clc_msg_hdr_valid(clcm)) {
  		smc->sk.sk_err = EPROTO;
  		reason_code = -EPROTO;
  		goto out;

^ permalink raw reply	[flat|nested] 19+ messages in thread

* linux-next: manual merge of the net-next tree with the vfs tree
@ 2017-04-07  0:22 Stephen Rothwell
  0 siblings, 0 replies; 19+ messages in thread
From: Stephen Rothwell @ 2017-04-07  0:22 UTC (permalink / raw)
  To: David Miller, Networking, Al Viro
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Nathan Fontenot

Hi all,

Today's linux-next merge of the net-next tree got a conflict in:

  drivers/net/ethernet/ibm/ibmvnic.c

between commit:

  98998345a579 ("ibmvnic: fix kstrtoul, copy_from_user and copy_to_user misuse")

from the vfs tree and commit:

  e704f0434ea6 ("ibmvnic: Remove debugfs support")

from the net-next tree.

I fixed it up (the latter removed all the code modified by the former,
so I just did that) 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.

-- 
Cheers,
Stephen Rothwell

^ permalink raw reply	[flat|nested] 19+ messages in thread

* linux-next: manual merge of the net-next tree with the vfs tree
@ 2015-03-30  3:24 Stephen Rothwell
  0 siblings, 0 replies; 19+ messages in thread
From: Stephen Rothwell @ 2015-03-30  3:24 UTC (permalink / raw)
  To: David Miller, netdev, Al Viro; +Cc: linux-next, linux-kernel, tadeusz.struk

[-- Attachment #1: Type: text/plain, Size: 2100 bytes --]

Hi all,

Today's linux-next merge of the net-next tree got a conflict in
net/socket.c between commit 774157aa4897 ("net: switch importing msghdr
from userland to {compat_,}import_iovec()") from the vfs tree and
commit 0345f93138b2 ("net: socket: add support for async operations")
from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc net/socket.c
index abc721654ab5,073809f4125f..000000000000
--- a/net/socket.c
+++ b/net/socket.c
@@@ -841,11 -808,10 +794,10 @@@ static ssize_t sock_read_iter(struct ki
  	if (iocb->ki_pos != 0)
  		return -ESPIPE;
  
 -	if (iocb->ki_nbytes == 0)	/* Match SYS5 behaviour */
 +	if (!iov_iter_count(to))	/* Match SYS5 behaviour */
  		return 0;
  
- 	res = __sock_recvmsg(iocb, sock, &msg,
- 			     iov_iter_count(to), msg.msg_flags);
 -	res = sock_recvmsg(sock, &msg, iocb->ki_nbytes, msg.msg_flags);
++	res = sock_recvmsg(sock, &msg, iov_iter_count(to), msg.msg_flags);
  	*to = msg.msg_iter;
  	return res;
  }
@@@ -866,7 -833,7 +819,7 @@@ static ssize_t sock_write_iter(struct k
  	if (sock->type == SOCK_SEQPACKET)
  		msg.msg_flags |= MSG_EOR;
  
- 	res = __sock_sendmsg(iocb, sock, &msg, iov_iter_count(from));
 -	res = sock_sendmsg(sock, &msg, iocb->ki_nbytes);
++	res = sock_sendmsg(sock, &msg, iov_iter_count(from));
  	*from = msg.msg_iter;
  	return res;
  }
@@@ -1921,8 -1896,15 +1874,10 @@@ static int copy_msghdr_from_user(struc
  	if (nr_segs > UIO_MAXIOV)
  		return -EMSGSIZE;
  
+ 	kmsg->msg_iocb = NULL;
+ 
 -	err = rw_copy_check_uvector(save_addr ? READ : WRITE,
 -				    uiov, nr_segs,
 -				    UIO_FASTIOV, *iov, iov);
 -	if (err >= 0)
 -		iov_iter_init(&kmsg->msg_iter, save_addr ? READ : WRITE,
 -			      *iov, nr_segs, err);
 -	return err;
 +	return import_iovec(save_addr ? READ : WRITE, uiov, nr_segs,
 +			    UIO_FASTIOV, iov, &kmsg->msg_iter);
  }
  
  static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg,

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* linux-next: manual merge of the net-next tree with the vfs tree
@ 2015-03-30  3:08 Stephen Rothwell
  0 siblings, 0 replies; 19+ messages in thread
From: Stephen Rothwell @ 2015-03-30  3:08 UTC (permalink / raw)
  To: David Miller, netdev, Al Viro, tadeusz.struk; +Cc: linux-next, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1182 bytes --]

Hi all,

Today's linux-next merge of the net-next tree got a conflict in
net/compat.c between commit 774157aa4897 ("net: switch importing msghdr
from userland to {compat_,}import_iovec()") from the vfs tree and
commit 0345f93138b2 ("net: socket: add support for async operations")
from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc net/compat.c
index 0e34814592e6,c4b6b0f43d5d..000000000000
--- a/net/compat.c
+++ b/net/compat.c
@@@ -79,9 -79,15 +79,11 @@@ int get_compat_msghdr(struct msghdr *km
  	if (nr_segs > UIO_MAXIOV)
  		return -EMSGSIZE;
  
+ 	kmsg->msg_iocb = NULL;
+ 
 -	err = compat_rw_copy_check_uvector(save_addr ? READ : WRITE,
 -					   compat_ptr(uiov), nr_segs,
 -					   UIO_FASTIOV, *iov, iov);
 -	if (err >= 0)
 -		iov_iter_init(&kmsg->msg_iter, save_addr ? READ : WRITE,
 -			      *iov, nr_segs, err);
 -	return err;
 +	return compat_import_iovec(save_addr ? READ : WRITE,
 +				   compat_ptr(uiov), nr_segs,
 +				   UIO_FASTIOV, iov, &kmsg->msg_iter);
  }
  
  /* Bleech... */

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: linux-next: manual merge of the net-next tree with the vfs tree
  2015-03-13  4:38     ` Stephen Rothwell
@ 2015-03-13 16:37       ` Al Viro
  0 siblings, 0 replies; 19+ messages in thread
From: Al Viro @ 2015-03-13 16:37 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: David Miller, Linus Torvalds, netdev, linux-next, linux-kernel,
	hch, ying.xue, Felipe Balbi, Alan Stern, linux-usb

On Fri, Mar 13, 2015 at 03:38:17PM +1100, Stephen Rothwell wrote:

> There is also a conflict with e9eab93cc2dc ("fs: don't allow to
> complete sync iocbs through aio_complete"), though it doesn't show up
> in the resolution since I I just used the next-next tree bits.  So a
> common branch containing that as well could be merged into both trees.

OK, for now I've done just that (vfs.git#iocb in never-rebase mode).
I still think that vfs.git#gadget ought to go into mainline; arguments
for the rest of #iocb are weaker and merging it into net-next would
suffice; as the matter of fact, I have pending stuff for net-next touching
the same area (further reduction of ->sendmsg()/->recvmsg() argument lists;
total_len is redundant); might as well deal with that when feeding that
to Dave...

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: linux-next: manual merge of the net-next tree with the vfs tree
  2015-03-13  3:56   ` Al Viro
  2015-03-13  4:38     ` Stephen Rothwell
@ 2015-03-13  4:52     ` David Miller
  1 sibling, 0 replies; 19+ messages in thread
From: David Miller @ 2015-03-13  4:52 UTC (permalink / raw)
  To: viro
  Cc: torvalds, sfr, netdev, linux-next, linux-kernel, hch, ying.xue,
	balbi, stern, linux-usb

From: Al Viro <viro@ZenIV.linux.org.uk>
Date: Fri, 13 Mar 2015 03:56:09 +0000

> On Thu, Mar 12, 2015 at 11:24:26PM -0400, David Miller wrote:
>> From: Stephen Rothwell <sfr@canb.auug.org.au>
>> Date: Fri, 13 Mar 2015 13:15:43 +1100
>> 
>> > Today's linux-next merge of the net-next tree got a conflict in
>> > net/socket.c between commits 005139a14660 ("fs: remove ki_nbytes") and
>> > e9eab93cc2dc ("fs: don't allow to complete sync iocbs through
>> > aio_complete") from the vfs tree and commit 1b784140474e ("net: Remove
>> > iocb argument from sendmsg and recvmsg") from the net-next tree.
>> > 
>> > I fixed it up (mainly using the net-next version - see below) and can
>> > carry the fix as necessary (no action is required).
>> 
>> Al, how do you want to resolve this?
> 
> Hmm...  I could backmerge 1b784140474e4fc94281a49e96c67d29df0efbde into
> vfs.git#for-next, of course, but you've got quite a pile of stuff in front
> of it...  FWIW, the conflict resolution proposed by Stephen is correct;
> the question is what should go into which tree.
> 
> Actually, prereqs of the commit in question on vfs.git side are mostly
> -stable fodder; all it really needs is vfs.git#gadget and I was planning
> to send that to Linus - fixes for leaks and use-after-free in gadgetfs
> that had been there since forever, plus fixes for regression since 3.18
> (->f_op flipping that had always been fishy and outright broke when we
> started to FMODE_CAN_READ/FMODE_CAN_WRITE).  USB folks seem to be OK
> with it.  Christoph's patch isn't a regression fix, but seeing that it's
> (a) trivial and (b) ends up causing merge headache...  Maybe it would
> make sense to pull it into mainline and resolve the conflict on backmerge
> from mainline to net-next.  Linus?  I've pushed that (gadget + ki_nbytes)
> into vfs.git#for-linus-2; would you be OK with pulling that?

Push your stuff to Linus, then I'll solve all of this by merging
Linus --> net --> net-next at some point, ok?

Meanwhile Stephen's fix will carry us over until then.

THanks!

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: linux-next: manual merge of the net-next tree with the vfs tree
  2015-03-13  3:56   ` Al Viro
@ 2015-03-13  4:38     ` Stephen Rothwell
  2015-03-13 16:37       ` Al Viro
  2015-03-13  4:52     ` David Miller
  1 sibling, 1 reply; 19+ messages in thread
From: Stephen Rothwell @ 2015-03-13  4:38 UTC (permalink / raw)
  To: Al Viro
  Cc: David Miller, Linus Torvalds, netdev, linux-next, linux-kernel,
	hch, ying.xue, Felipe Balbi, Alan Stern, linux-usb

[-- Attachment #1: Type: text/plain, Size: 3095 bytes --]

Hi Al,

On Fri, 13 Mar 2015 03:56:09 +0000 Al Viro <viro@ZenIV.linux.org.uk> wrote:
>
> On Thu, Mar 12, 2015 at 11:24:26PM -0400, David Miller wrote:
> > From: Stephen Rothwell <sfr@canb.auug.org.au>
> > Date: Fri, 13 Mar 2015 13:15:43 +1100
> > 
> > > Today's linux-next merge of the net-next tree got a conflict in
> > > net/socket.c between commits 005139a14660 ("fs: remove ki_nbytes") and
> > > e9eab93cc2dc ("fs: don't allow to complete sync iocbs through
> > > aio_complete") from the vfs tree and commit 1b784140474e ("net: Remove
> > > iocb argument from sendmsg and recvmsg") from the net-next tree.
> > > 
> > > I fixed it up (mainly using the net-next version - see below) and can
> > > carry the fix as necessary (no action is required).
> > 
> > Al, how do you want to resolve this?
> 
> Hmm...  I could backmerge 1b784140474e4fc94281a49e96c67d29df0efbde into
> vfs.git#for-next, of course, but you've got quite a pile of stuff in front
> of it...  FWIW, the conflict resolution proposed by Stephen is correct;
> the question is what should go into which tree.
> 
> Actually, prereqs of the commit in question on vfs.git side are mostly
> -stable fodder; all it really needs is vfs.git#gadget and I was planning
> to send that to Linus - fixes for leaks and use-after-free in gadgetfs
> that had been there since forever, plus fixes for regression since 3.18
> (->f_op flipping that had always been fishy and outright broke when we
> started to FMODE_CAN_READ/FMODE_CAN_WRITE).  USB folks seem to be OK
> with it.  Christoph's patch isn't a regression fix, but seeing that it's
> (a) trivial and (b) ends up causing merge headache...  Maybe it would
> make sense to pull it into mainline and resolve the conflict on backmerge
> from mainline to net-next.  Linus?  I've pushed that (gadget + ki_nbytes)
> into vfs.git#for-linus-2; would you be OK with pulling that?
> 
> It's on
> git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-linus-2
> 
> Shortlog:
> Al Viro (8):
>       new helper: dup_iter()
>       move iov_iter.c from mm/ to lib/
>       gadget/function/f_fs.c: close leaks
>       gadget/function/f_fs.c: use put iov_iter into io_data
>       gadget/function/f_fs.c: switch to ->{read,write}_iter()
>       gadgetfs: use-after-free in ->aio_read()
>       gadget: switch ep_io_operations to ->read_iter/->write_iter
>       gadgetfs: get rid of flipping ->f_op in ep_config()
> 
> Alan Stern (1):
>       gadgetfs: really get rid of switching ->f_op
> 
> Christoph Hellwig (1):
>       fs: remove ki_nbytes

There is also a conflict with e9eab93cc2dc ("fs: don't allow to
complete sync iocbs through aio_complete"), though it doesn't show up
in the resolution since I I just used the next-next tree bits.  So a
common branch containing that as well could be merged into both trees.

But none of this is really that complex, maybe worth a hint to Linus
during the merge window.  Unless there is more planned for that file?
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: linux-next: manual merge of the net-next tree with the vfs tree
  2015-03-13  3:24 ` David Miller
@ 2015-03-13  3:56   ` Al Viro
  2015-03-13  4:38     ` Stephen Rothwell
  2015-03-13  4:52     ` David Miller
  0 siblings, 2 replies; 19+ messages in thread
From: Al Viro @ 2015-03-13  3:56 UTC (permalink / raw)
  To: David Miller
  Cc: Linus Torvalds, sfr, netdev, linux-next, linux-kernel, hch,
	ying.xue, Felipe Balbi, Alan Stern, linux-usb

On Thu, Mar 12, 2015 at 11:24:26PM -0400, David Miller wrote:
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Fri, 13 Mar 2015 13:15:43 +1100
> 
> > Today's linux-next merge of the net-next tree got a conflict in
> > net/socket.c between commits 005139a14660 ("fs: remove ki_nbytes") and
> > e9eab93cc2dc ("fs: don't allow to complete sync iocbs through
> > aio_complete") from the vfs tree and commit 1b784140474e ("net: Remove
> > iocb argument from sendmsg and recvmsg") from the net-next tree.
> > 
> > I fixed it up (mainly using the net-next version - see below) and can
> > carry the fix as necessary (no action is required).
> 
> Al, how do you want to resolve this?

Hmm...  I could backmerge 1b784140474e4fc94281a49e96c67d29df0efbde into
vfs.git#for-next, of course, but you've got quite a pile of stuff in front
of it...  FWIW, the conflict resolution proposed by Stephen is correct;
the question is what should go into which tree.

Actually, prereqs of the commit in question on vfs.git side are mostly
-stable fodder; all it really needs is vfs.git#gadget and I was planning
to send that to Linus - fixes for leaks and use-after-free in gadgetfs
that had been there since forever, plus fixes for regression since 3.18
(->f_op flipping that had always been fishy and outright broke when we
started to FMODE_CAN_READ/FMODE_CAN_WRITE).  USB folks seem to be OK
with it.  Christoph's patch isn't a regression fix, but seeing that it's
(a) trivial and (b) ends up causing merge headache...  Maybe it would
make sense to pull it into mainline and resolve the conflict on backmerge
from mainline to net-next.  Linus?  I've pushed that (gadget + ki_nbytes)
into vfs.git#for-linus-2; would you be OK with pulling that?

It's on
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-linus-2

Shortlog:
Al Viro (8):
      new helper: dup_iter()
      move iov_iter.c from mm/ to lib/
      gadget/function/f_fs.c: close leaks
      gadget/function/f_fs.c: use put iov_iter into io_data
      gadget/function/f_fs.c: switch to ->{read,write}_iter()
      gadgetfs: use-after-free in ->aio_read()
      gadget: switch ep_io_operations to ->read_iter/->write_iter
      gadgetfs: get rid of flipping ->f_op in ep_config()

Alan Stern (1):
      gadgetfs: really get rid of switching ->f_op

Christoph Hellwig (1):
      fs: remove ki_nbytes

Diffstat:
 drivers/usb/gadget/function/f_fs.c | 204 +++++++---------
 drivers/usb/gadget/legacy/inode.c  | 466 +++++++++++++++----------------------
 fs/aio.c                           |  34 +--
 fs/ceph/file.c                     |   2 +-
 fs/nfs/direct.c                    |   2 +-
 fs/ocfs2/file.c                    |   8 +-
 fs/read_write.c                    |   8 -
 fs/udf/file.c                      |   2 +-
 include/linux/aio.h                |   1 -
 include/linux/uio.h                |   2 +
 kernel/printk/printk.c             |   2 +-
 lib/Makefile                       |   2 +-
 {mm => lib}/iov_iter.c             |  15 ++
 mm/Makefile                        |   2 +-
 mm/page_io.c                       |   1 -
 net/socket.c                       |   6 +-
 16 files changed, 319 insertions(+), 438 deletions(-)
 rename {mm => lib}/iov_iter.c (97%)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: linux-next: manual merge of the net-next tree with the vfs tree
  2015-03-13  2:15 Stephen Rothwell
@ 2015-03-13  3:24 ` David Miller
  2015-03-13  3:56   ` Al Viro
  0 siblings, 1 reply; 19+ messages in thread
From: David Miller @ 2015-03-13  3:24 UTC (permalink / raw)
  To: sfr; +Cc: netdev, viro, linux-next, linux-kernel, hch, ying.xue

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Fri, 13 Mar 2015 13:15:43 +1100

> Today's linux-next merge of the net-next tree got a conflict in
> net/socket.c between commits 005139a14660 ("fs: remove ki_nbytes") and
> e9eab93cc2dc ("fs: don't allow to complete sync iocbs through
> aio_complete") from the vfs tree and commit 1b784140474e ("net: Remove
> iocb argument from sendmsg and recvmsg") from the net-next tree.
> 
> I fixed it up (mainly using the net-next version - see below) and can
> carry the fix as necessary (no action is required).

Al, how do you want to resolve this?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* linux-next: manual merge of the net-next tree with the vfs tree
@ 2015-03-13  2:15 Stephen Rothwell
  2015-03-13  3:24 ` David Miller
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Rothwell @ 2015-03-13  2:15 UTC (permalink / raw)
  To: David Miller, netdev, Al Viro
  Cc: linux-next, linux-kernel, Christoph Hellwig, Ying Xue

[-- Attachment #1: Type: text/plain, Size: 1560 bytes --]

Hi all,

Today's linux-next merge of the net-next tree got a conflict in
net/socket.c between commits 005139a14660 ("fs: remove ki_nbytes") and
e9eab93cc2dc ("fs: don't allow to complete sync iocbs through
aio_complete") from the vfs tree and commit 1b784140474e ("net: Remove
iocb argument from sendmsg and recvmsg") from the net-next tree.

I fixed it up (mainly using the net-next version - see below) and can
carry the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc net/socket.c
index f6c519d7b3ba,95d3085cb477..000000000000
--- a/net/socket.c
+++ b/net/socket.c
@@@ -855,11 -807,10 +807,10 @@@ static ssize_t sock_read_iter(struct ki
  	if (iocb->ki_pos != 0)
  		return -ESPIPE;
  
 -	if (iocb->ki_nbytes == 0)	/* Match SYS5 behaviour */
 +	if (!iov_iter_count(to))	/* Match SYS5 behaviour */
  		return 0;
  
- 	res = __sock_recvmsg(iocb, sock, &msg,
- 			     iov_iter_count(to), msg.msg_flags);
 -	res = sock_recvmsg(sock, &msg, iocb->ki_nbytes, msg.msg_flags);
++	res = sock_recvmsg(sock, &msg, iov_iter_count(to), msg.msg_flags);
  	*to = msg.msg_iter;
  	return res;
  }
@@@ -880,7 -831,7 +831,7 @@@ static ssize_t sock_write_iter(struct k
  	if (sock->type == SOCK_SEQPACKET)
  		msg.msg_flags |= MSG_EOR;
  
- 	res = __sock_sendmsg(iocb, sock, &msg, iov_iter_count(from));
 -	res = sock_sendmsg(sock, &msg, iocb->ki_nbytes);
++	res = sock_sendmsg(sock, &msg, iov_iter_count(from));
  	*from = msg.msg_iter;
  	return res;
  }

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: linux-next: manual merge of the net-next tree with the vfs tree
  2012-09-05  2:02 Stephen Rothwell
@ 2012-09-05  4:55 ` Masatake YAMATO
  0 siblings, 0 replies; 19+ messages in thread
From: Masatake YAMATO @ 2012-09-05  4:55 UTC (permalink / raw)
  To: sfr; +Cc: davem, netdev, linux-next, linux-kernel, viro

Hi,

How can I see source files applied your patch?
(I'm very new to kernel development.)

You patch looks like a patch for another patch.

Masatake YAMATO

> Hi all,
> 
> Today's linux-next merge of the net-next tree got a conflict in
> net/socket.c between commits f8a78429cc70 ("take descriptor handling from
> sock_alloc_file() to callers") and 32b529f92ea7 ("unexport sock_map_fd(),
> switch to sock_alloc_file()") from the vfs tree and commit 600e177920df
> ("net: Providing protocol type via system.sockprotoname xattr
> of /proc/PID/fd entries") from the net-next tree.
> 
> I fixed it up (see below) and can carry the fix as necessary.  I also had
> to add this merge fix patch:
> 
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Wed, 5 Sep 2012 11:52:06 +1000
> Subject: [PATCH] net: cope with sock_alloc_file() API change
> 
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>  include/linux/net.h |    3 ++-
>  net/9p/trans_fd.c   |    2 +-
>  net/sctp/socket.c   |    2 +-
>  3 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/net.h b/include/linux/net.h
> index c8a9708..a3831f3 100644
> --- a/include/linux/net.h
> +++ b/include/linux/net.h
> @@ -247,7 +247,8 @@ extern int   	     sock_sendmsg(struct socket *sock, struct msghdr *msg,
>  				  size_t len);
>  extern int	     sock_recvmsg(struct socket *sock, struct msghdr *msg,
>  				  size_t size, int flags);
> -extern struct file  *sock_alloc_file(struct socket *sock, int flags);
> +extern struct file  *sock_alloc_file(struct socket *sock, int flags,
> +				     const char *dname);
>  extern struct socket *sockfd_lookup(int fd, int *err);
>  extern struct socket *sock_from_file(struct file *file, int *err);
>  #define		     sockfd_put(sock) fput(sock->file)
> diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
> index 8c4e0b5..1c8b557 100644
> --- a/net/9p/trans_fd.c
> +++ b/net/9p/trans_fd.c
> @@ -801,7 +801,7 @@ static int p9_socket_open(struct p9_client *client, struct socket *csocket)
>  		return -ENOMEM;
>  
>  	csocket->sk->sk_allocation = GFP_NOIO;
> -	file = sock_alloc_file(csocket, 0);
> +	file = sock_alloc_file(csocket, 0, NULL);
>  	if (IS_ERR(file)) {
>  		pr_err("%s (%d): failed to map fd\n",
>  		       __func__, task_pid_nr(current));
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 5ba739e..59d16ea 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -4313,7 +4313,7 @@ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval
>  		goto out;
>  	}
>  
> -	newfile = sock_alloc_file(newsock, 0);
> +	newfile = sock_alloc_file(newsock, 0, NULL);
>  	if (unlikely(IS_ERR(newfile))) {
>  		put_unused_fd(retval);
>  		sock_release(newsock);
> -- 
> 1.7.10.280.gaa39
> 
> -- 
> Cheers,
> Stephen Rothwell                    sfr@canb.auug.org.au
> 
> diff --cc net/socket.c
> index 79170dc,977c0f4..0000000
> --- a/net/socket.c
> +++ b/net/socket.c
> @@@ -346,15 -347,30 +347,23 @@@ static struct file_system_type sock_fs_
>    *	but we take care of internal coherence yet.
>    */
>   
> - struct file *sock_alloc_file(struct socket *sock, int flags)
>  -static int sock_alloc_file(struct socket *sock, struct file **f, int flags,
>  -			   const char *dname)
> ++struct file *sock_alloc_file(struct socket *sock, int flags,
> ++			     const char *dname)
>   {
>   	struct qstr name = { .name = "" };
>   	struct path path;
>   	struct file *file;
>  -	int fd;
>  -
>  -	fd = get_unused_fd_flags(flags);
>  -	if (unlikely(fd < 0))
>  -		return fd;
>   
> + 	if (dname) {
> + 		name.name = dname;
> + 		name.len = strlen(name.name);
> + 	} else if (sock->sk) {
> + 		name.name = sock->sk->sk_prot_creator->name;
> + 		name.len = strlen(name.name);
> + 	}
>   	path.dentry = d_alloc_pseudo(sock_mnt->mnt_sb, &name);
>  -	if (unlikely(!path.dentry)) {
>  -		put_unused_fd(fd);
>  -		return -ENOMEM;
>  -	}
>  +	if (unlikely(!path.dentry))
>  +		return ERR_PTR(-ENOMEM);
>   	path.mnt = mntget(sock_mnt);
>   
>   	d_instantiate(path.dentry, SOCK_INODE(sock));
> @@@ -373,26 -390,22 +382,26 @@@
>   	file->f_flags = O_RDWR | (flags & O_NONBLOCK);
>   	file->f_pos = 0;
>   	file->private_data = sock;
>  -
>  -	*f = file;
>  -	return fd;
>  +	return file;
>   }
>  +EXPORT_SYMBOL(sock_alloc_file);
>   
>  -int sock_map_fd(struct socket *sock, int flags)
>  +static int sock_map_fd(struct socket *sock, int flags)
>   {
>   	struct file *newfile;
>  -	int fd = sock_alloc_file(sock, &newfile, flags, NULL);
>  +	int fd = get_unused_fd_flags(flags);
>  +	if (unlikely(fd < 0))
>  +		return fd;
>   
> - 	newfile = sock_alloc_file(sock, flags);
>  -	if (likely(fd >= 0))
> ++	newfile = sock_alloc_file(sock, flags, NULL);
>  +	if (likely(!IS_ERR(newfile))) {
>   		fd_install(fd, newfile);
>  +		return fd;
>  +	}
>   
>  -	return fd;
>  +	put_unused_fd(fd);
>  +	return PTR_ERR(newfile);
>   }
>  -EXPORT_SYMBOL(sock_map_fd);
>   
>   struct socket *sock_from_file(struct file *file, int *err)
>   {
> @@@ -1395,27 -1471,12 +1467,27 @@@ SYSCALL_DEFINE4(socketpair, int, family
>   		err = fd1;
>   		goto out_release_both;
>   	}
>  -
>  -	fd2 = sock_alloc_file(sock2, &newfile2, flags, NULL);
>  +	fd2 = get_unused_fd_flags(flags);
>   	if (unlikely(fd2 < 0)) {
>   		err = fd2;
>  +		put_unused_fd(fd1);
>  +		goto out_release_both;
>  +	}
>  +
> - 	newfile1 = sock_alloc_file(sock1, flags);
> ++	newfile1 = sock_alloc_file(sock1, flags, NULL);
>  +	if (unlikely(IS_ERR(newfile1))) {
>  +		err = PTR_ERR(newfile1);
>  +		put_unused_fd(fd1);
>  +		put_unused_fd(fd2);
>  +		goto out_release_both;
>  +	}
>  +
> - 	newfile2 = sock_alloc_file(sock2, flags);
> ++	newfile2 = sock_alloc_file(sock2, flags, NULL);
>  +	if (IS_ERR(newfile2)) {
>  +		err = PTR_ERR(newfile2);
>   		fput(newfile1);
>   		put_unused_fd(fd1);
>  +		put_unused_fd(fd2);
>   		sock_release(sock2);
>   		goto out;
>   	}
> @@@ -1553,13 -1615,6 +1625,14 @@@ SYSCALL_DEFINE4(accept4, int, fd, struc
>   		sock_release(newsock);
>   		goto out_put;
>   	}
> - 	newfile = sock_alloc_file(newsock, flags);
> ++	newfile = sock_alloc_file(newsock, flags,
> ++				  sock->sk->sk_prot_creator->name);
>  +	if (unlikely(IS_ERR(newfile))) {
>  +		err = PTR_ERR(newfile);
>  +		put_unused_fd(newfd);
>  +		sock_release(newsock);
>  +		goto out_put;
>  +	}
>   
>   	err = security_socket_accept(sock, newsock);
>   	if (err)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* linux-next: manual merge of the net-next tree with the vfs tree
@ 2012-09-05  2:02 Stephen Rothwell
  2012-09-05  4:55 ` Masatake YAMATO
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Rothwell @ 2012-09-05  2:02 UTC (permalink / raw)
  To: David Miller, netdev; +Cc: linux-next, linux-kernel, Masatake YAMATO, Al Viro

[-- Attachment #1: Type: text/plain, Size: 6029 bytes --]

Hi all,

Today's linux-next merge of the net-next tree got a conflict in
net/socket.c between commits f8a78429cc70 ("take descriptor handling from
sock_alloc_file() to callers") and 32b529f92ea7 ("unexport sock_map_fd(),
switch to sock_alloc_file()") from the vfs tree and commit 600e177920df
("net: Providing protocol type via system.sockprotoname xattr
of /proc/PID/fd entries") from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary.  I also had
to add this merge fix patch:

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 5 Sep 2012 11:52:06 +1000
Subject: [PATCH] net: cope with sock_alloc_file() API change

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/linux/net.h |    3 ++-
 net/9p/trans_fd.c   |    2 +-
 net/sctp/socket.c   |    2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/linux/net.h b/include/linux/net.h
index c8a9708..a3831f3 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -247,7 +247,8 @@ extern int   	     sock_sendmsg(struct socket *sock, struct msghdr *msg,
 				  size_t len);
 extern int	     sock_recvmsg(struct socket *sock, struct msghdr *msg,
 				  size_t size, int flags);
-extern struct file  *sock_alloc_file(struct socket *sock, int flags);
+extern struct file  *sock_alloc_file(struct socket *sock, int flags,
+				     const char *dname);
 extern struct socket *sockfd_lookup(int fd, int *err);
 extern struct socket *sock_from_file(struct file *file, int *err);
 #define		     sockfd_put(sock) fput(sock->file)
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 8c4e0b5..1c8b557 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -801,7 +801,7 @@ static int p9_socket_open(struct p9_client *client, struct socket *csocket)
 		return -ENOMEM;
 
 	csocket->sk->sk_allocation = GFP_NOIO;
-	file = sock_alloc_file(csocket, 0);
+	file = sock_alloc_file(csocket, 0, NULL);
 	if (IS_ERR(file)) {
 		pr_err("%s (%d): failed to map fd\n",
 		       __func__, task_pid_nr(current));
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 5ba739e..59d16ea 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -4313,7 +4313,7 @@ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval
 		goto out;
 	}
 
-	newfile = sock_alloc_file(newsock, 0);
+	newfile = sock_alloc_file(newsock, 0, NULL);
 	if (unlikely(IS_ERR(newfile))) {
 		put_unused_fd(retval);
 		sock_release(newsock);
-- 
1.7.10.280.gaa39

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc net/socket.c
index 79170dc,977c0f4..0000000
--- a/net/socket.c
+++ b/net/socket.c
@@@ -346,15 -347,30 +347,23 @@@ static struct file_system_type sock_fs_
   *	but we take care of internal coherence yet.
   */
  
- struct file *sock_alloc_file(struct socket *sock, int flags)
 -static int sock_alloc_file(struct socket *sock, struct file **f, int flags,
 -			   const char *dname)
++struct file *sock_alloc_file(struct socket *sock, int flags,
++			     const char *dname)
  {
  	struct qstr name = { .name = "" };
  	struct path path;
  	struct file *file;
 -	int fd;
 -
 -	fd = get_unused_fd_flags(flags);
 -	if (unlikely(fd < 0))
 -		return fd;
  
+ 	if (dname) {
+ 		name.name = dname;
+ 		name.len = strlen(name.name);
+ 	} else if (sock->sk) {
+ 		name.name = sock->sk->sk_prot_creator->name;
+ 		name.len = strlen(name.name);
+ 	}
  	path.dentry = d_alloc_pseudo(sock_mnt->mnt_sb, &name);
 -	if (unlikely(!path.dentry)) {
 -		put_unused_fd(fd);
 -		return -ENOMEM;
 -	}
 +	if (unlikely(!path.dentry))
 +		return ERR_PTR(-ENOMEM);
  	path.mnt = mntget(sock_mnt);
  
  	d_instantiate(path.dentry, SOCK_INODE(sock));
@@@ -373,26 -390,22 +382,26 @@@
  	file->f_flags = O_RDWR | (flags & O_NONBLOCK);
  	file->f_pos = 0;
  	file->private_data = sock;
 -
 -	*f = file;
 -	return fd;
 +	return file;
  }
 +EXPORT_SYMBOL(sock_alloc_file);
  
 -int sock_map_fd(struct socket *sock, int flags)
 +static int sock_map_fd(struct socket *sock, int flags)
  {
  	struct file *newfile;
 -	int fd = sock_alloc_file(sock, &newfile, flags, NULL);
 +	int fd = get_unused_fd_flags(flags);
 +	if (unlikely(fd < 0))
 +		return fd;
  
- 	newfile = sock_alloc_file(sock, flags);
 -	if (likely(fd >= 0))
++	newfile = sock_alloc_file(sock, flags, NULL);
 +	if (likely(!IS_ERR(newfile))) {
  		fd_install(fd, newfile);
 +		return fd;
 +	}
  
 -	return fd;
 +	put_unused_fd(fd);
 +	return PTR_ERR(newfile);
  }
 -EXPORT_SYMBOL(sock_map_fd);
  
  struct socket *sock_from_file(struct file *file, int *err)
  {
@@@ -1395,27 -1471,12 +1467,27 @@@ SYSCALL_DEFINE4(socketpair, int, family
  		err = fd1;
  		goto out_release_both;
  	}
 -
 -	fd2 = sock_alloc_file(sock2, &newfile2, flags, NULL);
 +	fd2 = get_unused_fd_flags(flags);
  	if (unlikely(fd2 < 0)) {
  		err = fd2;
 +		put_unused_fd(fd1);
 +		goto out_release_both;
 +	}
 +
- 	newfile1 = sock_alloc_file(sock1, flags);
++	newfile1 = sock_alloc_file(sock1, flags, NULL);
 +	if (unlikely(IS_ERR(newfile1))) {
 +		err = PTR_ERR(newfile1);
 +		put_unused_fd(fd1);
 +		put_unused_fd(fd2);
 +		goto out_release_both;
 +	}
 +
- 	newfile2 = sock_alloc_file(sock2, flags);
++	newfile2 = sock_alloc_file(sock2, flags, NULL);
 +	if (IS_ERR(newfile2)) {
 +		err = PTR_ERR(newfile2);
  		fput(newfile1);
  		put_unused_fd(fd1);
 +		put_unused_fd(fd2);
  		sock_release(sock2);
  		goto out;
  	}
@@@ -1553,13 -1615,6 +1625,14 @@@ SYSCALL_DEFINE4(accept4, int, fd, struc
  		sock_release(newsock);
  		goto out_put;
  	}
- 	newfile = sock_alloc_file(newsock, flags);
++	newfile = sock_alloc_file(newsock, flags,
++				  sock->sk->sk_prot_creator->name);
 +	if (unlikely(IS_ERR(newfile))) {
 +		err = PTR_ERR(newfile);
 +		put_unused_fd(newfd);
 +		sock_release(newsock);
 +		goto out_put;
 +	}
  
  	err = security_socket_accept(sock, newsock);
  	if (err)

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2018-05-17  6:43 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-25  2:42 linux-next: manual merge of the net-next tree with the vfs tree Stephen Rothwell
2014-11-25 11:23 ` Marcelo Ricardo Leitner
2014-11-25 15:56   ` Pablo Neira Ayuso
  -- strict thread matches above, loose matches on Subject: below --
2018-05-17  1:34 Stephen Rothwell
2018-05-17  6:47 ` Christoph Hellwig
2018-01-25  6:41 Stephen Rothwell
2018-01-09 23:34 Stephen Rothwell
2017-12-08  0:33 Stephen Rothwell
2017-04-07  0:22 Stephen Rothwell
2015-03-30  3:24 Stephen Rothwell
2015-03-30  3:08 Stephen Rothwell
2015-03-13  2:15 Stephen Rothwell
2015-03-13  3:24 ` David Miller
2015-03-13  3:56   ` Al Viro
2015-03-13  4:38     ` Stephen Rothwell
2015-03-13 16:37       ` Al Viro
2015-03-13  4:52     ` David Miller
2012-09-05  2:02 Stephen Rothwell
2012-09-05  4:55 ` Masatake YAMATO

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).