4.10.15-stable review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.10.15-stable review
This is the start of the stable review cycle for the 4.10.15 release. There are 5 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 Mon May 8 20:38:36 UTC 2017. 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/v4.x/stable-review/patch-4.10.15-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.10.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.10.15-rc1
Adrian Salido <[email protected]>
dm ioctl: prevent stack leak in dm ioctl call
Guenter Roeck <[email protected]>
hwmon: (it87) Avoid registering the same chip on both SIO addresses
Stephen Hemminger <[email protected]>
scsi: storvsc: Workaround for virtual DVD SCSI version
Sachin Prabhu <[email protected]>
Handle mismatched open calls
Thomas Gleixner <[email protected]>
timerfd: Protect the might cancel mechanism proper
-------------
Diffstat:
Makefile | 4 ++-- drivers/hwmon/it87.c | 24 +++++++++++++++---- drivers/md/dm-ioctl.c | 2 +- drivers/scsi/storvsc_drv.c | 27 +++++++++++++-------- fs/cifs/cifsglob.h | 11 +++++++++ fs/cifs/cifssmb.c | 4 ++++ fs/cifs/connect.c | 13 +++++++++-- fs/cifs/smb2misc.c | 44 +++++++++++++++++++++++++++++++++++ fs/cifs/smb2ops.c | 4 ++++ fs/cifs/smb2proto.h | 7 ++++++ fs/cifs/smb2transport.c | 58 +++++++++++++++++++++++++++++++++++++++++----- fs/cifs/transport.c | 2 ++ fs/timerfd.c | 17 +++++++++++--- 13 files changed, 188 insertions(+), 29 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/5 timerfd: Protect the might cancel mechanism proper
4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 1e38da300e1e395a15048b0af1e5305bd91402f6 upstream.
The handling of the might_cancel queueing is not properly protected, so parallel operations on the file descriptor can race with each other and lead to list corruptions or use after free.
Protect the context for these operations with a seperate lock.
The wait queue lock cannot be reused for this because that would create a lock inversion scenario vs. the cancel lock. Replacing might_cancel with an atomic (atomic_t or atomic bit) does not help either because it still can race vs. the actual list operation.
--- fs/timerfd.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
fs/timerfd.c +14 -3
@@ -40,6 +40,7 @@ struct timerfd_ctx {short unsigned settime_flags;/* to show in fdinfo */ struct rcu_head rcu;struct list_head clist; +spinlock_t cancel_lock;bool might_cancel; };
@@ -112,7 +113,7 @@ void timerfd_clock_was_set(void)rcu_read_unlock (); } -static void timerfd_remove_cancel (struct timerfd_ctx *ctx) +static void __timerfd_remove_cancel (struct timerfd_ctx *ctx) {if (ctx->might_cancel) { ctx->might_cancel = false;
@@ -122,6 +123,13 @@ static void timerfd_remove_cancel(struct } } +static void timerfd_remove_cancel (struct timerfd_ctx *ctx) +{ +spin_lock (&ctx->cancel_lock); +__timerfd_remove_cancel (ctx); +spin_unlock (&ctx->cancel_lock); +} +static bool timerfd_canceled (struct timerfd_ctx *ctx) {if (!ctx->might_cancel || ctx->moffs !=KTIME_MAX )
@@ -132,6 +140,7 @@ static bool timerfd_canceled(struct timestatic void timerfd_setup_cancel (struct timerfd_ctx *ctx,int flags) { +spin_lock (&ctx->cancel_lock);if ((ctx->clockid ==CLOCK_REALTIME || ctx->clockid ==CLOCK_REALTIME_ALARM ) && (flags &TFD_TIMER_ABSTIME ) && (flags &TFD_TIMER_CANCEL_ON_SET )) {
@@ -141,9 +150,10 @@ static void timerfd_setup_cancel(structlist_add_rcu (&ctx->clist, &cancel_list);spin_unlock (&cancel_lock); } - }else if (ctx->might_cancel) { -timerfd_remove_cancel (ctx); + }else { +__timerfd_remove_cancel (ctx); } +spin_unlock (&ctx->cancel_lock); }static ktime_t timerfd_get_remaining (struct timerfd_ctx *ctx)
@@ -400,6 +410,7 @@ SYSCALL_DEFINE2(timerfd_create, int, cloreturn -ENOMEM ;init_waitqueue_head (&ctx->wqh); +spin_lock_init (&ctx->cancel_lock); ctx->clockid = clockid;if (isalarm (ctx))
Greg Kroah-Hartman
maintainerPATCH 2/5 Handle mismatched open calls
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sachin Prabhu <[email protected]>
commit 38bd49064a1ecb67baad33598e3d824448ab11ec upstream.
A signal can interrupt a SendReceive call which result in incoming responses to the call being ignored. This is a problem for calls such as open which results in the successful response being ignored. This results in an open file resource on the server.
The patch looks into responses which were cancelled after being sent and in case of successful open closes the open fids.
For this patch, the check is only done in SendReceive2()
RH-bz: 1403319
--- fs/cifs/cifsglob.h | 11 +++++++++ fs/cifs/cifssmb.c | 4 +++ fs/cifs/connect.c | 13 +++++++++- fs/cifs/smb2misc.c | 44 ++++++++++++++++++++++++++++++++++++ fs/cifs/smb2ops.c | 4 +++ fs/cifs/smb2proto.h | 7 +++++ fs/cifs/smb2transport.c | 58 +++++++++++++++++++++++++++++++++++++++++++----- fs/cifs/transport.c | 2 + 8 files changed, 135 insertions(+), 8 deletions(-)
fs/cifs/cifsglob.h +11 -0
@@ -241,6 +241,7 @@ struct smb_version_operations {/* verify the message */ int (*check_message)(char *,unsigned int ,struct TCP_Server_Info *);bool (*is_oplock_break)(char *,struct TCP_Server_Info *); +int (*handle_cancelled_mid)(char *,struct TCP_Server_Info *);void (*downgrade_oplock)(struct TCP_Server_Info *,struct cifsInodeInfo *,bool );/* process transaction2 response */
@@ -1318,12 +1319,19 @@ struct mid_q_entry {void *callback_data;/* general purpose pointer for callback */ void *resp_buf;/* pointer to received SMB header */ int mid_state;/* wish this were enum but can not pass to wait_event */ +unsigned int mid_flags;__le16 command;/* smb command code */ bool large_buf:1; /* if valid response, is pointer to large buf */ bool multiRsp:1; /* multiple trans2 responses for one request */ bool multiEnd:1; /* both received */ }; +struct close_cancelled_open { +struct cifs_fid fid; +struct cifs_tcon *tcon; +struct work_struct work; +}; +/* Make code in transport.c a little cleaner by moving update of optional stats into function below */ #ifdef CONFIG_CIFS_STATS2
@@ -1455,6 +1463,9 @@ static inline void free_dfs_info_array(s#define MID_RESPONSE_MALFORMED 0x10#define MID_SHUTDOWN 0x20 +/* Flags */ +#define MID_WAIT_CANCELLED 1/* Cancelled while waiting for response */ +/* Types of response buffer returned from SendReceive2 */ #define CIFS_NO_BUFFER 0/* Response buffer not returned */ #define CIFS_SMALL_BUFFER 1
fs/cifs/cifssmb.c +4 -0
@@ -1423,6 +1423,8 @@ cifs_readv_discard(struct TCP_Server_Inf length =discard_remaining_data (server);dequeue_mid (mid, rdata->result); + mid->resp_buf = server->smallbuf; + server->smallbuf =NULL ;return length; }
@@ -1534,6 +1536,8 @@ cifs_readv_receive(struct TCP_Server_Infreturn cifs_readv_discard (server, mid);dequeue_mid (mid, false); + mid->resp_buf = server->smallbuf; + server->smallbuf =NULL ;return length; }
fs/cifs/connect.c +11 -2
@@ -887,10 +887,19 @@ cifs_demultiplex_thread(void *p) server->lstrp = jiffies;if (mid_entry !=NULL ) { +if ((mid_entry->mid_flags &MID_WAIT_CANCELLED ) && + mid_entry->mid_state ==MID_RESPONSE_RECEIVED && + server->ops->handle_cancelled_mid) + server->ops->handle_cancelled_mid ( + mid_entry->resp_buf, + server); +if (!mid_entry->multiRsp || mid_entry->multiEnd) mid_entry->callback (mid_entry); - }else if (!server->ops->is_oplock_break || - !server->ops->is_oplock_break (buf, server)) { + }else if (server->ops->is_oplock_break && + server->ops->is_oplock_break (buf, server)) { +cifs_dbg (FYI ,"Received oplock break\n" ); + }else {cifs_dbg (VFS ,"No task to wake, unknown frame received! NumMids %d\n" ,atomic_read (&midCount)); cifs_dump_mem("Received Data is: ", buf,
fs/cifs/smb2misc.c +44 -0
47 lines not on this page · raw message
fs/cifs/smb2ops.c +4 -0
@@ -1565,6 +1565,7 @@ struct smb_version_operations smb20_oper .clear_stats = smb2_clear_stats, .print_stats = smb2_print_stats, .is_oplock_break = smb2_is_valid_oplock_break, + .handle_cancelled_mid = smb2_handle_cancelled_mid, .downgrade_oplock = smb2_downgrade_oplock, .need_neg = smb2_need_neg, .negotiate = smb2_negotiate,
@@ -1645,6 +1646,7 @@ struct smb_version_operations smb21_oper .clear_stats = smb2_clear_stats, .print_stats = smb2_print_stats, .is_oplock_break = smb2_is_valid_oplock_break, + .handle_cancelled_mid = smb2_handle_cancelled_mid, .downgrade_oplock = smb2_downgrade_oplock, .need_neg = smb2_need_neg, .negotiate = smb2_negotiate,
@@ -1727,6 +1729,7 @@ struct smb_version_operations smb30_oper .print_stats = smb2_print_stats, .dump_share_caps = smb2_dump_share_caps, .is_oplock_break = smb2_is_valid_oplock_break, + .handle_cancelled_mid = smb2_handle_cancelled_mid, .downgrade_oplock = smb2_downgrade_oplock, .need_neg = smb2_need_neg, .negotiate = smb2_negotiate,
@@ -1815,6 +1818,7 @@ struct smb_version_operations smb311_ope .print_stats = smb2_print_stats, .dump_share_caps = smb2_dump_share_caps, .is_oplock_break = smb2_is_valid_oplock_break, + .handle_cancelled_mid = smb2_handle_cancelled_mid, .downgrade_oplock = smb2_downgrade_oplock, .need_neg = smb2_need_neg, .negotiate = smb2_negotiate,
fs/cifs/smb2proto.h +7 -0
@@ -48,6 +48,10 @@ extern struct mid_q_entry *smb2_setup_re struct smb_rqst *rqst);extern struct mid_q_entry *smb2_setup_async_request (struct TCP_Server_Info *server,struct smb_rqst *rqst); +extern struct cifs_ses *smb2_find_smb_ses (struct TCP_Server_Info *server, +__u64 ses_id); +extern struct cifs_tcon *smb2_find_smb_tcon (struct TCP_Server_Info *server, +__u64 ses_id,__u32 tid);extern int smb2_calc_signature (struct smb_rqst *rqst,struct TCP_Server_Info *server); extern int smb3_calc_signature(struct smb_rqst *rqst,
@@ -158,6 +162,9 @@ extern int SMB2_set_compression(const unextern int SMB2_oplock_break (const unsigned int xid,struct cifs_tcon *tcon,const u64 persistent_fid,const u64 volatile_fid,const __u8 oplock_level); +extern int smb2_handle_cancelled_mid (char *buffer, +struct TCP_Server_Info *server); +void smb2_cancelled_close_fid (struct work_struct *work);extern int SMB2_QFS_info (const unsigned int xid,struct cifs_tcon *tcon,u64 persistent_file_id,u64 volatile_file_id,struct kstatfs *FSData);
fs/cifs/smb2transport.c +52 -6
88 lines not on this page · raw message
fs/cifs/transport.c +2 -0
@@ -728,9 +728,11 @@ SendReceive2(const unsigned int xid, str rc =wait_for_response (ses->server, midQ);if (rc !=0 ) { +cifs_dbg (FYI ,"Cancelling wait for mid %llu\n" , midQ->mid);send_cancel (ses->server, buf, midQ);spin_lock (&GlobalMid_Lock);if (midQ->mid_state ==MID_REQUEST_SUBMITTED ) { + midQ->mid_flags |=MID_WAIT_CANCELLED ; midQ->callback = DeleteMidQEntry;spin_unlock (&GlobalMid_Lock);cifs_small_buf_release (buf);
Greg Kroah-Hartman
maintainerPATCH 3/5 scsi: storvsc: Workaround for virtual DVD SCSI version
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Hemminger <[email protected]>
commit f1c635b439a5c01776fe3a25b1e2dc546ea82e6f upstream.
Hyper-V host emulation of SCSI for virtual DVD device reports SCSI version 0 (UNKNOWN) but is still capable of supporting REPORTLUN.
Without this patch, a GEN2 Linux guest on Hyper-V will not boot 4.11 successfully with virtual DVD ROM device. What happens is that the SCSI scan process falls back to doing sequential probing by INQUIRY. But the storvsc driver has a previous workaround that masks/blocks all errors reports from INQUIRY (or MODE_SENSE) commands. This workaround causes the scan to then populate a full set of bogus LUN's on the target and then sends kernel spinning off into a death spiral doing block reads on the non-existent LUNs.
By setting the correct blacklist flags, the target with the DVD device is scanned with REPORTLUN and that works correctly.
Patch needs to go in current 4.11, it is safe but not necessary in older kernels.
--- drivers/scsi/storvsc_drv.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
drivers/scsi/storvsc_drv.c +17 -10
@@ -400,8 +400,6 @@ MODULE_PARM_DESC(storvsc_vcpus_per_sub_c*/ static int storvsc_timeout =180 ; -static int msft_blist_flags =BLIST_TRY_VPD_PAGES ; -#if IS_ENABLED (CONFIG_SCSI_FC_ATTRS )static struct scsi_transport_template *fc_transport_template;#endif
@@ -1283,6 +1281,22 @@ static int storvsc_do_io(struct hv_devicreturn ret; } +static int storvsc_device_alloc (struct scsi_device *sdevice) +{ +/* +* Set blist flag to permit the reading of the VPD pages even when +* the target may claim SPC-2 compliance. MSFT targets currently +* claim SPC-2 compliance while they implement post SPC-2 features. +* With this flag we can correctly handle WRITE_SAME_16 issues. +* +* Hypervisor reports SCSI_UNKNOWN type for DVD ROM device but +* still supports REPORT LUN. +*/ + sdevice->sdev_bflags =BLIST_REPORTLUN2 |BLIST_TRY_VPD_PAGES ; + +return 0 ; +} +static int storvsc_device_configure (struct scsi_device *sdevice) {
@@ -1298,14 +1312,6 @@ static int storvsc_device_configure(stru sdevice->no_write_same =1 ;/* -* Add blist flags to permit the reading of the VPD pages even when -* the target may claim SPC-2 compliance. MSFT targets currently -* claim SPC-2 compliance while they implement post SPC-2 features. -* With this patch we can correctly handle WRITE_SAME_16 issues. -*/ - sdevice->sdev_bflags |= msft_blist_flags; - -/* * If the host is WIN8 or WIN8 R2, claim conformance to SPC-3 * if the device is a MSFT virtual device. If the host is * WIN10 or newer, allow write_same.
@@ -1569,6 +1575,7 @@ static struct scsi_host_template scsi_dr .eh_host_reset_handler = storvsc_host_reset_handler, .proc_name = "storvsc_host", .eh_timed_out = storvsc_eh_timed_out, + .slave_alloc = storvsc_device_alloc, .slave_configure = storvsc_device_configure, .cmd_per_lun = 255, .this_id = -1,
Greg Kroah-Hartman
maintainerPATCH 4/5 hwmon: (it87) Avoid registering the same chip on both SIO addresses
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 8358378b22518d92424597503d3c1cd302a490b6 upstream.
IT8705F is known to respond on both SIO addresses. Registering it twice may result in system lockups.
--- drivers/hwmon/it87.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
drivers/hwmon/it87.c +19 -5
@@ -3115,7 +3115,7 @@ static int __init sm_it87_init(void) {int sioaddr[2 ] = {REG_2E ,REG_4E };struct it87_sio_data sio_data; -unsigned short isa_address; +unsigned short isa_address[2 ];bool found = false;int i, err;
@@ -3125,15 +3125,29 @@ static int __init sm_it87_init(void)for (i =0 ; i <ARRAY_SIZE (sioaddr); i++) {memset (&sio_data,0 ,sizeof (struct it87_sio_data )); - isa_address =0 ; - err =it87_find (sioaddr[i], &isa_address, &sio_data); -if (err || isa_address ==0 ) + isa_address[i] =0 ; + err =it87_find (sioaddr[i], &isa_address[i], &sio_data); +if (err || isa_address[i] ==0 )continue ; +/* +* Don't register second chip if its ISA address matches +* the first chip's ISA address. +*/ +if (i && isa_address[i] == isa_address[0 ]) +break ; - err =it87_device_add (i, isa_address, &sio_data); + err =it87_device_add (i, isa_address[i], &sio_data);if (err) goto exit_dev_unregister; + found = true; + +/* +* IT8705F may respond on both SIO addresses. +* Stop probing after finding one. +*/ +if (sio_data.type == it87) +break ; }if (!found) {
Greg Kroah-Hartman
maintainerPATCH 5/5 dm ioctl: prevent stack leak in dm ioctl call
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Salido <[email protected]>
commit 4617f564c06117c7d1b611be49521a4430042287 upstream.
When calling a dm ioctl that doesn't process any data (IOCTL_FLAGS_NO_PARAMS), the contents of the data field in struct dm_ioctl are left initialized. Current code is incorrectly extending the size of data copied back to user, causing the contents of kernel stack to be leaked to user. Fix by only copying contents before data and allow the functions processing the ioctl to override.
--- drivers/md/dm-ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-ioctl.c +1 -1
@@ -1847,7 +1847,7 @@ static int ctl_ioctl(uint command, strucif (r) goto out; - param->data_size =sizeof (*param); + param->data_size = offsetof(struct dm_ioctl , data); r =fn (param, input_param_size); if (unlikely(param->flags & DM_BUFFER_FULL_FLAG) &&
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.10.15 release. There are 5 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 Mon May 8 20:38:36 UTC 2017. Anything received after that time might be too late.
Build results:
total: 145 pass: 145 fail: 0 Qemu test results: total: 122 pass: 122 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Greg Kroah-Hartman
maintainerQuoted 11 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.10.15 release. There are 5 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 Mon May 8 20:38:36 UTC 2017. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 145 pass: 145 fail: 0 Qemu test results: total: 122 pass: 122 fail: 0Details are available at http://kerneltests.org/builders.
Thanks for testing all of these and letting me know.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.10.15 release. There are 5 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 Mon May 8 20:38:36 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.10.15-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.10.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 15 lines · Shuah Khan
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.10.15 release. There are 5 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 Mon May 8 20:38:36 UTC 2017. 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/v4.x/stable-review/patch-4.10.15-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.10.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
Thanks for testing both of these and letting me know.
greg k-h