xenfs/xensyms: respect hypervisor's "next" indication
PATCH 1/1 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().
---
Not sure if this is to be considered stable (backport) material.
drivers/xen/xenfs/xensyms.c +2 -2
@@ -48,7 +48,7 @@ static int xensyms_next_sym(struct xensyreturn -ENOMEM ;set_xen_guest_handle (symdata->name, xs->name); - symdata->symnum--;/* Rewind */ + symdata->symnum = symnum;/* Rewind */ ret =HYPERVISOR_platform_op (&xs->op);if (ret <0 )
@@ -78,7 +78,7 @@ static void *xensyms_next(struct seq_fil {struct xensyms *xs = m->private; - xs->op.u.symdata.symnum = ++(*pos); + *pos = xs->op.u.symdata.symnum;if (xensyms_next_sym (xs))return NULL ;
Quoted 10 lines · Jan Beulich
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 (andxensyms_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 inxensyms_next(), and use the saved incoming index inxensyms_next_sym().Fixes a11f4f0a4e18 ("xen: xensyms support")Signed-off-by Jan Beulich <[email protected]>
Quoted 2 lines
---
Not sure if this is to be considered stable (backport) material.
I think it should be added to stable kernels. Will add [email protected] to Cc:
Juergen