netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/rds: Check laddr_check before calling it
@ 2019-09-17 15:29 Ka-Cheong Poon
  2019-09-17 15:31 ` santosh.shilimkar
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Ka-Cheong Poon @ 2019-09-17 15:29 UTC (permalink / raw)
  To: netdev; +Cc: santosh.shilimkar, davem, rds-devel

In rds_bind(), laddr_check is called without checking if it is NULL or
not.  And rs_transport should be reset if rds_add_bound() fails.

Reported-by: syzbot+fae39afd2101a17ec624@syzkaller.appspotmail.com
Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
---
 net/rds/bind.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/rds/bind.c b/net/rds/bind.c
index 20c156a..5b5fb4c 100644
--- a/net/rds/bind.c
+++ b/net/rds/bind.c
@@ -244,7 +244,8 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 	 */
 	if (rs->rs_transport) {
 		trans = rs->rs_transport;
-		if (trans->laddr_check(sock_net(sock->sk),
+		if (!trans->laddr_check ||
+		    trans->laddr_check(sock_net(sock->sk),
 				       binding_addr, scope_id) != 0) {
 			ret = -ENOPROTOOPT;
 			goto out;
@@ -263,6 +264,8 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 
 	sock_set_flag(sk, SOCK_RCU_FREE);
 	ret = rds_add_bound(rs, binding_addr, &port, scope_id);
+	if (ret)
+		rs->rs_transport = NULL;
 
 out:
 	release_sock(sk);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net] net/rds: Check laddr_check before calling it
  2019-09-17 15:29 [PATCH net] net/rds: Check laddr_check before calling it Ka-Cheong Poon
@ 2019-09-17 15:31 ` santosh.shilimkar
  2019-09-21  1:09 ` Jakub Kicinski
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: santosh.shilimkar @ 2019-09-17 15:31 UTC (permalink / raw)
  To: Ka-Cheong Poon; +Cc: netdev, davem, rds-devel

On 9/17/19 8:29 AM, Ka-Cheong Poon wrote:
> In rds_bind(), laddr_check is called without checking if it is NULL or
> not.  And rs_transport should be reset if rds_add_bound() fails.
> 
> Reported-by: syzbot+fae39afd2101a17ec624@syzkaller.appspotmail.com
> Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
> ---
Thanks Ka-Cheong for getting this out quickly on list.

Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net] net/rds: Check laddr_check before calling it
  2019-09-17 15:29 [PATCH net] net/rds: Check laddr_check before calling it Ka-Cheong Poon
  2019-09-17 15:31 ` santosh.shilimkar
@ 2019-09-21  1:09 ` Jakub Kicinski
  2019-09-24 15:58   ` Ka-Cheong Poon
  2019-09-23  8:52 ` David Miller
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2019-09-21  1:09 UTC (permalink / raw)
  To: Ka-Cheong Poon; +Cc: netdev, santosh.shilimkar, davem, rds-devel

On Tue, 17 Sep 2019 08:29:18 -0700, Ka-Cheong Poon wrote:
> In rds_bind(), laddr_check is called without checking if it is NULL or
> not.  And rs_transport should be reset if rds_add_bound() fails.
> 
> Reported-by: syzbot+fae39afd2101a17ec624@syzkaller.appspotmail.com
> Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>

Looks good, but could you please provide a fixes tag? 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net] net/rds: Check laddr_check before calling it
  2019-09-17 15:29 [PATCH net] net/rds: Check laddr_check before calling it Ka-Cheong Poon
  2019-09-17 15:31 ` santosh.shilimkar
  2019-09-21  1:09 ` Jakub Kicinski
@ 2019-09-23  8:52 ` David Miller
  2019-09-24 15:27 ` [PATCH net-next] " Ka-Cheong Poon
  2019-09-24 15:51 ` [PATCH net] " Ka-Cheong Poon
  4 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2019-09-23  8:52 UTC (permalink / raw)
  To: ka-cheong.poon; +Cc: netdev, santosh.shilimkar, rds-devel

From: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Date: Tue, 17 Sep 2019 08:29:18 -0700

