lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <3f0b140f-5ee1-0ee1-6984-aed9de3d241a@linux.alibaba.com>
Date:   Thu, 23 Feb 2023 10:22:47 +0800
From:   Wen Gu <guwen@...ux.alibaba.com>
To:     Hillf Danton <hdanton@...a.com>
Cc:     kgraul@...ux.ibm.com, wenjia@...ux.ibm.com, jaka@...ux.ibm.com,
        edumazet@...gle.com, pabeni@...hat.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH net-next v3 9/9] net/smc: Add interface implementation
 of loopback device



On 2023/2/22 22:09, Hillf Danton wrote:

> On Thu, 16 Feb 2023 00:18:25 +0800 Wen Gu <guwen@...ux.alibaba.com>
>> @@ -124,12 +126,76 @@ static int smc_lo_unregister_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
>>   	write_unlock(&ldev->dmb_ht_lock);
>>   
>>   	clear_bit(dmb_node->sba_idx, ldev->sba_idx_mask);
>> +
>> +	/* wait for dmb refcnt to be 0 */
>> +	if (!refcount_dec_and_test(&dmb_node->refcnt))
>> +		wait_event(ldev->dmbs_release, !refcount_read(&dmb_node->refcnt));
> 
> Wait for zero refcnt with dmb node deleted from hash table.
> 
>>   	kfree(dmb_node->cpu_addr);
>>   	kfree(dmb_node);
>>   
>> +	if (atomic_dec_and_test(&ldev->dmb_cnt))
>> +		wake_up(&ldev->ldev_release);
>> +	return 0;
>> +}
> 
> [...]
> 
>> +static int smc_lo_detach_dmb(struct smcd_dev *smcd, u64 token)
>> +{
>> +	struct smc_lo_dmb_node *dmb_node = NULL, *tmp_node;
>> +	struct smc_lo_dev *ldev = smcd->priv;
>> +
>> +	/* find dmb_node according to dmb->dmb_tok */
>> +	read_lock(&ldev->dmb_ht_lock);
>> +	hash_for_each_possible(ldev->dmb_ht, tmp_node, list, token) {
>> +		if (tmp_node->token == token) {
>> +			dmb_node = tmp_node;
>> +			break;
>> +		}
>> +	}
>> +	if (!dmb_node) {
>> +		read_unlock(&ldev->dmb_ht_lock);
>> +		return -EINVAL;
>> +	}
>> +	read_unlock(&ldev->dmb_ht_lock);
>> +
>> +	if (refcount_dec_and_test(&dmb_node->refcnt))
>> +		wake_up_all(&ldev->dmbs_release);
>>   	return 0;
>>   }
> 
> Given no wakeup without finding dmb node in hash table, the chance for
> missing wakeup is not zero.

Good catch! Will fix it.

Thanks,
Wen Gu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