From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
Nikolaus Schulz <microschulz@web.de>,
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Subject: [004/139] fat: fix buffer overflow in vfat_create_shortname()
Date: Thu, 22 Apr 2010 12:53:01 -0700 [thread overview]
Message-ID: <20100422195405.304205441@kvm.kroah.org> (raw)
In-Reply-To: <20100422195715.GA25490@kroah.com>
2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Nikolaus Schulz <microschulz@web.de>
commit 30d1872d9eb3663b4cf7bdebcbf5cd465674cced upstream.
When using the string representation of a random counter as part of the base
name, ensure that it is no longer than 4 bytes.
Since we are repeatedly decrementing the counter in a loop until we have found a
unique base name, the counter may wrap around zero; therefore, it is not enough
to mask its higher bits before entering the loop, this must be done inside the
loop.
[hirofumi@mail.parknet.co.jp: use snprintf()]
Signed-off-by: Nikolaus Schulz <microschulz@web.de>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/fat/namei_vfat.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -309,7 +309,7 @@ static int vfat_create_shortname(struct
{
struct fat_mount_options *opts = &MSDOS_SB(dir->i_sb)->options;
wchar_t *ip, *ext_start, *end, *name_start;
- unsigned char base[9], ext[4], buf[8], *p;
+ unsigned char base[9], ext[4], buf[5], *p;
unsigned char charbuf[NLS_MAX_CHARSET_SIZE];
int chl, chi;
int sz = 0, extlen, baselen, i, numtail_baselen, numtail2_baselen;
@@ -467,7 +467,7 @@ static int vfat_create_shortname(struct
return 0;
}
- i = jiffies & 0xffff;
+ i = jiffies;
sz = (jiffies >> 16) & 0x7;
if (baselen > 2) {
baselen = numtail2_baselen;
@@ -476,7 +476,7 @@ static int vfat_create_shortname(struct
name_res[baselen + 4] = '~';
name_res[baselen + 5] = '1' + sz;
while (1) {
- sprintf(buf, "%04X", i);
+ snprintf(buf, sizeof(buf), "%04X", i & 0xffff);
memcpy(&name_res[baselen], buf, 4);
if (vfat_find_form(dir, name_res) < 0)
break;
next prev parent reply other threads:[~2010-04-22 20:33 UTC|newest]
Thread overview: 142+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-22 19:57 [000/139] 2.6.33.3-stable review Greg KH
2010-04-22 19:52 ` [001/139] drm/edid: allow certain bogus edids to hit a fixup path rather than fail Greg KH
2010-04-22 19:52 ` [002/139] drm/radeon: add new RS880 pci id Greg KH
2010-04-22 19:53 ` [003/139] drm: remove the EDID blob stored in the EDID property when it is disconnected Greg KH
2010-04-22 19:53 ` Greg KH [this message]
2010-04-22 19:53 ` [005/139] oom: fix the unsafe usage of badness() in proc_oom_score() Greg KH
2010-04-22 19:53 ` [006/139] drm/radeon/kms: never treat rs4xx as AGP Greg KH
2010-04-22 19:53 ` [007/139] drm/radeon/kms: Fix NULL pointer dereference if memory allocation failed in a simple way Greg KH
2010-04-22 19:53 ` [008/139] drm/radeon/kms: dont print error on -ERESTARTSYS Greg KH
2010-04-22 19:53 ` [009/139] drm/radeon/kms: fix pal tv-out support on legacy IGP chips Greg KH
2010-04-22 19:53 ` [010/139] drm: Return ENODEV if the inode mapping changes Greg KH
2010-04-22 19:53 ` [011/139] sh: Fix FDPIC binary loader Greg KH
2010-04-22 19:53 ` [012/139] sh: Enable the mmu in start_secondary() Greg KH
2010-04-22 19:53 ` [013/139] reiserfs: Fix locking BUG during mount failure Greg KH
2010-04-22 19:53 ` [014/139] [SCSI] libiscsi: Fix recovery slowdown regression Greg KH
2010-04-22 19:53 ` [015/139] x86,kgdb: Always initialize the hw breakpoint attribute Greg KH
2010-04-22 19:53 ` [016/139] Freezer: Fix buggy resume test for tasks frozen with cgroup freezer Greg KH
2010-04-22 19:53 ` [017/139] iwlwifi: fix regulatory Greg KH
2010-04-22 19:53 ` [018/139] iwlwifi: counting number of tfds can be free for 4965 Greg KH
2010-04-22 19:53 ` [019/139] iwlwifi: range checking issue Greg KH
2010-04-22 19:53 ` [020/139] setup correct int pipe type in ar9170_usb_exec_cmd Greg KH
2010-04-22 19:53 ` [021/139] mac80211: fix PREQ processing and one small bug Greg KH
2010-04-22 19:53 ` [022/139] mac80211: move netdev queue enabling to correct spot Greg KH
2010-04-22 19:53 ` [023/139] mac80211: tear down all agg queues when restart/reconfig hw Greg KH
2010-04-22 19:53 ` [024/139] sparc: Fix regset register window handling Greg KH
2010-04-22 19:53 ` [025/139] sunxvr500: Ignore secondary output PCI devices Greg KH
2010-04-22 19:53 ` [026/139] WATCHDOG: hpwdt - fix lower timeout limit Greg KH
2010-04-22 19:53 ` [027/139] WATCHDOG: iTCO_wdt: TCO Watchdog patch for additional Intel Cougar Point DeviceIDs Greg KH
2010-04-22 19:53 ` [028/139] genirq: Force MSI irq handlers to run with interrupts disabled Greg KH
2010-04-22 19:53 ` [029/139] tty: release_one_tty() forgets to put pids Greg KH
2010-04-22 19:53 ` [030/139] HID: fix oops in gyration_event() Greg KH
2010-04-22 19:53 ` [031/139] raw: fsync method is now required Greg KH
2010-04-22 19:53 ` [032/139] readahead: fix NULL filp dereference Greg KH
2010-04-22 19:53 ` [033/139] include/linux/kfifo.h: fix INIT_KFIFO() Greg KH
2010-04-22 19:53 ` [034/139] ALSA: mixart: range checking proc file Greg KH
2010-04-22 19:53 ` [035/139] ALSA: hda: Fix 0 dB offset for Lenovo Thinkpad models using AD1981 Greg KH
2010-04-22 19:53 ` [036/139] ALSA: hda - Add ASRock mobo to MSI blacklist Greg KH
2010-04-22 19:53 ` [037/139] ALSA: hda - Add MSI blacklist for Aopen MZ915-M Greg KH
2010-04-22 19:53 ` [038/139] backlight: mbp_nvidia_bl - add five more MacBook variants Greg KH
2010-04-22 19:53 ` [039/139] pata_via: Add VIA VX900 support Greg KH
2010-04-22 19:53 ` [040/139] libata: disable NCQ on Crucial C300 SSD Greg KH
2010-04-22 19:53 ` [041/139] [S390] s390: disable change bit override Greg KH
2010-04-22 19:53 ` [042/139] cifs: Fix a kernel BUG with remote OS/2 server (try #3) Greg KH
2010-04-22 19:53 ` [043/139] CIFS: initialize nbytes at the beginning of CIFSSMBWrite() Greg KH
2010-04-22 19:53 ` [044/139] ath9k: fix double calls to ath_radio_enable Greg KH
2010-04-22 19:53 ` [045/139] iwlwifi: need check for valid qos packet before free Greg KH
2010-04-22 19:53 ` [046/139] mac80211: Handle mesh action frames in ieee80211_rx_h_action Greg KH
2010-04-22 19:53 ` [047/139] ARM: 6031/1: fix Thumb-2 decompressor Greg KH
2010-04-22 19:53 ` [048/139] drm/edid/quirks: Envision EN2028 Greg KH
2010-04-22 19:53 ` [049/139] drm/radeon: R300 AD only has one quad pipe Greg KH
2010-04-22 19:53 ` [050/139] drm/radeon/kms: fix washed out image on legacy tv dac Greg KH
2010-04-22 19:53 ` [051/139] drm/radeon/kms/combios: verify dac_adj values are valid Greg KH
2010-04-22 19:53 ` [052/139] x86-32, resume: do a global tlb flush in S4 resume Greg KH
2010-04-22 19:53 ` [053/139] x86: Handle overlapping mptables Greg KH
2010-04-22 19:53 ` [054/139] x86, hpet: Erratum workaround for read after write of HPET comparator Greg KH
2010-04-22 19:53 ` [055/139] x86: Fix double enable_IR_x2apic() call on SMP kernel on !SMP boards Greg KH
2010-04-22 19:53 ` [056/139] sched: sched_getaffinity(): Allow less than NR_CPUS length Greg KH
2010-04-22 19:53 ` [057/139] sched: Fix sched_getaffinity() Greg KH
2010-04-22 19:53 ` [058/139] NFSv4: Fall back to ordinary lookup if nfs4_atomic_open() returns EISDIR Greg KH
2010-04-22 19:53 ` [059/139] NFSv4: fix delegated locking Greg KH
2010-04-22 19:53 ` [060/139] Input: wacom - switch mode upon system resume Greg KH
2010-04-22 19:53 ` [061/139] Input: sparse-keymap - free the right keymap on error Greg KH
2010-04-22 19:53 ` [062/139] ALSA: hda - add a quirk for Clevo M570U laptop Greg KH
2010-04-22 19:54 ` [063/139] ALSA: usb - Fix Oops after usb-midi disconnection Greg KH
2010-04-22 19:54 ` [064/139] hwmon: (sht15) Fix sht15_calc_temp interpolation function Greg KH
2010-04-22 19:54 ` [065/139] hwmon: (sht15) Properly handle the case CONFIG_REGULATOR=n Greg KH
2010-04-22 19:54 ` [066/139] drm/i915: Add no_lvds entry for the Clientron U800 Greg KH
2010-04-22 19:54 ` [067/139] drm/radeon/kms: more atom parser fixes (v2) Greg KH
2010-04-22 19:54 ` [068/139] drm/radeon/kms: disable the tv encoder when tv/cv is not in use Greg KH
2010-04-22 19:54 ` [069/139] drm/radeon/kms: fix tv dac conflict resolver Greg KH
2010-04-22 19:54 ` [070/139] drm/radeon/kms: fix rs600 tlb flush Greg KH
2010-04-22 19:54 ` [071/139] drm/radeon/kms: add FireMV 2400 PCI ID Greg KH
2010-04-22 19:54 ` [072/139] x86/amd-iommu: Pt mode fix for domain_destroy Greg KH
2010-04-22 19:54 ` [073/139] x86/amd-iommu: Use helper function to destroy domain Greg KH
2010-04-22 19:54 ` [074/139] x86/amd-iommu: enable iommu before attaching devices Greg KH
2010-04-22 19:54 ` [075/139] Revert "x86: disable IOMMUs on kernel crash" Greg KH
2010-04-22 19:54 ` [076/139] x86, lib: Add wbinvd smp helpers Greg KH
2010-04-22 19:54 ` [077/139] x86, cacheinfo: Fix disabling of L3 cache indices Greg KH
2010-04-22 19:54 ` [078/139] intel-agp: Switch to wbinvd_on_all_cpus Greg KH
2010-04-22 19:54 ` [079/139] x86, cacheinfo: Add cache index disable sysfs attrs only to L3 caches Greg KH
2010-04-22 19:54 ` [080/139] x86, cacheinfo: Calculate L3 indices Greg KH
2010-04-22 19:54 ` [081/139] x86, cacheinfo: Remove NUMA dependency, fix for AMD Fam10h rev D1 Greg KH
2010-04-22 19:54 ` [082/139] x86, cacheinfo: Enable L3 CID only on AMD Greg KH
2010-04-22 19:54 ` [083/139] dm ioctl: introduce flag indicating uevent was generated Greg KH
2010-04-22 19:54 ` [084/139] x86-32: clean up rwsem inline asm statements Greg KH
2010-04-22 19:54 ` [085/139] x86: clean up rwsem type system Greg KH
2010-04-22 19:54 ` [086/139] x86-64, rwsem: 64-bit xadd rwsem implementation Greg KH
2010-04-22 19:54 ` [087/139] x86-64: support native " Greg KH
2010-04-22 19:54 ` [088/139] x86: Fix breakage of UML from the changes in the rwsem system Greg KH
2010-04-22 19:54 ` [089/139] x86-64, rwsem: Avoid store forwarding hazard in __downgrade_write Greg KH
2010-04-22 19:54 ` [090/139] fix NFS4 handling of mountpoint stat Greg KH
2010-04-22 19:54 ` [091/139] quota: Fix possible dq_flags corruption Greg KH
2010-04-22 19:54 ` [092/139] ocfs2: set i_mode on disk during acl operations Greg KH
2010-04-22 19:54 ` [093/139] ocfs2: Change bg_chain check for ocfs2_validate_gd_parent Greg KH
2010-04-22 19:54 ` [094/139] 9p: Skip check for mandatory locks when unlocking Greg KH
2010-04-22 19:54 ` [095/139] pci: Update pci_set_vga_state() to call arch functions Greg KH
2010-04-22 19:54 ` [096/139] PCI: kill off pci_register_set_vga_state() symbol export Greg KH
2010-04-22 19:54 ` [097/139] IPoIB: Fix TX queue lockup with mixed UD/CM traffic Greg KH
2010-04-22 19:54 ` [098/139] x86/PCI: irq and pci_ids patch for Intel Cougar Point DeviceIDs Greg KH
2010-04-22 19:54 ` [099/139] ALSA: hda_intel: ALSA HD Audio " Greg KH
2010-04-22 19:54 ` [100/139] ALSA: hda - enable snoop for Intel Cougar Point Greg KH
2010-04-22 19:54 ` [101/139] ata_piix: IDE Mode SATA patch for Intel Cougar Point DeviceIDs Greg KH
2010-04-22 19:54 ` [102/139] ahci: AHCI and RAID mode " Greg KH
2010-04-22 19:54 ` [103/139] i2c-i801: Add Intel Cougar Point device IDs Greg KH
2010-04-22 19:54 ` [104/139] b43: Allow PIO mode to be selected at module load Greg KH
2010-04-22 19:54 ` [105/139] b43: fall back gracefully to PIO mode after fatal DMA errors Greg KH
2010-04-22 19:54 ` [106/139] ALSA: hda - Add position_fix quirk for Biostar mobo Greg KH
2010-04-22 19:54 ` [107/139] ecryptfs: fix use with tmpfs by removing d_drop from ecryptfs_destroy_inode Greg KH
2010-04-22 19:54 ` [108/139] eCryptfs: Decrypt symlink target for stat size Greg KH
2010-04-22 19:54 ` [109/139] ecryptfs: fix error code for missing xattrs in lower fs Greg KH
2010-04-22 19:54 ` [110/139] USB: cdc-acm: Update to new autopm API Greg KH
2010-04-22 19:54 ` [111/139] USB: cdc-acm: Fix stupid NULL pointer in resume() Greg KH
2010-04-22 19:54 ` [112/139] iwlwifi: clear all tx queues when firmware ready Greg KH
2010-04-22 19:54 ` [113/139] iwlwifi: fix scan race Greg KH
2010-04-22 19:54 ` [114/139] e1000e: stop cleaning when we reach tx_ring->next_to_use Greg KH
2010-04-22 19:54 ` [115/139] perf_events, x86: Implement Intel Westmere/Nehalem-EX support Greg KH
2010-04-22 19:54 ` [116/139] xfs: Non-blocking inode locking in IO completion Greg KH
2010-04-22 19:54 ` [117/139] xfs: fix locking for inode cache radix tree tag updates Greg KH
2010-04-22 19:54 ` [118/139] xfs: check for more work before sleeping in xfssyncd Greg KH
2010-04-22 19:54 ` [119/139] ACPI: EC: Allow multibyte access to EC Greg KH
2010-04-22 19:54 ` [120/139] md/raid5: allow for more than 2^31 chunks Greg KH
2010-04-22 19:54 ` [121/139] ACPI: EC: Limit burst to 64 bits Greg KH
2010-04-22 19:54 ` [122/139] modules: fix incorrect percpu usage Greg KH
2010-04-22 19:55 ` [123/139] lockdep: " Greg KH
2010-04-22 19:55 ` [124/139] module: fix __module_ref_addr() Greg KH
2010-04-22 19:55 ` [125/139] md: deal with merge_bvec_fn in component devices better Greg KH
2010-04-22 19:55 ` [126/139] powerpc: Fix SMP build with disabled CPU hotplugging Greg KH
2010-04-22 19:55 ` [127/139] ext4: fix async i/o writes beyond 4GB to a sparse file Greg KH
2010-04-22 19:55 ` [128/139] sched: Use proper type in sched_getaffinity() Greg KH
2010-04-22 19:55 ` [129/139] KVM: VMX: Update instruction length on intercepted BP Greg KH
2010-04-22 19:55 ` [130/139] KVM: SVM: Fix memory leaks that happen when svm_create_vcpu() fails Greg KH
2010-04-22 19:55 ` [131/139] KVM: Dont spam kernel log when injecting exceptions due to bad cr writes Greg KH
2010-04-22 19:55 ` [132/139] KVM: allow bit 10 to be cleared in MSR_IA32_MC4_CTL Greg KH
2010-04-22 19:55 ` [133/139] KVM: VMX: Save/restore rflags.vm correctly in real mode Greg KH
2010-04-22 19:55 ` [134/139] KVM: MMU: fix kvm_mmu_zap_page() and its calling path Greg KH
2010-04-22 19:55 ` [135/139] KVM: fix the handling of dirty bitmaps to avoid overflows Greg KH
2010-04-22 19:55 ` [136/139] KVM: Increase NR_IOBUS_DEVS limit to 200 Greg KH
2010-04-22 19:55 ` [137/139] KVM: x86: Fix TSS size check for 16-bit tasks Greg KH
2010-04-22 19:55 ` [138/139] x86/gart: Disable GART explicitly before initialization Greg KH
2010-04-22 19:55 ` [139/139] MIPS: Sibyte: Fix M3 TLB exception handler workaround Greg KH
2010-04-22 20:52 ` Sebastian Andrzej Siewior
2010-04-23 16:23 ` [stable] [000/139] 2.6.33.3-stable review Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100422195405.304205441@kvm.kroah.org \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=microschulz@web.de \
--cc=stable-review@kernel.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome