Re: [PATCH] nvdimm: fix potential double-fetch bug

2017-09-19 Thread Meng Xu
Hi Jerry and Dan, Sorry for the late reply. I looked at this issue again and found that simple patches like memcmp(buf, in_env, in_len) && memcmp(buf + in_len, out_env, out_len) will only work in the case of (cmd == ND_CMD_CALL) and does not apply to other cmd. In fact, I fail to find a patch

Re: [PATCH] nvdimm: fix potential double-fetch bug

2017-09-12 Thread Meng Xu
Hi Jerry, Thank you for the question. Yes, these double copies do seem to present an issue. __nd_ioctl() and acpi_nfit_ctl() both use the same way to derive `out_size`, but based on different data fetches. A simple patch would be memcmp(buf, in_env, in_len) memcmp(buf + in_len, out_env, out_len

Re: [PATCH] nvdimm: fix potential double-fetch bug

2017-09-12 Thread Jerry Hoemann
On Thu, Aug 31, 2017 at 03:42:52PM -0700, Dan Williams wrote: > [ adding Jerry ] > > On Wed, Aug 23, 2017 at 2:07 PM, Meng Xu wrote: > > From: Meng Xu > > > > While examining the kernel source code, I found a dangerous operation that > > could turn into a double-fetch situation (a race condition

Re: [PATCH] nvdimm: fix potential double-fetch bug

2017-09-04 Thread Meng Xu
Hi Dan, I have adjusted the patch as suggested by moving the check on nd_reserved2 to acpi_nfit_ctl(). The new patch can be found at https://marc.info/?l=linux-kernel&m=150453930712916&w=2 Best Regards, Meng On 08/31/2017 06:42 PM, Dan Williams wrote: [ adding Jerry ] On Wed, Aug 23, 2017 at

Re: [PATCH] nvdimm: fix potential double-fetch bug

2017-08-31 Thread Dan Williams
[ adding Jerry ] On Wed, Aug 23, 2017 at 2:07 PM, Meng Xu wrote: > From: Meng Xu > > While examining the kernel source code, I found a dangerous operation that > could turn into a double-fetch situation (a race condition bug) where > the same userspace memory region are fetched twice into kernel