linux-next: manual merge of the crypto tree with the origin tree
Mark Brown
maintainerHi all,
Today's linux-next merge of the crypto tree got a conflict in:
drivers/char/hw_random/virtio-rng.c
between commit:
0f7bf47f5a0cc ("hwrng: virtio - prevent use-after-free after a failed restore")
from the origin tree and commits:
a3eaee98eecc4 ("hwrng: virtio - prevent use-after-free after a failed restore") 277b0dae660c3 ("hwrng: virtio - simplify probe_common()")
from the crypto 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.
drivers/char/hw_random/virtio-rng.c +0 -0
@@@ -70,7 -70,7 +70,7 @@@ static void request_entropy(struct virtstatic unsigned int copy_data (struct virtrng_info *vi,void *buf,unsigned int size) { -unsigned int idx, avail; +unsigned int idx;/* * vi->data_avail was set from the device-reported used.len and * steered into adjacent slab memory, including under * speculation. */ - avail =min (vi->data_avail,sizeof (vi->data)); -if (vi->data_idx >= avail) { +if (vi->data_idx >=sizeof (vi->data)) { vi->data_avail =0 ;request_entropy (vi);return 0 ; } - size =min (size, avail - vi->data_idx); + vi->data_avail =min (vi->data_avail,sizeof (vi->data) - vi->data_idx); + size =min (size, vi->data_avail); idx =array_index_nospec (vi->data_idx,sizeof (vi->data));memcpy (buf, vi->data + idx, size); vi->data_idx += size;static int probe_common (struct virtio_device *vdev) { -int err, index; -struct virtrng_info *vi =NULL ; +int err; +struct virtrng_info *vi; vi = kzalloc_obj(struct virtrng_info);if (!vi)return -ENOMEM ; - vi->index = index =ida_alloc (&rng_index_ida,GFP_KERNEL ); -if (index <0 ) { - err = index; - goto err_ida; + vi->index =ida_alloc (&rng_index_ida,GFP_KERNEL ); +if (vi->index <0 ) { + err = vi->index; + goto err; }snprintf (vi->name,sizeof (vi->name),"virtio_rng.%d" , vi->index);init_completion (&vi->have_data); vi->vq =virtio_find_single_vq (vdev, random_recv_done,"input" );if (IS_ERR (vi->vq)) { err =PTR_ERR (vi->vq); - goto err_find; +ida_free (&rng_index_ida, vi->index); + goto err; }virtio_device_ready (vdev);return 0 ; - err_find: -ida_free (&rng_index_ida, index); - err_ida: + err: vdev->priv =NULL ;kfree (vi);return err;static int virtrng_restore (struct virtio_device *vdev) { +struct virtrng_info *vi;int err; err =probe_common (vdev); -if (!err) { -struct virtrng_info *vi = vdev->priv; +if (err) +return err; + vi = vdev->priv; -/* -* Set hwrng_removed to ensure that virtio_read() -* does not block waiting for data before the -* registration is complete. -*/ - vi->hwrng_removed = true; - err =hwrng_register (&vi->hwrng); -if (!err) { - vi->hwrng_register_done = true; - vi->hwrng_removed = false; - } - } +/* +* Set hwrng_removed to ensure that virtio_read() +* does not block waiting for data before the +* registration is complete. +*/ + vi->hwrng_removed = true; + err =hwrng_register (&vi->hwrng); +if (err) +return err; -return err; + vi->hwrng_register_done = true; + vi->hwrng_removed = false; +return 0 ; } static const struct virtio_device_id id_table[] = {