Subject: linux-next: manual merge of the vhost tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 20 Dec 2022 10:05:53 +1100

Hi all,

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

  drivers/vhost/vsock.c

between commit:

  de4eda9de2d9 ("use less confusing names for iov_iter direction initializers")

from Linus' tree and commit:

  101cf89e8d08 ("virtio/vsock: replace virtio_vsock_pkt with sk_buff")

from the vhost 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 drivers/vhost/vsock.c
index cd6f7776013a,830bc823addc..000000000000
--- a/drivers/vhost/vsock.c
+++ b/drivers/vhost/vsock.c
@@@ -165,8 -157,9 +157,9 @@@ vhost_transport_do_send_pkt(struct vhos
  			break;
  		}
  
 -		iov_iter_init(&iov_iter, READ, &vq->iov[out], in, iov_len);
 +		iov_iter_init(&iov_iter, ITER_DEST, &vq->iov[out], in, iov_len);
- 		payload_len = pkt->len - pkt->off;
+ 		payload_len = skb->len;
+ 		hdr = virtio_vsock_hdr(skb);
  
  		/* If the packet is greater than the space available in the
  		 * buffer, we split it using multiple buffers.
@@@ -366,18 -340,21 +340,22 @@@ vhost_vsock_alloc_skb(struct vhost_virt
  		return NULL;
  	}
  
- 	pkt = kzalloc(sizeof(*pkt), GFP_KERNEL);
- 	if (!pkt)
+ 	len = iov_length(vq->iov, out);
+ 
+ 	/* len contains both payload and hdr */
+ 	skb = virtio_vsock_alloc_skb(len, GFP_KERNEL);
+ 	if (!skb)
  		return NULL;
  
 -	iov_iter_init(&iov_iter, WRITE, vq->iov, out, len);
 +	len = iov_length(vq->iov, out);
 +	iov_iter_init(&iov_iter, ITER_SOURCE, vq->iov, out, len);
  
- 	nbytes = copy_from_iter(&pkt->hdr, sizeof(pkt->hdr), &iov_iter);
- 	if (nbytes != sizeof(pkt->hdr)) {
+ 	hdr = virtio_vsock_hdr(skb);
+ 	nbytes = copy_from_iter(hdr, sizeof(*hdr), &iov_iter);
+ 	if (nbytes != sizeof(*hdr)) {
  		vq_err(vq, "Expected %zu bytes for pkt->hdr, got %zu bytes\n",
- 		       sizeof(pkt->hdr), nbytes);
- 		kfree(pkt);
+ 		       sizeof(*hdr), nbytes);
+ 		kfree_skb(skb);
  		return NULL;
  	}