<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/net/rds/message.c, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/net/rds/message.c?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/net/rds/message.c?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2021-04-24T16:32:35Z</updated>
<entry>
<title>Revert "net/rds: Avoid potential use after free in rds_send_remove_from_sock"</title>
<updated>2021-04-24T16:32:35Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2021-04-24T16:32:35Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=799bac5512188522213e2d7eb78ca7094dfdf30c'/>
<id>urn:sha1:799bac5512188522213e2d7eb78ca7094dfdf30c</id>
<content type='text'>
This reverts commit 0c85a7e87465f2d4cbc768e245f4f45b2f299b05.

The games with 'rm' are on (two separate instances) of a local variable,
and make no difference.

Quoting Aditya Pakki:
 "I was the author of the patch and it was the cause of the giant UMN
  revert.

  The patch is garbage and I was unaware of the steps involved in
  retracting it. I *believed* the maintainers would pull it, given it
  was already under Greg's list. The patch does not introduce any bugs
  but is pointless and is stupid. I accept my incompetence and for not
  requesting a revert earlier."

Link: https://lwn.net/Articles/854319/
Requested-by: Aditya Pakki &lt;pakki001@umn.edu&gt;
Cc: Santosh Shilimkar &lt;santosh.shilimkar@oracle.com&gt;
Cc: David S. Miller &lt;davem@davemloft.net&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>net/rds: Avoid potential use after free in rds_send_remove_from_sock</title>
<updated>2021-04-07T21:01:24Z</updated>
<author>
<name>Aditya Pakki</name>
<email>pakki001@umn.edu</email>
</author>
<published>2021-04-07T00:09:12Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=0c85a7e87465f2d4cbc768e245f4f45b2f299b05'/>
<id>urn:sha1:0c85a7e87465f2d4cbc768e245f4f45b2f299b05</id>
<content type='text'>
In case of rs failure in rds_send_remove_from_sock(), the 'rm' resource
is freed and later under spinlock, causing potential use-after-free.
Set the free pointer to NULL to avoid undefined behavior.

Signed-off-by: Aditya Pakki &lt;pakki001@umn.edu&gt;
Acked-by: Santosh Shilimkar &lt;santosh.shilimkar@oracle.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/rds: Fix a use after free in rds_message_map_pages</title>
<updated>2021-03-31T21:26:56Z</updated>
<author>
<name>Lv Yunlong</name>
<email>lyl2019@mail.ustc.edu.cn</email>
</author>
<published>2021-03-31T01:59:59Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=bdc2ab5c61a5c07388f4820ff21e787b4dfd1ced'/>
<id>urn:sha1:bdc2ab5c61a5c07388f4820ff21e787b4dfd1ced</id>
<content type='text'>
In rds_message_map_pages, the rm is freed by rds_message_put(rm).
But rm is still used by rm-&gt;data.op_sg in return value.

My patch assigns ERR_CAST(rm-&gt;data.op_sg) to err before the rm is
freed to avoid the uaf.

Fixes: 7dba92037baf3 ("net/rds: Use ERR_PTR for rds_message_alloc_sgs()")
Signed-off-by: Lv Yunlong &lt;lyl2019@mail.ustc.edu.cn&gt;
Reviewed-by: Håkon Bugge &lt;haakon.bugge@oracle.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/rds: Use ERR_PTR for rds_message_alloc_sgs()</title>
<updated>2020-04-15T19:33:29Z</updated>
<author>
<name>Jason Gunthorpe</name>
<email>jgg@mellanox.com</email>
</author>
<published>2020-04-14T23:02:07Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=7dba92037baf3fa00b4880a31fd532542264994c'/>
<id>urn:sha1:7dba92037baf3fa00b4880a31fd532542264994c</id>
<content type='text'>
Returning the error code via a 'int *ret' when the function returns a
pointer is very un-kernely and causes gcc 10's static analysis to choke:

net/rds/message.c: In function ‘rds_message_map_pages’:
net/rds/message.c:358:10: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  358 |   return ERR_PTR(ret);

Use a typical ERR_PTR return instead.

Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
Acked-by: Santosh Shilimkar &lt;santosh.shilimkar@oracle.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/rds: Replace struct rds_mr's r_refcount with struct kref</title>
<updated>2020-04-09T17:22:00Z</updated>
<author>
<name>Ka-Cheong Poon</name>
<email>ka-cheong.poon@oracle.com</email>
</author>
<published>2020-04-08T10:21:01Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=e228a5d05e9ee25878e9a40de96e7ceb579d4893'/>
<id>urn:sha1:e228a5d05e9ee25878e9a40de96e7ceb579d4893</id>
<content type='text'>
And removed rds_mr_put().

Signed-off-by: Ka-Cheong Poon &lt;ka-cheong.poon@oracle.com&gt;
Acked-by: Santosh Shilimkar &lt;santosh.shilimkar@oracle.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rds: use DIV_ROUND_UP instead of ceil</title>
<updated>2019-01-07T15:22:36Z</updated>
<author>
<name>Jacob Wen</name>
<email>jian.w.wen@oracle.com</email>
</author>
<published>2019-01-07T01:59:59Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=eeb2c4fb6a3d0ebed35fbc13a255f691c8b8d7e5'/>
<id>urn:sha1:eeb2c4fb6a3d0ebed35fbc13a255f691c8b8d7e5</id>
<content type='text'>
Yes indeed, DIV_ROUND_UP is in kernel.h.

Signed-off-by: Jacob Wen &lt;jian.w.wen@oracle.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/rds: remove user triggered WARN_ON in rds_sendmsg</title>
<updated>2018-12-19T18:27:58Z</updated>
<author>
<name>shamir rabinovitch</name>
<email>shamir.rabinovitch@oracle.com</email>
</author>
<published>2018-12-16T07:01:09Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=c75ab8a55ac1083c232e4407f52b0cadae6c1e0e'/>
<id>urn:sha1:c75ab8a55ac1083c232e4407f52b0cadae6c1e0e</id>
<content type='text'>
per comment from Leon in rdma mailing list
https://lkml.org/lkml/2018/10/31/312 :

Please don't forget to remove user triggered WARN_ON.
https://lwn.net/Articles/769365/
"Greg Kroah-Hartman raised the problem of core kernel API code that will
use WARN_ON_ONCE() to complain about bad usage; that will not generate
the desired result if WARN_ON_ONCE() is configured to crash the machine.
He was told that the code should just call pr_warn() instead, and that
the called function should return an error in such situations. It was
generally agreed that any WARN_ON() or WARN_ON_ONCE() calls that can be
triggered from user space need to be fixed."

in addition harden rds_sendmsg to detect and overcome issues with
invalid sg count and fail the sendmsg.

Suggested-by: Leon Romanovsky &lt;leon@kernel.org&gt;
Acked-by: Santosh Shilimkar &lt;santosh.shilimkar@oracle.com&gt;
Signed-off-by: shamir rabinovitch &lt;shamir.rabinovitch@oracle.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rds: remove trailing whitespace and blank lines</title>
<updated>2018-07-24T21:10:42Z</updated>
<author>
<name>Stephen Hemminger</name>
<email>stephen@networkplumber.org</email>
</author>
<published>2018-07-24T19:29:03Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=1cb1d977b41ad9fbcbd57ba24b203d6cb2f79952'/>
<id>urn:sha1:1cb1d977b41ad9fbcbd57ba24b203d6cb2f79952</id>
<content type='text'>
Signed-off-by: Stephen Hemminger &lt;stephen@networkplumber.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rds: remove redundant variable 'sg_off'</title>
<updated>2018-03-12T15:12:38Z</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2018-03-11T16:27:56Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=bdf08fc5412045f7648a49791d98cd04f72c1c1f'/>
<id>urn:sha1:bdf08fc5412045f7648a49791d98cd04f72c1c1f</id>
<content type='text'>
Variable sg_off is assigned a value but it is never read, hence it is
redundant and can be removed.

Cleans up clang warning:
net/rds/message.c:373:2: warning: Value stored to 'sg_off' is never read

Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Acked-by: Sowmini Varadhan &lt;sowmini.varadhan@oracle.com&gt;
Acked-by: Santosh Shilimkar &lt;santosh.shilimkar@oracle.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rds: rds_info_from_znotifier() can be static</title>
<updated>2018-03-09T02:54:00Z</updated>
<author>
<name>kbuild test robot</name>
<email>fengguang.wu@intel.com</email>
</author>
<published>2018-03-08T11:37:30Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=571e6776add4f499661e761e03e46ec0f6d66243'/>
<id>urn:sha1:571e6776add4f499661e761e03e46ec0f6d66243</id>
<content type='text'>
Fixes: 9426bbc6de99 ("rds: use list structure to track information for zerocopy completion notification")
Signed-off-by: Fengguang Wu &lt;fengguang.wu@intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
