<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/drivers/misc/ocxl/file.c, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/drivers/misc/ocxl/file.c?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/drivers/misc/ocxl/file.c?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-04-21T06:42:43Z</updated>
<entry>
<title>misc: ocxl: fix possible double free in ocxl_file_register_afu</title>
<updated>2022-04-21T06:42:43Z</updated>
<author>
<name>Hangyu Hua</name>
<email>hbh25y@gmail.com</email>
</author>
<published>2022-04-18T08:57:58Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=950cf957fe34d40d63dfa3bf3968210430b6491e'/>
<id>urn:sha1:950cf957fe34d40d63dfa3bf3968210430b6491e</id>
<content type='text'>
info_release() will be called in device_unregister() when info-&gt;dev's
reference count is 0. So there is no need to call ocxl_afu_put() and
kfree() again.

Fix this by adding free_minor() and return to err_unregister error path.

Fixes: 75ca758adbaf ("ocxl: Create a clear delineation between ocxl backend &amp; frontend")
Signed-off-by: Hangyu Hua &lt;hbh25y@gmail.com&gt;
Acked-by: Frederic Barrat &lt;fbarrat@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20220418085758.38145-1-hbh25y@gmail.com

</content>
</entry>
<entry>
<title>ocxl: remove redundant rc variable</title>
<updated>2021-12-20T01:15:33Z</updated>
<author>
<name>Minghao Chi</name>
<email>chi.minghao@zte.com.cn</email>
</author>
<published>2021-12-15T06:04:38Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=30e120e6a9d247cec7effd55fd6783d5c619ed4c'/>
<id>urn:sha1:30e120e6a9d247cec7effd55fd6783d5c619ed4c</id>
<content type='text'>
Return value from ocxl_context_attach() directly instead
of taking this in another redundant variable.

Reported-by: Zeal Robot &lt;zealci@zte.com.cn&gt;
Signed-off-by: Minghao Chi &lt;chi.minghao@zte.com.cn&gt;
Acked-by: Andrew Donnellan &lt;ajd@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20211215060438.441918-1-chi.minghao@zte.com.cn
</content>
</entry>
<entry>
<title> ocxl: use DEFINE_MUTEX() for mutex lock</title>
<updated>2021-01-30T00:39:21Z</updated>
<author>
<name>Zheng Yongjun</name>
<email>zhengyongjun3@huawei.com</email>
</author>
<published>2020-12-24T13:24:46Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=52f6b0a90bcf573ba8a33e97544c7b6f292376a4'/>
<id>urn:sha1:52f6b0a90bcf573ba8a33e97544c7b6f292376a4</id>
<content type='text'>
mutex lock can be initialized automatically with DEFINE_MUTEX()
rather than explicitly calling mutex_init().

Signed-off-by: Zheng Yongjun &lt;zhengyongjun3@huawei.com&gt;
Acked-by: Frederic Barrat &lt;fbarrat@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20201224132446.31286-1-zhengyongjun3@huawei.com
</content>
</entry>
<entry>
<title>ocxl: Fix concurrent AFU open and device removal</title>
<updated>2019-12-10T09:34:23Z</updated>
<author>
<name>Frederic Barrat</name>
<email>fbarrat@linux.ibm.com</email>
</author>
<published>2019-06-24T14:41:48Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=a58d37bce0d21cf7fbd589384c619e465ef2f927'/>
<id>urn:sha1:a58d37bce0d21cf7fbd589384c619e465ef2f927</id>
<content type='text'>
If an ocxl device is unbound through sysfs at the same time its AFU is
being opened by a user process, the open code may dereference freed
stuctures, which can lead to kernel oops messages. You'd have to hit a
tiny time window, but it's possible. It's fairly easy to test by
making the time window bigger artificially.

Fix it with a combination of 2 changes:
  - when an AFU device is found in the IDR by looking for the device
    minor number, we should hold a reference on the device until after
    the context is allocated. A reference on the AFU structure is kept
    when the context is allocated, so we can release the reference on
    the device after the context allocation.
  - with the fix above, there's still another even tinier window,
    between the time the AFU device is found in the IDR and the
    reference on the device is taken. We can fix this one by removing
    the IDR entry earlier, when the device setup is removed, instead
    of waiting for the 'release' device callback. With proper locking
    around the IDR.

Fixes: 75ca758adbaf ("ocxl: Create a clear delineation between ocxl backend &amp; frontend")
Cc: stable@vger.kernel.org # v5.2+
Signed-off-by: Frederic Barrat &lt;fbarrat@linux.ibm.com&gt;
Reviewed-by: Greg Kurz &lt;groug@kaod.org&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20190624144148.32022-1-fbarrat@linux.ibm.com
</content>
</entry>
<entry>
<title>ocxl: Fix return value check in afu_ioctl()</title>
<updated>2019-05-06T10:21:56Z</updated>
<author>
<name>Wei Yongjun</name>
<email>weiyongjun1@huawei.com</email>
</author>
<published>2019-05-04T07:04:30Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=6be6a8de1b55e719e3f95894910743719065d6a1'/>
<id>urn:sha1:6be6a8de1b55e719e3f95894910743719065d6a1</id>
<content type='text'>
In case of error, the function eventfd_ctx_fdget() returns ERR_PTR() and
never returns NULL. The NULL test in the return value check should be
replaced with IS_ERR().

This issue was detected by using the Coccinelle software.

Fixes: 060146614643 ("ocxl: move event_fd handling to frontend")
Signed-off-by: Wei Yongjun &lt;weiyongjun1@huawei.com&gt;
Acked-by: Alastair D'Silva &lt;alastair@d-silva.org&gt;
Acked-by: Andrew Donnellan &lt;ajd@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
</content>
</entry>
<entry>
<title>ocxl: move event_fd handling to frontend</title>
<updated>2019-05-02T16:55:02Z</updated>
<author>
<name>Alastair D'Silva</name>
<email>alastair@d-silva.org</email>
</author>
<published>2019-03-27T05:31:35Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=060146614643ddc5978c73ffac0329762b4651c9'/>
<id>urn:sha1:060146614643ddc5978c73ffac0329762b4651c9</id>
<content type='text'>
Event_fd is only used in the driver frontend, so it does not
need to exist in the backend code. Relocate it to the frontend
and provide an opaque mechanism for consumers instead.

Signed-off-by: Alastair D'Silva &lt;alastair@d-silva.org&gt;
Acked-by: Frederic Barrat &lt;fbarrat@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
</content>
</entry>
<entry>
<title>ocxl: afu_irq only deals with IRQ IDs, not offsets</title>
<updated>2019-05-02T16:55:02Z</updated>
<author>
<name>Alastair D'Silva</name>
<email>alastair@d-silva.org</email>
</author>
<published>2019-03-27T05:31:34Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=2ec3b7ed2ab8e07fdb5f800ff420e94dec75435f'/>
<id>urn:sha1:2ec3b7ed2ab8e07fdb5f800ff420e94dec75435f</id>
<content type='text'>
The use of offsets is required only in the frontend, so alter
the IRQ API to only work with IRQ IDs in the backend.

Signed-off-by: Alastair D'Silva &lt;alastair@d-silva.org&gt;
Acked-by: Frederic Barrat &lt;fbarrat@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
</content>
</entry>
<entry>
<title>ocxl: Allow external drivers to use OpenCAPI contexts</title>
<updated>2019-05-02T16:55:02Z</updated>
<author>
<name>Alastair D'Silva</name>
<email>alastair@d-silva.org</email>
</author>
<published>2019-03-27T05:31:33Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=b9721d275cc2c5e6c07371239c827e0faf05a6b9'/>
<id>urn:sha1:b9721d275cc2c5e6c07371239c827e0faf05a6b9</id>
<content type='text'>
Most OpenCAPI operations require a valid context, so
exposing these functions to external drivers is necessary.

Signed-off-by: Alastair D'Silva &lt;alastair@d-silva.org&gt;
Reviewed-by: Greg Kurz &lt;groug@kaod.org&gt;
Acked-by: Frederic Barrat &lt;fbarrat@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
</content>
</entry>
<entry>
<title>ocxl: Create a clear delineation between ocxl backend &amp; frontend</title>
<updated>2019-05-02T16:55:01Z</updated>
<author>
<name>Alastair D'Silva</name>
<email>alastair@d-silva.org</email>
</author>
<published>2019-03-27T05:31:32Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=75ca758adbafc81804c39b2c200ecdc819a6c042'/>
<id>urn:sha1:75ca758adbafc81804c39b2c200ecdc819a6c042</id>
<content type='text'>
The OCXL driver contains both frontend code for interacting with userspace,
as well as backend code for interacting with the hardware.

This patch separates the backend code from the frontend so that it can be
used by other device drivers that communicate via OpenCAPI.

Relocate dev, cdev &amp; sysfs files to the frontend code to allow external
drivers to maintain their own devices.

Reference counting on the device in the backend is replaced with kref
counting.

Move file &amp; sysfs layer initialisation from core.c (backend) to
pci.c (frontend).

Create an ocxl_function oriented interface for initing devices &amp;
enumerating AFUs.

Signed-off-by: Alastair D'Silva &lt;alastair@d-silva.org&gt;
Acked-by: Frederic Barrat &lt;fbarrat@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
</content>
</entry>
<entry>
<title>ocxl: Rename struct link to ocxl_link</title>
<updated>2019-05-02T16:55:00Z</updated>
<author>
<name>Alastair D'Silva</name>
<email>alastair@d-silva.org</email>
</author>
<published>2019-03-25T05:34:52Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=9c4ae0645682b97437072693f0edbee17214225b'/>
<id>urn:sha1:9c4ae0645682b97437072693f0edbee17214225b</id>
<content type='text'>
The term 'link' is ambiguous (especially when the struct is used for a
list), so rename it for clarity.

Signed-off-by: Alastair D'Silva &lt;alastair@d-silva.org&gt;
Reviewed-by: Greg Kurz &lt;groug@kaod.org&gt;
Acked-by: Frederic Barrat &lt;fbarrat@linux.ibm.com&gt;
Acked-by: Andrew Donnellan &lt;andrew.donnellan@au1.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
</content>
</entry>
</feed>
