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-next>] [day] [month] [year] [list]
Message-ID: <20100320113851.GB5331@bicker>
Date:	Sat, 20 Mar 2010 14:38:51 +0300
From:	Dan Carpenter <error27@...il.com>
To:	chris.mason@...cle.com
Cc:	linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: locking problems: Btrfs: be more selective in the defrag ioctl

Hi Chris,

There is a locking problem in 
	940100a4a7b78 "Btrfs: be more selective in the defrag ioctl"

There are two places where we break out of the while loop under the 
lock.

fs/btrfs/ioctl.c +708 btrfs_defrag_file(159) error: double lock 'mutex:&inode->i_mutex'
   600                  mutex_lock(&inode->i_mutex);
   601                  if (range->flags & BTRFS_DEFRAG_RANGE_COMPRESS)
   602                          BTRFS_I(inode)->force_compress = 1;
   603  
   604                  ret = btrfs_check_data_free_space(root, inode, PAGE_CACHE_SIZE);
   605                  if (ret) {
   606                          ret = -ENOSPC;
   607                          break;

	Here.

   608                  }
   609  
   610                  ret = btrfs_reserve_metadata_for_delalloc(root, inode, 1);
   611                  if (ret) {
   612                          btrfs_free_reserved_data_space(root, inode,
   613                                                         PAGE_CACHE_SIZE);
   614                          ret = -ENOSPC;
   615                          break;

	And here.

   616                  }

Maybe we should have "goto err_reservations;" instead of break?  I
don't know the code well enough to say.

regards,
dan carpenter
--
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