<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/quota, branch linux-3.16.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.16.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.16.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-02-11T20:03:23Z</updated>
<entry>
<title>quota: Check that quota is not dirty before release</title>
<updated>2020-02-11T20:03:23Z</updated>
<author>
<name>Dmitry Monakhov</name>
</author>
<published>2019-10-31T10:39:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9c64da63c028a800020bc9f7e139b8ba2d8f11ed'/>
<id>urn:sha1:9c64da63c028a800020bc9f7e139b8ba2d8f11ed</id>
<content type='text'>
commit df4bb5d128e2c44848aeb36b7ceceba3ac85080d upstream.

There is a race window where quota was redirted once we drop dq_list_lock inside dqput(),
but before we grab dquot-&gt;dq_lock inside dquot_release()

TASK1                                                       TASK2 (chowner)
-&gt;dqput()
  we_slept:
    spin_lock(&amp;dq_list_lock)
    if (dquot_dirty(dquot)) {
          spin_unlock(&amp;dq_list_lock);
          dquot-&gt;dq_sb-&gt;dq_op-&gt;write_dquot(dquot);
          goto we_slept
    if (test_bit(DQ_ACTIVE_B, &amp;dquot-&gt;dq_flags)) {
          spin_unlock(&amp;dq_list_lock);
          dquot-&gt;dq_sb-&gt;dq_op-&gt;release_dquot(dquot);
                                                            dqget()
							    mark_dquot_dirty()
							    dqput()
          goto we_slept;
        }
So dquot dirty quota will be released by TASK1, but on next we_sleept loop
we detect this and call -&gt;write_dquot() for it.
XFSTEST: https://github.com/dmonakhov/xfstests/commit/440a80d4cbb39e9234df4d7240aee1d551c36107

Link: https://lore.kernel.org/r/20191031103920.3919-2-dmonakhov@openvz.org
Signed-off-by: Dmitry Monakhov &lt;dmtrmonakhov@yandex-team.ru&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>quota: fix livelock in dquot_writeback_dquots</title>
<updated>2020-02-11T20:03:23Z</updated>
<author>
<name>Dmitry Monakhov</name>
</author>
<published>2019-10-31T10:39:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7f8f231ca569b39265277c86297569634da2891d'/>
<id>urn:sha1:7f8f231ca569b39265277c86297569634da2891d</id>
<content type='text'>
commit 6ff33d99fc5c96797103b48b7b0902c296f09c05 upstream.

Write only quotas which are dirty at entry.

XFSTEST: https://github.com/dmonakhov/xfstests/commit/b10ad23566a5bf75832a6f500e1236084083cddc

Link: https://lore.kernel.org/r/20191031103920.3919-1-dmonakhov@openvz.org
Signed-off-by: Konstantin Khlebnikov &lt;khlebnikov@yandex-team.ru&gt;
Signed-off-by: Dmitry Monakhov &lt;dmtrmonakhov@yandex-team.ru&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>fs/quota: Fix spectre gadget in do_quotactl</title>
<updated>2018-12-16T22:08:51Z</updated>
<author>
<name>Jeremy Cline</name>
</author>
<published>2018-07-31T01:37:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9d7c5b0db93d3101e15a4e1a6aafebf95685b6a6'/>
<id>urn:sha1:9d7c5b0db93d3101e15a4e1a6aafebf95685b6a6</id>
<content type='text'>
commit 7b6924d94a60c6b8c1279ca003e8744e6cd9e8b1 upstream.

'type' is user-controlled, so sanitize it after the bounds check to
avoid using it in speculative execution. This covers the following
potential gadgets detected with the help of smatch:

* fs/ext4/super.c:5741 ext4_quota_read() warn: potential spectre issue
  'sb_dqopt(sb)-&gt;files' [r]
* fs/ext4/super.c:5778 ext4_quota_write() warn: potential spectre issue
  'sb_dqopt(sb)-&gt;files' [r]
* fs/f2fs/super.c:1552 f2fs_quota_read() warn: potential spectre issue
  'sb_dqopt(sb)-&gt;files' [r]
* fs/f2fs/super.c:1608 f2fs_quota_write() warn: potential spectre issue
  'sb_dqopt(sb)-&gt;files' [r]
* fs/quota/dquot.c:412 mark_info_dirty() warn: potential spectre issue
  'sb_dqopt(sb)-&gt;info' [w]
* fs/quota/dquot.c:933 dqinit_needed() warn: potential spectre issue
  'dquots' [r]
* fs/quota/dquot.c:2112 dquot_commit_info() warn: potential spectre
  issue 'dqopt-&gt;ops' [r]
* fs/quota/dquot.c:2362 vfs_load_quota_inode() warn: potential spectre
  issue 'dqopt-&gt;files' [w] (local cap)
* fs/quota/dquot.c:2369 vfs_load_quota_inode() warn: potential spectre
  issue 'dqopt-&gt;ops' [w] (local cap)
* fs/quota/dquot.c:2370 vfs_load_quota_inode() warn: potential spectre
  issue 'dqopt-&gt;info' [w] (local cap)
* fs/quota/quota.c:110 quota_getfmt() warn: potential spectre issue
  'sb_dqopt(sb)-&gt;info' [r]
* fs/quota/quota_v2.c:84 v2_check_quota_file() warn: potential spectre
  issue 'quota_magics' [w]
* fs/quota/quota_v2.c:85 v2_check_quota_file() warn: potential spectre
  issue 'quota_versions' [w]
* fs/quota/quota_v2.c:96 v2_read_file_info() warn: potential spectre
  issue 'dqopt-&gt;info' [r]
* fs/quota/quota_v2.c:172 v2_write_file_info() warn: potential spectre
  issue 'dqopt-&gt;info' [r]

Additionally, a quick inspection indicates there are array accesses with
'type' in quota_on() and quota_off() functions which are also addressed
by this.

Cc: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Signed-off-by: Jeremy Cline &lt;jcline@redhat.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
[bwh: Backported to 3.16: The maximum valid quota type is command-dependent.
 Introduce a local variable rather than repeating the expression.]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>quota: Check for register_shrinker() failure.</title>
<updated>2018-03-03T15:51:39Z</updated>
<author>
<name>Tetsuo Handa</name>
</author>
<published>2017-11-29T13:34:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=94c2ab5a14372b8c0d2cfe9ff54833989c701229'/>
<id>urn:sha1:94c2ab5a14372b8c0d2cfe9ff54833989c701229</id>
<content type='text'>
commit 88bc0ede8d35edc969350852894dc864a2dc1859 upstream.

register_shrinker() might return -ENOMEM error since Linux 3.12.
Call panic() as with other failure checks in this function if
register_shrinker() failed.

Fixes: 1d3d4437eae1 ("vmscan: per-node deferred work")
Signed-off-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Cc: Jan Kara &lt;jack@suse.com&gt;
Cc: Michal Hocko &lt;mhocko@suse.com&gt;
Reviewed-by: Michal Hocko &lt;mhocko@suse.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>quota: Store maximum space limit in bytes</title>
<updated>2015-03-04T17:28:02Z</updated>
<author>
<name>Jan Kara</name>
</author>
<published>2014-10-09T14:54:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=075bc52630579feccc805b9baeaa26a700ca8bad'/>
<id>urn:sha1:075bc52630579feccc805b9baeaa26a700ca8bad</id>
<content type='text'>
commit b10a08194c2b615955dfab2300331a90ae9344c7 upstream.

Currently maximum space limit quota format supports is in blocks however
since we store space limits in bytes, this is somewhat confusing. So
store the maximum limit in bytes as well. Also rename the field to match
the new unit and related inode field to match the new naming scheme.

Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques &lt;luis.henriques@canonical.com&gt;
</content>
</entry>
<entry>
<title>quota: Switch -&gt;get_dqblk() and -&gt;set_dqblk() to use bytes as space units</title>
<updated>2015-02-04T10:58:23Z</updated>
<author>
<name>Jan Kara</name>
</author>
<published>2014-10-09T14:03:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e5c1cda088832f58c8477ac993ed70ec98fa1221'/>
<id>urn:sha1:e5c1cda088832f58c8477ac993ed70ec98fa1221</id>
<content type='text'>
commit 14bf61ffe6ac54afcd1e888a4407fe16054483db upstream.

Currently -&gt;get_dqblk() and -&gt;set_dqblk() use struct fs_disk_quota which
tracks space limits and usage in 512-byte blocks. However VFS quotas
track usage in bytes (as some filesystems require that) and we need to
somehow pass this information. Upto now it wasn't a problem because we
didn't do any unit conversion (thus VFS quota routines happily stuck
number of bytes into d_bcount field of struct fd_disk_quota). Only if
you tried to use Q_XGETQUOTA or Q_XSETQLIM for VFS quotas (or Q_GETQUOTA
/ Q_SETQUOTA for XFS quotas), you got bogus results. Hardly anyone
tried this but reportedly some Samba users hit the problem in practice.
So when we want interfaces compatible we need to fix this.

