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]
Message-ID: <aa79d98a0805200246w6f925f4ai83bd5bae43e37a95@mail.gmail.com>
Date:	Tue, 20 May 2008 13:46:50 +0400
From:	"Cyrill Gorcunov" <gorcunov@...il.com>
To:	"Andrew Morton" <akpm@...ux-foundation.org>
Cc:	"Michael A. Halcrow" <mhalcrow@...ibm.com>,
	"Ingo Molnar" <mingo@...e.hu>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] eCryptFS: fix missed mutex_unlock

On Tue, May 20, 2008 at 11:28 AM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
> On Sun, 18 May 2008 18:26:11 +0400 Cyrill Gorcunov <gorcunov@...il.com> wrote:
>
>> ---
>>
>> Ingo, could you please apply it and test? Actually I really doubt if it help
>> with the locking problem you pointed. There are two procedures
>> in miscrev.c - ecryptfs_miscdev_poll() and ecryptfs_miscdev_read()
>> which takes/releases mutexes in a bit strange way... investigating,
>> but this patch is needed anyway.
>>
>> Index: linux-2.6.git/fs/ecryptfs/crypto.c
>> ===================================================================
>> --- linux-2.6.git.orig/fs/ecryptfs/crypto.c   2008-05-18 16:44:20.000000000 +0400
>> +++ linux-2.6.git/fs/ecryptfs/crypto.c        2008-05-18 17:56:12.000000000 +0400
>> @@ -1903,6 +1903,7 @@ int ecryptfs_get_tfm_and_mutex_for_ciphe
>>               if (rc) {
>>                       printk(KERN_ERR "Error adding new key_tfm to list; "
>>                                       "rc = [%d]\n", rc);
>> +                     mutex_unlock(&key_tfm_list_mutex);
>>                       goto out;
>>               }
>>       }
>
> Better to do it this way, I think:
>
> --- a/fs/ecryptfs/crypto.c~ecryptfs-fix-missed-mutex_unlock
> +++ a/fs/ecryptfs/crypto.c
> @@ -1906,9 +1906,9 @@ int ecryptfs_get_tfm_and_mutex_for_ciphe
>                        goto out;
>                }
>        }
> -       mutex_unlock(&key_tfm_list_mutex);
>        (*tfm) = key_tfm->key_tfm;
>        (*tfm_mutex) = &key_tfm->key_tfm_mutex;
>  out:
> +       mutex_unlock(&key_tfm_list_mutex);
>        return rc;
>  }
> _
>
> Holding the lock for an additional few instructions may not be strictly
> needed, but we might avoid the reintroduction of such bugs?
>
>

Good idea, thanks! Could you update the patch, please?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