ssb: Fix error routine when fallback SPROM fails
PATCH 1/1 ssb: Fix error routine when fallback SPROM fails
From: Larry Finger <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 8052d7245b6089992343c80b38b14dbbd8354651 upstream.
When there is a CRC error in the SPROM read from the device, the code attempts to handle a fallback SPROM. When this also fails, the driver returns zero rather than an error code.
--- drivers/ssb/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/ssb/pci.c +1 -0
@@ -846,6 +846,7 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,if (err) {ssb_warn ("WARNING: Using fallback SPROM failed (err %d)\n" , err); + goto out_free; }else {ssb_dbg ("Using SPROM revision %d provided by platform\n" , sprom->revision);
Signature · 1 line
2.11.0
PATCH 1/1 thermal: hwmon: Properly report critical temperature in sysfs
From: Krzysztof Kozlowski <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit f37fabb8643eaf8e3b613333a72f683770c85eca upstream.
In the critical sysfs entry the thermal hwmon was returning wrong temperature to the user-space. It was reporting the temperature of the first trip point instead of the temperature of critical trip point.
For example:
/sys/class/hwmon/hwmon0/temp1_crit:50000 /sys/class/thermal/thermal_zone0/trip_point_0_temp:50000 /sys/class/thermal/thermal_zone0/trip_point_0_type:active /sys/class/thermal/thermal_zone0/trip_point_3_temp:120000 /sys/class/thermal/thermal_zone0/trip_point_3_type:critical
Since commit e68b16abd91d ("thermal: add hwmon sysfs I/F") the driver have been registering a sysfs entry if get_crit_temp() callback was provided. However when accessed, it was calling get_trip_temp() instead of the get_crit_temp().
--- drivers/thermal/thermal_hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_hwmon.c +1 -1
@@ -98,7 +98,7 @@ temp_crit_show(struct device *dev, struct device_attribute *attr, char *buf)long temperature;int ret; - ret = tz->ops->get_trip_temp (tz,0 , &temperature); + ret = tz->ops->get_crit_temp (tz, &temperature);if (ret)return ret;
Signature · 1 line
2.11.0
PATCH 1/1 drm/radeon: add additional pci revision to dpm workaround
In reply to Jiri SlabyFrom: Alex Deucher <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 8729675c00a8d13cb2094d617d70a4a4da7d83c5 upstream.
New variant.
--- drivers/gpu/drm/radeon/si_dpm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/si_dpm.c +1 -0
@@ -2961,6 +2961,7 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, (rdev->pdev->revision == 0x80) || (rdev->pdev->revision == 0x81) || (rdev->pdev->revision == 0x83) || + (rdev->pdev->revision == 0x87) || (rdev->pdev->device == 0x6604) || (rdev->pdev->device == 0x6605)) { max_sclk =75000 ;
Signature · 1 line
2.11.0
PATCH 1/1 drm/gma500: Add compat ioctl
In reply to Jiri SlabyFrom: Patrik Jakobsson <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 0a97c81a9717431e6c57ea845b59c3c345edce67 upstream.
Hook up drm_compat_ioctl to support 32-bit userspace on 64-bit kernels. It turns out that N2600 and N2800 comes with 64-bit enabled. We previously assumed there where no such systems out there.
--- drivers/gpu/drm/gma500/psb_drv.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/gma500/psb_drv.c +3 -0
@@ -620,6 +620,9 @@ static const struct file_operations psb_gem_fops = { .open = drm_open, .release = drm_release, .unlocked_ioctl = psb_unlocked_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = drm_compat_ioctl, +#endif .mmap = drm_gem_mmap, .poll = drm_poll, .read = drm_read,
Signature · 1 line
2.11.0
PATCH 1/1 drivers/gpu/drm/ast: Fix infinite loop if read fails
In reply to Jiri SlabyFrom: Russell Currey <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 298360af3dab45659810fdc51aba0c9f4097e4f6 upstream.
ast_get_dram_info() configures a window in order to access BMC memory. A BMC register can be configured to disallow this, and if so, causes an infinite loop in the ast driver which renders the system unusable.
Fix this by erroring out if an error is detected. On powerpc systems with EEH, this leads to the device being fenced and the system continuing to operate.
--- drivers/gpu/drm/ast/ast_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/ast/ast_main.c +5 -2
@@ -120,7 +120,8 @@ static int ast_get_dram_info(struct drm_device *dev)ast_write32 (ast,0x10000 ,0xfc600309 );do { - ; +if (pci_channel_offline (dev->pdev)) +return -EIO ; }while (ast_read32 (ast,0x10000 ) !=0x01 ); data =ast_read32 (ast,0x10004 );
@@ -343,7 +344,9 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags)ast_detect_chip (dev);if (ast->chip !=AST1180 ) { -ast_get_dram_info (dev); + ret =ast_get_dram_info (dev); +if (ret) + goto out_free; ast->vram_size =ast_get_vram_info (dev);DRM_INFO ("dram %d %d %d %08x\n" , ast->mclk, ast->dram_type, ast->dram_bus_width, ast->vram_size); }
Signature · 1 line
2.11.0
PATCH 1/1 block: protect iterate_bdevs() against concurrent close
In reply to Jiri SlabyFrom: Rabin Vincent <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit af309226db916e2c6e08d3eba3fa5c34225200c4 upstream.
If a block device is closed while iterate_bdevs() is handling it, the following NULL pointer dereference occurs because bdev->b_disk is NULL in bdev_get_queue(), which is called from blk_get_backing_dev_info() (in turn called by the mapping_cap_writeback_dirty() call in __filemap_fdatawrite_range()):
BUG: unable to handle kernel NULL pointer dereference at 0000000000000508 IP: [<ffffffff81314790>] blk_get_backing_dev_info+0x10/0x20 PGD 9e62067 PUD 9ee8067 PMD 0 Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC Modules linked in: CPU: 1 PID: 2422 Comm: sync Not tainted 4.5.0-rc7+ #400 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) task: ffff880009f4d700 ti: ffff880009f5c000 task.ti: ffff880009f5c000 RIP: 0010:[<ffffffff81314790>] [<ffffffff81314790>] blk_get_backing_dev_info+0x10/0x20 RSP: 0018:ffff880009f5fe68 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff88000ec17a38 RCX: ffffffff81a4e940 RDX: 7fffffffffffffff RSI: 0000000000000000 RDI: ffff88000ec176c0 RBP: ffff880009f5fe68 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffff88000ec17860 R13: ffffffff811b25c0 R14: ffff88000ec178e0 R15: ffff88000ec17a38 FS: 00007faee505d700(0000) GS:ffff88000fb00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000000000000508 CR3: 0000000009e8a000 CR4: 00000000000006e0 Stack: ffff880009f5feb8 ffffffff8112e7f5 0000000000000000 7fffffffffffffff 0000000000000000 0000000000000000 7fffffffffffffff 0000000000000001 ffff88000ec178e0 ffff88000ec17860 ffff880009f5fec8 ffffffff8112e81f Call Trace: [<ffffffff8112e7f5>] __filemap_fdatawrite_range+0x85/0x90 [<ffffffff8112e81f>] filemap_fdatawrite+0x1f/0x30 [<ffffffff811b25d6>] fdatawrite_one_bdev+0x16/0x20 [<ffffffff811bc402>] iterate_bdevs+0xf2/0x130 [<ffffffff811b2763>] sys_sync+0x63/0x90 [<ffffffff815d4272>] entry_SYSCALL_64_fastpath+0x12/0x76 Code: 0f 1f 44 00 00 48 8b 87 f0 00 00 00 55 48 89 e5 <48> 8b 80 08 05 00 00 5d RIP [<ffffffff81314790>] blk_get_backing_dev_info+0x10/0x20 RSP <ffff880009f5fe68> CR2: 0000000000000508 ---[ end trace 2487336ceb3de62d ]---
The crash is easily reproducible by running the following command, if an msleep(100) is inserted before the call to func() in iterate_devs():
while :; do head -c1 /dev/nullb0; done > /dev/null & while :; do sync; done
Fix it by holding the bd_mutex across the func() call and only calling func() if the bdev is opened.
--- fs/block_dev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/block_dev.c +6 -1
@@ -1672,6 +1672,7 @@ void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)spin_lock (&inode_sb_list_lock);list_for_each_entry (inode, &blockdev_superblock->s_inodes, i_sb_list) {struct address_space *mapping = inode->i_mapping; +struct block_device *bdev;spin_lock (&inode->i_lock); if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW) ||
@@ -1692,8 +1693,12 @@ void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)*/ iput (old_inode); old_inode = inode; + bdev =I_BDEV (inode); -func (I_BDEV (inode), arg); +mutex_lock (&bdev->bd_mutex); +if (bdev->bd_openers) +func (bdev, arg); +mutex_unlock (&bdev->bd_mutex);spin_lock (&inode_sb_list_lock); }
Signature · 1 line
2.11.0
PATCH 1/1 scsi: zfcp: fix use-after-"free" in FC ingress path after TMF
In reply to Jiri SlabyFrom: Benjamin Block <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit dac37e15b7d511e026a9313c8c46794c144103cd upstream.
When SCSI EH invokes zFCP's callbacks for eh_device_reset_handler() and eh_target_reset_handler(), it expects us to relent the ownership over the given scsi_cmnd and all other scsi_cmnds within the same scope - LUN or target - when returning with SUCCESS from the callback ('release' them). SCSI EH can then reuse those commands.
We did not follow this rule to release commands upon SUCCESS; and if later a reply arrived for one of those supposed to be released commands, we would still make use of the scsi_cmnd in our ingress tasklet. This will at least result in undefined behavior or a kernel panic because of a wrong kernel pointer dereference.
To fix this, we NULLify all pointers to scsi_cmnds (struct zfcp_fsf_req *)->data in the matching scope if a TMF was successful. This is done under the locks (struct zfcp_adapter *)->abort_lock and (struct zfcp_reqlist *)->lock to prevent the requests from being removed from the request-hashtable, and the ingress tasklet from making use of the scsi_cmnd-pointer in zfcp_fsf_fcp_cmnd_handler().
For cases where a reply arrives during SCSI EH, but before we get a chance to NULLify the pointer - but before we return from the callback -, we assume that the code is protected from races via the CAS operation in blk_complete_request() that is called in scsi_done().
The following stacktrace shows an example for a crash resulting from the previous behavior:
Unable to handle kernel pointer dereference at virtual kernel address fffffee17a672000
Oops: 0038 [#1] SMP
CPU: 2 PID: 0 Comm: swapper/2 Not tainted
task: 00000003f7ff5be0 ti: 00000003f3d38000 task.ti: 00000003f3d38000
Krnl PSW : 0404d00180000000 00000000001156b0 (smp_vcpu_scheduled+0x18/0x40)
R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:1 PM:0 EA:3
Krnl GPRS: 000000200000007e 0000000000000000 fffffee17a671fd8 0000000300000015
ffffffff80000000 00000000005dfde8 07000003f7f80e00 000000004fa4e800
000000036ce8d8f8 000000036ce8d9c0 00000003ece8fe00 ffffffff969c9e93
00000003fffffffd 000000036ce8da10 00000000003bf134 00000003f3b07918
Krnl Code: 00000000001156a2: a7190000 lghi %r1,0
00000000001156a6: a7380015 lhi %r3,21
#00000000001156aa: e32050000008 ag %r2,0(%r5)
>00000000001156b0: 482022b0 lh %r2,688(%r2)
00000000001156b4: ae123000 sigp %r1,%r2,0(%r3)
00000000001156b8: b2220020 ipm %r2
00000000001156bc: 8820001c srl %r2,28
00000000001156c0: c02700000001 xilf %r2,1
Call Trace:
([<0000000000000000>] 0x0)
[<000003ff807bdb8e>] zfcp_fsf_fcp_cmnd_handler+0x3de/0x490 [zfcp]
[<000003ff807be30a>] zfcp_fsf_req_complete+0x252/0x800 [zfcp]
[<000003ff807c0a48>] zfcp_fsf_reqid_check+0xe8/0x190 [zfcp]
[<000003ff807c194e>] zfcp_qdio_int_resp+0x66/0x188 [zfcp]
[<000003ff80440c64>] qdio_kick_handler+0xdc/0x310 [qdio]
[<000003ff804463d0>] __tiqdio_inbound_processing+0xf8/0xcd8 [qdio]
[<0000000000141fd4>] tasklet_action+0x9c/0x170
[<0000000000141550>] __do_softirq+0xe8/0x258
[<000000000010ce0a>] do_softirq+0xba/0xc0
[<000000000014187c>] irq_exit+0xc4/0xe8
[<000000000046b526>] do_IRQ+0x146/0x1d8
[<00000000005d6a3c>] io_return+0x0/0x8
[<00000000005d6422>] vtime_stop_cpu+0x4a/0xa0
([<0000000000000000>] 0x0)
[<0000000000103d8a>] arch_cpu_idle+0xa2/0xb0
[<0000000000197f94>] cpu_startup_entry+0x13c/0x1f8
[<0000000000114782>] smp_start_secondary+0xda/0xe8
[<00000000005d6efe>] restart_int_handler+0x56/0x6c
[<0000000000000000>] 0x0Last Breaking-Event-Address:
[<00000000003bf12e>] arch_spin_lock_wait+0x56/0xb0
--- drivers/s390/scsi/zfcp_dbf.h | 11 ++++++++ drivers/s390/scsi/zfcp_reqlist.h | 30 ++++++++++++++++++++- drivers/s390/scsi/zfcp_scsi.c | 57 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 95 insertions(+), 3 deletions(-)
drivers/s390/scsi/zfcp_dbf.h +11 -0
@@ -388,4 +388,15 @@ void zfcp_dbf_scsi_devreset(char *tag, struct scsi_cmnd *scmnd, u8 flag) _zfcp_dbf_scsi(tmp_tag, 1, scmnd, NULL); } +/** +* zfcp_dbf_scsi_nullcmnd() - trace NULLify of SCSI command in dev/tgt-reset. +* @scmnd: SCSI command that was NULLified. +* @fsf_req: request that owned @scmnd. +*/ +static inline void zfcp_dbf_scsi_nullcmnd (struct scsi_cmnd *scmnd, +struct zfcp_fsf_req *fsf_req) +{ +_zfcp_dbf_scsi ("scfc__1" ,3 , scmnd, fsf_req); +} +#endif /* ZFCP_DBF_H */
drivers/s390/scsi/zfcp_reqlist.h +29 -1
@@ -4,7 +4,7 @@* Data structure and helper functions for tracking pending FSF * requests. * -* Copyright IBM Corp. 2009 +* Copyright IBM Corp. 2009, 2016 */ #ifndef ZFCP_REQLIST_H
@@ -180,4 +180,32 @@ static inline void zfcp_reqlist_move(struct zfcp_reqlist *rl, spin_unlock_irqrestore(&rl->lock, flags); } +/** +* zfcp_reqlist_apply_for_all() - apply a function to every request. +* @rl: the requestlist that contains the target requests. +* @f: the function to apply to each request; the first parameter of the +* function will be the target-request; the second parameter is the same +* pointer as given with the argument @data. +* @data: freely chosen argument; passed through to @f as second parameter. +* +* Uses :c:macro:`list_for_each_entry` to iterate over the lists in the hash- +* table (not a 'safe' variant, so don't modify the list). +* +* Holds @rl->lock over the entire request-iteration. +*/ +static inline void +zfcp_reqlist_apply_for_all (struct zfcp_reqlist *rl, +void (*f)(struct zfcp_fsf_req *,void *),void *data) +{ +struct zfcp_fsf_req *req; +unsigned long flags; +unsigned int i; + +spin_lock_irqsave (&rl->lock, flags); +for (i =0 ; i <ZFCP_REQ_LIST_BUCKETS ; i++) +list_for_each_entry (req, &rl->buckets[i], list) +f (req, data); +spin_unlock_irqrestore (&rl->lock, flags); +} +#endif /* ZFCP_REQLIST_H */
drivers/s390/scsi/zfcp_scsi.c +55 -2
76 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH 1/1 scsi: zfcp: do not trace pure benign residual HBA responses at default level
In reply to Jiri SlabyFrom: Steffen Maier <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 56d23ed7adf3974f10e91b643bd230e9c65b5f79 upstream.
Since quite a while, Linux issues enough SCSI commands per scsi_device which successfully return with FCP_RESID_UNDER, FSF_FCP_RSP_AVAILABLE, and SAM_STAT_GOOD. This floods the HBA trace area and we cannot see other and important HBA trace records long enough.
Therefore, do not trace HBA response errors for pure benign residual under counts at the default trace level.
This excludes benign residual under count combined with other validity bits set in FCP_RSP_IU, such as FCP_SNS_LEN_VAL. For all those other cases, we still do want to see both the HBA record and the corresponding SCSI record by default.
--- drivers/s390/scsi/zfcp_dbf.h | 30 ++++++++++++++++++++++++++++-- drivers/s390/scsi/zfcp_fsf.h | 3 ++- 2 files changed, 30 insertions(+), 3 deletions(-)
drivers/s390/scsi/zfcp_dbf.h +28 -2
@@ -2,7 +2,7 @@* zfcp device driver * debug feature declarations * -* Copyright IBM Corp. 2008, 2015 +* Copyright IBM Corp. 2008, 2016 */ #ifndef ZFCP_DBF_H
@@ -283,6 +283,30 @@ struct zfcp_dbf {struct zfcp_dbf_scsi scsi_buf; }; +/** +* zfcp_dbf_hba_fsf_resp_suppress - true if we should not trace by default +* @req: request that has been completed +* +* Returns true if FCP response with only benign residual under count. +*/ +static inline +bool zfcp_dbf_hba_fsf_resp_suppress (struct zfcp_fsf_req *req) +{ +struct fsf_qtcb *qtcb = req->qtcb; +u32 fsf_stat = qtcb->header.fsf_status; +struct fcp_resp *fcp_rsp; +u8 rsp_flags, fr_status; + +if (qtcb->prefix.qtcb_type !=FSF_IO_COMMAND ) +return false;/* not an FCP response */ + fcp_rsp = (struct fcp_resp *)&qtcb->bottom.io.fcp_rsp; + rsp_flags = fcp_rsp->fr_flags; + fr_status = fcp_rsp->fr_status; +return (fsf_stat ==FSF_FCP_RSP_AVAILABLE ) && + (rsp_flags ==FCP_RESID_UNDER ) && + (fr_status ==SAM_STAT_GOOD ); +} +static inline void zfcp_dbf_hba_fsf_resp (char *tag,int level,struct zfcp_fsf_req *req) {
@@ -304,7 +328,9 @@ void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req)zfcp_dbf_hba_fsf_resp ("fs_perr" ,1 , req); }else if (qtcb->header.fsf_status !=FSF_GOOD ) { -zfcp_dbf_hba_fsf_resp ("fs_ferr" ,1 , req); +zfcp_dbf_hba_fsf_resp ("fs_ferr" , +zfcp_dbf_hba_fsf_resp_suppress (req) + ?5 :1 , req); }else if ((req->fsf_command ==FSF_QTCB_OPEN_PORT_WITH_DID ) || (req->fsf_command ==FSF_QTCB_OPEN_LUN )) {
drivers/s390/scsi/zfcp_fsf.h +2 -1
@@ -3,7 +3,7 @@* * Interface to the FSF support functions. * -* Copyright IBM Corp. 2002, 2015 +* Copyright IBM Corp. 2002, 2016 */ #ifndef FSF_H
@@ -78,6 +78,7 @@#define FSF_APP_TAG_CHECK_FAILURE 0x00000082#define FSF_REF_TAG_CHECK_FAILURE 0x00000083#define FSF_ADAPTER_STATUS_AVAILABLE 0x000000AD +#define FSF_FCP_RSP_AVAILABLE 0x000000AF#define FSF_UNKNOWN_COMMAND 0x000000E2#define FSF_UNKNOWN_OP_SUBTYPE 0x000000E3#define FSF_INVALID_COMMAND_OPTION 0x000000E5
Signature · 1 line
2.11.0
PATCH 1/1 scsi: avoid a permanent stop of the scsi device's request queue
In reply to Jiri SlabyFrom: Wei Fang <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit d2a145252c52792bc59e4767b486b26c430af4bb upstream.
A race between scanning and fc_remote_port_delete() may result in a permanent stop if the device gets blocked before scsi_sysfs_add_sdev() and unblocked after. The reason is that blocking a device sets both the SDEV_BLOCKED state and the QUEUE_FLAG_STOPPED. However, scsi_sysfs_add_sdev() unconditionally sets SDEV_RUNNING which causes the device to be ignored by scsi_target_unblock() and thus never have its QUEUE_FLAG_STOPPED cleared leading to a device which is apparently running but has a stopped queue.
We actually have two places where SDEV_RUNNING is set: once in scsi_add_lun() which respects the blocked flag and once in scsi_sysfs_add_sdev() which doesn't. Since the second set is entirely spurious, simply remove it to fix the problem.
--- drivers/scsi/scsi_sysfs.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/scsi/scsi_sysfs.c +0 -4
@@ -905,10 +905,6 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)struct request_queue *rq = sdev->request_queue;struct scsi_target *starget = sdev->sdev_target; - error =scsi_device_set_state (sdev,SDEV_RUNNING ); -if (error) -return error; - error =scsi_target_add (starget);if (error)return error;
Signature · 1 line
2.11.0
PATCH 1/1 s390/vmlogrdr: fix IUCV buffer allocation
In reply to Jiri SlabyFrom: Gerald Schaefer <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 5457e03de918f7a3e294eb9d26a608ab8a579976 upstream.
The buffer for iucv_message_receive() needs to be below 2 GB. In __iucv_message_receive(), the buffer address is casted to an u32, which would result in either memory corruption or an addressing exception when using addresses >= 2 GB.
Fix this by using GFP_DMA for the buffer allocation.
--- drivers/s390/char/vmlogrdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/char/vmlogrdr.c +1 -1
@@ -873,7 +873,7 @@ static int __init vmlogrdr_init(void) goto cleanup;for (i=0 ; i <MAXMINOR ; ++i ) { - sys_ser[i].buffer = (char *)get_zeroed_page (GFP_KERNEL ); + sys_ser[i].buffer = (char *)get_zeroed_page (GFP_KERNEL |GFP_DMA );if (!sys_ser[i].buffer) { rc = -ENOMEM ;break ;
Signature · 1 line
2.11.0
PATCH 1/1 md/raid5: limit request size according to implementation limits
In reply to Jiri SlabyFrom: Konstantin Khlebnikov <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit e8d7c33232e5fdfa761c3416539bc5b4acd12db5 upstream.
Current implementation employ 16bit counter of active stripes in lower bits of bio->bi_phys_segments. If request is big enough to overflow this counter bio will be completed and freed too early.
Fortunately this not happens in default configuration because several other limits prevent that: stripe_cache_size * nr_disks effectively limits count of active stripes. And small max_sectors_kb at lower disks prevent that during normal read/write operations.
Overflow easily happens in discard if it's enabled by module parameter "devices_handle_discard_safely" and stripe_cache_size is set big enough.
This patch limits requests size with 256Mb - 8Kb to prevent overflows.
--- drivers/md/raid5.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/md/raid5.c +9 -0
@@ -5943,6 +5943,15 @@ static int run(struct mddev *mddev) stripe = (stripe | (stripe-1 )) +1 ; mddev->queue->limits.discard_alignment = stripe; mddev->queue->limits.discard_granularity = stripe; + +/* +* We use 16-bit counter of active stripes in bi_phys_segments +* (minus one for over-loaded initialization) +*/ +blk_queue_max_hw_sectors (mddev->queue,0xfffe *STRIPE_SECTORS ); +blk_queue_max_discard_sectors (mddev->queue, +0xfffe *STRIPE_SECTORS ); +/* * unaligned part of discard request will be ignored, so can't * guarantee discard_zeroes_data
Signature · 1 line
2.11.0
PATCH 1/1 scsi: zfcp: fix rport unblock race with LUN recovery
In reply to Jiri SlabyFrom: Steffen Maier <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 6f2ce1c6af37191640ee3ff6e8fc39ea10352f4c upstream.
It is unavoidable that zfcp_scsi_queuecommand() has to finish requests with DID_IMM_RETRY (like fc_remote_port_chkready()) during the time window when zfcp detected an unavailable rport but fc_remote_port_delete(), which is asynchronous via zfcp_scsi_schedule_rport_block(), has not yet blocked the rport.
However, for the case when the rport becomes available again, we should prevent unblocking the rport too early. In contrast to other FCP LLDDs, zfcp has to open each LUN with the FCP channel hardware before it can send I/O to a LUN. So if a port already has LUNs attached and we unblock the rport just after port recovery, recoveries of LUNs behind this port can still be pending which in turn force zfcp_scsi_queuecommand() to unnecessarily finish requests with DID_IMM_RETRY.
This also opens a time window with unblocked rport (until the followup LUN reopen recovery has finished). If a scsi_cmnd timeout occurs during this time window fc_timed_out() cannot work as desired and such command would indeed time out and trigger scsi_eh. This prevents a clean and timely path failover. This should not happen if the path issue can be recovered on FC transport layer such as path issues involving RSCNs.
Fix this by only calling zfcp_scsi_schedule_rport_register(), to asynchronously trigger fc_remote_port_add(), after all LUN recoveries as children of the rport have finished and no new recoveries of equal or higher order were triggered meanwhile. Finished intentionally includes any recovery result no matter if successful or failed (still unblock rport so other successful LUNs work). For simplicity, we check after each finished LUN recovery if there is another LUN recovery pending on the same port and then do nothing. We handle the special case of a successful recovery of a port without LUN children the same way without changing this case's semantics.
For debugging we introduce 2 new trace records written if the rport unblock attempt was aborted due to still unfinished or freshly triggered recovery. The records are only written above the default trace level.
Benjamin noticed the important special case of new recovery that can be triggered between having given up the erp_lock and before calling zfcp_erp_action_cleanup() within zfcp_erp_strategy(). We must avoid the following sequence:
ERP thread rport_work other context ------------------------- -------------- --------------------------------
port is unblocked, rport still blocked,
due to pending/running ERP action,
so ((port->status & ...UNBLOCK) != 0)
and (port->rport == NULL)
unlock ERPzfcp_erp_action_cleanup()
case ZFCP_ERP_ACTION_REOPEN_LUN:zfcp_erp_try_rport_unblock()
((status & ...UNBLOCK) != 0) [OLD!]
zfcp_erp_port_reopen()
lock ERP
zfcp_erp_port_block()
port->status clear ...UNBLOCK
unlock ERP
zfcp_scsi_schedule_rport_block()
port->rport_task = RPORT_DEL
queue_work(rport_work)
zfcp_scsi_rport_work()
(port->rport_task != RPORT_ADD)
port->rport_task = RPORT_NONE
zfcp_scsi_rport_block()
if (!port->rport) return
zfcp_scsi_schedule_rport_register()
port->rport_task = RPORT_ADD
queue_work(rport_work)
zfcp_scsi_rport_work()
(port->rport_task == RPORT_ADD)
port->rport_task = RPORT_NONE
zfcp_scsi_rport_register()
(port->rport == NULL)
rport = fc_remote_port_add()
port->rport = rport;Now the rport was erroneously unblocked while the zfcp_port is blocked. This is another situation we want to avoid due to scsi_eh potential. This state would at least remain until the new recovery from the other context finished successfully, or potentially forever if it failed. In order to close this race, we take the erp_lock inside zfcp_erp_try_rport_unblock() when checking the status of zfcp_port or LUN. With that, the possible corresponding rport state sequences would
be: (unblock[ERP thread],block[other context]) if the ERP thread gets erp_lock first and still sees ((port->status & ...UNBLOCK) != 0), (block[other context],NOP[ERP thread]) if the ERP thread gets erp_lock after the other context has already cleard ...UNBLOCK from port->status.
Since checking fields of struct erp_action is unsafe because they could have been overwritten (re-used for new recovery) meanwhile, we only check status of zfcp_port and LUN since these are only changed under erp_lock elsewhere. Regarding the check of the proper status flags (port or port_forced are similar to the shown adapter recovery):
[zfcp_erp_adapter_shutdown()] zfcp_erp_adapter_reopen()
zfcp_erp_adapter_block()
* clear UNBLOCK ---------------------------------------+
zfcp_scsi_schedule_rports_block() |
write_lock_irqsave(&adapter->erp_lock, flags);-------+ |
zfcp_erp_action_enqueue() | |
zfcp_erp_setup_act() | |
* set ERP_INUSE -----------------------------------|--|--+
write_unlock_irqrestore(&adapter->erp_lock, flags);--+ | |
.context-switch. | |
zfcp_erp_thread() | |
zfcp_erp_strategy() | |
write_lock_irqsave(&adapter->erp_lock, flags);------+ | |
... | | |
zfcp_erp_strategy_check_target() | | |
zfcp_erp_strategy_check_adapter() | | |
zfcp_erp_adapter_unblock() | | |
* set UNBLOCK -----------------------------------|--+ |
zfcp_erp_action_dequeue() | |
* clear ERP_INUSE ---------------------------------|-----+
... | write_unlock_irqrestore(&adapter->erp_lock, flags);-+
Hence, we should check for both UNBLOCK and ERP_INUSE because they are interleaved. Also we need to explicitly check ERP_FAILED for the link down case which currently does not clear the UNBLOCK flag in zfcp_fsf_link_down_info_eval().
--- drivers/s390/scsi/zfcp_dbf.c | 17 +++++++++--- drivers/s390/scsi/zfcp_erp.c | 61 +++++++++++++++++++++++++++++++++++++++++-- drivers/s390/scsi/zfcp_ext.h | 4 ++- drivers/s390/scsi/zfcp_scsi.c | 4 +-- 4 files changed, 77 insertions(+), 9 deletions(-)
drivers/s390/scsi/zfcp_dbf.c +14 -3
@@ -289,11 +289,12 @@ void zfcp_dbf_rec_trig(char *tag, struct zfcp_adapter *adapter,/** -* zfcp_dbf_rec_run - trace event related to running recovery +* zfcp_dbf_rec_run_lvl - trace event related to running recovery +* @level: trace level to be used for event * @tag: identifier for event * @erp: erp_action running */ -void zfcp_dbf_rec_run (char *tag,struct zfcp_erp_action *erp) +void zfcp_dbf_rec_run_lvl (int level,char *tag,struct zfcp_erp_action *erp) {struct zfcp_dbf *dbf = erp->adapter->dbf;struct zfcp_dbf_rec *rec = &dbf->rec_buf;
@@ -319,11 +320,21 @@ void zfcp_dbf_rec_run(char *tag, struct zfcp_erp_action *erp)else rec->u.run.rec_count =atomic_read (&erp->adapter->erp_counter); -debug_event (dbf->rec,1 , rec,sizeof (*rec)); +debug_event (dbf->rec, level, rec,sizeof (*rec));spin_unlock_irqrestore (&dbf->rec_lock, flags); }/** +* zfcp_dbf_rec_run - trace event related to running recovery +* @tag: identifier for event +* @erp: erp_action running +*/ +void zfcp_dbf_rec_run (char *tag,struct zfcp_erp_action *erp) +{ +zfcp_dbf_rec_run_lvl (1 , tag, erp); +} + +/** * zfcp_dbf_rec_run_wka - trace wka port event with info like running recovery * @tag: identifier for event * @wka_port: well known address port
drivers/s390/scsi/zfcp_erp.c +59 -2
85 lines not on this page · raw message
drivers/s390/scsi/zfcp_ext.h +3 -1
@@ -3,7 +3,7 @@* * External function declarations. * -* Copyright IBM Corp. 2002, 2015 +* Copyright IBM Corp. 2002, 2016 */ #ifndef ZFCP_EXT_H
@@ -35,6 +35,8 @@ extern void zfcp_dbf_adapter_unregister(struct zfcp_adapter *);extern void zfcp_dbf_rec_trig (char *,struct zfcp_adapter *,struct zfcp_port *,struct scsi_device *,u8 ,u8 );extern void zfcp_dbf_rec_run (char *,struct zfcp_erp_action *); +extern void zfcp_dbf_rec_run_lvl (int level,char *tag, +struct zfcp_erp_action *erp);extern void zfcp_dbf_rec_run_wka (char *,struct zfcp_fc_wka_port *,u64 );extern void zfcp_dbf_hba_fsf_uss (char *,struct zfcp_fsf_req *);extern void zfcp_dbf_hba_fsf_res (char *,int ,struct zfcp_fsf_req *);
drivers/s390/scsi/zfcp_scsi.c +1 -3
@@ -109,9 +109,7 @@ int zfcp_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scpnt) }if (unlikely (!(status &ZFCP_STATUS_COMMON_UNBLOCKED ))) { -/* This could be either -* open LUN pending: this is temporary, will result in -* open LUN or ERP_FAILED, so retry command +/* This could be * call to rport_delete pending: mimic retry from * fc_remote_port_chkready until rport is BLOCKED */
Signature · 1 line
2.11.0
PATCH 1/1 kvm: nVMX: Allow L1 to intercept software exceptions (#BP and #OF)
In reply to Jiri SlabyFrom: Jim Mattson <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit ef85b67385436ddc1998f45f1d6a210f935b3388 upstream.
When L2 exits to L0 due to "exception or NMI", software exceptions (#BP and #OF) for which L1 has requested an intercept should be handled by L1 rather than L0. Previously, only hardware exceptions were forwarded to L1.
--- arch/x86/kvm/vmx.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
arch/x86/kvm/vmx.c +5 -6
@@ -1052,10 +1052,10 @@ static inline int nested_cpu_has_ept(struct vmcs12 *vmcs12)return nested_cpu_has2 (vmcs12,SECONDARY_EXEC_ENABLE_EPT ); } -static inline bool is_exception (u32 intr_info) +static inline bool is_nmi (u32 intr_info) {return (intr_info & (INTR_INFO_INTR_TYPE_MASK |INTR_INFO_VALID_MASK )) - == (INTR_TYPE_HARD_EXCEPTION |INTR_INFO_VALID_MASK ); + == (INTR_TYPE_NMI_INTR |INTR_INFO_VALID_MASK ); }static void nested_vmx_vmexit (struct kvm_vcpu *vcpu);
@@ -4769,7 +4769,7 @@ static int handle_exception(struct kvm_vcpu *vcpu)if (is_machine_check (intr_info))return handle_machine_check (vcpu); -if ((intr_info &INTR_INFO_INTR_TYPE_MASK ) ==INTR_TYPE_NMI_INTR ) +if (is_nmi (intr_info))return 1 ;/* already handled by vmx_vcpu_run() */ if (is_no_device (intr_info)) {
@@ -6653,7 +6653,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)switch (exit_reason) {case EXIT_REASON_EXCEPTION_NMI : -if (!is_exception (intr_info)) +if (is_nmi (intr_info))return 0 ;else if (is_page_fault (intr_info))return enable_ept;
@@ -6962,8 +6962,7 @@ static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx)kvm_machine_check ();/* We need to handle NMIs before interrupts are enabled */ -if ((exit_intr_info &INTR_INFO_INTR_TYPE_MASK ) ==INTR_TYPE_NMI_INTR && - (exit_intr_info &INTR_INFO_VALID_MASK )) { +if (is_nmi (exit_intr_info)) {kvm_before_handle_nmi (&vmx->vcpu); asm("int $2" );kvm_after_handle_nmi (&vmx->vcpu);
Signature · 1 line
2.11.0
PATCH 1/1 ftrace/x86_32: Set ftrace_stub to weak to prevent gcc from using short jumps to it
In reply to Jiri SlabyFrom: "Steven Rostedt (Red Hat)" <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 847fa1a6d3d00f3bdf68ef5fa4a786f644a0dd67 upstream.
With new binutils, gcc may get smart with its optimization and change a jmp from a 5 byte jump to a 2 byte one even though it was jumping to a global function. But that global function existed within a 2 byte radius, and gcc was able to optimize it. Unfortunately, that jump was also being modified when function graph tracing begins. Since ftrace expected that jump to be 5 bytes, but it was only two, it overwrote code after the jump, causing a crash.
This was fixed for x86_64 with commit 8329e818f149, with the same subject as this commit, but nothing was done for x86_32.
--- arch/x86/kernel/entry_32.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/entry_32.S +2 -2
@@ -1113,8 +1113,8 @@ ftrace_graph_call: jmp ftrace_stub #endif -.globl ftrace_stub -ftrace_stub: +/* This is weak to keep gas from relaxing the jumps */ +WEAK(ftrace_stub) ret END(ftrace_caller)
Signature · 1 line
2.11.0
PATCH 1/1 IB/mad: Fix an array index check
In reply to Jiri SlabyFrom: Bart Van Assche <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 2fe2f378dd45847d2643638c07a7658822087836 upstream.
The array ib_mad_mgmt_class_table.method_table has MAX_MGMT_CLASS
(80) elements. Hence compare the array index with that value instead of with IB_MGMT_MAX_METHODS (128). This patch avoids that Coverity reports the following:
Overrunning array class->method_table of 80 8-byte elements at element index 127 (byte offset 1016) using index convert_mgmt_class(mad_hdr->mgmt_class) (which evaluates to 127).
--- drivers/infiniband/core/mad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/mad.c +1 -1
@@ -1598,7 +1598,7 @@ find_mad_agent(struct ib_mad_port_private *port_priv,if (!class) goto out;if (convert_mgmt_class (mad->mad_hdr.mgmt_class) >= -IB_MGMT_MAX_METHODS ) +ARRAY_SIZE (class->method_table)) goto out; method = class->method_table[convert_mgmt_class ( mad->mad_hdr.mgmt_class)];
Signature · 1 line
2.11.0
PATCH 1/1 IB/multicast: Check ib_find_pkey() return value
In reply to Jiri SlabyFrom: Bart Van Assche <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit d3a2418ee36a59bc02e9d454723f3175dcf4bfd9 upstream.
This patch avoids that Coverity complains about not checking the ib_find_pkey() return value.
--- drivers/infiniband/core/multicast.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/infiniband/core/multicast.c +5 -2
@@ -516,8 +516,11 @@ static void join_handler(int status, struct ib_sa_mcmember_rec *rec,if (status)process_join_error (group, status);else { -ib_find_pkey (group->port->dev->device, group->port->port_num, -be16_to_cpu (rec->pkey), &pkey_index); + +if (ib_find_pkey (group->port->dev->device, + group->port->port_num,be16_to_cpu (rec->pkey), + &pkey_index)) + pkey_index =MCAST_INVALID_PKEY_INDEX ;spin_lock_irq (&group->port->lock); group->rec = *rec;
Signature · 1 line
2.11.0
PATCH 1/1 PCI: Check for PME in targeted sleep state
In reply to Jiri SlabyFrom: Alan Stern <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 6496ebd7edf446fccf8266a1a70ffcb64252593e upstream.
One some systems, the firmware does not allow certain PCI devices to be put in deep D-states. This can cause problems for wakeup signalling, if the device does not support PME# in the deepest allowed suspend state. For example, Pierre reports that on his system, ACPI does not permit his xHCI host controller to go into D3 during runtime suspend -- but D3 is the only state in which the controller can generate PME# signals. As a result, the controller goes into runtime suspend but never wakes up, so it doesn't work properly. USB devices plugged into the controller are never detected.
If the device relies on PME# for wakeup signals but is not capable of generating PME# in the target state, the PCI core should accurately report that it cannot do wakeup from runtime suspend. This patch modifies the pci_dev_run_wake() routine to add this check.
--- drivers/pci/pci.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/pci/pci.c +4 -0
@@ -1906,6 +1906,10 @@ bool pci_dev_run_wake(struct pci_dev *dev)if (!dev->pme_support)return false; +/* PME-capable in principle, but not from the intended sleep state */ +if (!pci_pme_capable (dev,pci_target_state (dev))) +return false; +while (bus->parent) {struct pci_dev *bridge = bus->self;
Signature · 1 line
2.11.0
PATCH 1/1 libceph: verify authorize reply on connect
In reply to Jiri SlabyFrom: Ilya Dryomov <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 5c056fdc5b474329037f2aa18401bd73033e0ce0 upstream.
After sending an authorizer (ceph_x_authorize_a + ceph_x_authorize_b), the client gets back a ceph_x_authorize_reply, which it is supposed to verify to ensure the authenticity and protect against replay attacks. The code for doing this is there (ceph_x_verify_authorizer_reply(), ceph_auth_verify_authorizer_reply() + plumbing), but it is never invoked by the the messenger.
AFAICT this goes back to 2009, when ceph authentication protocols support was added to the kernel client in 4e7a5dcd1bba ("ceph:
negotiate authentication protocol; implement AUTH_NONE protocol").
The second param of ceph_connection_operations::verify_authorizer_reply is unused all the way down. Pass 0 to facilitate backporting, and kill it in the next commit.
--- net/ceph/messenger.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/ceph/messenger.c +13 -0
@@ -1972,6 +1972,19 @@ static int process_connect(struct ceph_connection *con)dout ("process_connect on %p tag %d\n" , con, (int )con->in_tag); +if (con->auth_reply_buf) { +/* +* Any connection that defines ->get_authorizer() +* should also define ->verify_authorizer_reply(). +* See get_connect_authorizer(). +*/ + ret = con->ops->verify_authorizer_reply (con,0 ); +if (ret <0 ) { + con->error_msg ="bad authorize reply" ; +return ret; + } + } +switch (con->in_reply.tag) {case CEPH_MSGR_TAG_FEATURES : pr_err("%s%lld %s feature set mismatch,"
Signature · 1 line
2.11.0
PATCH 1/1 nfs_write_end(): fix handling of short copies
In reply to Jiri SlabyFrom: Al Viro <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit c0cf3ef5e0f47e385920450b245d22bead93e7ad upstream.
What matters when deciding if we should make a page uptodate is not how much we _wanted_ to copy, but how much we actually have copied. As it is, on architectures that do not zero tail on short copy we can leave uninitialized data in page marked uptodate.
--- fs/nfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/file.c +1 -1
@@ -425,7 +425,7 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,*/ if (!PageUptodate (page)) {unsigned pglen =nfs_page_length (page); -unsigned end = offset + len; +unsigned end = offset + copied;if (pglen ==0 ) { zero_user_segments(page, 0, offset,
Signature · 1 line
2.11.0
PATCH 1/1 powerpc/ps3: Fix system hang with GCC 5 builds
In reply to Jiri SlabyFrom: Geoff Levand <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 6dff5b67054e17c91bd630bcdda17cfca5aa4215 upstream.
GCC 5 generates different code for this bootwrapper null check that causes the PS3 to hang very early in its bootup. This check is of limited value, so just get rid of it.
--- arch/powerpc/boot/ps3-head.S | 5 ----- arch/powerpc/boot/ps3.c | 8 +------- 2 files changed, 1 insertion(+), 12 deletions(-)
arch/powerpc/boot/ps3-head.S +0 -5
@@ -57,11 +57,6 @@ __system_reset_overlay: bctr 1: - /* Save the value at addr zero for a null pointer write check later. */ - - li r4, 0 - lwz r3, 0(r4) - /* Primary delays then goes to _zimage_start in wrapper. */ or 31, 31, 31 /* db16cyc */
arch/powerpc/boot/ps3.c +1 -7
@@ -119,13 +119,12 @@ void ps3_copy_vectors(void)flush_cache ((void *)0x100 ,512 ); } -void platform_init (unsigned long null_check) +void platform_init (void ) {const u32 heapsize =0x1000000 - (u32 )_end;/* 16MiB */ void *chosen;unsigned long ft_addr;u64 rm_size; -unsigned long val; console_ops.write = ps3_console_write; platform_ops.exit = ps3_exit;
@@ -153,11 +152,6 @@ void platform_init(unsigned long null_check)printf (" flat tree at 0x%lx\n\r" , ft_addr); - val = *(unsigned long *)0 ; - -if (val != null_check) -printf ("null check failed: %lx != %lx\n\r" , val, null_check); - ((kernel_entry_t )0 )(ft_addr,0 ,NULL );ps3_exit ();
Signature · 1 line
2.11.0
PATCH 1/1 kconfig/nconf: Fix hang when editing symbol with a long prompt
In reply to Jiri SlabyFrom: Ben Hutchings <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 79e51b5c2deea542b3bb8c66e0d502230b017dde upstream.
Currently it is impossible to edit the value of a config symbol with a prompt longer than (terminal width - 2) characters. dialog_inputbox() calculates a negative x-offset for the input window and newwin() fails as this is invalid. It also doesn't check for this failure, so it busy-loops calling wgetch(NULL) which immediately returns -1.
The additions in the offset calculations also don't match the intended size of the window.
Limit the window size and calculate the offset similarly to show_scroll_win().
--- scripts/kconfig/nconf.gui.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
scripts/kconfig/nconf.gui.c +11 -4
@@ -364,12 +364,14 @@ int dialog_inputbox(WINDOW *main_window,WINDOW *prompt_win;WINDOW *form_win;PANEL *panel; -int i, x, y; +int i, x, y, lines, columns, win_lines, win_cols;int res =-1 ;int cursor_position =strlen (init);int cursor_form_win;char *result = *resultp; +getmaxyx (stdscr, lines, columns); +if (strlen (init)+1 > *result_len) { *result_len =strlen (init)+1 ; *resultp = result =realloc (result, *result_len);
@@ -386,14 +388,19 @@ int dialog_inputbox(WINDOW *main_window,if (title) prompt_width =max (prompt_width,strlen (title)); + win_lines =min (prompt_lines+6 , lines-2 ); + win_cols =min (prompt_width+7 , columns-2 ); + prompt_lines =max (win_lines-6 ,0 ); + prompt_width =max (win_cols-7 ,0 ); +/* place dialog in middle of screen */ - y = (getmaxy (stdscr)-(prompt_lines+4 ))/2 ; - x = (getmaxx (stdscr)-(prompt_width+4 ))/2 ; + y = (lines-win_lines)/2 ; + x = (columns-win_cols)/2 ;strncpy (result, init, *result_len);/* create the windows */ - win =newwin (prompt_lines+6 , prompt_width+7 , y, x); + win =newwin (win_lines, win_cols, y, x); prompt_win =derwin (win, prompt_lines+1 , prompt_width,2 ,2 ); form_win =derwin (win,1 , prompt_width, prompt_lines+3 ,2 );keypad (form_win, TRUE);
Signature · 1 line
2.11.0
PATCH 1/1 sg_write()/bsg_write() is not fit to be called under KERNEL_DS
In reply to Jiri SlabyFrom: Al Viro <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 128394eff343fc6d2f32172f03e24829539c5835 upstream.
Both damn things interpret userland pointers embedded into the payload; worse, they are actually traversing those. Leaving aside the bad API design, this is very much _not_ safe to call with KERNEL_DS. Bail out early if that happens.
--- block/bsg.c | 3 +++ drivers/scsi/sg.c | 3 +++ 2 files changed, 6 insertions(+)
block/bsg.c +3 -0
@@ -675,6 +675,9 @@ bsg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)dprintk ("%s: write %Zd bytes\n" , bd->name, count); +if (unlikely (segment_eq (get_fs (),KERNEL_DS ))) +return -EINVAL ; +bsg_set_block (bd, file); bytes_written =0 ;
drivers/scsi/sg.c +3 -0
@@ -568,6 +568,9 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)sg_io_hdr_t *hp;unsigned char cmnd[MAX_COMMAND_SIZE ]; +if (unlikely (segment_eq (get_fs (),KERNEL_DS ))) +return -EINVAL ; +if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))return -ENXIO ; SCSI_LOG_TIMEOUT(3, printk("sg_write: %s, count=%d\n",
Signature · 1 line
2.11.0
PATCH 1/1 powerpc: Convert cmp to cmpd in idle enter sequence
In reply to Jiri SlabyFrom: Segher Boessenkool <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 80f23935cadb1c654e81951f5a8b7ceae0acc1b4 upstream.
PowerPC's "cmp" instruction has four operands. Normally people write "cmpw" or "cmpd" for the second cmp operand 0 or 1. But, frequently people forget, and write "cmp" with just three operands.
With older binutils this is silently accepted as if this was "cmpw", while often "cmpd" is wanted. With newer binutils GAS will complain about this for 64-bit code. For 32-bit code it still silently assumes "cmpw" is what is meant.
In this instance the code comes directly from ISA v2.07, including the cmp, but cmpd is correct. Backport to stable so that new toolchains can build old kernels.
--- arch/powerpc/kernel/idle_power7.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/idle_power7.S +1 -1
@@ -110,7 +110,7 @@ power7_enter_nap_mode: std r0,0(r1) ptesync ld r0,0(r1) -1: cmp cr0,r0,r0 +1: cmpd cr0,r0,r0 bne 1b PPC_NAP b .
Signature · 1 line
2.11.0