We bite the bullet and define another quota structure used for passing
information from/to -&gt;get_dqblk()/-&gt;set_dqblk. It's somewhat sad we have
to have more conversion routines in fs/quota/quota.c and another copying
of quota structure slows down getting of quota information by about 2%
but it seems cleaner than overloading e.g. units of d_bcount to bytes.

Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
[ luis: backported to 3.16: since 3.16 doesn't contain commit 2451337dd043
  ("xfs: global error sign conversion"), return values for functions
  xfs_qm_scall_setqlim, xfs_fs_get_dqblk and xfs_fs_set_dqblk had to be
  adjusted. ]
Signed-off-by: Luis Henriques &lt;luis.henriques@canonical.com&gt;
</content>
</entry>
<entry>
<title>quota: Properly return errors from dquot_writeback_dquots()</title>
<updated>2014-11-13T11:48:35Z</updated>
<author>
<name>Jan Kara</name>
</author>
<published>2014-10-22T07:06:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8d8926d398711b7be26309eac857998debfd572a'/>
<id>urn:sha1:8d8926d398711b7be26309eac857998debfd572a</id>
<content type='text'>
commit 474d2605d119479e5aa050f738632e63589d4bb5 upstream.

Due to a switched left and right side of an assignment,
dquot_writeback_dquots() never returned error. This could result in
errors during quota writeback to not be reported to userspace properly.
Fix it.

