Patchwork e2fsck: fix precedence bug in built-in quota support

login
register
mail settings
Submitter Theodore Ts'o
Date May 22, 2012, 2:09 a.m.
Message ID <1337652574-7132-1-git-send-email-tytso@mit.edu>
Download mbox | patch
Permalink /patch/160524/
State Accepted
Headers show

Comments

Theodore Ts'o - May 22, 2012, 2:09 a.m.
The operator precedence bug means that we might pay atteion to
s_grp_quota_inum even if the RO_COMPAT_QUOTA feature flag is clear.
However, fortunately, this is unlikely to happen in practice.

Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 e2fsck/pass1.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Aditya Kali - May 22, 2012, 5:20 p.m.
T29wcy4gVGhhbmtzIGZvciB0aGUgcGF0Y2guCgoKT24gTW9uLCBNYXkgMjEsIDIwMTIgYXQgNzow
OSBQTSwgVGhlb2RvcmUgVHMnbyA8dHl0c29AbWl0LmVkdT4gd3JvdGU6Cj4gVGhlIG9wZXJhdG9y
IHByZWNlZGVuY2UgYnVnIG1lYW5zIHRoYXQgd2UgbWlnaHQgcGF5IGF0dGVpb24gdG8KPiBzX2dy
cF9xdW90YV9pbnVtIGV2ZW4gaWYgdGhlIFJPX0NPTVBBVF9RVU9UQSBmZWF0dXJlIGZsYWcgaXMg
Y2xlYXIuCj4gSG93ZXZlciwgZm9ydHVuYXRlbHksIHRoaXMgaXMgdW5saWtlbHkgdG8gaGFwcGVu
IGluIHByYWN0aWNlLgo+Cj4gQ2M6IEFkaXR5YSBLYWxpIDxhZGl0eWFrYWxpQGdvb2dsZS5jb20+
Cj4gU2lnbmVkLW9mZi1ieTogIlRoZW9kb3JlIFRzJ28iIDx0eXRzb0BtaXQuZWR1PgpSZXZpZXdl
ZC1ieTogQWRpdHlhIEthbGkgPGFkaXR5YWthbGlAZ29vZ2xlLmNvbT4KPiAtLS0KPiDCoGUyZnNj
ay9wYXNzMS5jIHwgwqAgwqA0ICsrLS0KPiDCoDEgZmlsZSBjaG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DCoChmcy0+c3VwZXItPnNfZ3JwX3F1b3RhX2ludW0gPT0gaW5vKSkpIHsKPiDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoGlmICghTElOVVhf
U19JU1JFRyhpbm9kZS0+aV9tb2RlKSAmJgo+IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgZml4X3Byb2JsZW0oY3R4LCBQUl8xX1FVT1RBX0JBRF9N
T0RFLAo+IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgJnBjdHgpKSB7Cj4gLS0KPiAxLjcuMTAu
cmMzCj4KCgoKLS0gCgpBZGl0eWEK
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index c7645d1..c6aae6e 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -928,8 +928,8 @@  void e2fsck_pass1(e2fsck_t ctx)
 			ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino);
 			if ((fs->super->s_feature_ro_compat &
 					EXT4_FEATURE_RO_COMPAT_QUOTA) &&
-			    (fs->super->s_usr_quota_inum == ino) ||
-			    (fs->super->s_grp_quota_inum == ino)) {
+			    ((fs->super->s_usr_quota_inum == ino) ||
+			     (fs->super->s_grp_quota_inum == ino))) {
 				if (!LINUX_S_ISREG(inode->i_mode) &&
 				    fix_problem(ctx, PR_1_QUOTA_BAD_MODE,
 							&pctx)) {