Skip to content

Commit ab290ea

Browse files
committed
Merge tag 's390-6.1-5' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 fixes from Alexander Gordeev: - Fix deadlock in discontiguous saved segments (DCSS) block device driver. When adding a disk and scanning partitions the scan would not break out early without a missed flag. - Avoid using global register variable for current_stack_pointer due to an old bug in gcc versions prior to gcc-8.4. Due to this bug a broken code is generated, which leads to stack corruptions. * tag 's390-6.1-5' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390: avoid using global register for current_stack_pointer s390/dcssblk: fix deadlock when adding a DCSS
2 parents 5556a78 + e3c1102 commit ab290ea

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

arch/s390/include/asm/processor.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,16 @@ unsigned long __get_wchan(struct task_struct *p);
199199
/* Has task runtime instrumentation enabled ? */
200200
#define is_ri_task(tsk) (!!(tsk)->thread.ri_cb)
201201

202-
register unsigned long current_stack_pointer asm("r15");
202+
/* avoid using global register due to gcc bug in versions < 8.4 */
203+
#define current_stack_pointer (__current_stack_pointer())
204+
205+
static __always_inline unsigned long __current_stack_pointer(void)
206+
{
207+
unsigned long sp;
208+
209+
asm volatile("lgr %0,15" : "=d" (sp));
210+
return sp;
211+
}
203212

204213
static __always_inline unsigned short stap(void)
205214
{

drivers/s390/block/dcssblk.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
636636
dev_info->gd->minors = DCSSBLK_MINORS_PER_DISK;
637637
dev_info->gd->fops = &dcssblk_devops;
638638
dev_info->gd->private_data = dev_info;
639+
dev_info->gd->flags |= GENHD_FL_NO_PART;
639640
blk_queue_logical_block_size(dev_info->gd->queue, 4096);
640641
blk_queue_flag_set(QUEUE_FLAG_DAX, dev_info->gd->queue);
641642

0 commit comments

Comments
 (0)