Re: [PATCH V4] scsi_debugfs: fix crash in scsi_show_rq()

2017-11-10 Thread Ming Lei
On Fri, Nov 10, 2017 at 08:51:58AM -0800, James Bottomley wrote: > On Fri, 2017-11-10 at 17:01 +0800, Ming Lei wrote: > > cmd->cmnd can be allocated/freed dynamically in case of > > T10_PI_TYPE2_PROTECTION, > > so we should check it in scsi_show_rq() because this request may have > > been freed alr

Re: [PATCH 2/3] scsi: 3ware: use 64-bit times for FW time sync

2017-11-10 Thread adam radford
On Fri, Nov 10, 2017 at 7:58 AM, Arnd Bergmann wrote: > The calculation of the number of seconds since Sunday 00:00:00 overflows > in 2106, meaning that we instead will return the seconds since Wednesday > 06:28:16 afterwards. > > Using 64-bit time stamps avoids this slight inconsistency, and the

Re: [PATCH 1/3] scsi: 3ware: fix 32-bit time calculations

2017-11-10 Thread adam radford
On Fri, Nov 10, 2017 at 7:58 AM, Arnd Bergmann wrote: > twl_aen_queue_event/twa_aen_queue_event, we use do_gettimeofday() > to read the lower 32 bits of the current time in seconds, to pass > them to the TW_IOCTL_GET_NEXT_EVENT ioctl or the 3ware_aen_read > sysfs file. > > This will overflow on al

Re: [PATCH 3/3] scsi: 3w-9xxx: rework lock timeouts

2017-11-10 Thread adam radford
On Fri, Nov 10, 2017 at 7:58 AM, Arnd Bergmann wrote: > The TW_IOCTL_GET_LOCK ioctl uses do_gettimeofday() to check whether > a lock has expired. This can misbehave due to a concurrent > settimeofday() call, as it is based on 'real' time, and it > will overflow in y2038 on 32-bit architectures, pr

RE: [PATCH 0/7] scsi: bfa: do_gettimeofday removal

2017-11-10 Thread Gurumurthy, Anil
The bfa drivers are in deep maintenance mode for some time now. We have not had issues reported on them for a while, but it would be good to continue to have them. The series looks ok to me too. Thanks, Anil -Original Message- From: Christoph Hellwig [mailto:h...@lst.de] Sent: 10 Nove

Re: [PATCH 0/7] scsi: bfa: do_gettimeofday removal

2017-11-10 Thread Christoph Hellwig
This stuff look ok - but I have a bigger question and that is if bfa is still alive at all. Everytime I look at it I have doubts if it works at all, so I wonder if we need to keep it on life support.

Re: [PATCH V4] scsi_debugfs: fix crash in scsi_show_rq()

2017-11-10 Thread James Bottomley
On Fri, 2017-11-10 at 17:01 +0800, Ming Lei wrote: > cmd->cmnd can be allocated/freed dynamically in case of > T10_PI_TYPE2_PROTECTION, > so we should check it in scsi_show_rq() because this request may have > been freed already here, and cmd->cmnd has been set as null. > > We choose to accept rea

Re: [PATCH] scsi: ufs: Fix Runtime PM

2017-11-10 Thread kbuild test robot
-ci/linux/commits/Michal-Potomski/scsi-ufs-Fix-Runtime-PM/20171110-191314 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: x86_64-randconfig-v0-11102116 (attached as .config) compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026 reproduce: # save the attached

[PATCH 1/3] scsi: 3ware: fix 32-bit time calculations

2017-11-10 Thread Arnd Bergmann
twl_aen_queue_event/twa_aen_queue_event, we use do_gettimeofday() to read the lower 32 bits of the current time in seconds, to pass them to the TW_IOCTL_GET_NEXT_EVENT ioctl or the 3ware_aen_read sysfs file. This will overflow on all architectures in year 2106, there is not much we can do about th

[PATCH 2/3] scsi: 3ware: use 64-bit times for FW time sync

2017-11-10 Thread Arnd Bergmann
The calculation of the number of seconds since Sunday 00:00:00 overflows in 2106, meaning that we instead will return the seconds since Wednesday 06:28:16 afterwards. Using 64-bit time stamps avoids this slight inconsistency, and the deprecated do_gettimeofday(), replacing it with the simpler ktim

[PATCH 3/3] scsi: 3w-9xxx: rework lock timeouts

2017-11-10 Thread Arnd Bergmann
The TW_IOCTL_GET_LOCK ioctl uses do_gettimeofday() to check whether a lock has expired. This can misbehave due to a concurrent settimeofday() call, as it is based on 'real' time, and it will overflow in y2038 on 32-bit architectures, producing unexpected results when used across the overflow time.

[PATCH] megaraid: use ktime_get_real for firmware time

2017-11-10 Thread Arnd Bergmann
do_gettimeofday() overflows in 2038 on 32-bit architectures and is deprecated, so convert this driver to call ktime_get_real() directly. This also simplifies the calculation. Signed-off-by: Arnd Bergmann --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 +++ 1 file changed, 3 insertions(+)

[PATCH] scsi: ips: fix firmware timestamps for 32-bit

2017-11-10 Thread Arnd Bergmann
do_gettimeofday() is deprecated since it will stop working in 2038 on 32-bit platforms. The firmware interface here actually supports times until year 25500, so we should use longer timestamps. Using ktime_get_real_seconds() to get a 64-bit seconds value and time64_to_tm() to convert it into the r

