Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xenfs/xensyms: respect hypervisor's "next" indication

The interface specifies the symnum field as an input and output; the
hypervisor sets it to the next sequential symbol's index. xensyms_next()
incrementing the position explicitly (and xensyms_next_sym()
decrementing it to "rewind") is only correct as long as the sequence of
symbol indexes is non-sparse. Use the hypervisor-supplied value instead
to update the position in xensyms_next(), and use the saved incoming
index in xensyms_next_sym().

Cc: stable@kernel.org
Fixes: a11f4f0a4e18 ("xen: xensyms support")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Message-ID: <15d5e7fa-ec5d-422f-9319-d28bed916349@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>

authored by

Jan Beulich and committed by
Juergen Gross
5c4e79e2 1c3dfc7c

+2 -2
+2 -2
drivers/xen/xenfs/xensyms.c
··· 48 48 return -ENOMEM; 49 49 50 50 set_xen_guest_handle(symdata->name, xs->name); 51 - symdata->symnum--; /* Rewind */ 51 + symdata->symnum = symnum; /* Rewind */ 52 52 53 53 ret = HYPERVISOR_platform_op(&xs->op); 54 54 if (ret < 0) ··· 78 78 { 79 79 struct xensyms *xs = m->private; 80 80 81 - xs->op.u.symdata.symnum = ++(*pos); 81 + *pos = xs->op.u.symdata.symnum; 82 82 83 83 if (xensyms_next_sym(xs)) 84 84 return NULL;