id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
29a2e2836ff9ea65a603c89df217f4198973a74f
Analyze and fix the following issue in the Linux kernel code: x86-32: Fix endless loop when processing signals for kernel tasks
Problem Details: The problem occurs on !CONFIG_VM86 kernels [1] when a kernel-mode task returns from a system call with a pending signal. A real-life scenario is a child of 'khelper' returning from a failed kernel_execve() in ____call_usermodehelper() [ kernel/kmod.c ]. kernel_execve() fails due to a pending SIGKILL, ...
```diff diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index 79d97e68f042..7b784f4ef1e4 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S @@ -98,12 +98,6 @@ #endif .endm -#ifdef CONFIG_VM86 -#define resume_userspace_sig check_userspace -#else -#define resume_userspace_si...
bc67f63650fad6b3478d9ddfd5406d45a95987c9
Analyze and fix the following issue in the Linux kernel code: cciss: Fix scsi tape io with more than 255 scatter gather elements
Problem Details: The total number of scatter gather elements in the CISS command used by the scsi tape code was being cast to a u8, which can hold at most 255 scatter gather elements. It should have been cast to a u16. Without this patch the command gets rejected by the controller since the total scatter gather count...
```diff diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index f510a9c9a6fd..acda773b3720 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c @@ -1411,7 +1411,7 @@ static void cciss_scatter_gather(ctlr_info_t *h, CommandList_struct *c, /* track how many SG entries we are using...
5575acc7807595687288b3bbac15103f2a5462e1
Analyze and fix the following issue in the Linux kernel code: xfs: fix deadlock in xfs_rtfree_extent
Problem Details: To fix the deadlock caused by repeatedly calling xfs_rtfree_extent - removed xfs_ilock() and xfs_trans_ijoin() from xfs_rtfree_extent(), instead added asserts that the inode is locked and has an inode_item attached to it. - in xfs_bunmapi() when dealing with an inode with the rt flag call x...
```diff diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 3548c6f75593..85e7e327bcd8 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c @@ -5124,6 +5124,15 @@ xfs_bunmapi( cur->bc_private.b.flags = 0; } else cur = NULL; + + if (isrt) { + /* + * Synchronize by locking the bitmap inode. + */ + xf...
b8adde8ddec9ff62a21564fa8020b5463e70d4de
Analyze and fix the following issue in the Linux kernel code: kdb: Avoid using dbg_io_ops until it is initialized
Problem Details: This fixes a bug with setting a breakpoint during kdb initialization (from kdb_cmds). Any call to kdb_printf() before the initialization of the kgdboc serial console driver (which happens much later during bootup than kdb_init), results in kernel panic due to the use of dbg_io_ops before it is initial...
```diff diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 4802eb5840e1..9b5f17da1c56 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -689,7 +689,7 @@ kdb_printit: if (!dbg_kdb_mode && kgdb_connected) { gdbstub_msg_write(kdb_buffer, retlen); } else { - if (!dbg_io...
8f30d411767351656ea62c9e7612120f9b870b59
Analyze and fix the following issue in the Linux kernel code: KDB: Fix usability issues relating to the 'enter' key.
Problem Details: This fixes the following problems: 1) Typematic-repeat of 'enter' gives warning message and leaks make/break if KDB exits. Repeats look something like 0x1c 0x1c .... 0x9c 2) Use of 'keypad enter' gives warning message and leaks the ENTER break/make code out if KDB exits. KP ENTER repeats lo...
```diff diff --git a/kernel/debug/kdb/kdb_keyboard.c b/kernel/debug/kdb/kdb_keyboard.c index 4bca634975c0..118527aa60ea 100644 --- a/kernel/debug/kdb/kdb_keyboard.c +++ b/kernel/debug/kdb/kdb_keyboard.c @@ -25,6 +25,7 @@ #define KBD_STAT_MOUSE_OBF 0x20 /* Mouse output buffer full */ static int kbd_exists; +static i...
2366e047840e33928803c0442176fb3991423da8
Analyze and fix the following issue in the Linux kernel code: kgdb,debug-core,gdbstub: Hook the reboot notifier for debugger detach
Problem Details: The gdbstub and kdb should get detached if the system is rebooting. Calling gdbstub_exit() will set the proper debug core state and send a message to any debugger that is connected to correctly detach. An attached debugger will receive the exit code from include/linux/reboot.h based on SYS_HALT, SYS_R...
```diff diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 0d7c08784efb..3c1ad4e03543 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c @@ -41,6 +41,7 @@ #include <linux/delay.h> #include <linux/sched.h> #include <linux/sysrq.h> +#include <linux/reboot.h> #include <linux/i...
446e1c86d51d0823e003a43a2b85c430efce2733
Analyze and fix the following issue in the Linux kernel code: x86, boot: Correct CFLAGS for hostprogs
Problem Details: This is a partial revert of commit: d40f833 "Restrict CFLAGS for hostprogs" The endian-manipulation macros in tools/include need <linux/types.h>, but the hostprogs in arch/x86/boot need several headers from the kernel build tree, which means we have to add the kernel headers to the include path. ...
```diff diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index 3e02148bb774..5a747dd884db 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -37,9 +37,9 @@ setup-y += video-bios.o targets += $(setup-y) hostprogs-y := mkcpustr tools/build -HOSTCFLAGS_mkcpustr.o := -I$(srctree)/arch/$(S...
13354dc412c36fe554f9904a92f1268c74af7e87
Analyze and fix the following issue in the Linux kernel code: x86-32: Fix typo for mq_getsetattr in syscall table
Problem Details: Syscall 282 was mistakenly named mq_getsetaddr instead of mq_getsetattr. When building uClibc against the Linux kernel this would result in a shared library that doesn't provide the mq_getattr() and mq_setattr() functions. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Link: http://l...
```diff diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl index ce98e287c066..e7e67cc3c14b 100644 --- a/arch/x86/syscalls/syscall_32.tbl +++ b/arch/x86/syscalls/syscall_32.tbl @@ -288,7 +288,7 @@ 279 i386 mq_timedsend sys_mq_timedsend compat_sys_mq_timedsend 280 i386 mq_timedreceive ...
1c2ccc66bcef992bec7bad6d52cade66d632d7fb
Analyze and fix the following issue in the Linux kernel code: fs: xfs: fix section mismatch in linux-next
Problem Details: xfs_qm_exit() is called in init_xfs_fs(). Signed-off-by: Gerard Snitselaar <dev@snitselaar.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
```diff diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index 4be16a0cbe5a..1155208fa830 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c @@ -1065,7 +1065,7 @@ out: return -ENOMEM; } -void __exit +void xfs_qm_exit(void) { kmem_zone_destroy(xfs_qm_dqtrxzone); ```
ae295142d2d3989e49c6425c90d2593732a068a1
Analyze and fix the following issue in the Linux kernel code: iommu/amd: Fix section mismatch
Problem Details: amd_iommu_enable_interrupts() called in amd_iommu_resume(). Signed-off-by: Gerard Snitselaar <dev@snitselaar.org> Signed-off-by: Joerg Roedel <joro@8bytes.org>
```diff diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 8b026bfe05d1..a051f9a88bd2 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -196,7 +196,7 @@ static u32 rlookup_table_size; /* size if the rlookup table */ */ extern void iommu_flush_all_cach...
4bf9ce1b5ecffffeb8b9d7e925bac3e6b10109aa
Analyze and fix the following issue in the Linux kernel code: perf diff: Fix to work with new hists design
Problem Details: The perf diff command is broken since: perf hists: Threaded addition and sorting of entries commit 1980c2ebd7020d82c024b8c4046849b38e78e7da Several places were broken: - hists data need to be collected into opened sessions instead of into events - session's hists data need to be initialize...
```diff diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 4f19513d7dda..d29d350fb2b7 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -24,6 +24,11 @@ static char diff__default_sort_order[] = "dso,symbol"; static bool force; static bool show_displacement; +struct pe...
9fafd98f1bf14276f95b69f0186ad5675f1e1a18
Analyze and fix the following issue in the Linux kernel code: perf tools: Fix various casting issues for 32 bits
Problem Details: - util/parse-events.c(parse_events_add_breakpoint) need to use unsigned long instead of u64, otherwise we get following gcc error on 32 bits: error: cast from pointer to integer of different size - util/header.c(print_event_desc) cannot retype to signed type, otherwise we get following gc...
```diff diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index fcd9cf3ea63e..4c7c2d73251f 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -1177,7 +1177,7 @@ static void print_event_desc(struct perf_header *ph, int fd, FILE *fp) goto error; msz = sizeof(attr); - if (sz < (s...
1a8c55d37268d8b7ab7797e6d378caa697dbd029
Analyze and fix the following issue in the Linux kernel code: drm/i915: [dinq] shut up six instances of -Warray-bounds
Problem Details: Introduced in commits c1cd90ed and d27b1e0e Signed-off-by: Ben Widawsky <ben@bwidawsk.net> [danvet: s/fix/shut up in the commit msg and add a comment to the BUG_ON.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
```diff diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index fdb7ccefffbd..66c90d4477a3 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -704,6 +704,7 @@ static void i915_ring_error_state(struct seq_file *m, struct drm_i915_erro...
eb2c0c818a4109489de53fd7334c21f1f26f6635
Analyze and fix the following issue in the Linux kernel code: drm/i915: [dinq] shut up two instances -Wunitialized
Problem Details: Introduced in commit 8461d226 and 8c59967c Signed-off-by: Ben Widawsky <ben@bwidawsk.net> [danvet: s/fix/shut up/ in the commit msg.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
```diff diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 863e14ac0406..6b1859799e6c 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -387,7 +387,7 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, char __user *user_data; ssize_t remain; l...
01de982abf8c9e10fc3089e10585cd2cc914bdab
Analyze and fix the following issue in the Linux kernel code: tracing: Fix ftrace stack trace entries
Problem Details: 8 hex characters tell only half the tale for 64 bit CPUs, so use the appropriate length. Link: http://lkml.kernel.org/r/1332411501-8059-2-git-send-email-wolfgang.mauerer@siemens.com Cc: stable@vger.kernel.org Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@siemens.com> Signed-off-by: Steven Rostedt...
```diff diff --git a/kernel/trace/trace_entries.h b/kernel/trace/trace_entries.h index 93365907f219..205dcac89206 100644 --- a/kernel/trace/trace_entries.h +++ b/kernel/trace/trace_entries.h @@ -156,6 +156,12 @@ FTRACE_ENTRY_DUP(wakeup, ctx_switch_entry, #define FTRACE_STACK_ENTRIES 8 +#ifndef CONFIG_64BIT +# defi...
3489b42a72a41d477665ab37f196ae9257180abb
Analyze and fix the following issue in the Linux kernel code: ceph: fix three bugs, two in ceph_vxattrcb_file_layout()
Problem Details: In ceph_vxattrcb_file_layout(), there is a check to determine whether a preferred PG should be formatted into the output buffer. That check assumes that a preferred PG number of 0 indicates "no preference," but that is wrong. No preference is indicated by a negative (specifically, -1) PG number. In a...
```diff diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 8294f461ecd1..35b86331d8a5 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -79,7 +79,7 @@ static size_t ceph_vxattrcb_dir_rbytes(struct ceph_inode_info *ci, char *val, static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val, ...
37675b0f42a8f7699c3602350d1c3b2a1698a3d3
Analyze and fix the following issue in the Linux kernel code: libceph: fix inverted crc option logic
Problem Details: CRC's are computed for all messages between ceph entities. The CRC computation for the data portion of message can optionally be disabled using the "nocrc" (common) ceph option. The default is for CRC computation for the data portion to be enabled. Unfortunately, the code that implements this featur...
```diff diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 1a22975945da..589b7689d31b 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -812,7 +812,7 @@ static int write_partial_msg_pages(struct ceph_connection *con) struct ceph_msg *msg = con->out_msg; unsigned data_len = le32_to_cpu(msg-...
bca064d236a2e3162a07c758855221bcbe3c475b
Analyze and fix the following issue in the Linux kernel code: libceph: use "do" in CRC-related Boolean variables
Problem Details: Change the name (and type) of a few CRC-related Boolean local variables so they contain the word "do", to distingish their purpose from variables used for holding an actual CRC value. Note that in the process of doing this I identified a fairly serious logic error in write_partial_msg_pages(): the va...
```diff diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index 5ca0f8244203..3bff047f6b0f 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h @@ -98,7 +98,7 @@ struct ceph_msg { struct ceph_msg_pos { int page, page_pos; /* which page; offset in page */ int ...
32eec68d2f233e8a6ae1cd326022f6862e2b9ce3
Analyze and fix the following issue in the Linux kernel code: rbd: don't drop the rbd_id too early
Problem Details: Currently an rbd device's id is released when it is removed, but it is done before the code is run to clean up sysfs-related files (such as /sys/bus/rbd/devices/1). It's possible that an rbd is still in use after the rbd_remove() call has been made. It's essentially the same as an active inode that s...
```diff diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 568fa5b1206b..6bbd5af1f029 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2421,7 +2421,12 @@ static ssize_t rbd_add(struct bus_type *bus, if (rc) goto err_out_blkdev; - /* set up and announce blkdev mapping */ + /* + * At this ...
fed4c143ba8f08c8bddfdc7c69738e691a06d565
Analyze and fix the following issue in the Linux kernel code: rbd: fix module sysfs setup/teardown code
Problem Details: Once rbd_bus_type is registered, it allows an "add" operation via the /sys/bus/rbd/add bus attribute, and adding a new rbd device that way establishes a connection between the device and rbd_root_dev. But rbd_root_dev is not registered until after the rbd_bus_type registration is complete. This could ...
```diff diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 641f09898e19..b0f6812f8f99 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2564,19 +2564,21 @@ static int rbd_sysfs_init(void) { int ret; - ret = bus_register(&rbd_bus_type); + ret = device_register(&rbd_root_dev); if (ret < 0) ...
e28fff268e7d40ea7a936478c97ce41b6c22815f
Analyze and fix the following issue in the Linux kernel code: rbd: don't use sscanf() in rbd_add_parse_args()
Problem Details: Make use of a few simple helper routines to parse the arguments rather than sscanf(). This will treat both missing and too-long arguments as invalid input (rather than silently truncating the input in the too-long case). In time this can also be used by rbd_add() to use the passed-in buffer in place,...
```diff diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index caafe1d87a4b..085df6765d21 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2220,6 +2220,53 @@ static void rbd_id_put(struct rbd_device *rbd_dev) atomic64_cmpxchg(&rbd_id_max, rbd_id, max_id); } +/* + * Skips over white space at *bu...
f0f8cef5a30504eaeba5588a9115b46c824d91a3
Analyze and fix the following issue in the Linux kernel code: rbd: a few simple changes
Problem Details: Here are a few very simple cleanups: - Add a "RBD_" prefix to the two driver name string definitions. - Move the definition of struct rbd_request below struct rbd_req_coll to avoid the need for an empty declaration of the latter. - Move and group the definitions of rbd_root_dev_releas...
```diff diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 92b8c374d84d..812fd38cba3d 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -41,8 +41,8 @@ #include "rbd_types.h" -#define DRV_NAME "rbd" -#define DRV_NAME_LONG "rbd (rados block device)" +#define RBD_DRV_NAME "rbd" +#define RBD_DRV_...
881a5fa20092d221a7c4b365742c959ef4b297ec
Analyze and fix the following issue in the Linux kernel code: ceph: drop "_cb" from name of struct ceph_vxattr_cb
Problem Details: A struct ceph_vxattr_cb does not represent a callback at all, but rather a virtual extended attribute itself. Drop the "_cb" suffix from its name to reflect that. Signed-off-by: Alex Elder <elder@dreamhost.com> Signed-off-by: Sage Weil <sage@newdream.net>
```diff diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 38aef476f786..e29c7d3fa405 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -24,7 +24,7 @@ static bool ceph_is_valid_xattr(const char *name) * These define virtual xattrs exposing the recursive directory * statistics and layout metadata. */ -struct...
22891907193e005923a14384d82d702f6af4f0cf
Analyze and fix the following issue in the Linux kernel code: ceph: use a symbolic name for "ceph." extended attribute namespace
Problem Details: Use symbolic constants to define the top-level prefix for "ceph." extended attribute names. Signed-off-by: Alex Elder <elder@dreamhost.com> Signed-off-by: Sage Weil <sage@newdream.net>
```diff diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 3418615c53ea..05bb56f402a4 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -8,9 +8,12 @@ #include <linux/xattr.h> #include <linux/slab.h> +#define XATTR_CEPH_PREFIX "ceph." +#define XATTR_CEPH_PREFIX_LEN (sizeof (XATTR_CEPH_PREFIX) - 1) + static bo...
99f0f3b2c4be15784bb4ede33b5f2c3f7861dba7
Analyze and fix the following issue in the Linux kernel code: ceph: eliminate some abusive casts
Problem Details: This fixes some spots where a type cast to (void *) was used as as a universal type hiding mechanism. Instead, properly cast the type to the intended target type. Signed-off-by: Alex Elder <elder@newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
```diff diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 09a412ba4b70..3917847ad8e5 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -62,8 +62,8 @@ const char *ceph_pr_addr(const struct sockaddr_storage *ss) { int i; char *s; - struct sockaddr_in *in4 = (void *)ss; - struct sockaddr_in...
80834312a4da1405a9bc788313c67643de6fcb4c
Analyze and fix the following issue in the Linux kernel code: ceph: fix overflow check in build_snap_context()
Problem Details: The overflow check for a + n * b should be (n > (ULONG_MAX - a) / b), rather than (n > ULONG_MAX / b - a). Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: Sage Weil <sage@newdream.net>
```diff diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index a559c80f127a..f04c0961f993 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c @@ -331,7 +331,7 @@ static int build_snap_context(struct ceph_snap_realm *realm) /* alloc new snap context */ err = -ENOMEM; - if (num > ULONG_MAX / sizeof(u64) - sizeof(*snapc)) ...
64486697771cbe219fffcb5c8e2ed9ca4fdf086c
Analyze and fix the following issue in the Linux kernel code: libceph: fix overflow check in crush_decode()
Problem Details: The existing overflow check (n > ULONG_MAX / b) didn't work, because n = ULONG_MAX / b would both bypass the check and still overflow the allocation size a + n * b. The correct check should be (n > (ULONG_MAX - a) / b). Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: Sage Weil <sage@newdrea...
```diff diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index fd863fe76934..29ad46ec9dcf 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c @@ -283,7 +283,8 @@ static struct crush_map *crush_decode(void *pbyval, void *end) ceph_decode_32_safe(p, end, yes, bad); #if BITS_PER_LONG == 32 err = -EINVAL; - if...
182fac2689b769a96e7fc9defcd560c5cca92b1e
Analyze and fix the following issue in the Linux kernel code: net/ceph: Only clear SOCK_NOSPACE when there is sufficient space in the socket buffer
Problem Details: The Ceph messenger would sometimes queue multiple work items to write data to a socket when the socket buffer was full. Fix this problem by making ceph_write_space() use SOCK_NOSPACE in the same way that net/core/stream.c:sk_stream_write_space() does, i.e., clearing it only when sufficient space is av...
```diff diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index ad5b70801f37..d11f91b05452 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -143,16 +143,22 @@ static void ceph_write_space(struct sock *sk) struct ceph_connection *con = (struct ceph_connection *)sk->sk_user_data; - /* only qu...
4a163c82d600e554ef79e931db6315026e1fc819
Analyze and fix the following issue in the Linux kernel code: ASoC: Add extra parameter to device_prep_dma_cyclic
Problem Details: Since commit 185ecb5 (dmaengine: add context parameter to prep_slave_sg and prep_dma_cyclic) prep_dma_cyclic() got an extra context parameter. Add this new parameter in order to fix the following build error (mxs_defconfig and imx_v4_v5_defconfig): sound/soc/soc-dmaengine-pcm.c:149:3: error: too few ...
```diff diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c index 4420b7030c83..76c038b4a970 100644 --- a/sound/soc/soc-dmaengine-pcm.c +++ b/sound/soc/soc-dmaengine-pcm.c @@ -146,7 +146,7 @@ static int dmaengine_pcm_prepare_and_submit(struct snd_pcm_substream *substream) desc = chan->device->d...
b9136d207f0c05c96c6b9c980fa7f7fd541a65a8
Analyze and fix the following issue in the Linux kernel code: xen: initialize platform-pci even if xen_emul_unplug=never
Problem Details: When xen_emul_unplug=never is specified on kernel command line reading files from /sys/hypervisor is broken (returns -EBUSY). It is caused by xen_bus dependency on platform-pci and platform-pci isn't initialized when xen_emul_unplug=never is specified. Fix it by allowing platform-pci to ignore xen_emu...
```diff diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 9fd3ee203b1e..4276ab035e00 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -1452,6 +1452,9 @@ static int __init xlblk_init(void) if (!xen_domain()) return -ENODEV; + if (!xen_platform_pci_unplug...
106b44388d8f76373149c4ea144f717b6d4d9a6d
Analyze and fix the following issue in the Linux kernel code: xen/smp: Fix bringup bug in AP code.
Problem Details: The CPU hotplug code has now a callback to help bring up the CPU. Without the call we end up getting: BUG: soft lockup - CPU#0 stuck for 29s! [migration/0:6] Modules linked in: CPU ] Pid: 6, comm: migration/0 Not tainted 3.3.0upstream-01180-ged378a5 #1 Dell Inc. PowerEdge T105 /0RR825 RIP: e030:[<fff...
```diff diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index 449f86897db3..240def438dc3 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c @@ -75,8 +75,14 @@ static void __cpuinit cpu_bringup(void) xen_setup_cpu_clockevents(); + notify_cpu_starting(cpu); + + ipi_call_lock(); set_cpu_online(cpu, true...
26acaf08556a3c64ebf8ea3654b51e6acbb0a26c
Analyze and fix the following issue in the Linux kernel code: ALSA: hda/realtek - Fix ADC assignment with a shared HP/Mic pin
Problem Details: The recent Realtek driver tries to assign an extra input via the headphone plug when only a single input source is found. The code worked on Samsung Q1, but it broke ASUS 1015 where the mic is a digital-mic and only a specific ADC works. This patch fixes the assignment of ADC in the shared mic/hp cas...
```diff diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8ea2fd654327..9917e55d6f11 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -2717,9 +2717,6 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec) int max_nums = ARRAY_SIZE(spec->private_ad...
29cd293f9f8cd76444657622980010b9364b1de6
Analyze and fix the following issue in the Linux kernel code: toshiba_acpi: Support alternate hotkey interfaces
Problem Details: There are two types of problems that prevent hotkeys from working on many of the machines supported by toshiba_acpi. The first of these is the lack of a functioning SCI for hotkey events. For these machines it is possible to filter the Fn keypresses from the keyboard and generate a notification by exec...
```diff diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index eab5e11fb41f..42d73b0f530a 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c @@ -52,6 +52,8 @@ #include <linux/input/sparse-keymap.h> #include <linux/leds.h> #include <linux/s...
2d9dd99b4470a2ef05509435465e055f50456330
Analyze and fix the following issue in the Linux kernel code: gpio/twl: Allocate irq_desc dynamically for SPARSE_IRQ support
Problem Details: Do not use the board pdata for irq_base, but allocate them dynamically to allow a proper support of SPARSE_IRQ. Fix an unneeded line wrap. Signed-off-by: Benoit Cousson <b-cousson@ti.com> Acked-by: Felipe Balbi <balbi@ti.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Samuel Or...
```diff diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c index 697396c74627..49e5c6eb403a 100644 --- a/drivers/gpio/gpio-twl4030.c +++ b/drivers/gpio/gpio-twl4030.c @@ -395,23 +395,26 @@ static int gpio_twl4030_remove(struct platform_device *pdev); static int __devinit gpio_twl4030_probe(struct p...
914b20070b413ca10f832c45a58b2894990f065f
Analyze and fix the following issue in the Linux kernel code: btrfs: Fix busyloop in transaction_kthread()
Problem Details: When a filesystem got aborted due do error, transaction_kthread() will busyloop. Fix it by going to sleep in that case as well. Maybe we should just stop transaction_kthread() when filesystem is aborted but that would be more complex. Signed-off-by: Jan Kara <jack@suse.cz>
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 16a0cada26c2..438993e3d832 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1640,8 +1640,10 @@ static int transaction_kthread(void *arg) u64 transid; unsigned long now; unsigned long delay; + bool cannot_commit; do { + cannot_comm...
a0f65a267dd62aef4e003f833ea6290fd1e07b34
Analyze and fix the following issue in the Linux kernel code: netfilter: xt_LOG: use CONFIG_IP6_NF_IPTABLES instead of CONFIG_IPV6
Problem Details: This fixes the following linking error: xt_LOG.c:(.text+0x789b1): undefined reference to `ip6t_ext_hdr' ifdefs have to use CONFIG_IP6_NF_IPTABLES instead of CONFIG_IPV6. Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
```diff diff --git a/net/netfilter/xt_LOG.c b/net/netfilter/xt_LOG.c index f99f8dee238b..ff5f75fddb15 100644 --- a/net/netfilter/xt_LOG.c +++ b/net/netfilter/xt_LOG.c @@ -480,7 +480,7 @@ ipt_log_packet(u_int8_t pf, sb_close(m); } -#if IS_ENABLED(CONFIG_IPV6) +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) /* One level of...
2815ab92ba3ab27556212cc306288dc95692824b
Analyze and fix the following issue in the Linux kernel code: ACPI: Do cpufreq clamping for throttling per package v2
Problem Details: On Intel CPUs the processor typically uses the highest frequency set by any logical CPU. When the system overheats Linux first forces the frequency to the lowest available one to lower the temperature. However this was done only per logical CPU, which means all logical CPUs in a package would need to ...
```diff diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 3b599abf2b40..641b5450a0db 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -57,6 +57,27 @@ ACPI_MODULE_NAME("processor_thermal"); static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_re...
ea143604c5c8426923bbed7cd389fdaed7d58a2e
Analyze and fix the following issue in the Linux kernel code: ACPICA: ACPI 5: Update debug output for new notify values
Problem Details: Add new notify values, add support for "hardware specific" notifies. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
```diff diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c index 0912f62f05a0..51ef9f5e002d 100644 --- a/drivers/acpi/acpica/evmisc.c +++ b/drivers/acpi/acpica/evmisc.c @@ -108,27 +108,30 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, ACPI_FUNCTION_NAME(ev_queue_notify_reques...
6a6ea0acc9375571a13aa8c4e105a0807e1c16a4
Analyze and fix the following issue in the Linux kernel code: ARM: davinci: Fix for cpuidle consolidation changes
Problem Details: The recent cpuidle consolidation changes erroneously omitted one critical line of code. Signed-off-by: Robert Lee <rob.lee@linaro.org> Tested-by: Sekhar Nori <nsekhar@ti.com> Acked-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Len Brown <len.brown@intel.com>
```diff diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c index 93ae096c4ab2..9107691adbdb 100644 --- a/arch/arm/mach-davinci/cpuidle.c +++ b/arch/arm/mach-davinci/cpuidle.c @@ -55,10 +55,11 @@ static int davinci_enter_idle(struct cpuidle_device *dev, #define DAVINCI_CPUIDLE_FLAGS_DDR2_PWD...
f1f0e2ac596f531c15b7b09ebeb8cfd011fffbd2
Analyze and fix the following issue in the Linux kernel code: thermal: Fix for setting the thermal zone mode to enable/disable
Problem Details: Basically without this patch changing the mode of thermal zone is not possible as wrong string size is passed to strncmp. Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Len Brown <len.brown@intel.com>
```diff diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index fab970d9e3e1..022bacb71a7e 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c @@ -150,9 +150,9 @@ mode_store(struct device *dev, struct device_attribute *attr, if (!tz->ops->set_mode) return -EPERM;...
c5a01dd52dc4903772f464ea580895ccc36e911d
Analyze and fix the following issue in the Linux kernel code: thermal_sys: convert printks to pr_<level>
Problem Details: Use the current logging style. Remove PREFIX, add pr_fmt, convert the printks. All dmesg output now prefixed with "thermal_sys: ". Signed-off-by: Joe Perches <joe@perches.com> Cc: Jesper Juhl <jj@chaosbits.net> Cc: Len Brown <lenb@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> ...
```diff diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index db5d8f882668..fab970d9e3e1 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c @@ -23,6 +23,8 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +#define pr_fmt(fmt) ...
b11de07ce561574b6e03c8192b28bad540da8f79
Analyze and fix the following issue in the Linux kernel code: drivers/thermal/thermal_sys.c: fix build warning
Problem Details: With CONFIG_NET=n: drivers/thermal/thermal_sys.c:63: warning: 'thermal_event_seqnum' defined but not used Move 'thermal_event_seqnum' definition inside the '#ifdef CONFIG_NET' [akpm@linux-foundation.org: make thermal_event_seqnum local to generate_netlink_event()] Signed-off-by: Fabio Estevam <fabio...
```diff diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index 220ce7e31cf5..859b80b6d376 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c @@ -60,8 +60,6 @@ static LIST_HEAD(thermal_tz_list); static LIST_HEAD(thermal_cdev_list); static DEFINE_MUTEX(thermal_list_...
9395a09d05a23bb313cd20c99fb234f308d948b3
Analyze and fix the following issue in the Linux kernel code: l2tp: enable automatic module loading for l2tp_ppp
Problem Details: When L2TP is configured as a module, requests for L2TP sockets do not result in the l2tp_ppp module being loaded. Fix this by adding the appropriate MODULE_ALIAS to be recognized by pppox's request_module() call. Signed-off-by: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: David S. Miller <davem@d...
```diff diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index 9b071910b4ba..1addd9f3f40a 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -1845,3 +1845,4 @@ MODULE_AUTHOR("James Chapman <jchapman@katalix.com>"); MODULE_DESCRIPTION("PPP over L2TP over UDP"); MODULE_LICENSE("GPL"); MODULE_VERSION(P...
8ec3e70207486bbd3e2d3c0d6b809116ccd4f219
Analyze and fix the following issue in the Linux kernel code: cnic: Fix parity error code conflict
Problem Details: The recently added parity error handling used an error code that was already defined for a different error. This could lead to bnx2x firmware assert. We need to fix this with new error codes that are defined for parity error only. Signed-off-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Eddie W...
```diff diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index 7b65716b8734..c95e7b5e2b85 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c @@ -47,6 +47,7 @@ #include "bnx2x/bnx2x_hsi.h" #include "../../../scsi/bnx2i/57xx_iscsi_constan...
7ae5289017e5ed5514b2603d157fb54c058a3c82
Analyze and fix the following issue in the Linux kernel code: tg3: Fix RSS ring refill race condition
Problem Details: The RSS feature in tg3 hardware has only one rx producer ring for all RSS rings. NAPI vector 1 is special and handles the refilling of the rx producer ring on behalf of all RSS rings. There is a race condition between these RSS NAPIs and the NAPI[1]. If NAPI[1] finishes checking for refill and then ...
```diff diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index b0657466041d..7b71387cf93c 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -89,10 +89,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits) #...
a7967f055a9438941268d725b268141c57e32a05
Analyze and fix the following issue in the Linux kernel code: ext4: always set then trimmed blocks count into len
Problem Details: Currently if the range to trim is too small, for example on 1K fs the request to trim the first block, then the 'range->len' is not set reporting wrong number of discarded block to the caller. Fix this by always setting the 'range->len' before we return. Note that when there is a failure (-EINVAL) cal...
```diff diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index c8b6a8808166..99ab428bcfa0 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -5035,11 +5035,11 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) */ first_cluster = 0; } - range->len = trimmed * sb->s_blocksize; i...
21e7fd22a5a0ca83befe12c58cced21975dab213
Analyze and fix the following issue in the Linux kernel code: ext4: fix trimmed block count accunting
Problem Details: Currently when there is not enough free blocks in the block group to discard (grp->bb_free < minlen) the 'trimmed' is bumped up anyway with the number of discarded blocks from the previous iteration. Fix this by bumping up 'trimmed' only if the ext4_trim_all_free() was actually run. Signed-off-by: Luk...
```diff diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 7d5a1e3a703a..c8b6a8808166 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -5026,8 +5026,8 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) ret = cnt; break; } + trimmed += cnt; } - trimmed += cnt; ...
913eed83eda42012cde8a9a801c31b312545c098
Analyze and fix the following issue in the Linux kernel code: ext4: fix start and len arguments handling in ext4_trim_fs()
Problem Details: The overflow can happen when we are calling get_group_no_and_offset() which stores the group number in the ext4_grpblk_t type which is actually int. However when the blocknr is big enough the group number might be bigger than ext4_grpblk_t resulting in overflow. This will most likely happen with FITRIM...
```diff diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 23ec6a879b35..7d5a1e3a703a 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4914,11 +4914,11 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group, start = (e4b.bd_info->bb_first_free > start) ? e4b.bd_info->bb_first_free : start...
d8c37c480678ebe09bc570f33e085e28049db035
Analyze and fix the following issue in the Linux kernel code: thp: add HPAGE_PMD_* definitions for !CONFIG_TRANSPARENT_HUGEPAGE
Problem Details: These macros will be used in a later patch, where all usages are expected to be optimized away without #ifdef CONFIG_TRANSPARENT_HUGEPAGE. But to detect unexpected usages, we convert the existing BUG() to BUILD_BUG(). [akpm@linux-foundation.org: fix build in mm/pgtable-generic.c] Signed-off-by: Naoya...
```diff diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index f56cacb4fec3..c8af7a2efb52 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -51,6 +51,9 @@ extern pmd_t *page_check_address_pmd(struct page *page, unsigned long address, enum page_check_address_pmd_flag...
45f3e385b7a639c633d7a4b1e863c2d52b918258
Analyze and fix the following issue in the Linux kernel code: mm/memcontrol.c: remove redundant BUG_ON() in mem_cgroup_usage_unregister_event()
Problem Details: In the following code: if (type == _MEM) thresholds = &memcg->thresholds; else if (type == _MEMSWAP) thresholds = &memcg->memsw_thresholds; else BUG(); BUG_ON(!thresholds); The BUG_ON() seems redundant. Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org> Signed-off-by: Andrew Mort...
```diff diff --git a/mm/memcontrol.c b/mm/memcontrol.c index c200875072f7..4dc9709eff31 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4467,12 +4467,6 @@ static void mem_cgroup_usage_unregister_event(struct cgroup *cgrp, else BUG(); - /* - * Something went wrong if we trying to unregister a threshold - ...
13fd1dd9db345f6b2babd1e80a1c929092eb4896
Analyze and fix the following issue in the Linux kernel code: mm/memcontrol.c: s/stealed/stolen/
Problem Details: A grammatical fix. Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
```diff diff --git a/mm/memcontrol.c b/mm/memcontrol.c index eb1004f207b3..c200875072f7 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1332,8 +1332,8 @@ static void mem_cgroup_end_move(struct mem_cgroup *memcg) /* * 2 routines for checking "mem" is under move_account() or not. * - * mem_cgroup_stealed() - ...
4331f7d339ee0b54603344b9d13662a9c022540c
Analyze and fix the following issue in the Linux kernel code: memcg: fix performance of mem_cgroup_begin_update_page_stat()
Problem Details: mem_cgroup_begin_update_page_stat() should be very fast because it's called very frequently. Now, it needs to look up page_cgroup and its memcg....this is slow. This patch adds a global variable to check "any memcg is moving or not". With this, the caller doesn't need to visit page_cgroup and memcg. ...
```diff diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index bf7ae01fc93b..f94efd2f6c27 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -144,6 +144,8 @@ static inline bool mem_cgroup_disabled(void) void __mem_cgroup_begin_update_page_stat(struct page *page, bool *locke...
2ff76f1193f8481f7e6c29304eea4006e8e51569
Analyze and fix the following issue in the Linux kernel code: memcg: remove PCG_FILE_MAPPED
Problem Details: With the new lock scheme for updating memcg's page stat, we don't need a flag PCG_FILE_MAPPED which was duplicated information of page_mapped(). [hughd@google.com: cosmetic fix] [hughd@google.com: add comment to MEM_CGROUP_CHARGE_TYPE_MAPPED case in __mem_cgroup_uncharge_common()] Signed-off-by: KAMEZ...
```diff diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h index 7a3af748f32b..a88cdba27809 100644 --- a/include/linux/page_cgroup.h +++ b/include/linux/page_cgroup.h @@ -6,8 +6,6 @@ enum { PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */ PCG_USED, /* this object is in use. */ PCG_...
89c06bd52fb9ffceddf84f7309d2e8c9f1666216
Analyze and fix the following issue in the Linux kernel code: memcg: use new logic for page stat accounting
Problem Details: Now, page-stat-per-memcg is recorded into per page_cgroup flag by duplicating page's status into the flag. The reason is that memcg has a feature to move a page from a group to another group and we have race between "move" and "page stat accounting", Under current logic, assume CPU-A and CPU-B. CPU-...
```diff diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index c54e5dfa1962..bf7ae01fc93b 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -141,6 +141,31 @@ static inline bool mem_cgroup_disabled(void) return false; } +void __mem_cgroup_begin_update_page_stat(struct p...
b24028572fb69e9dd6de8c359eba2b2c66baa889
Analyze and fix the following issue in the Linux kernel code: memcg: remove PCG_CACHE page_cgroup flag
Problem Details: We record 'the page is cache' with the PCG_CACHE bit in page_cgroup. Here, "CACHE" means anonymous user pages (and SwapCache). This doesn't include shmem. Considering callers, at charge/uncharge, the caller should know what the page is and we don't need to record it by using one bit per page. This p...
```diff diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h index a2d11771c84b..106029243ff4 100644 --- a/include/linux/page_cgroup.h +++ b/include/linux/page_cgroup.h @@ -4,7 +4,6 @@ enum { /* flags for mem_cgroup */ PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */ - PCG_CACHE, /* c...
1480de0340a8d5f094b74d7c4b902456c9a06903
Analyze and fix the following issue in the Linux kernel code: mm: forbid lumpy-reclaim in shrink_active_list()
Problem Details: Reset the reclaim mode in shrink_active_list() to RECLAIM_MODE_SINGLE | RECLAIM_MODE_ASYNC. (sync/async sign is used only in shrink_page_list and does not affect shrink_active_list) Currenly shrink_active_list() sometimes works in lumpy-reclaim mode, if RECLAIM_MODE_LUMPYRECLAIM is left over from an ...
```diff diff --git a/mm/vmscan.c b/mm/vmscan.c index 55d86c9506f3..49f15ef0a99a 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1690,6 +1690,8 @@ static void shrink_active_list(unsigned long nr_to_scan, lru_add_drain(); + reset_reclaim_mode(sc); + if (!sc->may_unmap) isolate_mode |= ISOLATE_UNMAPPED; if (!s...
88f6b4c32e531dc5b06bd05144f790847a1fdaeb
Analyze and fix the following issue in the Linux kernel code: mmap.c: fix comment for __insert_vm_struct()
Problem Details: The comment above __insert_vm_struct seems to suggest that this function is also going to link the VMA with the anon_vma, but this is not true. This function only links the VMA to the mm->mm_rb tree and the mm->mmap linked list. [akpm@linux-foundation.org: improve comment layout and text] Signed-off-b...
```diff diff --git a/mm/mmap.c b/mm/mmap.c index a19cc271e794..230f0bac06b6 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -451,9 +451,8 @@ static void vma_link(struct mm_struct *mm, struct vm_area_struct *vma, } /* - * Helper for vma_adjust in the split_vma insert case: - * insert vm structure into list and rbtree and ...
d71b5a73fe9af42752c4329b087f7911b35f8f79
Analyze and fix the following issue in the Linux kernel code: numa_emulation: fix cpumask_of_node()
Problem Details: Without this fix the cpumask_of_node() for a fake=numa=2 is: cpumask 0 ff cpumask 1 ff with the fix it's correct and it's set to: cpumask 0 55 cpumask 1 aa Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Johannes Weiner <jweiner@redhat....
```diff diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index 46db56845f18..740b0a355431 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c @@ -60,7 +60,7 @@ static int __init emu_setup_memblk(struct numa_meminfo *ei, eb->nid = nid; if (emu_nid_to_phys[nid] == NU...
40716e29243de46720e5773797791466c28904ec
Analyze and fix the following issue in the Linux kernel code: hugetlbfs: fix alignment of huge page requests
Problem Details: When calling shmget() with SHM_HUGETLB, shmget aligns the request size to PAGE_SIZE, but this is not sufficient. Modify hugetlb_file_setup() to align requests to the huge page size, and to accept an address argument so that all alignment checks can be performed in hugetlb_file_setup(), rather than in ...
```diff diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 79408159a001..631329f3de63 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -935,8 +935,8 @@ static int can_do_hugetlb_shm(void) return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group); } -struct file *hugetlb_file_s...
05af2e104a0c282dcd9303431e1360750ba76de6
Analyze and fix the following issue in the Linux kernel code: mm, counters: remove task argument to sync_mm_rss() and __sync_task_rss_stat()
Problem Details: sync_mm_rss() can only be used for current to avoid race conditions in iterating and clearing its per-task counters. Remove the task argument for it and its helper function, __sync_task_rss_stat(), to avoid thinking it can be used safely for anything other than current. Signed-off-by: David Rientjes ...
```diff diff --git a/fs/exec.c b/fs/exec.c index 3908544f5d18..6ed164d20d7d 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -824,7 +824,7 @@ static int exec_mmap(struct mm_struct *mm) /* Notify parent that we're no longer interested in the old VM */ tsk = current; old_mm = current->mm; - sync_mm_rss(tsk, old_mm); + syn...
90481622d75715bfcb68501280a917dbfe516029
Analyze and fix the following issue in the Linux kernel code: hugepages: fix use after free bug in "quota" handling
Problem Details: hugetlbfs_{get,put}_quota() are badly named. They don't interact with the general quota handling code, and they don't much resemble its behaviour. Rather than being about maintaining limits on on-disk block usage by particular users, they are instead about maintaining limits on in-memory page usage (i...
```diff diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 4fbd9fccd550..7913e3252167 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -626,9 +626,15 @@ static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf) spin_lock(&sbinfo->stat_lock); /* If no limits set, just repor...
cc9a6c8776615f9c194ccf0b63a0aa5628235545
Analyze and fix the following issue in the Linux kernel code: cpuset: mm: reduce large amounts of memory barrier related damage v3
Problem Details: Commit c0ff7453bb5c ("cpuset,mm: fix no node to alloc memory when changing cpuset's mems") wins a super prize for the largest number of memory barriers entered into fast paths for one commit. [get|put]_mems_allowed is incredibly heavy with pairs of full memory barriers inserted into a number of hot pa...
```diff diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index e9eaec522655..7a7e5fd2a277 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h @@ -89,42 +89,33 @@ extern void rebuild_sched_domains(void); extern void cpuset_print_task_mems_allowed(struct task_struct *p); /* - * reading curren...
c7cfa37b7324a190fc36ff116d79d0f899e8d273
Analyze and fix the following issue in the Linux kernel code: mm/vmscan.c: fix spelling error
Problem Details: s/noticable/noticeable/ Signed-off-by: Copot Alexandru <alex.mihai.c@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
```diff diff --git a/mm/vmscan.c b/mm/vmscan.c index 57d8ef6ee4dd..440af1d899b9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2261,8 +2261,8 @@ static bool shrink_zones(int priority, struct zonelist *zonelist, * Even though compaction is invoked for any * non-zero order, only frequent costly order * ...
a05b0855fd15504972dba2358e5faa172a1e50ba
Analyze and fix the following issue in the Linux kernel code: hugetlbfs: avoid taking i_mutex from hugetlbfs_read()
Problem Details: Taking i_mutex in hugetlbfs_read() can result in deadlock with mmap as explained below Thread A: read() on hugetlbfs hugetlbfs_read() called i_mutex grabbed hugetlbfs_read_actor() called __copy_to_user() called page fault is triggered Thread B, sharing address space with A...
```diff diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index b7bc7868c7b5..19654cfe780b 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -245,17 +245,10 @@ static ssize_t hugetlbfs_read(struct file *filp, char __user *buf, loff_t isize; ssize_t retval = 0; - mutex_lock(&inode->i_mutex); -...
f5bf18fa22f8c41a13eb8762c7373eb3a93a7333
Analyze and fix the following issue in the Linux kernel code: bootmem/sparsemem: remove limit constraint in alloc_bootmem_section
Problem Details: While testing AMS (Active Memory Sharing) / CMO (Cooperative Memory Overcommit) on powerpc, we tripped the following: kernel BUG at mm/bootmem.c:483! cpu 0x0: Vector: 700 (Program Check) at [c000000000c03940] pc: c000000000a62bd8: .alloc_bootmem_core+0x90/0x39c lr: c000000000a64bcc: .s...
```diff diff --git a/mm/bootmem.c b/mm/bootmem.c index 668e94df8cf2..0131170c9d54 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c @@ -766,14 +766,13 @@ void * __init alloc_bootmem_section(unsigned long size, unsigned long section_nr) { bootmem_data_t *bdata; - unsigned long pfn, goal, limit; + unsigned long pf...
f0cb3c76ae1ced85f9034480b1b24cd96530ec78
Analyze and fix the following issue in the Linux kernel code: mm: drain percpu lru add/rotate page-vectors on cpu hot-unplug
Problem Details: This cpu hotplug hook was accidentally removed in commit 00a62ce91e55 ("mm: fix Committed_AS underflow on large NR_CPUS environment") The visible effect of this accident: some pages are borrowed in per-cpu page-vectors. Truncate can deal with it, but these pages cannot be reused while this cpu is off...
```diff diff --git a/include/linux/swap.h b/include/linux/swap.h index 64a7dba67840..b86b5c20617d 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -223,6 +223,7 @@ extern void lru_add_page_tail(struct zone* zone, extern void activate_page(struct page *); extern void mark_page_accessed(struct page *); ...
3268c63eded4612a3d07b56d1e02ce7731e6608e
Analyze and fix the following issue in the Linux kernel code: mm: fix move/migrate_pages() race on task struct
Problem Details: Migration functions perform the rcu_read_unlock too early. As a result the task pointed to may change from under us. This can result in an oops, as reported by Dave Hansen in https://lkml.org/lkml/2012/2/23/302. The following patch extend the period of the rcu_read_lock until after the permissions c...
```diff diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 0a3757067631..71e1a523e209 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1323,12 +1323,9 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode, err = -ESRCH; goto out; } - mm = get_task_mm(task); - rcu_read_unlock(); + get_task_str...
b76437579d1344b612cf1851ae610c636cec7db0
Analyze and fix the following issue in the Linux kernel code: procfs: mark thread stack correctly in proc/<pid>/maps
Problem Details: Stack for a new thread is mapped by userspace code and passed via sys_clone. This memory is currently seen as anonymous in /proc/<pid>/maps, which makes it difficult to ascertain which mappings are being used for thread stacks. This patch uses the individual task stack pointers to determine which vma...
```diff diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index a76a26a1db8a..b7413cb46dcb 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt @@ -290,7 +290,7 @@ Table 1-4: Contents of the stat files (as of 2.6.30-rc7) rsslim current lim...
cc715d99e529d470dde2f33a6614f255adea71f3
Analyze and fix the following issue in the Linux kernel code: mm: vmscan: forcibly scan highmem if there are too many buffer_heads pinning highmem
Problem Details: Stuart Foster reported on bugzilla that copying large amounts of data from NTFS caused an OOM kill on 32-bit X86 with 16G of memory. Andrew Morton correctly identified that the problem was NTFS was using 512 blocks meaning each page had 8 buffer_heads in low memory pinning it. In the past, direct rec...
```diff diff --git a/mm/vmscan.c b/mm/vmscan.c index 87e4d6a6dc11..ae3bf0a09cdd 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1642,18 +1642,6 @@ static void move_active_pages_to_lru(struct zone *zone, unsigned long pgmoved = 0; struct page *page; - if (buffer_heads_over_limit) { - spin_unlock_irq(&zone->lru_loc...
e873c49fbfdd595481976b915850e682441bcbec
Analyze and fix the following issue in the Linux kernel code: pagemap: export KPF_THP
Problem Details: This flag shows that a given page is a subpage of a transparent hugepage. It helps us debug and test the kernel by showing physical address of thp. Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Reviewed-by: Wu Fengguang <fengguang.wu@intel.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hir...
```diff diff --git a/fs/proc/page.c b/fs/proc/page.c index 6d8e6a9e93ab..7fcd0d60a968 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -115,6 +115,8 @@ u64 stable_page_flags(struct page *page) u |= 1 << KPF_COMPOUND_TAIL; if (PageHuge(page)) u |= 1 << KPF_HUGE; + else if (PageTransCompound(page)) + u |= 1 <...
025c5b2451e42c9e8dfdecd6dc84956ce8f321b5
Analyze and fix the following issue in the Linux kernel code: thp: optimize away unnecessary page table locking
Problem Details: Currently when we check if we can handle thp as it is or we need to split it into regular sized pages, we hold page table lock prior to check whether a given pmd is mapping thp or not. Because of this, when it's not "huge pmd" we suffer from unnecessary lock/unlock overhead. To remove it, this patch ...
```diff diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 95264c0ef308..328843de6e9f 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -394,20 +394,11 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, pte_t *pte; spinlock_t *ptl; - spin_lock(&walk->mm->page_table_...
4bfc130d5afa28395288d1b57092906349604b41
Analyze and fix the following issue in the Linux kernel code: hugetlbfs: fix hugetlb_get_unmapped_area()
Problem Details: Use/update cached_hole_size and free_area_cache properly to speedup finding of a free region. Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Michal Hocko <mhocko@suse....
```diff diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 1e85a7ac0217..b7bc7868c7b5 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -154,10 +154,12 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, return addr; } - start_addr = mm->free_area_cache; - - if (len <= ...
aad6ec3777bf4930d4f7293745cc4c17a2d87947
Analyze and fix the following issue in the Linux kernel code: mm: compaction: make compact_control order signed
Problem Details: "order" is -1 when compacting via /proc/sys/vm/compact_memory. Making it unsigned causes a bug in __compact_pgdat() when we test: if (cc->order < 0 || !compaction_deferred(zone, cc->order)) compact_zone(zone, cc); [akpm@linux-foundation.org: make __compact_pgdat()'s comparison match other code si...
```diff diff --git a/mm/compaction.c b/mm/compaction.c index a08bf219f88c..74a8c825ff28 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -35,7 +35,7 @@ struct compact_control { unsigned long migrate_pfn; /* isolate_migratepages search base */ bool sync; /* Synchronous migration */ - unsigned int order; /*...
8575ec29f61da83a2bf382c8c490499dc022101e
Analyze and fix the following issue in the Linux kernel code: compact_pgdat: workaround lockdep warning in kswapd
Problem Details: I get this lockdep warning from swapping load on linux-next, due to "vmscan: kswapd carefully call compaction". ================================= [ INFO: inconsistent lock state ] 3.3.0-rc2-next-20120201 #5 Not tainted --------------------------------- inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-...
```diff diff --git a/mm/compaction.c b/mm/compaction.c index c4b344a95032..a08bf219f88c 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -680,9 +680,6 @@ static int __compact_pgdat(pg_data_t *pgdat, struct compact_control *cc) int zoneid; struct zone *zone; - /* Flush pending updates to the LRU lists */ - lr...
aff622495c9a0b56148192e53bdec539f5e147f2
Analyze and fix the following issue in the Linux kernel code: vmscan: only defer compaction for failed order and higher
Problem Details: Currently a failed order-9 (transparent hugepage) compaction can lead to memory compaction being temporarily disabled for a memory zone. Even if we only need compaction for an order 2 allocation, eg. for jumbo frames networking. The fix is relatively straightforward: keep track of the highest order ...
```diff diff --git a/include/linux/compaction.h b/include/linux/compaction.h index 7a9323aef4a3..51a90b7f2d60 100644 --- a/include/linux/compaction.h +++ b/include/linux/compaction.h @@ -34,20 +34,26 @@ extern unsigned long compaction_suitable(struct zone *zone, int order); * allocation success. 1 << compact_defer_li...
67f96aa252e606cdf6c3cf1032952ec207ec0cf0
Analyze and fix the following issue in the Linux kernel code: mm: make swapin readahead skip over holes
Problem Details: Ever since abandoning the virtual scan of processes, for scalability reasons, swap space has been a little more fragmented than before. This can lead to the situation where a large memory user is killed, swap space ends up full of "holes" and swapin readahead is totally ineffective. On my home system...
```diff diff --git a/include/linux/swap.h b/include/linux/swap.h index 3e60228e7299..64a7dba67840 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -329,7 +329,6 @@ extern long total_swap_pages; extern void si_swapinfo(struct sysinfo *); extern swp_entry_t get_swap_page(void); extern swp_entry_t get_sw...
c38446cc65e1f2b3eb8630c53943b94c4f65f670
Analyze and fix the following issue in the Linux kernel code: mm: vmscan: fix misused nr_reclaimed in shrink_mem_cgroup_zone()
Problem Details: The value of nr_reclaimed is the number of pages reclaimed in the current round of the loop, whereas nr_to_reclaim should be compared with the number of pages reclaimed in all rounds. In each round of the loop, reclaimed pages are cut off from the reclaim goal, and the loop stops once the goal achieve...
```diff diff --git a/mm/vmscan.c b/mm/vmscan.c index 61a66881235d..8dfa59866af2 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2112,7 +2112,12 @@ restart: * with multiple processes reclaiming pages, the total * freeing target can get unreasonably large. */ - if (nr_reclaimed >= nr_to_reclaim && priority < ...
c3f0327f8e9d7a503f0d64573c311eddd61f197d
Analyze and fix the following issue in the Linux kernel code: mm: add rss counters consistency check
Problem Details: Warn about non-zero rss counters at final mmdrop. This check will prevent reoccurences of bugs such as that fixed in "mm: fix rss count leakage during migration". I didn't hide this check under CONFIG_VM_DEBUG because it rather small and rss counters cover whole page-table management, so this is a go...
```diff diff --git a/kernel/fork.c b/kernel/fork.c index c4f38a849436..a9e99f3c18e0 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -511,6 +511,23 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p) return NULL; } +static void check_mm(struct mm_struct *mm) +{ + int i; + + for (i = 0...
fa47ac59020e91082386f65a01f3e8cc6116ef95
Analyze and fix the following issue in the Linux kernel code: xtensa: don't reimplement force_sigsegv()
Problem Details: Instead of open coding the sequence from force_sigsegv() just call it. This also fixes a bug because we were modifying ka->sa.sa_handler (which is a copy of sighand->action[]), whereas the intention of the code was to modify sighand->action[] directly. As the original code was working with a copy it h...
```diff diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c index f2220b5bdce6..4f53770c42ec 100644 --- a/arch/xtensa/kernel/signal.c +++ b/arch/xtensa/kernel/signal.c @@ -425,9 +425,7 @@ static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, return; give_sigsegv: - if (sig ==...
7904ac84244b59f536c2a5d1066a10f46df07b08
Analyze and fix the following issue in the Linux kernel code: seq_file: fix mishandling of consecutive pread() invocations.
Problem Details: The following program illustrates the problem: char buf[8192]; int fd = open("/proc/self/maps", O_RDONLY); n = pread(fd, buf, sizeof(buf), 0); printf("%d\n", n); /* lseek(fd, 0, SEEK_CUR); */ /* Uncomment to work around */ n = pread(fd, buf, sizeof(buf), 0); printf("%d\...
```diff diff --git a/fs/seq_file.c b/fs/seq_file.c index 4023d6be939b..aa242dc99373 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -140,9 +140,21 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) mutex_lock(&m->lock); + /* + * seq_file->op->..m_start/m_stop/m_next may do spec...
dc716e96f5a467835e8121e1caaf25d66a901cb3
Analyze and fix the following issue in the Linux kernel code: drivers/idle/intel_idle.c: fix confusing code identation
Problem Details: Fix a code indentation in the function intel_idle_cpu_init that looks confusing.o Suggested-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Signed-off-by: Marcos Paulo de Souza <marcos.mage@gmail.com> Cc: "Brown, Len" <len.brown@...
```diff diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index 1c15e9b33575..d0f59c3f87ef 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c @@ -507,8 +507,7 @@ int intel_idle_cpu_init(int cpu) int num_substates; if (cstate > max_cstate) { - printk(PREFIX "max_cstate %d r...
1de5b41cd3b2474c2770b825266d372073e1b28b
Analyze and fix the following issue in the Linux kernel code: fs/namei.c: fix warnings on 32-bit
Problem Details: i386 allnoconfig: fs/namei.c: In function 'has_zero': fs/namei.c:1617: warning: integer constant is too large for 'unsigned long' type fs/namei.c:1617: warning: integer constant is too large for 'unsigned long' type fs/namei.c: In function 'hash_name': fs/namei.c:1635: warning: integer const...
```diff diff --git a/fs/namei.c b/fs/namei.c index 20a4fcf001ec..561db47ae041 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1455,9 +1455,15 @@ done: } EXPORT_SYMBOL(full_name_hash); +#ifdef CONFIG_64BIT #define ONEBYTES 0x0101010101010101ul #define SLASHBYTES 0x2f2f2f2f2f2f2f2ful #define HIGHBITS 0x80808080808080...
1a5a9906d4e8d1976b701f889d8f35d54b928f25
Analyze and fix the following issue in the Linux kernel code: mm: thp: fix pmd_bad() triggering in code paths holding mmap_sem read mode
Problem Details: In some cases it may happen that pmd_none_or_clear_bad() is called with the mmap_sem hold in read mode. In those cases the huge page faults can allocate hugepmds under pmd_none_or_clear_bad() and that can trigger a false positive from pmd_bad() that will not like to see a pmd materializing as trans hu...
```diff diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c index b466cab5ba15..328cb37bb827 100644 --- a/arch/x86/kernel/vm86_32.c +++ b/arch/x86/kernel/vm86_32.c @@ -172,6 +172,7 @@ static void mark_screen_rdonly(struct mm_struct *mm) spinlock_t *ptl; int i; + down_write(&mm->mmap_sem); pgd = p...
0678b61851b510ba68341dff59cd9b47e1712e91
Analyze and fix the following issue in the Linux kernel code: btrfs: Don't BUG_ON kzalloc error in btrfs_lookup_csums_range()
Problem Details: Unfortunately it isn't enough to just exit here - the kzalloc() happens in a loop and the allocated items are added to a linked list whose head is passed in from the caller. To fix the BUG_ON() and also provide the semantic that the list passed in is only modified on success, I create function-local t...
```diff diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index edb69b4d5335..89af104c7569 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -284,6 +284,7 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end, struct btrfs_ordered_sum *sums; struct btrfs_sector_sum *sector...
ce598979be6f83549c90f42ba522a19a33727611
Analyze and fix the following issue in the Linux kernel code: btrfs: Don't BUG_ON errors from btrfs_create_subvol_root()
Problem Details: This is called from only one place - create_subvol() which passes errors safely back out to it's caller, btrfs_mksubvol where they are handled. Additionally, btrfs_create_subvol_root() itself bug's needlessly from error return of btrfs_update_inode(). Since create_subvol() was fixed to catch errors we...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 593a2c3a27ab..41132339e2ea 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6734,10 +6734,9 @@ int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, btrfs_i_size_write(inode, 0); err = btrfs_update_inode(trans, new_root, inode); - BUG...
3444a97255de907f32562741fb6d104620b9fce3
Analyze and fix the following issue in the Linux kernel code: btrfs: Factor out tree->ops->merge_bio_hook call
Problem Details: In submit_extent_page, there's a visually noisy if statement that, in the midst of other conditions, does the tree dependency for tree->ops and tree->ops->merge_bio_hook before calling it, and then another condition afterwards. If an error is returned from merge_bio_hook, there's no way to catch it. It...
```diff diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index a4a7a18cdd3d..c342e923ea41 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2429,6 +2429,19 @@ static int submit_one_bio(int rw, struct bio *bio, int mirror_num, return ret; } +static int merge_bio(struct extent_io_tree *tree, s...
b45a9d8b48e5ce534bd222007c43cbf374544f0b
Analyze and fix the following issue in the Linux kernel code: btrfs: btrfs_update_root error push-up
Problem Details: btrfs_update_root BUG's when it can't alloc a path, yet it can recover from a search error. This patch returns -ENOMEM instead. Signed-off-by: Jeff Mahoney <jeffm@suse.com>
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index a97a67089755..339e637ab272 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -2724,9 +2724,10 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root ...
d5c13f927fe77b11a67f79559808c68b26474c77
Analyze and fix the following issue in the Linux kernel code: btrfs: clean_tree_block should panic on observed memory corruption and return void
Problem Details: The only error condition in clean_tree_block is an accounting bug. Returning without modifying dirty_metadata_bytes and as if the cleaning as been performed may cause problems later so it should panic instead. It should probably be a BUG_ON but we have btrfs_panic now. Signed-off-by: Jeff Mahoney ...
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 534266fe505f..d52ec1155204 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1109,8 +1109,8 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr, } -int clean_tree_block(struct btrfs_trans_handle *trans, struct bt...
cddcd800189bc03745d576f913dc57692c6f439a
Analyze and fix the following issue in the Linux kernel code: btrfs: Fix kfree of member instead of structure
Problem Details: Correctness fix: The kfree calls in the add_delayed_* functions free the node that's passed into it, but the node is a member of another structure. It works because it's always the first member of the containing structure, but it should really be using the containing structure itself. Signed-off-by: J...
```diff diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index 66e4f29505a3..29ecd543d807 100644 --- a/fs/btrfs/delayed-ref.c +++ b/fs/btrfs/delayed-ref.c @@ -487,7 +487,7 @@ static noinline int add_delayed_ref_head(struct btrfs_fs_info *fs_info, * we've updated the existing ref, free the newly * al...
8c3429300181be44b30f9f017d53dc717da56caa
Analyze and fix the following issue in the Linux kernel code: btrfs: Add btrfs_panic()
Problem Details: As part of the effort to eliminate BUG_ON as an error handling technique, we need to determine which errors are actual logic errors, which are on-disk corruption, and which are normal runtime errors e.g. -ENOMEM. Annotating these error cases is helpful to understand and report them. This patch adds a...
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 80b6486fd5e6..a97a67089755 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1503,6 +1503,7 @@ struct btrfs_ioctl_defrag_range_args { #define BTRFS_MOUNT_SKIP_BALANCE (1 << 19) #define BTRFS_MOUNT_CHECK_INTEGRITY (1 << 20) #define BTRFS_MOUNT_CHEC...
2a2a459eeeff48640dc557548ce576d666ab06ed
Analyze and fix the following issue in the Linux kernel code: net: fix napi_reuse_skb() skb reserve
Problem Details: napi->skb is allocated in napi_get_frags() using netdev_alloc_skb_ip_align(), with a reserve of NET_SKB_PAD + NET_IP_ALIGN bytes. However, when such skb is recycled in napi_reuse_skb(), it ends with a reserve of NET_IP_ALIGN which is suboptimal. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Cc...
```diff diff --git a/net/core/dev.c b/net/core/dev.c index 0f3eb7d79a2d..452db7090d18 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3560,7 +3560,8 @@ EXPORT_SYMBOL(napi_gro_receive); static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) { __skb_pull(skb, skb_headlen(skb)); - skb_reserve(s...
a4b4be3fd7a76021f67380b03d8bccebf067db72
Analyze and fix the following issue in the Linux kernel code: edac: rename channel_info to rank_info
Problem Details: What it is pointed by a csrow/channel vector is a rank information, and not a channel information. On a traditional architecture, the memory controller directly access the memory ranks, via chip select rows. Different ranks at the same DIMM is selected via different chip select rows. So, typically, on...
```diff diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index ca6c04d350ee..690cbf15a007 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -39,7 +39,7 @@ static LIST_HEAD(mc_devices); #ifdef CONFIG_EDAC_DEBUG -static void edac_mc_dump_channel(struct channel_info *chan) +static void e...
0142877aa4e54dd9943fb727e9b386c36c8e3ab7
Analyze and fix the following issue in the Linux kernel code: i5400_edac: Avoid calling pci_put_device() twice
Problem Details: When i5400_edac driver is removed and re-loaded a few times, it causes an OOPS, as it is currently decrementing some PCI device usage two times. When called inside a loop, pci_get_device() will call pci_put_device(). That mangles the error count. In this specific case, it seems easier to just duplicat...
```diff diff --git a/drivers/edac/i5400_edac.c b/drivers/edac/i5400_edac.c index 74d6ec342afb..b44a5de1c22c 100644 --- a/drivers/edac/i5400_edac.c +++ b/drivers/edac/i5400_edac.c @@ -735,7 +735,7 @@ static int i5400_get_devices(struct mem_ctl_info *mci, int dev_idx) /* Attempt to 'get' the MCH register we want */ ...
b6378cb3e545912a19e6355aa9171326fdc004d8
Analyze and fix the following issue in the Linux kernel code: edac: i5100 fix erroneous define for M1Err
Problem Details: According to [1] the define for M1Err in the FERR_NF_MEM register is wrong. It should be at position 1 not 0. [1] Intel 5100 Memory Controller Hub Chipset Doc.Nr: 318378 http://www.intel.com/content/dam/doc/datasheet/5100- memory-controller-hub-chipset-datasheet.pdf Reported-by: Ba Thang Nguy...
```diff diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c index bcbdeeca48b8..ab2f90619821 100644 --- a/drivers/edac/i5100_edac.c +++ b/drivers/edac/i5100_edac.c @@ -49,7 +49,7 @@ #define I5100_FERR_NF_MEM_M6ERR_MASK (1 << 6) #define I5100_FERR_NF_MEM_M5ERR_MASK (1 << 5) #define I5100_FERR_NF_MEM...
7fae0db43906ef182b3aee22415c9042ab18d6e6
Analyze and fix the following issue in the Linux kernel code: edac: sb_edac: Fix a wrong value setting for the previous value
Problem Details: >From the driver design, the variable limit wants to compare with its previous value, we should set the value of limit instead of the value of tmp_mb to the variable prev. Signed-off-by: Hui Wang <jason77.wang@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
```diff diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c index 843545beba64..291788798b6f 100644 --- a/drivers/edac/sb_edac.c +++ b/drivers/edac/sb_edac.c @@ -763,7 +763,7 @@ static void get_memory_layout(const struct mem_ctl_info *mci) (u32)TAD_TGT2(reg), (u32)TAD_TGT3(reg), reg); - prv = tmp_...
ad9c40b7dd749d6429c8b21178c125004c6dc75d
Analyze and fix the following issue in the Linux kernel code: edac: sb_edac: Fix a INTERLEAVE_MODE() misuse
Problem Details: We can identify dram interleave mode from the Dram Rule register rather than Dram Interleave list register. In this context, the reg of INTERLEAVE_MODE(reg) contains the Dram Interleave list register, we can't get interleave mode from the reg, while the variable interleave_mode saves the the mode got ...
```diff diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c index f256a121fec3..843545beba64 100644 --- a/drivers/edac/sb_edac.c +++ b/drivers/edac/sb_edac.c @@ -923,7 +923,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci, addr, limit, sad_way + 7, - INTERLEAVE_MODE(reg) ? "" : "XOR[18:...
b877763ea01d740f6c62a35c45b7351fec9c288d
Analyze and fix the following issue in the Linux kernel code: edac/ppc4xx_edac: Fix compilation
Problem Details: It seems that nobody is cross-compiling for this arch anymore... drivers/edac/ppc4xx_edac.c: In function 'ppc4xx_edac_probe': drivers/edac/ppc4xx_edac.c:188:12: error: storage class specified for parameter 'ppc4xx_edac_remove' ... drivers/edac/ppc4xx_edac.c:1068:19: error: 'match' undeclared (first us...
```diff diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c index fc757069c6af..d427c69bb8b1 100644 --- a/drivers/edac/ppc4xx_edac.c +++ b/drivers/edac/ppc4xx_edac.c @@ -184,7 +184,7 @@ struct ppc4xx_ecc_status { /* Function Prototypes */ -static int ppc4xx_edac_probe(struct platform_device *devic...
5b889e379f340f43b1252abde5d37a7084c846b9
Analyze and fix the following issue in the Linux kernel code: Fix sb_edac compilation with 32 bits kernels
Problem Details: As reported by Josh Boyer <jwboyer@redhat.com>: > drivers/edac/sb_edac.c: In function 'get_memory_error_data': > drivers/edac/sb_edac.c:861:2: warning: left shift count >= width of type > [enabled by default] > <snip> > ERROR: "__udivdi3" [drivers/edac/sb_edac.ko] undefined! > make[1]: *** [__modp...
```diff diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig index 5948a2194f50..203361e4ef94 100644 --- a/drivers/edac/Kconfig +++ b/drivers/edac/Kconfig @@ -214,7 +214,7 @@ config EDAC_I7300 config EDAC_SBRIDGE tristate "Intel Sandy-Bridge Integrated MC" - depends on EDAC_MM_EDAC && PCI && X86_64 && X86_MCE_...
8c3ec84102d171a24f050a086bfc546e9de93f9f
Analyze and fix the following issue in the Linux kernel code: ARM: tegra: Fix device tree AUXDATA for USB/EHCI
Problem Details: Commit 4a53f4e "USB: ehci-tegra: add probing through device tree" added AUXDATA for Tegra's USB/EHCI controller. However, it pointed the platform data at a location containing the address of the intended platform data, rather than the platform data itself. This change fixes that. Signed-off-by: Stephe...
```diff diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c index 7a95e0bc4aba..7cd34565a2da 100644 --- a/arch/arm/mach-tegra/board-dt-tegra20.c +++ b/arch/arm/mach-tegra/board-dt-tegra20.c @@ -68,11 +68,11 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { OF_DE...
1daaae8fa4afe3df78ca34e724ed7e8187e4eb32
Analyze and fix the following issue in the Linux kernel code: cifs: fix issue mounting of DFS ROOT when redirecting from one domain controller to the next
Problem Details: This patch fixes an issue when cifs_mount receives a STATUS_BAD_NETWORK_NAME error during cifs_get_tcon but is able to continue after an DFS ROOT referral. In this case, the return code variable is not reset prior to trying to mount from the system referred to. Thus, is_path_accessible is not executed ...
```diff diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 03f71fb40a8a..0ac595c8c262 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3368,7 +3368,7 @@ cifs_ra_pages(struct cifs_sb_info *cifs_sb) int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) { - int rc = 0; + int rc; in...