3.14.52-stable review
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 5/18 perf: Fix fasync handling on inherited events
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit fed66e2cdd4f127a43fd11b8d92a99bdd429528c upstream.
Vince reported that the fasync signal stuff doesn't work proper for inherited events. So fix that.
Installing fasync allocates memory and sets filp->f_flags |= FASYNC, which upon the demise of the file descriptor ensures the allocation is freed and state is updated.
Now for perf, we can have the events stick around for a while after the original FD is dead because of references from child events. So we cannot copy the fasync pointer around. We can however consistently use the parent's fasync, as that will be updated.
--- kernel/events/core.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
kernel/events/core.c +10 -2
@@ -4218,12 +4218,20 @@ static const struct file_operations perf* to user-space before waking everybody up. */ +static inline struct fasync_struct **perf_event_fasync (struct perf_event *event) +{ +/* only the parent has fasync state */ +if (event->parent) + event = event->parent; +return &event->fasync; +} +void perf_event_wakeup (struct perf_event *event) {ring_buffer_wakeup (event);if (event->pending_kill) { -kill_fasync (&event->fasync,SIGIO , event->pending_kill); +kill_fasync (perf_event_fasync (event),SIGIO , event->pending_kill); event->pending_kill =0 ; } }
@@ -5432,7 +5440,7 @@ static int __perf_event_overflow(structelse perf_event_output (event, data, regs); -if (event->fasync && event->pending_kill) { +if (*perf_event_fasync (event) && event->pending_kill) { event->pending_wakeup =1 ;irq_work_queue (&event->pending); }
Greg Kroah-Hartman
maintainerPATCH 12/18 libfc: Fix fc_exch_recv_req() error path
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit f6979adeaab578f8ca14fdd32b06ddee0d9d3314 upstream.
Due to patch "libfc: Do not invoke the response handler after fc_exch_done()" (commit ID 7030fd62) the lport_recv() call in fc_exch_recv_req() is passed a dangling pointer. Avoid this by moving the fc_frame_free() call from fc_invoke_resp() to its callers. This patch fixes the following crash:
general protection fault: 0000 [#3] PREEMPT SMP RIP: fc_lport_recv_req+0x72/0x280 [libfc] Call Trace: fc_exch_recv+0x642/0xde0 [libfc] fcoe_percpu_receive_thread+0x46a/0x5ed [fcoe] kthread+0x10a/0x120 ret_from_fork+0x42/0x70
--- drivers/scsi/libfc/fc_exch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/libfc/fc_exch.c +4 -4
@@ -733,8 +733,6 @@ static bool fc_invoke_resp(struct fc_excif (resp) {resp (sp, fp, arg); res = true; - }else if (!IS_ERR (fp)) { -fc_frame_free (fp); }spin_lock_bh (&ep->ex_lock);
@@ -1596,7 +1594,8 @@ static void fc_exch_recv_seq_resp(struct* If new exch resp handler is valid then call that * first. */ -fc_invoke_resp (ep, sp, fp); +if (!fc_invoke_resp (ep, sp, fp)) +fc_frame_free (fp);fc_exch_release (ep);return ;
@@ -1695,7 +1694,8 @@ static void fc_exch_abts_resp(struct fc_fc_exch_hold (ep);if (!rc)fc_exch_delete (ep); -fc_invoke_resp (ep, sp, fp); +if (!fc_invoke_resp (ep, sp, fp)) +fc_frame_free (fp);if (has_rec)fc_exch_timer_set (ep, ep->r_a_tov);fc_exch_release (ep);
Greg Kroah-Hartman
maintainerPATCH 13/18 libfc: Fix fc_fcp_cleanup_each_cmd()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 8f2777f53e3d5ad8ef2a176a4463a5c8e1a16431 upstream.
Since fc_fcp_cleanup_cmd() can sleep this function must not be called while holding a spinlock. This patch avoids that fc_fcp_cleanup_each_cmd() triggers the following bug:
BUG: scheduling while atomic: sg_reset/1512/0x00000202
1 lock held by sg_reset/1512:
#0: (&(&fsp->scsi_pkt_lock)->rlock){+.-...}, at: [<ffffffffc0225cd5>] fc_fcp_cleanup_each_cmd.isra.21+0xa5/0x150 [libfc]
Preemption disabled at:[<ffffffffc0225cd5>] fc_fcp_cleanup_each_cmd.isra.21+0xa5/0x150 [libfc]
Call Trace:
[<ffffffff816c612c>] dump_stack+0x4f/0x7b
[<ffffffff810828bc>] __schedule_bug+0x6c/0xd0
[<ffffffff816c87aa>] __schedule+0x71a/0xa10
[<ffffffff816c8ad2>] schedule+0x32/0x80
[<ffffffffc0217eac>] fc_seq_set_resp+0xac/0x100 [libfc]
[<ffffffffc0218b11>] fc_exch_done+0x41/0x60 [libfc]
[<ffffffffc0225cff>] fc_fcp_cleanup_each_cmd.isra.21+0xcf/0x150 [libfc]
[<ffffffffc0225f43>] fc_eh_device_reset+0x1c3/0x270 [libfc]
[<ffffffff814a2cc9>] scsi_try_bus_device_reset+0x29/0x60
[<ffffffff814a3908>] scsi_ioctl_reset+0x258/0x2d0
[<ffffffff814a2650>] scsi_ioctl+0x150/0x440
[<ffffffff814b3a9d>] sd_ioctl+0xad/0x120
[<ffffffff8132f266>] blkdev_ioctl+0x1b6/0x810
[<ffffffff811da608>] block_ioctl+0x38/0x40
[<ffffffff811b4e08>] do_vfs_ioctl+0x2f8/0x530
[<ffffffff811b50c1>] SyS_ioctl+0x81/0xa0
[<ffffffff816cf8b2>] system_call_fastpath+0x16/0x7a--- drivers/scsi/libfc/fc_fcp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/scsi/libfc/fc_fcp.c +17 -2
@@ -1039,11 +1039,26 @@ restart:fc_fcp_pkt_hold (fsp);spin_unlock_irqrestore (&si->scsi_queue_lock, flags); -if (!fc_fcp_lock_pkt (fsp)) { +spin_lock_bh (&fsp->scsi_pkt_lock); +if (!(fsp->state &FC_SRB_COMPL )) { + fsp->state |=FC_SRB_COMPL ; +/* +* TODO: dropping scsi_pkt_lock and then reacquiring +* again around fc_fcp_cleanup_cmd() is required, +* since fc_fcp_cleanup_cmd() calls into +* fc_seq_set_resp() and that func preempts cpu using +* schedule. May be schedule and related code should be +* removed instead of unlocking here to avoid scheduling +* while atomic bug. +*/ +spin_unlock_bh (&fsp->scsi_pkt_lock); +fc_fcp_cleanup_cmd (fsp, error); + +spin_lock_bh (&fsp->scsi_pkt_lock);fc_io_compl (fsp); -fc_fcp_unlock_pkt (fsp); } +spin_unlock_bh (&fsp->scsi_pkt_lock);fc_fcp_pkt_release (fsp);spin_lock_irqsave (&si->scsi_queue_lock, flags);
Greg Kroah-Hartman
maintainerPATCH 14/18 regmap: regcache-rbtree: Clean new present bits on present bitmap resize
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 8ef9724bf9718af81cfc5132253372f79c71b7e2 upstream.
When inserting a new register into a block, the present bit map size is increased using krealloc. krealloc does not clear the additionally allocated memory, leaving it filled with random values. Result is that some registers are considered cached even though this is not the case.
Fix the problem by clearing the additionally allocated memory. Also, if the bitmap size does not increase, do not reallocate the bitmap at all to reduce overhead.
--- drivers/base/regmap/regcache-rbtree.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/base/regmap/regcache-rbtree.c +14 -5
@@ -302,11 +302,20 @@ static int regcache_rbtree_insert_to_bloif (!blk)return -ENOMEM ; - present =krealloc (rbnode->cache_present, -BITS_TO_LONGS (blklen) *sizeof (*present),GFP_KERNEL ); -if (!present) { -kfree (blk); -return -ENOMEM ; +if (BITS_TO_LONGS (blklen) >BITS_TO_LONGS (rbnode->blklen)) { + present =krealloc (rbnode->cache_present, +BITS_TO_LONGS (blklen) *sizeof (*present), +GFP_KERNEL ); +if (!present) { +kfree (blk); +return -ENOMEM ; + } + +memset (present +BITS_TO_LONGS (rbnode->blklen),0 , + (BITS_TO_LONGS (blklen) -BITS_TO_LONGS (rbnode->blklen)) + *sizeof (*present)); + }else { + present = rbnode->cache_present; }/* insert the register value in the correct place in the rbnode block */
Greg Kroah-Hartman
maintainerPATCH 16/18 arm64/mm: Remove hack in mmap randomize layout
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yann Droneaud <[email protected]>
commit d6c763afab142a85e4770b4bc2a5f40f256d5c5d upstream.
Since commit 8a0a9bd4db63 ('random: make get_random_int() more random'), get_random_int() returns a random value for each call, so comment and hack introduced in mmap_rnd() as part of commit 1d18c47c735e ('arm64: MMU fault handling and page table management') are incorrects.
Commit 1d18c47c735e seems to use the same hack introduced by commit a5adc91a4b44 ('powerpc: Ensure random space between stack and mmaps'), latter copied in commit 5a0efea09f42 ('sparc64: Sharpen address space randomization calculations.').
But both architectures were cleaned up as part of commit fa8cbaaf5a68 ('powerpc+sparc64/mm: Remove hack in mmap randomize layout') as hack is no more needed since commit 8a0a9bd4db63.
So the present patch removes the comment and the hack around get_random_int() on AArch64's mmap_rnd().
--- arch/arm64/mm/mmap.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
arch/arm64/mm/mmap.c +2 -10
@@ -47,22 +47,14 @@ static int mmap_is_legacy(void)return sysctl_legacy_va_layout; } -/* -* Since get_random_int() returns the same value within a 1 jiffy window, we -* will almost always get the same randomisation for the stack and mmap -* region. This will mean the relative distance between stack and mmap will be -* the same. -* -* To avoid this we can shift the randomness by 1 bit. -*/ static unsigned long mmap_rnd (void ) {unsigned long rnd =0 ;if (current->flags &PF_RANDOMIZE ) - rnd = (long )get_random_int () & (STACK_RND_MASK >>1 ); + rnd = (long )get_random_int () &STACK_RND_MASK ; -return rnd << (PAGE_SHIFT +1 ); +return rnd <<PAGE_SHIFT ; }static unsigned long mmap_base (void )
Greg Kroah-Hartman
maintainerPATCH 18/18 arm64: KVM: Fix host crash when injecting a fault into a 32bit guest
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit 126c69a0bd0e441bf6766a5d9bf20de011be9f68 upstream.
When injecting a fault into a misbehaving 32bit guest, it seems rather idiotic to also inject a 64bit fault that is only going to corrupt the guest state. This leads to a situation where we perform an illegal exception return at EL2 causing the host to crash instead of killing the guest.
Just fix the stupid bug that has been there from day 1.
--- arch/arm64/kvm/inject_fault.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm64/kvm/inject_fault.c +6 -6
@@ -168,8 +168,8 @@ void kvm_inject_dabt(struct kvm_vcpu *vc {if (!(vcpu->arch.hcr_el2 &HCR_RW ))inject_abt32 (vcpu, false, addr); - -inject_abt64 (vcpu, false, addr); +else +inject_abt64 (vcpu, false, addr); }/**
@@ -184,8 +184,8 @@ void kvm_inject_pabt(struct kvm_vcpu *vc {if (!(vcpu->arch.hcr_el2 &HCR_RW ))inject_abt32 (vcpu, true, addr); - -inject_abt64 (vcpu, true, addr); +else +inject_abt64 (vcpu, true, addr); }/**
@@ -198,6 +198,6 @@ void kvm_inject_undefined(struct kvm_vcp {if (!(vcpu->arch.hcr_el2 &HCR_RW ))inject_undef32 (vcpu); - -inject_undef64 (vcpu); +else +inject_undef64 (vcpu); }
Greg Kroah-Hartman
maintainercover 3.14.52-stable review
This is the start of the stable review cycle for the 3.14.52 release. There are 18 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Sep 13 22:46:12 UTC 2015. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.14.52-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.14.52-rc1
Marc Zyngier <[email protected]>
arm64: KVM: Fix host crash when injecting a fault into a 32bit guest
Alan Stern <[email protected]>
SCSI: Fix NULL pointer dereference in runtime PM
Yann Droneaud <[email protected]>
arm64/mm: Remove hack in mmap randomize layout
Horia Geant? <[email protected]>
crypto: caam - fix memory corruption in ahash_final_ctx
Guenter Roeck <[email protected]>
regmap: regcache-rbtree: Clean new present bits on present bitmap resize
Bart Van Assche <[email protected]>
libfc: Fix fc_fcp_cleanup_each_cmd()
Bart Van Assche <[email protected]>
libfc: Fix fc_exch_recv_req() error path
Thomas Hellstrom <[email protected]>
drm/vmwgfx: Fix execbuf locking issues
Alex Deucher <[email protected]>
drm/radeon: add new OLAND pci id
Michael Walle <[email protected]>
EDAC, ppc4xx: Access mci->csrows array elements properly
Richard Weinberger <[email protected]>
localmodconfig: Use Kbuild files too
Joe Thornber <[email protected]>
dm thin metadata: delete btrees when releasing metadata snapshot
Peter Zijlstra <[email protected]>
perf: Fix PERF_EVENT_IOC_PERIOD migration race
Peter Zijlstra <[email protected]>
perf: Fix fasync handling on inherited events
Bob Liu <[email protected]>
xen-blkfront: don't add indirect pages to list when !feature_persistent
Wanpeng Li <[email protected]>
mm/hwpoison: fix page refcount of unknown non LRU page
Manfred Spraul <[email protected]>
ipc/sem.c: update/correct memory barriers
Herton R. Krzesinski <[email protected]>
ipc,sem: fix use after free on IPC_RMID after a task using same semaphore set exits
-------------
Diffstat:
Makefile | 4 +- arch/arm64/kvm/inject_fault.c | 12 ++--- arch/arm64/mm/mmap.c | 12 +---- drivers/base/regmap/regcache-rbtree.c | 19 +++++-- drivers/block/xen-blkfront.c | 6 ++- drivers/crypto/caam/caamhash.c | 7 +-- drivers/edac/ppc4xx_edac.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 +- drivers/md/dm-thin-metadata.c | 4 +- drivers/scsi/libfc/fc_exch.c | 8 +-- drivers/scsi/libfc/fc_fcp.c | 19 ++++++- drivers/scsi/scsi_pm.c | 22 ++++----- include/drm/drm_pciids.h | 1 + ipc/sem.c | 43 +++++++++++++--- kernel/events/core.c | 87 ++++++++++++++++++++++++--------- mm/memory-failure.c | 2 + scripts/kconfig/streamline_config.pl | 2 +- 17 files changed, 173 insertions(+), 81 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/18 ipc,sem: fix use after free on IPC_RMID after a task using same semaphore set exits
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Herton R. Krzesinski" <[email protected]>
commit 602b8593d2b4138c10e922eeaafe306f6b51817b upstream.
The current semaphore code allows a potential use after free: in exit_sem we may free the task's sem_undo_list while there is still another task looping through the same semaphore set and cleaning the sem_undo list at freeary function (the task called IPC_RMID for the same semaphore set).
For example, with a test program [1] running which keeps forking a lot of processes (which then do a semop call with SEM_UNDO flag), and with the parent right after removing the semaphore set with IPC_RMID, and a kernel built with CONFIG_SLAB, CONFIG_SLAB_DEBUG and CONFIG_DEBUG_SPINLOCK, you can easily see something like the following in the kernel log:
Slab corruption (Not tainted): kmalloc-64 start=ffff88003b45c1c0, len=64 000: 6b 6b 6b 6b 6b 6b 6b 6b 00 6b 6b 6b 6b 6b 6b 6b kkkkkkkk.kkkkkkk 010: ff ff ff ff 6b 6b 6b 6b ff ff ff ff ff ff ff ff ....kkkk........ Prev obj: start=ffff88003b45c180, len=64
000: 00 00 00 00 ad 4e ad de ff ff ff ff 5a 5a 5a 5a .....N......ZZZZ 010: ff ff ff ff ff ff ff ff c0 fb 01 37 00 88 ff ff ...........7.... Next obj: start=ffff88003b45c200, len=64
000: 00 00 00 00 ad 4e ad de ff ff ff ff 5a 5a 5a 5a .....N......ZZZZ 010: ff ff ff ff ff ff ff ff 68 29 a7 3c 00 88 ff ff ........h).<....
BUG: spinlock wrong CPU on CPU#2, test/18028
general protection fault: 0000 [#1] SMP
Modules linked in: 8021q mrp garp stp llc nf_conntrack_ipv4 nf_defrag_ipv4 ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables binfmt_misc ppdev input_leds joydev parport_pc parport floppy serio_raw virtio_balloon virtio_rng virtio_console virtio_net iosf_mbi crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcspkr qxl ttm drm_kms_helper drm snd_hda_codec_generic i2c_piix4 snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore crc32c_intel virtio_pci virtio_ring virtio pata_acpi ata_generic [last unloaded: speedstep_lib]
CPU: 2 PID: 18028 Comm: test Not tainted 4.2.0-rc5+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.8.1-20150318_183358- 04/01/2014
RIP: spin_dump+0x53/0xc0
Call Trace:
spin_bug+0x30/0x40
do_raw_spin_unlock+0x71/0xa0
_raw_spin_unlock+0xe/0x10
freeary+0x82/0x2a0
? _raw_spin_lock+0xe/0x10
semctl_down.clone.0+0xce/0x160
? __do_page_fault+0x19a/0x430
? __audit_syscall_entry+0xa8/0x100
SyS_semctl+0x236/0x2c0
? syscall_trace_leave+0xde/0x130
entry_SYSCALL_64_fastpath+0x12/0x71
Code: 8b 80 88 03 00 00 48 8d 88 60 05 00 00 48 c7 c7 a0 2c a4 81 31 c0 65 8b 15 eb 40 f3 7e e8 08 31 68 00 4d 85 e4 44 8b 4b 08 74 5e <45> 8b 84 24 88 03 00 00 49 8d 8c 24 60 05 00 00 8b 53 04 48 89
RIP [<ffffffff810d6053>] spin_dump+0x53/0xc0
RSP <ffff88003750fd68>
---[ end trace 783ebb76612867a0 ]---
NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [test:18053]
Modules linked in: 8021q mrp garp stp llc nf_conntrack_ipv4 nf_defrag_ipv4 ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables binfmt_misc ppdev input_leds joydev parport_pc parport floppy serio_raw virtio_balloon virtio_rng virtio_console virtio_net iosf_mbi crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcspkr qxl ttm drm_kms_helper drm snd_hda_codec_generic i2c_piix4 snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore crc32c_intel virtio_pci virtio_ring virtio pata_acpi ata_generic [last unloaded: speedstep_lib]
CPU: 3 PID: 18053 Comm: test Tainted: G D 4.2.0-rc5+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.8.1-20150318_183358- 04/01/2014
RIP: native_read_tsc+0x0/0x20
Call Trace:
? delay_tsc+0x40/0x70
__delay+0xf/0x20
do_raw_spin_lock+0x96/0x140
_raw_spin_lock+0xe/0x10
sem_lock_and_putref+0x11/0x70
SYSC_semtimedop+0x7bf/0x960
? handle_mm_fault+0xbf6/0x1880
? dequeue_task_fair+0x79/0x4a0
? __do_page_fault+0x19a/0x430
? kfree_debugcheck+0x16/0x40
? __do_page_fault+0x19a/0x430
? __audit_syscall_entry+0xa8/0x100
? do_audit_syscall_entry+0x66/0x70
? syscall_trace_enter_phase1+0x139/0x160
SyS_semtimedop+0xe/0x10
SyS_semop+0x10/0x20
entry_SYSCALL_64_fastpath+0x12/0x71
Code: 47 10 83 e8 01 85 c0 89 47 10 75 08 65 48 89 3d 1f 74 ff 7e c9 c3 0f 1f 44 00 00 55 48 89 e5 e8 87 17 04 00 66 90 c9 c3 0f 1f 00 <55> 48 89 e5 0f 31 89 c1 48 89 d0 48 c1 e0 20 89 c9 48 09 c8 c9
Kernel panic - not syncing: softlockup: hung tasksI wasn't able to trigger any badness on a recent kernel without the proper config debugs enabled, however I have softlockup reports on some kernel versions, in the semaphore code, which are similar as above (the scenario is seen on some servers running IBM DB2 which uses semaphore syscalls).
The patch here fixes the race against freeary, by acquiring or waiting on the sem_undo_list lock as necessary (exit_sem can race with freeary, while freeary sets un->semid to -1 and removes the same sem_undo from list_proc or when it removes the last sem_undo).
After the patch I'm unable to reproduce the problem using the test case [1].
[1] Test case used below:
#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <errno.h>
#define NSEM 1
#define NSET 5
int sid[NSET];
void thread()
{
struct sembuf op;
int s;
uid_t pid = getuid();
s = rand() % NSET;
op.sem_num = pid % NSEM;
op.sem_op = 1;
op.sem_flg = SEM_UNDO;
semop(sid[s], &op, 1);
exit(EXIT_SUCCESS);
}
void create_set()
{
int i, j;
pid_t p;
union {
int val;
struct semid_ds *buf;
unsigned short int *array;
struct seminfo *__buf;
} un;
/* Create and initialize semaphore set */
for (i = 0; i < NSET; i++) {
sid[i] = semget(IPC_PRIVATE , NSEM, 0644 | IPC_CREAT);
if (sid[i] < 0) {
perror("semget");
exit(EXIT_FAILURE);
}
}
un.val = 0;
for (i = 0; i < NSET; i++) {
for (j = 0; j < NSEM; j++) {
if (semctl(sid[i], j, SETVAL, un) < 0)
perror("semctl");
}
}
/* Launch threads that operate on semaphore set */
for (i = 0; i < NSEM * NSET * NSET; i++) {
p = fork();
if (p < 0)
perror("fork");
if (p == 0)
thread();
}
/* Free semaphore set */
for (i = 0; i < NSET; i++) {
if (semctl(sid[i], NSEM, IPC_RMID))
perror("IPC_RMID");
}
/* Wait for forked processes to exit */
while (wait(NULL)) {
if (errno == ECHILD)
break;
};
}
int main(int argc, char **argv)
{
pid_t p;
srand(time(NULL));
while (1) {
p = fork();
if (p < 0) {
perror("fork");
exit(EXIT_FAILURE);
}
if (p == 0) {
create_set();
goto end;
}
/* Wait for forked processes to exit */
while (wait(NULL)) {
if (errno == ECHILD)
break;
};
}
end:
return 0;
}--- ipc/sem.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
ipc/sem.c +17 -6
@@ -2055,17 +2055,28 @@ void exit_sem(struct task_struct *tsk)rcu_read_lock (); un =list_entry_rcu (ulp->list_proc.next, struct sem_undo, list_proc); -if (&un->list_proc == &ulp->list_proc) - semid =-1 ; -else - semid = un->semid; +if (&un->list_proc == &ulp->list_proc) { +/* +* We must wait for freeary() before freeing this ulp, +* in case we raced with last sem_undo. There is a small +* possibility where we exit while freeary() didn't +* finish unlocking sem_undo_list. +*/ +spin_unlock_wait (&ulp->lock); +rcu_read_unlock (); +break ; + } +spin_lock (&ulp->lock); + semid = un->semid; +spin_unlock (&ulp->lock); +/* exit_sem raced with IPC_RMID, nothing to do */ if (semid ==-1 ) {rcu_read_unlock (); -break ; +continue ; } - sma =sem_obtain_object_check (tsk->nsproxy->ipc_ns, un->semid); + sma =sem_obtain_object_check (tsk->nsproxy->ipc_ns, semid);/* exit_sem raced with IPC_RMID, nothing to do */ if (IS_ERR (sma)) {rcu_read_unlock ();
Greg Kroah-Hartman
maintainerPATCH 2/18 ipc/sem.c: update/correct memory barriers
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manfred Spraul <[email protected]>
commit 3ed1f8a99d70ea1cd1508910eb107d0edcae5009 upstream.
sem_lock() did not properly pair memory barriers:
!spin_is_locked() and spin_unlock_wait() are both only control barriers. The code needs an acquire barrier, otherwise the cpu might perform read operations before the lock test.
As no primitive exists inside <include/spinlock.h> and since it seems noone wants another primitive, the code creates a local primitive within ipc/sem.c.
With regards to -stable:
The change of sem_wait_array() is a bugfix, the change to sem_lock() is a nop (just a preprocessor redefinition to improve the readability). The bugfix is necessary for all kernels that use sem_wait_array() (i.e.:
starting from 3.10).
--- ipc/sem.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
ipc/sem.c +18 -2
@@ -253,6 +253,16 @@ static void sem_rcu_free(struct rcu_head }/* +* spin_unlock_wait() and !spin_is_locked() are not memory barriers, they +* are only control barriers. +* The code must pair with spin_unlock(&sem->lock) or +* spin_unlock(&sem_perm.lock), thus just the control barrier is insufficient. +* +* smp_rmb() is sufficient, as writes cannot pass the control barrier. +*/ +#define ipc_smp_acquire__after_spin_is_unlocked () smp_rmb() + +/* * Wait until all currently ongoing simple ops have completed. * Caller must own sem_perm.lock. * New simple ops cannot start, because simple ops first check
@@ -275,6 +285,7 @@ static void sem_wait_array(struct sem_ar sem = sma->sem_base + i;spin_unlock_wait (&sem->lock); } +ipc_smp_acquire__after_spin_is_unlocked (); }/*
@@ -326,8 +337,13 @@ static inline int sem_lock(struct sem_ar/* Then check that the global lock is free */ if (!spin_is_locked (&sma->sem_perm.lock)) { -/* spin_is_locked() is not a memory barrier */ -smp_mb (); +/* +* We need a memory barrier with acquire semantics, +* otherwise we can race with another thread that does: +* complex_count++; +* spin_unlock(sem_perm.lock); +*/ +ipc_smp_acquire__after_spin_is_unlocked ();/* Now repeat the test of complex_count: * It can't change anymore until we drop sem->lock.
Greg Kroah-Hartman
maintainerPATCH 3/18 mm/hwpoison: fix page refcount of unknown non LRU page
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wanpeng Li <[email protected]>
commit 4f32be677b124a49459e2603321c7a5605ceb9f8 upstream.
After trying to drain pages from pagevec/pageset, we try to get reference count of the page again, however, the reference count of the page is not reduced if the page is still not on LRU list.
Fix it by adding the put_page() to drop the page reference which is from __get_any_page().
--- mm/memory-failure.c | 2 ++ 1 file changed, 2 insertions(+)
mm/memory-failure.c +2 -0
@@ -1510,6 +1510,8 @@ static int get_any_page(struct page *pag*/ ret =__get_any_page (page, pfn,0 );if (!PageLRU (page)) { +/* Drop page reference which is from __get_any_page() */ +put_page (page);pr_info ("soft_offline: %#lx: unknown non LRU page type %lx\n" , pfn, page->flags);return -EIO ;
Greg Kroah-Hartman
maintainerPATCH 7/18 dm thin metadata: delete btrees when releasing metadata snapshot
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit 7f518ad0a212e2a6fd68630e176af1de395070a7 upstream.
The device details and mapping trees were just being decremented before. Now btree_del() is called to do a deep delete.
--- drivers/md/dm-thin-metadata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/dm-thin-metadata.c +2 -2
@@ -1295,8 +1295,8 @@ static int __release_metadata_snap(strucreturn r; disk_super =dm_block_data (copy); -dm_sm_dec_block (pmd->metadata_sm,le64_to_cpu (disk_super->data_mapping_root)); -dm_sm_dec_block (pmd->metadata_sm,le64_to_cpu (disk_super->device_details_root)); +dm_btree_del (&pmd->info,le64_to_cpu (disk_super->data_mapping_root)); +dm_btree_del (&pmd->details_info,le64_to_cpu (disk_super->device_details_root));dm_sm_dec_block (pmd->metadata_sm, held_root);return dm_tm_unlock (pmd->tm, copy);
Greg Kroah-Hartman
maintainerPATCH 8/18 localmodconfig: Use Kbuild files too
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit c0ddc8c745b7f89c50385fd7aa03c78dc543fa7a upstream.
In kbuild it is allowed to define objects in files named "Makefile" and "Kbuild".
Currently localmodconfig reads objects only from "Makefile"s and misses modules like nouveau.
--- scripts/kconfig/streamline_config.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/streamline_config.pl +1 -1
@@ -137,7 +137,7 @@ my $ksource = ($ARGV[0] ? $ARGV[0] : '.' my $kconfig = $ARGV[1]; my $lsmod_file = $ENV{'LSMOD'}; -my @makefiles = `find $ksource -name Makefile 2>/dev/null`; +my @makefiles = `find $ksource -name Makefile -or -name Kbuild 2>/dev/null`; chomp @makefiles; my %depends;
Greg Kroah-Hartman
maintainerPATCH 9/18 EDAC, ppc4xx: Access mci->csrows array elements properly
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Walle <[email protected]>
commit 5c16179b550b9fd8114637a56b153c9768ea06a5 upstream.
The commit
de3910eb79ac ("edac: change the mem allocation scheme to
make Documentation/kobject.txt happy")
changed the memory allocation for the csrows member. But ppc4xx_edac was forgotten in the patch. Fix it.
--- drivers/edac/ppc4xx_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/ppc4xx_edac.c +1 -1
@@ -921,7 +921,7 @@ static int ppc4xx_edac_init_csrows(struc*/ for (row =0 ; row < mci->nr_csrows; row++) { -struct csrow_info *csi = &mci->csrows[row]; +struct csrow_info *csi = mci->csrows[row];/* * Get the configuration settings for this
Greg Kroah-Hartman
maintainerPATCH 10/18 drm/radeon: add new OLAND pci id
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit e037239e5e7b61007763984aa35a8329596d8c88 upstream.
--- include/drm/drm_pciids.h | 1 + 1 file changed, 1 insertion(+)
include/drm/drm_pciids.h +1 -0
@@ -172,6 +172,7 @@ {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6617, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6620, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
Greg Kroah-Hartman
maintainerPATCH 11/18 drm/vmwgfx: Fix execbuf locking issues
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hellstrom <[email protected]>
commit 3e04e2fe6d87807d27521ad6ebb9e7919d628f25 upstream.
This addresses two issues that cause problems with viewperf maya-03 in situation with memory pressure.
The first issue causes attempts to unreserve buffers if batched reservation fails due to, for example, a signal pending. While previously the ttm_eu api was resistant against this type of error, it is no longer and the lockdep code will complain about attempting to unreserve buffers that are not reserved. The issue is resolved by avoid calling ttm_eu_backoff_reservation in the buffer reserve error path.
The second issue is that the binding_mutex may be held when user-space fence objects are created and hence during memory reclaims. This may cause recursive attempts to grab the binding mutex. The issue is resolved by not holding the binding mutex across fence creation and submission.
--- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +2 -2
@@ -2475,7 +2475,7 @@ int vmw_execbuf_process(struct drm_file ret =vmw_resources_validate (sw_context);if (unlikely (ret !=0 )) - goto out_err; + goto out_err_nores;if (throttle_us) { ret = vmw_wait_lag(dev_priv, &dev_priv->fifo.marker_queue,
@@ -2511,6 +2511,7 @@ int vmw_execbuf_process(struct drm_filevmw_resource_relocations_free (&sw_context->res_relocations);vmw_fifo_commit (dev_priv, command_size); +mutex_unlock (&dev_priv->binding_mutex);vmw_query_bo_switch_commit (dev_priv, sw_context); ret = vmw_execbuf_fence_commands(file_priv, dev_priv,
@@ -2526,7 +2527,6 @@ int vmw_execbuf_process(struct drm_fileDRM_ERROR ("Fence submission error. Syncing.\n" );vmw_resource_list_unreserve (&sw_context->resource_list, false); -mutex_unlock (&dev_priv->binding_mutex);ttm_eu_fence_buffer_objects (&ticket, &sw_context->validate_nodes, (void *) fence);
Greg Kroah-Hartman
maintainerPATCH 6/18 perf: Fix PERF_EVENT_IOC_PERIOD migration race
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit c7999c6f3fed9e383d3131474588f282ae6d56b9 upstream.
I ran the perf fuzzer, which triggered some WARN()s which are due to trying to stop/restart an event on the wrong CPU.
Use the normal IPI pattern to ensure we run the code on the correct CPU.
--- kernel/events/core.c | 75 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 20 deletions(-)
kernel/events/core.c +55 -20
@@ -3562,28 +3562,21 @@ static void perf_event_for_each(struct pmutex_unlock (&ctx->mutex); } -static int perf_event_period (struct perf_event *event,u64 __user *arg) -{ -struct perf_event_context *ctx = event->ctx; -int ret =0 , active; +struct period_event { +struct perf_event *event;u64 value; +}; -if (!is_sampling_event (event)) -return -EINVAL ; - -if (copy_from_user (&value, arg,sizeof (value))) -return -EFAULT ; - -if (!value) -return -EINVAL ; +static int __perf_event_period (void *info) +{ +struct period_event *pe = info; +struct perf_event *event = pe->event; +struct perf_event_context *ctx = event->ctx; +u64 value = pe->value; +bool active; -raw_spin_lock_irq (&ctx->lock); +raw_spin_lock (&ctx->lock);if (event->attr.freq) { -if (value > sysctl_perf_event_sample_rate) { - ret = -EINVAL ; - goto unlock; - } - event->attr.sample_freq = value; }else { event->attr.sample_period = value;
@@ -3602,11 +3595,53 @@ static int perf_event_period(struct perf event->pmu->start (event,PERF_EF_RELOAD );perf_pmu_enable (ctx->pmu); } +raw_spin_unlock (&ctx->lock); + +return 0 ; +} + +static int perf_event_period (struct perf_event *event,u64 __user *arg) +{ +struct period_event pe = { .event = event, }; +struct perf_event_context *ctx = event->ctx; +struct task_struct *task; +u64 value; + +if (!is_sampling_event (event)) +return -EINVAL ; + +if (copy_from_user (&value, arg,sizeof (value))) +return -EFAULT ; + +if (!value) +return -EINVAL ; + +if (event->attr.freq && value > sysctl_perf_event_sample_rate) +return -EINVAL ; + + task = ctx->task; + pe.value = value; + +if (!task) { +cpu_function_call (event->cpu, __perf_event_period, &pe); +return 0 ; + } + +retry: +if (!task_function_call (task, __perf_event_period, &pe)) +return 0 ; + +raw_spin_lock_irq (&ctx->lock); +if (ctx->is_active) { +raw_spin_unlock_irq (&ctx->lock); + task = ctx->task; + goto retry; + } -unlock: +__perf_event_period (&pe);raw_spin_unlock_irq (&ctx->lock); -return ret; +return 0 ; }static const struct file_operations perf_fops;
Greg Kroah-Hartman
maintainerPATCH 15/18 crypto: caam - fix memory corruption in ahash_final_ctx
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horia Geant? <[email protected]>
commit b310c178e6d897f82abb9da3af1cd7c02b09f592 upstream.
When doing pointer operation for accessing the HW S/G table, a value representing number of entries (and not number of bytes) must be used.
--- drivers/crypto/caam/caamhash.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/crypto/caam/caamhash.c +4 -3
@@ -900,13 +900,14 @@ static int ahash_final_ctx(struct ahash_ state->buflen_1;u32 *sh_desc = ctx->sh_desc_fin, *desc;dma_addr_t ptr = ctx->sh_desc_fin_dma; -int sec4_sg_bytes; +int sec4_sg_bytes, sec4_sg_src_index;int digestsize =crypto_ahash_digestsize (ahash);struct ahash_edesc *edesc;int ret =0 ;int sh_len; - sec4_sg_bytes = (1 + (buflen ?1 :0 )) *sizeof (struct sec4_sg_entry ); + sec4_sg_src_index =1 + (buflen ?1 :0 ); + sec4_sg_bytes = sec4_sg_src_index *sizeof (struct sec4_sg_entry );/* allocate space for base edesc and hw desc commands, link tables */ edesc = kmalloc(sizeof(struct ahash_edesc) + DESC_JOB_IO_LEN +
@@ -933,7 +934,7 @@ static int ahash_final_ctx(struct ahash_ state->buf_dma =try_buf_map_to_sec4_sg (jrdev, edesc->sec4_sg +1 , buf, state->buf_dma, buflen, last_buflen); - (edesc->sec4_sg + sec4_sg_bytes -1 )->len |=SEC4_SG_LEN_FIN ; + (edesc->sec4_sg + sec4_sg_src_index -1 )->len |=SEC4_SG_LEN_FIN ;append_seq_in_ptr (desc, edesc->sec4_sg_dma, ctx->ctx_len + buflen,LDST_SGF );
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.52 release. There are 18 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 7 lines
Responses should be made by Sun Sep 13 22:46:12 UTC 2015. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.14.52-rc1.gzand the diffstat can be found below.
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.52 release. There are 18 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Sep 13 22:46:12 UTC 2015. Anything received after that time might be too late.
Build results:
total: 128 pass: 128 fail: 0 Qemu test results: total: 80 pass: 80 fail: 0
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.52 release. There are 18 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Sep 13 22:46:12 UTC 2015. Anything received after that time might be too late.
Compiled and booted on x86_32. dmesg showd:
kmemleak: 47 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
/sys/kernel/debug/kmemleak showed lots of:
unreferenced object 0xf3204fb0 (size 1024):
comm "setfont", pid 326, jiffies 4294897405 (age 2079.568s) hex dump (first 32 bytes):
a3 00 a0 25 92 25 b1 00 a2 00 a5 00 a9 00 ae 00 ...%.%.......... c6 00 dd 00 e6 00 52 01 53 01 78 01 14 20 20 20 ......R.S.x.. backtrace: [<c1637adc>] kmemleak_alloc+0x3c/0xa0 [<c116845f>] kmem_cache_alloc_trace+0x9f/0x140 [<c13d3caa>] set_inverse_trans_unicode.isra.0+0x10a/0x120 [<c13d4672>] con_set_unimap+0x1b2/0x230 [<c13cee27>] vt_ioctl+0x857/0x1020 [<c13c40e3>] tty_ioctl+0x233/0xa40 [<c1188e82>] do_vfs_ioctl+0x2e2/0x540 [<c1189140>] SyS_ioctl+0x60/0x90 [<c164f086>] sysenter_after_call+0x0/0x21 [<ffffffff>] 0xffffffff
9e326f78713a ("tty/vt: don't set font mappings on vc not supporting this") solved the error for me. 9e326f78713a is marked for stable also and it will not apply cleanly.
cross_compiled with allmodconfig:
i386 - passx86_64 - pass
alphacheck - pass
arm - pass
cris - fail
m68k - pass
mips - pass
powerpc - pass
s390 - pass
sparc - pass
sparc64 - pass
tile - fail
tilegx - fail
xtensa - pass
build report at:
https://travis-ci.org/sudipm-mukherjee/parport/builds/79960443
regards
sudip
Greg Kroah-Hartman
maintainerQuoted 30 lines · Sudip Mukherjee
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.52 release. There are 18 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Sep 13 22:46:12 UTC 2015. Anything received after that time might be too late.
Compiled and booted on
x86_32. dmesg showd:
kmemleak: 47 new suspected memory leaks (see/sys/kernel/debug/kmemleak)
/sys/kernel/debug/kmemleakshowed lots of:
unreferenced object0xf3204fb0(size 1024):
comm "setfont", pid 326, jiffies 4294897405 (age 2079.568s) hex dump (first 32 bytes):a3 00 a0 25 92 25 b1 00 a2 00 a5 00 a9 00 ae 00 ...%.%.......... c6 00 dd 00 e6 00 52 01 53 01 78 01 14 20 20 20 ......R.S.x.. backtrace: [<c1637adc>] kmemleak_alloc+0x3c/0xa0 [<c116845f>] kmem_cache_alloc_trace+0x9f/0x140 [<c13d3caa>] set_inverse_trans_unicode.isra.0+0x10a/0x120 [<c13d4672>] con_set_unimap+0x1b2/0x230 [<c13cee27>] vt_ioctl+0x857/0x1020 [<c13c40e3>] tty_ioctl+0x233/0xa40 [<c1188e82>] do_vfs_ioctl+0x2e2/0x540 [<c1189140>] SyS_ioctl+0x60/0x90 [<c164f086>] sysenter_after_call+0x0/0x21 [<ffffffff>] 0xffffffff
Quoted 3 lines
9e326f78713a("tty/vt: don't set font mappings on vc not supporting this") solved the error for me.9e326f78713ais marked for stable also and it will not apply cleanly.
So this isn't a new thing at all, can you provide a backport that worked for you so I can queue it up for the next round?
thanks,
greg k-h
PATCH 1/1 tty/vt: don't set font mappings on vc not supporting this
commit 9e326f78713a4421fe11afc2ddeac07698fac131 upstream
We can call this function for a dummy console that doesn't support setting the font mapping, which will result in a null ptr BUG. So check for this case and return error for consoles w/o font mapping support.
---
backporting for the first time so not exactly sure if the format is ok.
drivers/tty/vt/consolemap.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/tty/vt/consolemap.c +6 -0
@@ -540,6 +540,11 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)/* Save original vc_unipagdir_loc in case we allocate a new one */ p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; + +if (!p) { + err = -EINVAL ; + goto out_unlock; + }if (p->readonly) {console_unlock ();return -EIO ;
@@ -633,6 +638,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)set_inverse_transl (vc, p, i);/* Update inverse translations */ set_inverse_trans_unicode (vc, p); +out_unlock:console_unlock ();return err; }
Signature · 1 line
1.9.1
Greg Kroah-Hartman
maintainerRe: [PATCH] tty/vt: don't set font mappings on vc not supporting this
Quoted 11 lines · Sudip Mukherjee
commit
9e326f78713a4421fe11afc2ddeac07698fac131upstreamWe can call this function for a dummy console that doesn't support setting the font mapping, which will result in a null ptr BUG. So check for this case and return error for consoles w/o font mapping support.
Cc <[email protected]> # 3.14.xSigned-off-by Sudip Mukherjee <[email protected]>---
backporting for the first time so not exactly sure if the format is ok.
You need to keep the original authorship of the patch around, as well as their signed-off-by information. Also, you didn't backport it identically:
Quoted 9 lines
drivers/tty/vt/consolemap.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/tty/vt/consolemap.c +0
-0
drivers/tty/vt/consolemap.c int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) · line 546
Quoted 7 lines
drivers/tty/vt/consolemap.c +4
-0@@ -540,6 +540,11 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)/* Save original vc_unipagdir_loc in case we allocate a new one */ p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; + +if (!p) { + err = -EINVAL ; + goto out_unlock;
The original has a blank line between these two lines, why not keep it?
I'll fix it up, but be a bit more careful next time please.
thanks,
greg k-h
Re: [PATCH] tty/vt: don't set font mappings on vc not supporting this
Quoted 2 lines · Greg Kroah-Hartman
Quoted 1 line · Sudip Mukherjee
commit
9e326f78713a4421fe11afc2ddeac07698fac131upstream
<snip>
Quoted 10 lines
Quoted 5 lines
Cc <[email protected]> # 3.14.xSigned-off-by Sudip Mukherjee <[email protected]>---
backporting for the first time so not exactly sure if the format is ok.
You need to keep the original authorship of the patch around, as well as their signed-off-by information. Also, you didn't backport it identically:
<snip>
Quoted 8 lines
drivers/tty/vt/consolemap.c int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) · line 546
Quoted 4 lines
drivers/tty/vt/consolemap.c +4
-0+ +if (!p) { + err = -EINVAL ; + goto out_unlock;The original has a blank line between these two lines, why not keep it?
I'll fix it up, but be a bit more careful next time please.
Sure, next time you will have no complaints about this.
regards
sudip