All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/1] net/smc: fix 2020-09-15
@ 2020-09-15 20:57 Karsten Graul
  2020-09-15 20:57 ` [PATCH net-next 1/1] net/smc: check variable before dereferencing in smc_close.c Karsten Graul
  0 siblings, 1 reply; 3+ messages in thread
From: Karsten Graul @ 2020-09-15 20:57 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

Please apply the following patch for smc to netdev's net-next tree.

The patch fixes a problem that was revealed by a smatch warning. Because the
fixed patch is still only in net-next tree I am sending this fix to net-next.

Karsten Graul (1):
  net/smc: check variable before dereferencing in smc_close.c

 net/smc/smc_close.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

-- 
2.17.1


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

* [PATCH net-next 1/1] net/smc: check variable before dereferencing in smc_close.c
  2020-09-15 20:57 [PATCH net-next 0/1] net/smc: fix 2020-09-15 Karsten Graul
@ 2020-09-15 20:57 ` Karsten Graul
  2020-09-17  0:34   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Karsten Graul @ 2020-09-15 20:57 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

smc->clcsock and smc->clcsock->sk are used before the check if they can
be dereferenced. Fix this by checking the variables first.

Fixes: a60a2b1e0af1 ("net/smc: reduce active tcp_listen workers")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
---
 net/smc/smc_close.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c
index 10d05a6d34fc..0f9ffba07d26 100644
--- a/net/smc/smc_close.c
+++ b/net/smc/smc_close.c
@@ -208,11 +208,12 @@ int smc_close_active(struct smc_sock *smc)
 		break;
 	case SMC_LISTEN:
 		sk->sk_state = SMC_CLOSED;
-		smc->clcsock->sk->sk_data_ready = smc->clcsk_data_ready;
-		smc->clcsock->sk->sk_user_data = NULL;
 		sk->sk_state_change(sk); /* wake up accept */
-		if (smc->clcsock && smc->clcsock->sk)
+		if (smc->clcsock && smc->clcsock->sk) {
+			smc->clcsock->sk->sk_data_ready = smc->clcsk_data_ready;
+			smc->clcsock->sk->sk_user_data = NULL;
 			rc = kernel_sock_shutdown(smc->clcsock, SHUT_RDWR);
+		}
 		smc_close_cleanup_listen(sk);
 		release_sock(sk);
 		flush_work(&smc->tcp_listen_work);
-- 
2.17.1


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

* Re: [PATCH net-next 1/1] net/smc: check variable before dereferencing in smc_close.c
  2020-09-15 20:57 ` [PATCH net-next 1/1] net/smc: check variable before dereferencing in smc_close.c Karsten Graul
@ 2020-09-17  0:34   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2020-09-17  0:34 UTC (permalink / raw)
  To: kgraul; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

From: Karsten Graul <kgraul@linux.ibm.com>
Date: Tue, 15 Sep 2020 22:57:09 +0200

> smc->clcsock and smc->clcsock->sk are used before the check if they can
> be dereferenced. Fix this by checking the variables first.
> 
> Fixes: a60a2b1e0af1 ("net/smc: reduce active tcp_listen workers")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>

Applied, thank you.

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

end of thread, other threads:[~2020-09-17  0:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15 20:57 [PATCH net-next 0/1] net/smc: fix 2020-09-15 Karsten Graul
2020-09-15 20:57 ` [PATCH net-next 1/1] net/smc: check variable before dereferencing in smc_close.c Karsten Graul
2020-09-17  0:34   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.