aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/fcp.c
diff options
context:
space:
mode:
authorXi Wang <xi.wang@gmail.com>2012-01-10 11:51:10 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-25 17:24:33 -0800
commit0146b288f47cc3ef3f0791b3023643ccdeeeb339 (patch)
tree5e1890f8ededa9b2e1e52c83302b9679d47ae3b2 /sound/firewire/fcp.c
parent922d41ed4740408d2719a8c99d9f80138e562c03 (diff)
downloadkernel_samsung_smdk4412-0146b288f47cc3ef3f0791b3023643ccdeeeb339.zip
kernel_samsung_smdk4412-0146b288f47cc3ef3f0791b3023643ccdeeeb339.tar.gz
kernel_samsung_smdk4412-0146b288f47cc3ef3f0791b3023643ccdeeeb339.tar.bz2
ext4: fix undefined behavior in ext4_fill_flex_info()
commit d50f2ab6f050311dbf7b8f5501b25f0bf64a439b upstream. Commit 503358ae01b70ce6909d19dd01287093f6b6271c ("ext4: avoid divide by zero when trying to mount a corrupted file system") fixes CVE-2009-4307 by performing a sanity check on s_log_groups_per_flex, since it can be set to a bogus value by an attacker. sbi->s_log_groups_per_flex = sbi->s_es->s_log_groups_per_flex; groups_per_flex = 1 << sbi->s_log_groups_per_flex; if (groups_per_flex < 2) { ... } This patch fixes two potential issues in the previous commit. 1) The sanity check might only work on architectures like PowerPC. On x86, 5 bits are used for the shifting amount. That means, given a large s_log_groups_per_flex value like 36, groups_per_flex = 1 << 36 is essentially 1 << 4 = 16, rather than 0. This will bypass the check, leaving s_log_groups_per_flex and groups_per_flex inconsistent. 2) The sanity check relies on undefined behavior, i.e., oversized shift. A standard-confirming C compiler could rewrite the check in unexpected ways. Consider the following equivalent form, assuming groups_per_flex is unsigned for simplicity. groups_per_flex = 1 << sbi->s_log_groups_per_flex; if (groups_per_flex == 0 || groups_per_flex == 1) { We compile the code snippet using Clang 3.0 and GCC 4.6. Clang will completely optimize away the check groups_per_flex == 0, leaving the patched code as vulnerable as the original. GCC keeps the check, but there is no guarantee that future versions will do the same. Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'sound/firewire/fcp.c')
0 files changed, 0 insertions, 0 deletions