* [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info()
@ 2018-03-11 21:07 Salvatore Mesoraca
2018-03-11 21:07 ` [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info() Salvatore Mesoraca
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Salvatore Mesoraca @ 2018-03-11 21:07 UTC (permalink / raw)
To: linux-kernel
Cc: kernel-hardening, linux-rdma, netdev, David S. Miller, Kees Cook,
Salvatore Mesoraca, Santosh Shilimkar
Avoid VLA[1] by using an already allocated buffer passed
by the caller.
[1] https://lkml.org/lkml/2018/3/7/621
Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com>
---
net/rds/connection.c | 2 +-
net/rds/ib.c | 3 +++
net/rds/rds.h | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/rds/connection.c b/net/rds/connection.c
index 2da3176..f80792c 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -540,9 +540,9 @@ void rds_for_each_conn_info(struct socket *sock, unsigned int len,
struct rds_info_iterator *iter,
struct rds_info_lengths *lens,
int (*visitor)(struct rds_connection *, void *),
+ u64 *buffer,
size_t item_len)
{
- uint64_t buffer[(item_len + 7) / 8];
struct hlist_head *head;
struct rds_connection *conn;
size_t i;
diff --git a/net/rds/ib.c b/net/rds/ib.c
index 50a88f3..02deee2 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -321,8 +321,11 @@ static void rds_ib_ic_info(struct socket *sock, unsigned int len,
struct rds_info_iterator *iter,
struct rds_info_lengths *lens)
{
+ u64 buffer[(sizeof(struct rds_info_rdma_connection) + 7) / 8];
+
rds_for_each_conn_info(sock, len, iter, lens,
rds_ib_conn_info_visitor,
+ buffer,
sizeof(struct rds_info_rdma_connection));
}
diff --git a/net/rds/rds.h b/net/rds/rds.h
index 7301b9b..91ea08f 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -709,6 +709,7 @@ void rds_for_each_conn_info(struct socket *sock, unsigned int len,
struct rds_info_iterator *iter,
struct rds_info_lengths *lens,
int (*visitor)(struct rds_connection *, void *),
+ u64 *buffer,
size_t item_len);
__printf(2, 3)
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info()
2018-03-11 21:07 [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info() Salvatore Mesoraca
@ 2018-03-11 21:07 ` Salvatore Mesoraca
2018-03-12 7:06 ` santosh.shilimkar
2018-03-12 19:08 ` David Miller
2018-03-12 7:06 ` [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info() santosh.shilimkar
2018-03-12 19:07 ` David Miller
2 siblings, 2 replies; 7+ messages in thread
From: Salvatore Mesoraca @ 2018-03-11 21:07 UTC (permalink / raw)
To: linux-kernel
Cc: kernel-hardening, linux-rdma, netdev, David S. Miller, Kees Cook,
Salvatore Mesoraca, Santosh Shilimkar
Avoid VLA[1] by using an already allocated buffer passed
by the caller.
[1] https://lkml.org/lkml/2018/3/7/621
Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com>
---
net/rds/connection.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/rds/connection.c b/net/rds/connection.c
index f80792c..abef75d 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -578,9 +578,9 @@ static void rds_walk_conn_path_info(struct socket *sock, unsigned int len,
struct rds_info_iterator *iter,
struct rds_info_lengths *lens,
int (*visitor)(struct rds_conn_path *, void *),
+ u64 *buffer,
size_t item_len)
{
- u64 buffer[(item_len + 7) / 8];
struct hlist_head *head;
struct rds_connection *conn;
size_t i;
@@ -649,8 +649,11 @@ static void rds_conn_info(struct socket *sock, unsigned int len,
struct rds_info_iterator *iter,
struct rds_info_lengths *lens)
{
+ u64 buffer[(sizeof(struct rds_info_connection) + 7) / 8];
+
rds_walk_conn_path_info(sock, len, iter, lens,
rds_conn_info_visitor,
+ buffer,
sizeof(struct rds_info_connection));
}
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info()
2018-03-11 21:07 [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info() Salvatore Mesoraca
2018-03-11 21:07 ` [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info() Salvatore Mesoraca
@ 2018-03-12 7:06 ` santosh.shilimkar
2018-03-12 10:12 ` Salvatore Mesoraca
2018-03-12 19:07 ` David Miller
2 siblings, 1 reply; 7+ messages in thread
From: santosh.shilimkar @ 2018-03-12 7:06 UTC (permalink / raw)
To: Salvatore Mesoraca, linux-kernel
Cc: kernel-hardening, linux-rdma, netdev, David S. Miller, Kees Cook
On 3/11/18 2:07 PM, Salvatore Mesoraca wrote:
> Avoid VLA[1] by using an already allocated buffer passed
> by the caller.
>
> [1] https://lkml.org/lkml/2018/3/7/621
>
> Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com>
> ---
Thanks for both VLA fixes Salvatore.
FWIW, Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info()
2018-03-11 21:07 ` [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info() Salvatore Mesoraca
@ 2018-03-12 7:06 ` santosh.shilimkar
2018-03-12 19:08 ` David Miller
1 sibling, 0 replies; 7+ messages in thread
From: santosh.shilimkar @ 2018-03-12 7:06 UTC (permalink / raw)
To: Salvatore Mesoraca, linux-kernel
Cc: kernel-hardening, linux-rdma, netdev, David S. Miller, Kees Cook
On 3/11/18 2:07 PM, Salvatore Mesoraca wrote:
> Avoid VLA[1] by using an already allocated buffer passed
> by the caller.
>
> [1] https://lkml.org/lkml/2018/3/7/621
>
> Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com>
> ---
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info()
2018-03-12 7:06 ` [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info() santosh.shilimkar
@ 2018-03-12 10:12 ` Salvatore Mesoraca
0 siblings, 0 replies; 7+ messages in thread
From: Salvatore Mesoraca @ 2018-03-12 10:12 UTC (permalink / raw)
To: santosh.shilimkar@oracle.com
Cc: linux-kernel, Kernel Hardening, linux-rdma, netdev,
David S. Miller, Kees Cook
2018-03-12 8:06 GMT+01:00 santosh.shilimkar@oracle.com
<santosh.shilimkar@oracle.com>:
> On 3/11/18 2:07 PM, Salvatore Mesoraca wrote:
>>
>> Avoid VLA[1] by using an already allocated buffer passed
>> by the caller.
>>
>> [1] https://lkml.org/lkml/2018/3/7/621
>>
>> Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com>
>> ---
>
> Thanks for both VLA fixes Salvatore.
>
> FWIW, Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Thank you very much for your time,
Salvatore
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info()
2018-03-11 21:07 [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info() Salvatore Mesoraca
2018-03-11 21:07 ` [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info() Salvatore Mesoraca
2018-03-12 7:06 ` [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info() santosh.shilimkar
@ 2018-03-12 19:07 ` David Miller
2 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2018-03-12 19:07 UTC (permalink / raw)
To: s.mesoraca16
Cc: linux-kernel, kernel-hardening, linux-rdma, netdev, keescook,
santosh.shilimkar
From: Salvatore Mesoraca <s.mesoraca16@gmail.com>
Date: Sun, 11 Mar 2018 22:07:49 +0100
> Avoid VLA[1] by using an already allocated buffer passed
> by the caller.
>
> [1] https://lkml.org/lkml/2018/3/7/621
>
> Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info()
2018-03-11 21:07 ` [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info() Salvatore Mesoraca
2018-03-12 7:06 ` santosh.shilimkar
@ 2018-03-12 19:08 ` David Miller
1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2018-03-12 19:08 UTC (permalink / raw)
To: s.mesoraca16
Cc: linux-kernel, kernel-hardening, linux-rdma, netdev, keescook,
santosh.shilimkar
From: Salvatore Mesoraca <s.mesoraca16@gmail.com>
Date: Sun, 11 Mar 2018 22:07:50 +0100
> Avoid VLA[1] by using an already allocated buffer passed
> by the caller.
>
> [1] https://lkml.org/lkml/2018/3/7/621
>
> Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com>
Also applied, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-03-12 19:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-11 21:07 [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info() Salvatore Mesoraca
2018-03-11 21:07 ` [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info() Salvatore Mesoraca
2018-03-12 7:06 ` santosh.shilimkar
2018-03-12 19:08 ` David Miller
2018-03-12 7:06 ` [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info() santosh.shilimkar
2018-03-12 10:12 ` Salvatore Mesoraca
2018-03-12 19:07 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).