[PATCH 0/7] scsi: bfa: do_gettimeofday removal

2017-11-10 Thread Arnd Bergmann
The bfa driver is one of the main users of do_gettimeofday(), a function that I'm trying to remove as part of the y2038 cleanup. The timestamps are all uses in slightly different ways, so this has turned into a rather longish series for doing something that should be simple. The last patch in the

[PATCH 2/7] scsi: bfa: use proper time accessor for stats_reset_time

2017-11-10 Thread Arnd Bergmann
We use the deprecated do_gettimeofday() function to read the current time when resetting the statistics in both bfa_port and bfa_svc. This works fine because overflow is handled correctly, but we want to get rid of do_gettimeofday() and using a non-monotonic time suffers from concurrent settimeofda

[PATCH] scsi: esas2r: use ktime_get_real_seconds()

2017-11-10 Thread Arnd Bergmann
do_gettimeofday() is deprecated because of the y2038 overflow. Here, we use the result to pass into a 32-bit field in the firmware, which still risks an overflow, but if the firmware is written to expect unsigned values, it can at least last until y2106, and there is not much we can do about it. T

[PATCH 4/7] scsi: bfa: document overflow of io_profile_start_time

2017-11-10 Thread Arnd Bergmann
io_profile_start_time() gets read using do_gettimeofday() and passed down as a 32-bit value through multiple functions. This will overflow in y2038 or y2106, depending on whether it gets interpreted as unsigned in the end. This changes do_gettimeofday() to ktime_get_real_seconds() and pushes the p

[PATCH 1/7] scsi: bfa: use ktime_get_real_ts64 for firmware timestamp

2017-11-10 Thread Arnd Bergmann
BFA_TRC_TS() calculates a 32-bit microsecond timestamp using the deprecated do_gettimeofday() function. This overflows roughly every 71 minutes, so it's obviously not used as an absolute time stamp, but it seems wrong to use a time base for it that will jump during settimeofday() calls, leap second

[PATCH 6/7] scsi: bfa: try to sanitize vendor netlink events

2017-11-10 Thread Arnd Bergmann
bfa_aen_entry_s is passed to user space in a netlink message, but is defined using a 'struct timeval' and an 'enum' that are not only different between architectures, but also between 32-bit user space and 64-bit kernels they may run on, as well as depending on the particular C library that defines

[PATCH 5/7] scsi: bfa: replace bfa_get_log_time() with ktime_get_real_seconds()

2017-11-10 Thread Arnd Bergmann
The bfa_get_log_time() returns a 64-bit timestamp that does not suffer from the y2038 overflow on 64-bit systems. However, on 32-bit architectures the timestamp will jump from 0x7fff to 0x8000 in y2038 and produce wrong results. The ktime_get_real_seconds() function does th

[PATCH 7/7] scsi: bfa: use 64-bit times in bfa_aen_entry_s ABI

2017-11-10 Thread Arnd Bergmann
bfa_aen_entry_s is passed through a netlink socket that can be read by either 32-bit or 64-bit processes, but the data format is different between the two on current implementations. Originally, this was using a 'struct timeval', which also suffers from getting redefined with a new libc implementa

[PATCH 3/7] scsi: bfa: improve bfa_ioc_send_enable/disable data

2017-11-10 Thread Arnd Bergmann
In bfa_ioc_send_enable, we use the deprecated do_gettimeofday() function to read the current time. This is not a problem, since the firmware interface is already limited to 32-bit timestamps, but it's better to use ktime_get_seconds() and document what the limitation is. I noticed that I did the s

[PATCH] uas: Add US_FL_NO_ATA_1X quirk for one more Seagate device

2017-11-10 Thread Hans de Goede
Just like all previous UAS capable Seagate disk enclosures, this one needs a US_FL_NO_ATA_1X quirk. Cc: sta...@vger.kernel.org # 3.16 Signed-off-by: Andrey Astafyev <1...@246060.ru> Signed-off-by: Hans de Goede --- drivers/usb/storage/unusual_uas.h | 7 +++ 1 file changed, 7 insertions(+) d

Re: [PATCH] scsi: ufs: Fix Runtime PM

2017-11-10 Thread kbuild test robot
/commits/Michal-Potomski/scsi-ufs-Fix-Runtime-PM/20171110-191314 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: m68k-allyesconfig (attached as .config) compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 reproduce: wget https

Re: [PATCH V9 1/4] dma-mapping: Rework dma_get_cache_alignment()

2017-11-10 Thread Christoph Hellwig
> diff --git a/drivers/net/ethernet/broadcom/b44.c > b/drivers/net/ethernet/broadcom/b44.c > index a1125d1..2f6ffe5 100644 > --- a/drivers/net/ethernet/broadcom/b44.c > +++ b/drivers/net/ethernet/broadcom/b44.c > @@ -2344,6 +2344,10 @@ static int b44_init_one(struct ssb_device *sdev, > struc

[PATCH V4] scsi_debugfs: fix crash in scsi_show_rq()

2017-11-10 Thread Ming Lei
cmd->cmnd can be allocated/freed dynamically in case of T10_PI_TYPE2_PROTECTION, so we should check it in scsi_show_rq() because this request may have been freed already here, and cmd->cmnd has been set as null. We choose to accept read-after-free and dump request data as far as possible. This pa