<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/block/rnbd, branch v5.10.78</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.10.78</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.10.78'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2021-05-19T08:13:06+00:00</updated>
<entry>
<title>block/rnbd-clt: Check the return value of the function rtrs_clt_query</title>
<updated>2021-05-19T08:13:06+00:00</updated>
<author>
<name>Md Haris Iqbal</name>
<email>haris.iqbal@cloud.ionos.com</email>
</author>
<published>2021-04-28T06:13:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3d808916d256b49b971b55eebedece7b34e1d6a2'/>
<id>urn:sha1:3d808916d256b49b971b55eebedece7b34e1d6a2</id>
<content type='text'>
[ Upstream commit 1056ad829ec43f9b705b507c2093b05e2088b0b7 ]

In case none of the paths are in connected state, the function
rtrs_clt_query returns an error. In such a case, error out since the
values in the rtrs_attrs structure would be garbage.

Fixes: f7a7a5c228d45 ("block/rnbd: client: main functionality")
Signed-off-by: Md Haris Iqbal &lt;haris.iqbal@ionos.com&gt;
Reviewed-by: Guoqing Jiang &lt;guoqing.jiang@ionos.com&gt;
Signed-off-by: Jack Wang &lt;jinpu.wang@ionos.com&gt;
Signed-off-by: Gioh Kim &lt;gi-oh.kim@ionos.com&gt;
Link: https://lore.kernel.org/r/20210428061359.206794-4-gi-oh.kim@ionos.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>block/rnbd-clt: Change queue_depth type in rnbd_clt_session to size_t</title>
<updated>2021-05-19T08:13:06+00:00</updated>
<author>
<name>Md Haris Iqbal</name>
<email>haris.iqbal@cloud.ionos.com</email>
</author>
<published>2021-04-28T06:13:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c1a90296a9b5dad2afaf7f3802f4c8e9e8410c3d'/>
<id>urn:sha1:c1a90296a9b5dad2afaf7f3802f4c8e9e8410c3d</id>
<content type='text'>
[ Upstream commit 80d43cbd46155744ee450d2476ee4fcf2917ae9b ]

The member queue_depth in the structure rnbd_clt_session is read from the
rtrs client side using the function rtrs_clt_query, which in turn is read
from the rtrs_clt structure. It should really be of type size_t.

Fixes: 90426e89f54db ("block/rnbd: client: private header with client structs and functions")
Signed-off-by: Md Haris Iqbal &lt;haris.iqbal@ionos.com&gt;
Reviewed-by: Guoqing Jiang &lt;guoqing.jiang@ionos.com&gt;
Signed-off-by: Gioh Kim &lt;gi-oh.kim@ionos.com&gt;
Link: https://lore.kernel.org/r/20210428061359.206794-2-gi-oh.kim@ionos.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>block/rnbd-clt: Fix missing a memory free when unloading the module</title>
<updated>2021-05-11T12:47:31+00:00</updated>
<author>
<name>Gioh Kim</name>
<email>gi-oh.kim@cloud.ionos.com</email>
</author>
<published>2021-04-19T07:37:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=338a8723022892399d67e4d3aeaa513ae25eed8e'/>
<id>urn:sha1:338a8723022892399d67e4d3aeaa513ae25eed8e</id>
<content type='text'>
[ Upstream commit 12b06533104e802df73c1fbe159437c19933d6c0 ]

When unloading the rnbd-clt module, it does not free a memory
including the filename of the symbolic link to /sys/block/rnbdX.

It is found by kmemleak as below.

unreferenced object 0xffff9f1a83d3c740 (size 16):
  comm "bash", pid 736, jiffies 4295179665 (age 9841.310s)
  hex dump (first 16 bytes):
    21 64 65 76 21 6e 75 6c 6c 62 30 40 62 6c 61 00  !dev!nullb0@bla.
  backtrace:
    [&lt;0000000039f0c55e&gt;] 0xffffffffc0456c24
    [&lt;000000001aab9513&gt;] kernfs_fop_write+0xcf/0x1c0
    [&lt;00000000db5aa4b3&gt;] vfs_write+0xdb/0x1d0
    [&lt;000000007a2e2207&gt;] ksys_write+0x65/0xe0
    [&lt;00000000055e280a&gt;] do_syscall_64+0x50/0x1b0
    [&lt;00000000c2b51831&gt;] entry_SYSCALL_64_after_hwframe+0x49/0xbe

Signed-off-by: Gioh Kim &lt;gi-oh.kim@ionos.com&gt;
Signed-off-by: Jack Wang &lt;jinpu.wang@ionos.com&gt;
Link: https://lore.kernel.org/r/20210419073722.15351-13-gi-oh.kim@ionos.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>block/rnbd-clt: avoid module unload race with close confirmation</title>
<updated>2021-01-17T13:17:05+00:00</updated>
<author>
<name>Jack Wang</name>
<email>jinpu.wang@cloud.ionos.com</email>
</author>
<published>2021-01-08T14:36:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6f7a362e1c6fdc6fd9c0bea4c9b6f34b6d063a3f'/>
<id>urn:sha1:6f7a362e1c6fdc6fd9c0bea4c9b6f34b6d063a3f</id>
<content type='text'>
commit 3a21777c6ee99749bac10727b3c17e5bcfebe5c1 upstream.

We had kernel panic, it is caused by unload module and last
close confirmation.

call trace:
[1196029.743127]  free_sess+0x15/0x50 [rtrs_client]
[1196029.743128]  rtrs_clt_close+0x4c/0x70 [rtrs_client]
[1196029.743129]  ? rnbd_clt_unmap_device+0x1b0/0x1b0 [rnbd_client]
[1196029.743130]  close_rtrs+0x25/0x50 [rnbd_client]
[1196029.743131]  rnbd_client_exit+0x93/0xb99 [rnbd_client]
[1196029.743132]  __x64_sys_delete_module+0x190/0x260

And in the crashdump confirmation kworker is also running.
PID: 6943   TASK: ffff9e2ac8098000  CPU: 4   COMMAND: "kworker/4:2"
 #0 [ffffb206cf337c30] __schedule at ffffffff9f93f891
 #1 [ffffb206cf337cc8] schedule at ffffffff9f93fe98
 #2 [ffffb206cf337cd0] schedule_timeout at ffffffff9f943938
 #3 [ffffb206cf337d50] wait_for_completion at ffffffff9f9410a7
 #4 [ffffb206cf337da0] __flush_work at ffffffff9f08ce0e
 #5 [ffffb206cf337e20] rtrs_clt_close_conns at ffffffffc0d5f668 [rtrs_client]
 #6 [ffffb206cf337e48] rtrs_clt_close at ffffffffc0d5f801 [rtrs_client]
 #7 [ffffb206cf337e68] close_rtrs at ffffffffc0d26255 [rnbd_client]
 #8 [ffffb206cf337e78] free_sess at ffffffffc0d262ad [rnbd_client]
 #9 [ffffb206cf337e88] rnbd_clt_put_dev at ffffffffc0d266a7 [rnbd_client]

The problem is both code path try to close same session, which lead to
panic.

To fix it, just skip the sess if the refcount already drop to 0.

Fixes: f7a7a5c228d4 ("block/rnbd: client: main functionality")
Signed-off-by: Jack Wang &lt;jinpu.wang@cloud.ionos.com&gt;
Reviewed-by: Gioh Kim &lt;gi-oh.kim@cloud.ionos.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>block/rnbd-clt: Fix possible memleak</title>
<updated>2020-12-30T10:53:57+00:00</updated>
<author>
<name>Jack Wang</name>
<email>jinpu.wang@cloud.ionos.com</email>
</author>
<published>2020-12-10T10:18:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1b75aea3e360f5e660612b6c25a54cb16c313b23'/>
<id>urn:sha1:1b75aea3e360f5e660612b6c25a54cb16c313b23</id>
<content type='text'>
[ Upstream commit 46067844efdb8275ade705923120fc5391543b53 ]

In error case, we do not free the memory for blk_symlink_name.

Do it by free the memory in error case, and set to NULL
afterwards.

Also fix the condition in rnbd_clt_remove_dev_symlink.

Fixes: 64e8a6ece1a5 ("block/rnbd-clt: Dynamically alloc buffer for pathname &amp; blk_symlink_name")
Signed-off-by: Jack Wang &lt;jinpu.wang@cloud.ionos.com&gt;
Reviewed-by: Md Haris Iqbal &lt;haris.iqbal@cloud.ionos.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>block/rnbd-clt: Get rid of warning regarding size argument in strlcpy</title>
<updated>2020-12-30T10:53:57+00:00</updated>
<author>
<name>Md Haris Iqbal</name>
<email>haris.iqbal@cloud.ionos.com</email>
</author>
<published>2020-12-10T10:18:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=996ce53a2af75bf7d59e2515b475b7c7cc45d2b5'/>
<id>urn:sha1:996ce53a2af75bf7d59e2515b475b7c7cc45d2b5</id>
<content type='text'>
[ Upstream commit e7508d48565060af5d89f10cb83c9359c8ae1310 ]

The kernel test robot triggerred the following warning,

&gt;&gt; drivers/block/rnbd/rnbd-clt.c:1397:42: warning: size argument in
'strlcpy' call appears to be size of the source; expected the size of the
destination [-Wstrlcpy-strlcat-size]
	strlcpy(dev-&gt;pathname, pathname, strlen(pathname) + 1);
					      ~~~~~~~^~~~~~~~~~~~~

To get rid of the above warning, use a kstrdup as Bart suggested.

Fixes: 64e8a6ece1a5 ("block/rnbd-clt: Dynamically alloc buffer for pathname &amp; blk_symlink_name")
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: Md Haris Iqbal &lt;haris.iqbal@cloud.ionos.com&gt;
Signed-off-by: Jack Wang &lt;jinpu.wang@cloud.ionos.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>block/rnbd: fix a null pointer dereference on dev-&gt;blk_symlink_name</title>
<updated>2020-12-30T10:53:40+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2020-12-07T14:54:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=aa4f552aec3d43cc1455490825399d178da0a65f'/>
<id>urn:sha1:aa4f552aec3d43cc1455490825399d178da0a65f</id>
<content type='text'>
[ Upstream commit 733c15bd3a944b8eeaacdddf061759b6a83dd3f4 ]

Currently in the case where dev-&gt;blk_symlink_name fails to be allocates
the error return path attempts to set an end-of-string character to
the unallocated dev-&gt;blk_symlink_name causing a null pointer dereference
error. Fix this by returning with an explicity ENOMEM error (which also
is missing in the original code as was not initialized).

Fixes: 1eb54f8f5dd8 ("block/rnbd: client: sysfs interface functions")
Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Addresses-Coverity: ("Dereference after null check")
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>block/rnbd-clt: Dynamically alloc buffer for pathname &amp; blk_symlink_name</title>
<updated>2020-12-30T10:53:40+00:00</updated>
<author>
<name>Md Haris Iqbal</name>
<email>haris.iqbal@cloud.ionos.com</email>
</author>
<published>2020-11-26T10:47:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a7d4dd109eae096eb38cef8a50a9c86335420a98'/>
<id>urn:sha1:a7d4dd109eae096eb38cef8a50a9c86335420a98</id>
<content type='text'>
[ Upstream commit 64e8a6ece1a5b1fa21316918053d068baeac84af ]

For every rnbd_clt_dev, we alloc the pathname and blk_symlink_name
statically to NAME_MAX which is 255 bytes. In most of the cases we only
need less than 10 bytes, so 500 bytes per block device are wasted.

This commit dynamically allocates memory buffer for pathname and
blk_symlink_name.

Signed-off-by: Md Haris Iqbal &lt;haris.iqbal@cloud.ionos.com&gt;
Signed-off-by: Jack Wang &lt;jinpu.wang@cloud.ionos.com&gt;
Reviewed-by: Lutz Pogrell &lt;lutz.pogrell@cloud.ionos.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>block/rnbd-clt: send_msg_close if any error occurs after send_msg_open</title>
<updated>2020-10-13T21:05:05+00:00</updated>
<author>
<name>Gioh Kim</name>
<email>gi-oh.kim@cloud.ionos.com</email>
</author>
<published>2020-10-13T10:30:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=47be77c2f80412f903134a57caea25fa3fc5f578'/>
<id>urn:sha1:47be77c2f80412f903134a57caea25fa3fc5f578</id>
<content type='text'>
After send_msg_open is done, send_msg_close should be done
if any error occurs and it is necessary to recover
what has been done.

Signed-off-by: Gioh Kim &lt;gi-oh.kim@cloud.ionos.com&gt;
Signed-off-by: Jack Wang &lt;jinpu.wang@cloud.ionos.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block/rnbd-clt: do not cap max_hw_sectors &amp; max_segments with remote device</title>
<updated>2020-10-13T21:05:05+00:00</updated>
<author>
<name>Jack Wang</name>
<email>jinpu.wang@cloud.ionos.com</email>
</author>
<published>2020-10-13T10:30:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=050b654b2a70a978873bd5885a615c6a47c6205a'/>
<id>urn:sha1:050b654b2a70a978873bd5885a615c6a47c6205a</id>
<content type='text'>
The max_hw_secotrs is only limited by the transport, not remote device,
block layer on server side will split to the device limit if it's too
big.

The max_segments, similar, and rtrs server will submit single buffer, so
no need to cap.

Signed-off-by: Jack Wang &lt;jinpu.wang@cloud.ionos.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
</feed>
