Re: [PATCH] f2fs crypto: add rwsem to avoid data races

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 18, 2015 at 10:36:41PM -0700, Jaegeuk Kim wrote:
> Previoulsy, fi->i_crypt_info was not covered by any lock, resulting in
> memory leak.
> 
> This patch adds a rwsem to avoid leaking objects on i_crypt_info.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>

I'm not sure we need an rwsem to fix this issue.  In terms of
serializing the creation and deletion of the structure, it should be
possible to use an cmpxchg() on the pointer itself.  (e.g., if we lose
the race on the creation side, we just release our structure and use
the one that the winner allocated).

If we do end up needing to serialize access to the tfm in the
i_crypt_info object for datapath reads/writes, then we might need a
mutex, but I think that should be it, no?

	       	     	   	       - Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux