Re: [PATCH net 1/3] net/smc: Resolve the race between link group access and termination

From: Wen Gu
Date: Mon Jan 10 2022 - 08:56:12 EST




On 2022/1/10 8:25 pm, Karsten Graul wrote:
On 10/01/2022 10:26, Wen Gu wrote:
We encountered some crashes caused by the race between the access
and the termination of link groups.


@@ -1120,8 +1122,22 @@ void smc_conn_free(struct smc_connection *conn)
{
struct smc_link_group *lgr = conn->lgr;
- if (!lgr)
+ if (!lgr || conn->freed)
+ /* The connection has never been registered in a
+ * link group, or has already been freed.
+ *
+ * Check to ensure that the refcnt of link group
+ * won't be put incorrectly.

I would delete the second sentence here, its obvious enough.

+ */
return;
+
+ conn->freed = 1;
+ if (!conn->alert_token_local)
+ /* The connection was registered in a link group
+ * defore, but now it is unregistered from it.

'before' ... But would maybe the following be more exact:

'Connection already unregistered from link group.'


We still review the patches...


Thanks for your detailed and patient review. The comments will
be improved as you suggested.

Thanks,
Wen Gu