Skip to content

Commit fdc606b

Browse files
author
Alex Shi
committed
Merge tag 'v4.4.86' into linux-linaro-lsk-v4.4
This is the 4.4.86 stable release
2 parents 8c8a1f3 + cd99a4f commit fdc606b

15 files changed

Lines changed: 63 additions & 43 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION = 4
22
PATCHLEVEL = 4
3-
SUBLEVEL = 85
3+
SUBLEVEL = 86
44
EXTRAVERSION =
55
NAME = Blurry Fish Butt
66

arch/arm64/kernel/fpsimd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,11 @@ void fpsimd_thread_switch(struct task_struct *next)
157157

158158
void fpsimd_flush_thread(void)
159159
{
160+
preempt_disable();
160161
memset(&current->thread.fpsimd_state, 0, sizeof(struct fpsimd_state));
161162
fpsimd_flush_task_state(current);
162163
set_thread_flag(TIF_FOREIGN_FPSTATE);
164+
preempt_enable();
163165
}
164166

165167
/*

arch/arm64/mm/fault.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,11 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
347347
* signal first. We do not need to release the mmap_sem because it
348348
* would already be released in __lock_page_or_retry in mm/filemap.c.
349349
*/
350-
if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
350+
if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) {
351+
if (!user_mode(regs))
352+
goto no_context;
351353
return 0;
354+
}
352355

353356
/*
354357
* Major/minor page fault accounting is only done on the initial

arch/x86/include/asm/io.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,13 @@ static inline unsigned type in##bwl##_p(int port) \
304304
static inline void outs##bwl(int port, const void *addr, unsigned long count) \
305305
{ \
306306
asm volatile("rep; outs" #bwl \
307-
: "+S"(addr), "+c"(count) : "d"(port)); \
307+
: "+S"(addr), "+c"(count) : "d"(port) : "memory"); \
308308
} \
309309
\
310310
static inline void ins##bwl(int port, void *addr, unsigned long count) \
311311
{ \
312312
asm volatile("rep; ins" #bwl \
313-
: "+D"(addr), "+c"(count) : "d"(port)); \
313+
: "+D"(addr), "+c"(count) : "d"(port) : "memory"); \
314314
}
315315

316316
BUILDIO(b, b, char)

drivers/gpu/drm/i915/intel_uncore.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,8 @@ hsw_unclaimed_reg_detect(struct drm_i915_private *dev_priv)
635635
"enabling oneshot unclaimed register reporting. "
636636
"Please use i915.mmio_debug=N for more information.\n");
637637
__raw_i915_write32(dev_priv, FPGA_DBG, FPGA_DBG_RM_NOCLAIM);
638-
i915.mmio_debug = mmio_debug_once--;
638+
i915.mmio_debug = mmio_debug_once;
639+
mmio_debug_once = false;
639640
}
640641
}
641642

drivers/i2c/busses/i2c-jz4780.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -786,10 +786,6 @@ static int jz4780_i2c_probe(struct platform_device *pdev)
786786

787787
jz4780_i2c_writew(i2c, JZ4780_I2C_INTM, 0x0);
788788

789-
i2c->cmd = 0;
790-
memset(i2c->cmd_buf, 0, BUFSIZE);
791-
memset(i2c->data_buf, 0, BUFSIZE);
792-
793789
i2c->irq = platform_get_irq(pdev, 0);
794790
ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0,
795791
dev_name(&pdev->dev), i2c);

drivers/net/wireless/p54/fwio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ int p54_scan(struct p54_common *priv, u16 mode, u16 dwell)
488488

489489
entry += sizeof(__le16);
490490
chan->pa_points_per_curve = 8;
491-
memset(chan->curve_data, 0, sizeof(*chan->curve_data));
491+
memset(chan->curve_data, 0, sizeof(chan->curve_data));
492492
memcpy(chan->curve_data, entry,
493493
sizeof(struct p54_pa_curve_data_sample) *
494494
min((u8)8, curve_data->points_per_channel));

drivers/scsi/isci/remote_node_context.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ const char *rnc_state_name(enum scis_sds_remote_node_context_states state)
6666
{
6767
static const char * const strings[] = RNC_STATES;
6868

69+
if (state >= ARRAY_SIZE(strings))
70+
return "UNKNOWN";
71+
6972
return strings[state];
7073
}
7174
#undef C

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,10 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
10541054
lpfc_sli4_unreg_all_rpis(vport);
10551055
}
10561056
}
1057-
lpfc_issue_reg_vfi(vport);
1057+
1058+
/* Do not register VFI if the driver aborted FLOGI */
1059+
if (!lpfc_error_lost_link(irsp))
1060+
lpfc_issue_reg_vfi(vport);
10581061
lpfc_nlp_put(ndlp);
10591062
goto out;
10601063
}

