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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 12 Jan 2022 16:16:58 +0800
From:   Wen Gu <guwen@...ux.alibaba.com>
To:     dust.li@...ux.alibaba.com, kgraul@...ux.ibm.com,
        davem@...emloft.net, kuba@...nel.org
Cc:     linux-s390@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net/smc: Avoid setting clcsock options after clcsock
 released



On 2022/1/12 3:11 pm, dust.li wrote:
> On Mon, Jan 10, 2022 at 05:38:25PM +0800, Wen Gu wrote:
>>
>> This patch tries to fix it by holding clcsock_release_lock and
>> checking whether clcsock has already been released. In case that
>> a crash of the same reason happens in smc_getsockopt(), this patch
>> also checkes smc->clcsock in smc_getsockopt().

>> @@ -2509,13 +2515,21 @@ static int smc_getsockopt(struct socket *sock, int level, int optname,
>> 			  char __user *optval, int __user *optlen)
>> {
>> 	struct smc_sock *smc;
>> +	int rc;
>>
>> 	smc = smc_sk(sock->sk);
>> +	mutex_lock(&smc->clcsock_release_lock);
>> +	if (!smc->clcsock) {
>> +		mutex_unlock(&smc->clcsock_release_lock);
>> +		return -EBADF;
>> +	}
>> 	/* socket options apply to the CLC socket */
>> 	if (unlikely(!smc->clcsock->ops->getsockopt))
> Missed a mutex_unlock() here ?
> 
>> 		return -EOPNOTSUPP;

Thanks for pointing it out. Will add an additional mutex_unlock().

Thanks,
Wen Gu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