Prevent oopsing in posix_acl_valid()
PATCH 1/1 Prevent oopsing in posix_acl_valid()
If posix_acl_from_xattr() returns an error code, a negative address is dereferenced causing an oops; fix by checking for an error code first.
Typo fixed; too much late-night coding.
--- fs/btrfs/acl.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
fs/btrfs/acl.c +3 -2
@@ -178,12 +178,13 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name,if (value) { acl =posix_acl_from_xattr (value, size); +if (IS_ERR (acl)) +return PTR_ERR (acl); +if (acl) { ret =posix_acl_valid (acl);if (ret) goto out; - }else if (IS_ERR (acl)) { -return PTR_ERR (acl); } }
Signature · 1 line
1.7.4.1
Quoted 20 lines · Daniel J Blueman
If
posix_acl_from_xattr()returns an error code, a negative address is dereferenced causing an oops; fix by checking for an error code first.Typo fixed; too much late-night coding.
Signed-off-by Daniel J Blueman<[email protected]>--- fs/btrfs/acl.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)fs/btrfs/acl.c +2
-0@@ -178,12 +178,13 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name,if (value) { acl =posix_acl_from_xattr (value, size); +if (IS_ERR (acl)) +return PTR_ERR (acl);
fs/btrfs/acl.c static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name, · line 190
Quoted 10 lines
fs/btrfs/acl.c +1
-2+if (acl) { ret =posix_acl_valid (acl);if (ret) goto out; - }else if (IS_ERR (acl)) { -return PTR_ERR (acl); } }
Actually pulled this down and compiled it this time to make sure it worked. You can add
Thanks,
Josef
Hi Chris,
Quoted 3 lines · Josef Bacik
Quoted 2 lines · Daniel J Blueman
If
posix_acl_from_xattr()returns an error code, a negative address =
is
Quoted 1 line
Quoted 1 line
dereferenced causing an oops; fix by checking for an error code firs=
t.
Quoted 15 lines
Quoted 15 lines
Typo fixed; too much late-night coding.
Signed-off-by Daniel J Blueman<[email protected]>---
=A0fs/btrfs/acl.c | =A0 =A05 +++--
=A01 files changed, 3 insertions(+), 2 deletions(-)fs/btrfs/acl.c +0
-0@@ -178,12 +178,13 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name,
Quoted 2 lines
Quoted 2 lines
fs/btrfs/acl.c +0
-0=A0 =A0 =A0 =A0if (value) {=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0acl =3D posix_acl_from_xattr(value, s=
ize);
Quoted 5 lines
Quoted 5 lines
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (
IS_ERR(acl))
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 returnPTR_ERR(acl); +
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (acl) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ret =3D posix_acl_val=
id(acl);
Quoted 2 lines
Quoted 2 lines
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (ret) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto =
out;
Quoted 7 lines
Quoted 5 lines
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (
IS_ERR(acl)) {
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 returnPTR_ERR(acl); =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
=A0 =A0 =A0 =A0}Actually pulled this down and compiled it this time to make sure it w=
orked.
Quoted 3 lines
=A0You can add
Reviewed-by Josef Bacik <[email protected]>
Will this fix go upstream for the final 2.6.39, now that the last -rc is already out? I hit it in two independent cases when rebooting after other kernel crashes.
Thanks,
Daniel
--=20
Daniel J Blueman
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Excerpts from Daniel J Blueman's message of 2011-05-10 01:42:45 -0400:
Quoted 6 lines
Hi Chris,
=20Quoted 3 lines · Josef Bacik
Quoted 2 lines · Daniel J Blueman
If
posix_acl_from_xattr()returns an error code, a negative addres=
s is
Quoted 1 line
Quoted 1 line
Quoted 1 line
dereferenced causing an oops; fix by checking for an error code fi=
rst.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Typo fixed; too much late-night coding.
Signed-off-by Daniel J Blueman<[email protected]>---
=C2=A0fs/btrfs/acl.c | =C2=A0 =C2=A05 +++-- =C2=A01 files changed, 3 insertions(+), 2 deletions(-)fs/btrfs/acl.c +0
-0@@ -178,12 +178,13 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name,
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
fs/btrfs/acl.c +0
-0=C2=A0 =C2=A0 =C2=A0 =C2=A0if (value) {=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0acl =3D pos=
ix_acl_from_xattr(value, size);
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (IS_ERR(acl)=
)
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 return PTR_ERR(acl);
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (acl) { =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0ret =3D posix_acl_valid(acl);
Quoted 1 line
Quoted 1 line
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0if (ret)
Quoted 1 line
Quoted 1 line
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out;
Quoted 1 line
Quoted 1 line
Quoted 1 line
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else if (IS_E=
RR(acl)) {
Quoted 1 line
Quoted 1 line
Quoted 1 line
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 return PTR_ERR(acl);
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} =C2=A0 =C2=A0 =C2=A0 =C2=A0}
Actually pulled this down and compiled it this time to make sure it=
worked.
Quoted 6 lines
Quoted 3 lines
=C2=A0You can add
Reviewed-by Josef Bacik <[email protected]>=20
Will this fix go upstream for the final 2.6.39, now that the last -rc is already out? I hit it in two independent cases when rebooting afte=
r
Quoted 1 line
other kernel crashes.
Yes, I have one other patch to from Li Zefan that I will send along.
-chris
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html