drivers/scsi/sg.c

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ typedef struct sg_fd { /* holds the state of a file descriptor */
153153
struct sg_device *parentdp; /* owning device */
154154
wait_queue_head_t read_wait; /* queue read until command done */
155155
rwlock_t rq_list_lock; /* protect access to list in req_arr */
156+
struct mutex f_mutex; /* protect against changes in this fd */
156157
int timeout; /* defaults to SG_DEFAULT_TIMEOUT */
157158
int timeout_user; /* defaults to SG_DEFAULT_TIMEOUT_USER */
158159
Sg_scatter_hold reserve; /* buffer held for this file descriptor */
@@ -166,6 +167,7 @@ typedef struct sg_fd { /* holds the state of a file descriptor */
166167
unsigned char next_cmd_len; /* 0: automatic, >0: use on next write() */
167168
char keep_orphan; /* 0 -> drop orphan (def), 1 -> keep for read() */
168169
char mmap_called; /* 0 -> mmap() never called on this fd */
170+
char res_in_use; /* 1 -> 'reserve' array in use */
169171
struct kref f_ref;
170172
struct execute_work ew;
171173
} Sg_fd;
@@ -209,7 +211,6 @@ static void sg_remove_sfp(struct kref *);
209211
static Sg_request *sg_get_rq_mark(Sg_fd * sfp, int pack_id);
210212
static Sg_request *sg_add_request(Sg_fd * sfp);
211213
static int sg_remove_request(Sg_fd * sfp, Sg_request * srp);
212-
static int sg_res_in_use(Sg_fd * sfp);
213214
static Sg_device *sg_get_dev(int dev);
214215
static void sg_device_destroy(struct kref *kref);
215216

@@ -625,6 +626,7 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
625626
}
626627
buf += SZ_SG_HEADER;
627628
__get_user(opcode, buf);
629+
mutex_lock(&sfp->f_mutex);
628630
if (sfp->next_cmd_len > 0) {
629631
cmd_size = sfp->next_cmd_len;
630632
sfp->next_cmd_len = 0; /* reset so only this write() effected */
@@ -633,6 +635,7 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
633635
if ((opcode >= 0xc0) && old_hdr.twelve_byte)
634636
cmd_size = 12;
635637
}
638+
mutex_unlock(&sfp->f_mutex);
636639
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sdp,
637640
"sg_write: scsi opcode=0x%02x, cmd_size=%d\n", (int) opcode, cmd_size));
638641
/* Determine buffer size. */
@@ -732,7 +735,7 @@ sg_new_write(Sg_fd *sfp, struct file *file, const char __user *buf,
732735
sg_remove_request(sfp, srp);
733736
return -EINVAL; /* either MMAP_IO or DIRECT_IO (not both) */
734737
}
735-
if (sg_res_in_use(sfp)) {
738+
if (sfp->res_in_use) {
736739
sg_remove_request(sfp, srp);
737740
return -EBUSY; /* reserve buffer already being used */
738741
}
@@ -902,7 +905,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
902905
return result;
903906
if (val) {
904907
sfp->low_dma = 1;
905-
if ((0 == sfp->low_dma) && (0 == sg_res_in_use(sfp))) {
908+
if ((0 == sfp->low_dma) && !sfp->res_in_use) {
906909
val = (int) sfp->reserve.bufflen;
907910
sg_remove_scat(sfp, &sfp->reserve);
908911
sg_build_reserve(sfp, val);
@@ -977,12 +980,18 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
977980
return -EINVAL;
978981
val = min_t(int, val,
979982
max_sectors_bytes(sdp->device->request_queue));
983+
mutex_lock(&sfp->f_mutex);
980984
if (val != sfp->reserve.bufflen) {
981-
if (sg_res_in_use(sfp) || sfp->mmap_called)
985+
if (sfp->mmap_called ||
986+
sfp->res_in_use) {
987+
mutex_unlock(&sfp->f_mutex);
982988
return -EBUSY;
989+
}
990+
983991
sg_remove_scat(sfp, &sfp->reserve);
984992
sg_build_reserve(sfp, val);
985993
}
994+
mutex_unlock(&sfp->f_mutex);
986995
return 0;
987996
case SG_GET_RESERVED_SIZE:
988997
val = min_t(int, sfp->reserve.bufflen,
@@ -1737,13 +1746,22 @@ sg_start_req(Sg_request *srp, unsigned char *cmd)
17371746
md = &map_data;
17381747

17391748
if (md) {
1740-
if (!sg_res_in_use(sfp) && dxfer_len <= rsv_schp->bufflen)
1749+
mutex_lock(&sfp->f_mutex);
1750+
if (dxfer_len <= rsv_schp->bufflen &&
1751+
!sfp->res_in_use) {
1752+
sfp->res_in_use = 1;
17411753
sg_link_reserve(sfp, srp, dxfer_len);
1742-
else {
1754+
} else if ((hp->flags & SG_FLAG_MMAP_IO) && sfp->res_in_use) {
1755+
mutex_unlock(&sfp->f_mutex);
1756+
return -EBUSY;
1757+
} else {
17431758
res = sg_build_indirect(req_schp, sfp, dxfer_len);
1744-
if (res)
1759+
if (res) {
1760+
mutex_unlock(&sfp->f_mutex);
17451761
return res;
1762+
}
17461763
}
1764+
mutex_unlock(&sfp->f_mutex);
17471765

17481766
md->pages = req_schp->pages;
17491767
md->page_order = req_schp->page_order;
@@ -2034,6 +2052,8 @@ sg_unlink_reserve(Sg_fd * sfp, Sg_request * srp)
20342052
req_schp->sglist_len = 0;
20352053
sfp->save_scat_len = 0;
20362054
srp->res_used = 0;
2055+
/* Called without mutex lock to avoid deadlock */
2056+
sfp->res_in_use = 0;
20372057
}
20382058

20392059
static Sg_request *
@@ -2145,6 +2165,7 @@ sg_add_sfp(Sg_device * sdp)
21452165
rwlock_init(&sfp->rq_list_lock);
21462166

21472167
kref_init(&sfp->f_ref);
2168+
mutex_init(&sfp->f_mutex);
21482169
sfp->timeout = SG_DEFAULT_TIMEOUT;
21492170
sfp->timeout_user = SG_DEFAULT_TIMEOUT_USER;
21502171
sfp->force_packid = SG_DEF_FORCE_PACK_ID;
@@ -2220,20 +2241,6 @@ sg_remove_sfp(struct kref *kref)
22202241
schedule_work(&sfp->ew.work);
22212242
}
22222243

2223-
static int
2224-
sg_res_in_use(Sg_fd * sfp)
2225-
{
2226-
const Sg_request *srp;
2227-
unsigned long iflags;
2228-
2229-
read_lock_irqsave(&sfp->rq_list_lock, iflags);
2230-
for (srp = sfp->headrp; srp; srp = srp->nextrp)
2231-
if (srp->res_used)
2232-
break;
2233-
read_unlock_irqrestore(&sfp->rq_list_lock, iflags);
2234-
return srp ? 1 : 0;
2235-
}
2236-
22372244
#ifdef CONFIG_SCSI_PROC_FS
22382245
static int
22392246
sg_idr_max_id(int id, void *p, void *data)

0 commit comments

Comments
 (0)