Subject: linux-next: build failure after merge of the net-next tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 21 Feb 2023 12:40:08 +1100

Hi all,

After merging the net-next tree, today's linux-next build (x86_64
allmodconfig) failed like this:

In file included from include/linux/notifier.h:14,
                 from arch/x86/include/asm/uprobes.h:13,
                 from include/linux/uprobes.h:49,
                 from include/linux/mm_types.h:16,
                 from include/linux/buildid.h:5,
                 from include/linux/module.h:14,
                 from net/smc/af_smc.c:22:
net/smc/af_smc.c: In function 'smcr_serv_conf_first_link':
net/smc/af_smc.c:1842:20: error: passing argument 1 of 'mutex_lock_nested' from incompatible pointer type [-Werror=incompatible-pointer-types]
 1842 |         mutex_lock(&link->lgr->llc_conf_mutex);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                    |
      |                    struct rw_semaphore *
include/linux/mutex.h:187:44: note: in definition of macro 'mutex_lock'
  187 | #define mutex_lock(lock) mutex_lock_nested(lock, 0)
      |                                            ^~~~
include/linux/mutex.h:178:45: note: expected 'struct mutex *' but argument is of type 'struct rw_semaphore *'
  178 | extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
      |                               ~~~~~~~~~~~~~~^~~~
net/smc/af_smc.c:1845:22: error: passing argument 1 of 'mutex_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
 1845 |         mutex_unlock(&link->lgr->llc_conf_mutex);
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                      |
      |                      struct rw_semaphore *
include/linux/mutex.h:218:40: note: expected 'struct mutex *' but argument is of type 'struct rw_semaphore *'
  218 | extern void mutex_unlock(struct mutex *lock);
      |                          ~~~~~~~~~~~~~~^~~~

Caused by commit

  b5dd4d698171 ("net/smc: llc_conf_mutex refactor, replace it with rw_semaphore")

interacting with commit

  e40b801b3603 ("net/smc: fix potential panic dues to unprotected smc_llc_srv_add_link()")

from the net tree.

I applied the following merge resolution patch.

From: Stephen Rothwell <[email-masked]>
Date: Tue, 21 Feb 2023 12:30:46 +1100
Subject: [PATCH] fix up for "net/smc: llc_conf_mutex refactor, replace it with rw_semaphore"

interacting with "net/smc: fix potential panic dues to unprotected smc_llc_srv_add_link()"

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 net/smc/af_smc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 0f6a61e44e93..a4cccdfdc00a 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1839,10 +1839,10 @@ static int smcr_serv_conf_first_link(struct smc_sock *smc)
 	smc_llc_link_active(link);
 	smcr_lgr_set_type(link->lgr, SMC_LGR_SINGLE);
 
-	mutex_lock(&link->lgr->llc_conf_mutex);
+	down_write(&link->lgr->llc_conf_mutex);
 	/* initial contact - try to establish second link */
 	smc_llc_srv_add_link(link, NULL);
-	mutex_unlock(&link->lgr->llc_conf_mutex);
+	up_write(&link->lgr->llc_conf_mutex);
 	return 0;
 }
 
-- 
2.39.1

-- 
Cheers,
Stephen Rothwell