Coverity-id: 1226884
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Luis Henriques &lt;luis.henriques@canonical.com&gt;
</content>
</entry>
<entry>
<title>quota: missing lock in dqcache_shrink_scan()</title>
<updated>2014-07-15T20:36:18Z</updated>
<author>
<name>Niu Yawei</name>
</author>
<published>2014-06-04T04:22:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d68aab6b8f572406aa93b45ef6483934dd3b54a6'/>
<id>urn:sha1:d68aab6b8f572406aa93b45ef6483934dd3b54a6</id>
<content type='text'>
Commit 1ab6c4997e04 (fs: convert fs shrinkers to new scan/count API)
accidentally removed locking from quota shrinker. Fix it -
dqcache_shrink_scan() should use dq_list_lock to protect the
scan on free_dquots list.

CC: stable@vger.kernel.org
Fixes: 1ab6c4997e04a00c50c6d786c2f046adc0d1f5de
Signed-off-by: Niu Yawei &lt;yawei.niu@intel.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>xfs: fix Q_XQUOTARM ioctl</title>
<updated>2014-05-05T07:25:50Z</updated>
<author>
<name>Eric Sandeen</name>
</author>
<published>2014-05-05T07:25:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9da93f9b7cdf8ab28da6b364cdc1fafc8670b4dc'/>
<id>urn:sha1:9da93f9b7cdf8ab28da6b364cdc1fafc8670b4dc</id>
<content type='text'>
The Q_XQUOTARM quotactl was not working properly, because
we weren't passing around proper flags.  The xfs_fs_set_xstate()
ioctl handler used the same flags for Q_XQUOTAON/OFF as
well as for Q_XQUOTARM, but Q_XQUOTAON/OFF look for
XFS_UQUOTA_ACCT, XFS_UQUOTA_ENFD, XFS_GQUOTA_ACCT etc,
i.e. quota type + state, while Q_XQUOTARM looks only for
the type of quota, i.e. XFS_DQ_USER, XFS_DQ_GROUP etc.

Unfortunately these flag spaces overlap a bit, so we
got semi-random results for Q_XQUOTARM; i.e. the value
for XFS_DQ_USER == XFS_UQUOTA_ACCT, etc.  yeargh.

Add a new quotactl op vector specifically for the QUOTARM
operation, since it operates with a different flag space.

This has been broken more or less forever, AFAICT.

Signed-off-by: Eric Sandeen &lt;sandeen@redhat.com&gt;
Acked-by: Jan Kara &lt;jack@suse.cz&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Dave Chinner &lt;david@fromorbit.com&gt;


</content>
</entry>
<entry>
<title>Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs</title>
<updated>2014-04-08T00:59:17Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2014-04-08T00:59:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a7963eb7f4c4b5df84d5dd5083734278ad75bafb'/>
<id>urn:sha1:a7963eb7f4c4b5df84d5dd5083734278ad75bafb</id>
<content type='text'>
Pull ext3 improvements, cleanups, reiserfs fix from Jan Kara:
 "various cleanups for ext2, ext3, udf, isofs, a documentation update
  for quota, and a fix of a race in reiserfs readdir implementation"

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  reiserfs: fix race in readdir
  ext2: acl: remove unneeded include of linux/capability.h
  ext3: explicitly remove inode from orphan list after failed direct io
  fs/isofs/inode.c add __init to init_inodecache()
  ext3: Speedup WB_SYNC_ALL pass
  fs/quota/Kconfig: Update filesystems
  ext3: Update outdated comment before ext3_ordered_writepage()
  ext3: Update PF_MEMALLOC handling in ext3_write_inode()
  ext2/3: use prandom_u32() instead of get_random_bytes()
  ext3: remove an unneeded check in ext3_new_blocks()
  ext3: remove unneeded check in ext3_ordered_writepage()
  fs: Mark function as static in ext3/xattr_security.c
  fs: Mark function as static in ext3/dir.c
  fs: Mark function as static in ext2/xattr_security.c
  ext3: Add __init macro to init_inodecache
  ext2: Add __init macro to init_inodecache
  udf: Add __init macro to init_inodecache
  fs: udf: parse_options: blocksize check
</content>
</entry>
</feed>
