/* * Copyright (c) 2000-2001 Christoph Hellwig. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions, and the following disclaimer, * without modification. * 2. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL"). * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #ifndef _VXFS_DIR_H_ #define _VXFS_DIR_H_ /* * Veritas filesystem driver - directory structure. * * This file contains the definition of the vxfs directory format. */ /* * VxFS directory block header. * * This entry is the head of every filesystem block in a directory. * It is used for free space management and additionally includes * a hash for speeding up directory search (lookup). * * The hash may be empty and in fact we do not use it all in the * Linux driver for now. */ struct vxfs_dirblk { __fs16 d_free; /* free space in dirblock */ __fs16 d_nhash; /* no of hash chains */ __fs16 d_hash[1]; /* hash chain */ }; /* * VXFS_NAMELEN is the maximum length of the d_name field * of an VxFS directory entry. */ #define VXFS_NAMELEN 256 /* * VxFS directory entry. */ struct vxfs_direct { __fs32 d_ino; /* inode number */ __fs16 d_reclen; /* record length */ __fs16 d_namelen; /* d_name length */ __fs16 d_hashnext; /* next hash entry */ char d_name[VXFS_NAMELEN]; /* name */ }; /* * VXFS_DIRPAD defines the directory entry boundaries, is _must_ be * a multiple of four. * VXFS_NAMEMIN is the length of a directory entry with a NULL d_name. * VXFS_DIRROUND is an internal macros that rounds a length to a value * usable for directory sizes. * VXFS_DIRLEN calculates the directory entry size for an entry with * a d_name with size len. */ #define VXFS_DIRPAD 4 #define VXFS_NAMEMIN offsetof(struct vxfs_direct, d_name) #define VXFS_DIRROUND(len) ((VXFS_DIRPAD + (len) - 1) & ~(VXFS_DIRPAD -1)) #define VXFS_DIRLEN(len) (VXFS_DIRROUND(VXFS_NAMEMIN + (len))) /* * VXFS_DIRBLKOV is the overhead of a specific dirblock. */ #define VXFS_DIRBLKOV(sbi, dbp) \ ((sizeof(short) * fs16_to_cpu(sbi, dbp->d_nhash)) + 4) #endif /* _VXFS_DIR_H_ */ dc3341'>crypto
diff options
context:
space:
mode:
authorDouglas Miller <dougmill@linux.vnet.ibm.com>2017-01-28 06:42:20 -0600
committerTejun Heo <tj@kernel.org>2017-01-28 07:49:42 -0500
commit966d2b04e070bc040319aaebfec09e0144dc3341 (patch)
tree4b96156e3d1dd4dfd6039b7c219c9dc4616da52d /include/crypto
parent1b1bc42c1692e9b62756323c675a44cb1a1f9dbd (diff)
percpu-refcount: fix reference leak during percpu-atomic transition
percpu_ref_tryget() and percpu_ref_tryget_live() should return "true" IFF they acquire a reference. But the return value from atomic_long_inc_not_zero() is a long and may have high bits set, e.g. PERCPU_COUNT_BIAS, and the return value of the tryget routines is bool so the reference may actually be acquired but the routines return "false" which results in a reference leak since the caller assumes it does not need to do a corresponding percpu_ref_put(). This was seen when performing CPU hotplug during I/O, as hangs in blk_mq_freeze_queue_wait where percpu_ref_kill (blk_mq_freeze_queue_start) raced with percpu_ref_tryget (blk_mq_timeout_work). Sample stack trace: __switch_to+0x2c0/0x450 __schedule+0x2f8/0x970 schedule+0x48/0xc0 blk_mq_freeze_queue_wait+0x94/0x120 blk_mq_queue_reinit_work+0xb8/0x180 blk_mq_queue_reinit_prepare+0x84/0xa0 cpuhp_invoke_callback+0x17c/0x600 cpuhp_up_callbacks+0x58/0x150 _cpu_up+0xf0/0x1c0 do_cpu_up+0x120/0x150 cpu_subsys_online+0x64/0xe0 device_online+0xb4/0x120 online_store+0xb4/0xc0 dev_attr_store+0x68/0xa0 sysfs_kf_write+0x80/0xb0 kernfs_fop_write+0x17c/0x250 __vfs_write+0x6c/0x1e0 vfs_write+0xd0/0x270 SyS_write+0x6c/0x110 system_call+0x38/0xe0 Examination of the queue showed a single reference (no PERCPU_COUNT_BIAS, and __PERCPU_REF_DEAD, __PERCPU_REF_ATOMIC set) and no requests. However, conditions at the time of the race are count of PERCPU_COUNT_BIAS + 0 and __PERCPU_REF_DEAD and __PERCPU_REF_ATOMIC set. The fix is to make the tryget routines use an actual boolean internally instead of the atomic long result truncated to a int. Fixes: e625305b3907 percpu-refcount: make percpu_ref based on longs instead of ints Link: https://bugzilla.kernel.org/show_bug.cgi?id=190751 Signed-off-by: Douglas Miller <dougmill@linux.vnet.ibm.com> Reviewed-by: Jens Axboe <axboe@fb.com> Signed-off-by: Tejun Heo <tj@kernel.org> Fixes: e625305b3907 ("percpu-refcount: make percpu_ref based on longs instead of ints") Cc: stable@vger.kernel.org # v3.18+
Diffstat (limited to 'include/crypto')
9f66d3f9f96bc0f41d94b4830c0b2d0a50'>plain
-rw-r--r--ak4531_codec.h3173logplain
-rw-r--r--ak4641.h622logplain
-rw-r--r--ak4xxx-adda.h3416logplain
-rw-r--r--alc5623.h497logplain
-rw-r--r--asequencer.h3670logplain
-rw-r--r--asound.h1285logplain
-rw-r--r--asoundef.h17098logplain
-rw-r--r--atmel-abdac.h639logplain
-rw-r--r--atmel-ac97c.h1342logplain
-rw-r--r--compress_driver.h6772logplain
-rw-r--r--control.h8704logplain
-rw-r--r--core.h14380logplain
-rw-r--r--cs35l33.h1034logplain
-rw-r--r--cs35l34.h887logplain
-rw-r--r--cs4231-regs.h8480logplain
-rw-r--r--cs4271.h1417logplain
-rw-r--r--cs42l52.h738logplain
-rw-r--r--cs42l56.h1192logplain
-rw-r--r--cs42l73.h507logplain
-rw-r--r--cs8403.h8833logplain
-rw-r--r--cs8427.h10649logplain
-rw-r--r--da7213.h1178logplain
-rw-r--r--da7218.h2681logplain
-rw-r--r--da7219-aad.h2476logplain
-rw-r--r--da7219.h1064logplain
-rw-r--r--da9055.h914logplain
-rw-r--r--designware_i2s.h2249logplain
-rw-r--r--dmaengine_pcm.h6157logplain
-rw-r--r--emu10k1.h91396logplain
-rw-r--r--emu10k1_synth.h1382logplain
-rw-r--r--emu8000.h4109logplain
-rw-r--r--emu8000_reg.h10459logplain
-rw-r--r--emux_legacy.h5503logplain
-rw-r--r--emux_synth.h7649logplain
-rw-r--r--es1688.h3618logplain
-rw-r--r--gus.h20691logplain
-rw-r--r--hda_chmap.h2621logplain
-rw-r--r--hda_hwdep.h1412logplain
-rw-r--r--hda_i915.h1645logplain
-rw-r--r--hda_register.h9475logplain
-rw-r--r--hda_regmap.h6714logplain
-rw-r--r--hda_verbs.h17130logplain
-rw-r--r--hdaudio.h18455logplain
-rw-r--r--hdaudio_ext.h7119logplain
-rw-r--r--hdmi-codec.h2290logplain
-rw-r--r--hwdep.h2624logplain
-rw-r--r--i2c.h3555logplain
-rw-r--r--info.h7584logplain