> In rds_bind(), laddr_check is called without checking if it is NULL or
> not.  And rs_transport should be reset if rds_add_bound() fails.
> 
> Reported-by: syzbot+fae39afd2101a17ec624@syzkaller.appspotmail.com
> Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>

Please resubmit with an appropriate Fixes: tag.

Thank you.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net-next] net/rds: Check laddr_check before calling it
  2019-09-17 15:29 [PATCH net] net/rds: Check laddr_check before calling it Ka-Cheong Poon
                   ` (2 preceding siblings ...)
  2019-09-23  8:52 ` David Miller
@ 2019-09-24 15:27 ` Ka-Cheong Poon
  2019-09-24 15:43   ` Ka-Cheong Poon
  2019-09-24 15:51 ` [PATCH net] " Ka-Cheong Poon
  4 siblings, 1 reply; 9+ messages in thread
From: Ka-Cheong Poon @ 2019-09-24 15:27 UTC (permalink / raw)
  To: netdev; +Cc: santosh.shilimkar, davem, rds-devel

In rds_bind(), laddr_check is called without checking if it is NULL or
not.  And rs_transport should be reset if rds_add_bound() fails.

Fixes: c5c1a030a7db ("net/rds: Check laddr_check before calling it")
Reported-by: syzbot+fae39afd2101a17ec624@syzkaller.appspotmail.com
Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
---
 net/rds/bind.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/rds/bind.c b/net/rds/bind.c
index 20c156a..5b5fb4c 100644
--- a/net/rds/bind.c
+++ b/net/rds/bind.c
@@ -244,7 +244,8 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 	 */
 	if (rs->rs_transport) {
 		trans = rs->rs_transport;
-		if (trans->laddr_check(sock_net(sock->sk),
+		if (!trans->laddr_check ||
+		    trans->laddr_check(sock_net(sock->sk),
 				       binding_addr, scope_id) != 0) {
 			ret = -ENOPROTOOPT;
 			goto out;
@@ -263,6 +264,8 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 
 	sock_set_flag(sk, SOCK_RCU_FREE);
 	ret = rds_add_bound(rs, binding_addr, &port, scope_id);
+	if (ret)
+		rs->rs_transport = NULL;
 
 out:
 	release_sock(sk);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] net/rds: Check laddr_check before calling it
  2019-09-24 15:27 ` [PATCH net-next] " Ka-Cheong Poon
@ 2019-09-24 15:43   ` Ka-Cheong Poon
  0 siblings, 0 replies; 9+ messages in thread
From: Ka-Cheong Poon @ 2019-09-24 15:43 UTC (permalink / raw)
  To: netdev; +Cc: santosh.shilimkar, davem, rds-devel

On 9/24/19 11:27 PM, Ka-Cheong Poon wrote:
> In rds_bind(), laddr_check is called without checking if it is NULL or
> not.  And rs_transport should be reset if rds_add_bound() fails.
> 
> Fixes: c5c1a030a7db ("net/rds: Check laddr_check before calling it")


Oops, wrong Subject.  Will re-submit.  Sorry about that.


> Reported-by: syzbot+fae39afd2101a17ec624@syzkaller.appspotmail.com
> Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
> ---
>   net/rds/bind.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/net/rds/bind.c b/net/rds/bind.c
> index 20c156a..5b5fb4c 100644
> --- a/net/rds/bind.c
> +++ b/net/rds/bind.c
> @@ -244,7 +244,8 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
>   	 */
>   	if (rs->rs_transport) {
>   		trans = rs->rs_transport;
> -		if (trans->laddr_check(sock_net(sock->sk),
> +		if (!trans->laddr_check ||
> +		    trans->laddr_check(sock_net(sock->sk),
>   				       binding_addr, scope_id) != 0) {
>   			ret = -ENOPROTOOPT;
>   			goto out;
> @@ -263,6 +264,8 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
>   
>   	sock_set_flag(sk, SOCK_RCU_FREE);
>   	ret = rds_add_bound(rs, binding_addr, &port, scope_id);
> +	if (ret)
> +		rs->rs_transport = NULL;
>   
>   out:
>   	release_sock(sk);
> 


-- 
K. Poon
ka-cheong.poon@oracle.com



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net] net/rds: Check laddr_check before calling it
  2019-09-17 15:29 [PATCH net] net/rds: Check laddr_check before calling it Ka-Cheong Poon
                   ` (3 preceding siblings ...)
  2019-09-24 15:27 ` [PATCH net-next] " Ka-Cheong Poon
@ 2019-09-24 15:51 ` Ka-Cheong Poon
  2019-09-27 10:12   ` David Miller
  4 siblings, 1 reply; 9+ messages in thread
From: Ka-Cheong Poon @ 2019-09-24 15:51 UTC (permalink / raw)
  To: netdev; +Cc: santosh.shilimkar, davem, rds-devel

In rds_bind(), laddr_check is called without checking if it is NULL or
not.  And rs_transport should be reset if rds_add_bound() fails.

Fixes: c5c1a030a7db ("net/rds: An rds_sock is added too early to the hash table")
Reported-by: syzbot+fae39afd2101a17ec624@syzkaller.appspotmail.com
Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
---
 net/rds/bind.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/rds/bind.c b/net/rds/bind.c
index 20c156a..5b5fb4c 100644
--- a/net/rds/bind.c
+++ b/net/rds/bind.c
@@ -244,7 +244,8 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 	 */
 	if (rs->rs_transport) {
 		trans = rs->rs_transport;
-		if (trans->laddr_check(sock_net(sock->sk),
+		if (!trans->laddr_check ||
+		    trans->laddr_check(sock_net(sock->sk),
 				       binding_addr, scope_id) != 0) {
 			ret = -ENOPROTOOPT;
 			goto out;
@@ -263,6 +264,8 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 
 	sock_set_flag(sk, SOCK_RCU_FREE);
 	ret = rds_add_bound(rs, binding_addr, &port, scope_id);
+	if (ret)
+		rs->rs_transport = NULL;
 
 out:
 	release_sock(sk);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net] net/rds: Check laddr_check before calling it
  2019-09-21  1:09 ` Jakub Kicinski
@ 2019-09-24 15:58   ` Ka-Cheong Poon
  0 siblings, 0 replies; 9+ messages in thread
From: Ka-Cheong Poon @ 2019-09-24 15:58 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, santosh.shilimkar, davem, rds-devel

On 9/21/19 9:09 AM, Jakub Kicinski wrote:
> On Tue, 17 Sep 2019 08:29:18 -0700, Ka-Cheong Poon wrote:
>> In rds_bind(), laddr_check is called without checking if it is NULL or
>> not.  And rs_transport should be reset if rds_add_bound() fails.
>>
>> Reported-by: syzbot+fae39afd2101a17ec624@syzkaller.appspotmail.com
>> Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
> 
> Looks good, but could you please provide a fixes tag?


Done.  Thanks.


-- 
K. Poon
ka-cheong.poon@oracle.com



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net] net/rds: Check laddr_check before calling it
  2019-09-24 15:51 ` [PATCH net] " Ka-Cheong Poon
@ 2019-09-27 10:12   ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2019-09-27 10:12 UTC (permalink / raw)
  To: ka-cheong.poon; +Cc: netdev, santosh.shilimkar, rds-devel

From: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Date: Tue, 24 Sep 2019 08:51:16 -0700

> In rds_bind(), laddr_check is called without checking if it is NULL or
> not.  And rs_transport should be reset if rds_add_bound() fails.
> 
> Fixes: c5c1a030a7db ("net/rds: An rds_sock is added too early to the hash table")
> Reported-by: syzbot+fae39afd2101a17ec624@syzkaller.appspotmail.com
> Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>

Applied and queued up for v5.3 -stable.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-09-27 10:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-17 15:29 [PATCH net] net/rds: Check laddr_check before calling it Ka-Cheong Poon
2019-09-17 15:31 ` santosh.shilimkar
2019-09-21  1:09 ` Jakub Kicinski
2019-09-24 15:58   ` Ka-Cheong Poon
2019-09-23  8:52 ` David Miller
2019-09-24 15:27 ` [PATCH net-next] " Ka-Cheong Poon
2019-09-24 15:43   ` Ka-Cheong Poon
2019-09-24 15:51 ` [PATCH net] " Ka-Cheong Poon
2019-09-27 10:12   ` 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).