3.0.45-stable review
Greg Kroah-Hartman
maintainercover 3.0.45-stable review
This is the start of the stable review cycle for the 3.0.45 release. There are 33 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 Sat Oct 6 21:02:56 UTC 2012. 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/v3.0/stable-review/patch-3.0.45-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Bart Van Assche <[email protected]>
SCSI: scsi_dh_alua: Enable STPG for unavailable ports
Dan Williams <[email protected]>
SCSI: scsi_remove_target: fix softlockup regression on hot remove
Yinghai Lu <[email protected]>
PCI: honor child buses add_size in hot plug configuration
Avi Kivity <[email protected]>
x86/alternatives: Fix p6 nops on non-modular kernels
Dan Williams <[email protected]>
isci: fix isci_pci_probe() generates warning on efi failure path
Bart Van Assche <[email protected]>
IB/srp: Avoid having aborted requests hang
Bart Van Assche <[email protected]>
IB/srp: Fix use-after-free in srp_reset_req()
Patrick McHardy <[email protected]>
IPoIB: Fix use-after-free of multicast object
Wei Yongjun <[email protected]>
can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock()
Stephen M. Cameron <[email protected]>
SCSI: hpsa: Use LUN reset instead of target reset
Benjamin Herrenschmidt <[email protected]>
SCSI: ibmvscsi: Fix host config length field overflow
Artem Bityutskiy <[email protected]>
UBI: fix autoresize handling in R/O mode
Russ Gorby <[email protected]>
n_gsm: memory leak in uplink error path
Michael Spang <[email protected]>
Increase XHCI suspend timeout to 16ms
Denys Vlasenko <[email protected]>
coredump: prevent double-free on an error path in core dumper
Russ Gorby <[email protected]>
n_gsm: added interlocking for gsm_data_lock for certain code paths
Sarah Sharp <[email protected]>
xhci: Intel Panther Point BEI quirk.
Khalid Aziz <[email protected]>
firmware: Add missing attributes to EFI variable attribute print out from sysfs
Larry Finger <[email protected]>
b43legacy: Fix crash on unload when firmware not available
Flavio Leitner <[email protected]>
serial: set correct baud_base for EXSYS EX-41092 Dual 16950
Linus Walleij <[email protected]>
serial: pl011: handle corruption at high clock speeds
Jiri Slaby <[email protected]>
TTY: ttyprintk, don't touch behind tty->write_buf
Stanislav Kozina <[email protected]>
Remove BUG_ON from n_tty_read()
Ian Abbott <[email protected]>
staging: comedi: fix memory leak for saved channel list
Ian Abbott <[email protected]>
staging: comedi: don't dereference user memory for INSN_INTTRIG
Ian Abbott <[email protected]>
staging: comedi: jr3_pci: fix iomem dereference
Ian Abbott <[email protected]>
staging: comedi: s626: don't dereference insn->data
Ben Hutchings <[email protected]>
staging: speakup_soft: Fix reading of init string
Bjørn Mork <[email protected]>
USB: qcaux: add Pantech vendor class match
Antonio Ospite <[email protected]>
USB: ftdi_sio: add TIAO USB Multi-Protocol Adapter (TUMPA) support
Bjørn Mork <[email protected]>
USB: option: blacklist QMI interface on ZTE MF683
Mike Snitzer <[email protected]>
dm: handle requests beyond end of device instead of using BUG_ON
Miklos Szeredi <[email protected]>
vfs: dcache: fix deadlock in tree traversal
-------------
Diffstat:
Makefile | 4 +- arch/x86/kernel/alternative.c | 2 +- drivers/char/ttyprintk.c | 2 +- drivers/firmware/efivars.c | 17 ++++++-- drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 +- drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 19 ++++----- drivers/infiniband/ulp/srp/ib_srp.c | 3 +- drivers/md/dm.c | 56 +++++++++++++++++--------- drivers/mtd/ubi/build.c | 5 +++ drivers/net/can/mscan/mpc5xxx_can.c | 4 +- drivers/net/wireless/b43legacy/main.c | 2 + drivers/pci/setup-bus.c | 26 ++++++++++++ drivers/scsi/device_handler/scsi_dh_alua.c | 3 +- drivers/scsi/hpsa.c | 2 +- drivers/scsi/ibmvscsi/ibmvscsi.c | 3 ++ drivers/scsi/isci/init.c | 1 - drivers/scsi/isci/probe_roms.c | 1 - drivers/scsi/scsi_sysfs.c | 30 +++++++------- drivers/staging/comedi/comedi_fops.c | 5 ++- drivers/staging/comedi/drivers/jr3_pci.c | 2 +- drivers/staging/comedi/drivers/s626.c | 2 +- drivers/staging/speakup/speakup_soft.c | 13 ++---- drivers/tty/n_gsm.c | 15 +++++-- drivers/tty/n_tty.c | 3 +- drivers/tty/serial/8250_pci.c | 9 ++++- drivers/tty/serial/amba-pl011.c | 15 ++++++- drivers/usb/host/xhci-pci.c | 1 + drivers/usb/host/xhci-ring.c | 4 +- drivers/usb/host/xhci.c | 2 +- drivers/usb/host/xhci.h | 1 + drivers/usb/serial/ftdi_sio.c | 2 + drivers/usb/serial/ftdi_sio_ids.h | 5 +++ drivers/usb/serial/option.c | 3 +- drivers/usb/serial/qcaux.c | 10 ++--- fs/binfmt_elf.c | 19 ++------- fs/dcache.c | 6 +++ include/linux/pci_ids.h | 1 - 37 files changed, 194 insertions(+), 106 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/33 vfs: dcache: fix deadlock in tree traversal
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 8110e16d42d587997bcaee0c864179e6d93603fe upstream.
IBM reported a deadlock in select_parent(). This was found to be caused by taking rename_lock when already locked when restarting the tree traversal.
There are two cases when the traversal needs to be restarted:
1) concurrent d_move(); this can only happen when not already locked, since taking rename_lock protects against concurrent d_move().
2) racing with final d_put() on child just at the moment of ascending to parent; rename_lock doesn't protect against this rare race, so it can happen when already locked.
Because of case 2, we need to be able to handle restarting the traversal when rename_lock is already held. This patch fixes all three callers of try_to_ascend().
IBM reported that the deadlock is gone with this patch.
[ I rewrote the patch to be smaller and just do the "goto again" if the
lock was already held, but credit goes to Miklos for the real work.
- Linus ]
--- fs/dcache.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/dcache.c +6 -0
@@ -1101,6 +1101,8 @@ positive:return 1 ; rename_retry: +if (locked) + goto again; locked =1 ;write_seqlock (&rename_lock); goto again;
@@ -1203,6 +1205,8 @@ out: rename_retry:if (found)return found; +if (locked) + goto again; locked =1 ;write_seqlock (&rename_lock); goto again;
@@ -2990,6 +2994,8 @@ resume:return ; rename_retry: +if (locked) + goto again; locked =1 ;write_seqlock (&rename_lock); goto again;
Greg Kroah-Hartman
maintainerPATCH 2/33 dm: handle requests beyond end of device instead of using BUG_ON
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit ba1cbad93dd47223b1f3b8edd50dd9ef2abcb2ed upstream.
The access beyond the end of device BUG_ON that was introduced to dm_request_fn via commit 29e4013de7ad950280e4b2208 ("dm: implement REQ_FLUSH/FUA support for request-based dm") was an overly drastic (but simple) response to this situation.
I have received a report that this BUG_ON was hit and now think it would be better to use dm_kill_unmapped_request() to fail the clone and original request with -EIO.
map_request() will assign the valid target returned by dm_table_find_target to tio->ti. But when the target isn't valid tio->ti is never assigned (because map_request isn't called); so add a check for tio->ti != NULL to dm_done().
--- drivers/md/dm.c | 56 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 18 deletions(-)
drivers/md/dm.c +38 -18
@@ -856,10 +856,14 @@ static void dm_done(struct request *clon {int r = error;struct dm_rq_target_io *tio = clone->end_io_data; -dm_request_endio_fn rq_end_io = tio->ti->type->rq_end_io; +dm_request_endio_fn rq_end_io =NULL ; -if (mapped && rq_end_io) - r =rq_end_io (tio->ti, clone, error, &tio->info); +if (tio->ti) { + rq_end_io = tio->ti->type->rq_end_io; + +if (mapped && rq_end_io) + r =rq_end_io (tio->ti, clone, error, &tio->info); + }if (r <=0 )/* The target wants to complete the I/O */
@@ -1562,15 +1566,6 @@ static int map_request(struct dm_targetint r, requeued =0 ;struct dm_rq_target_io *tio = clone->end_io_data; -/* -* Hold the md reference here for the in-flight I/O. -* We can't rely on the reference count by device opener, -* because the device may be closed during the request completion -* when all bios are completed. -* See the comment in rq_completed() too. -*/ -dm_get (md); - tio->ti = ti; r = ti->type->map_rq (ti, clone, &tio->info);switch (r) {
@@ -1602,6 +1597,26 @@ static int map_request(struct dm_targetreturn requeued; } +static struct request *dm_start_request (struct mapped_device *md,struct request *orig) +{ +struct request *clone; + +blk_start_request (orig); + clone = orig->special; +atomic_inc (&md->pending[rq_data_dir (clone)]); + +/* +* Hold the md reference here for the in-flight I/O. +* We can't rely on the reference count by device opener, +* because the device may be closed during the request completion +* when all bios are completed. +* See the comment in rq_completed() too. +*/ +dm_get (md); + +return clone; +} +/* * q->request_fn for request-based dm. * Called with the queue lock held.
@@ -1631,14 +1646,21 @@ static void dm_request_fn(struct request pos =blk_rq_pos (rq); ti =dm_table_find_target (map, pos); -BUG_ON (!dm_target_is_valid (ti)); +if (!dm_target_is_valid (ti)) { +/* +* Must perform setup, that dm_done() requires, +* before calling dm_kill_unmapped_request +*/ +DMERR_LIMIT ("request attempted access beyond the end of device" ); + clone =dm_start_request (md, rq); +dm_kill_unmapped_request (clone, -EIO ); +continue ; + }if (ti->type->busy && ti->type->busy (ti)) goto delay_and_out; -blk_start_request (rq); - clone = rq->special; -atomic_inc (&md->pending[rq_data_dir (clone)]); + clone =dm_start_request (md, rq);spin_unlock (q->queue_lock);if (map_request (ti, clone, md))
@@ -1658,8 +1680,6 @@ delay_and_out:blk_delay_queue (q,HZ /10 ); out:dm_table_put (map); - -return ; }int dm_underlying_device_busy (struct request_queue *q)
Greg Kroah-Hartman
maintainerPATCH 3/33 USB: option: blacklist QMI interface on ZTE MF683
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit 160c9425ac52cb30502be2d9c5e848cec91bb115 upstream.
Interface #5 on ZTE MF683 is a QMI/wwan interface.
--- drivers/usb/serial/option.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/serial/option.c +2 -1
@@ -870,7 +870,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0153, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0155, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) },
Greg Kroah-Hartman
maintainerPATCH 4/33 USB: ftdi_sio: add TIAO USB Multi-Protocol Adapter (TUMPA) support
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Ospite <[email protected]>
commit 54575b05af36959dfb6a49a3e9ca0c2b456b7126 upstream.
TIAO/DIYGADGET USB Multi-Protocol Adapter (TUMPA) is an FTDI FT2232H based device which provides an easily accessible JTAG, SPI, I2C, serial breakout.
http://www.diygadget.com/tiao-usb-multi-protocol-adapter-jtag-spi-i2c-serial.html
http://www.tiaowiki.com/w/TIAO_USB_Multi_Protocol_Adapter_User%27s_Manual
FTDI FT2232H provides two serial channels (A and B), but on the TUMPA channel A is dedicated to JTAG/SPI while channel B can be used for UART/RS-232: use the ftdi_jtag_quirk to expose only channel B as a usb-serial interface to userspace.
--- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 5 +++++ 2 files changed, 7 insertions(+)
drivers/usb/serial/ftdi_sio.c +2 -0
@@ -582,6 +582,8 @@ static struct usb_device_id id_table_com { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) }, { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) }, { USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_TIAO_UMPA_PID), + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },/* * ELV devices: */
drivers/usb/serial/ftdi_sio_ids.h +5 -0
@@ -517,6 +517,11 @@*/ #define FTDI_TAVIR_STK500_PID 0xFA33/* STK500 AVR programmer */ +/* +* TIAO product ids (FTDI_VID) +* http://www.tiaowiki.com/w/Main_Page +*/ +#define FTDI_TIAO_UMPA_PID 0x8a98/* TIAO/DIYGADGET USB Multi-Protocol Adapter */ /********************************/
Greg Kroah-Hartman
maintainerPATCH 5/33 USB: qcaux: add Pantech vendor class match
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit c638eb2872b3af079501e7ee44cbb8a5cce9b4b5 upstream.
The three Pantech devices UML190 (106c:3716), UML290 (106c:3718) and P4200 (106c:3721) all use the same subclasses to identify vendor specific functions. Replace the existing device specific entries with generic vendor matching, adding support for the P4200.
--- drivers/usb/serial/qcaux.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/usb/serial/qcaux.c +3 -7
@@ -36,8 +36,6 @@#define UTSTARCOM_PRODUCT_UM175_V1 0x3712#define UTSTARCOM_PRODUCT_UM175_V2 0x3714#define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 -#define PANTECH_PRODUCT_UML190_VZW 0x3716 -#define PANTECH_PRODUCT_UML290_VZW 0x3718/* CMOTECH devices */ #define CMOTECH_VENDOR_ID 0x16d8
@@ -68,11 +66,9 @@ static struct usb_device_id id_table[] = { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, - { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML190_VZW, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML190_VZW, 0xff, 0xfe, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xfd, 0xff) }, /* NMEA */ - { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xfe, 0xff) }, /* WMC */ - { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) }, /* DIAG */ + { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfd, 0xff) }, /* NMEA */ + { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfe, 0xff) }, /* WMC */ + { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xff, 0xff) }, /* DIAG */ { }, };MODULE_DEVICE_TABLE (usb, id_table);
Greg Kroah-Hartman
maintainerPATCH 6/33 staging: speakup_soft: Fix reading of init string
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit 40fe4f89671fb3c7ded94190fb267402a38b0261 upstream.
softsynth_read() reads a character at a time from the init string; when it finds the null terminator it sets the initialized flag but then repeats the last character.
Additionally, if the read() buffer is not big enough for the init string, the next read() will start reading from the beginning again. So the caller may never progress to reading anything else.
Replace the simple initialized flag with the current position in the init string, carried over between calls. Switch to reading real data once this reaches the null terminator.
(This assumes that the length of the init string can't change, which seems to be the case. Really, the string and position belong together in a per-file private struct.)
--- drivers/staging/speakup/speakup_soft.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/staging/speakup/speakup_soft.c +4 -9
@@ -40,7 +40,7 @@ static int softsynth_is_alive(struct spkstatic unsigned char get_index (void );static struct miscdevice synth_device; -static int initialized; +static int init_pos;static int misc_registered;static struct var_t vars[] = {
@@ -194,7 +194,7 @@ static int softsynth_close(struct inodeunsigned long flags;spk_lock (flags); synth_soft.alive =0 ; - initialized =0 ; + init_pos =0 ;spk_unlock (flags);/* Make sure we let applications go before leaving */ speakup_start_ttys ();
@@ -239,13 +239,8 @@ static ssize_t softsynth_read(struct fil ch ='\x18' ; }else if (synth_buffer_empty ()) {break ; - }else if (!initialized) { -if (*init) { - ch = *init; - init++; - }else { - initialized =1 ; - } + }else if (init[init_pos]) { + ch = init[init_pos++]; }else { ch =synth_buffer_getc (); }
Greg Kroah-Hartman
maintainerPATCH 7/33 staging: comedi: s626: dont dereference insn->data
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit b655c2c4782ed3e2e71d2608154e295a3e860311 upstream.
s626_enc_insn_config() is incorrectly dereferencing insn->data which is a pointer to user memory. It should be dereferencing the separate data parameter that points to a copy of the data in kernel memory.
--- drivers/staging/comedi/drivers/s626.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/s626.c +1 -1
@@ -2370,7 +2370,7 @@ static int s626_enc_insn_config(struct c/* (data==NULL) ? (Preloadvalue=0) : (Preloadvalue=data[0]); */ k->SetMode (dev, k, Setup, TRUE); -Preload (dev, k, *(insn->data)); +Preload (dev, k, data[0 ]); k->PulseIndex (dev, k);SetLatchSource (dev, k, valueSrclatch); k->SetEnable (dev, k, (uint16_t ) (enab !=0 ));
Greg Kroah-Hartman
maintainerPATCH 8/33 staging: comedi: jr3_pci: fix iomem dereference
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit e1878957b4676a17cf398f7f5723b365e9a2ca48 upstream.
Correct a direct dereference of I/O memory to use an appropriate I/O memory access function. Note that the pointer being dereferenced is not currently tagged with __iomem but I plan to correct that for 3.7.
--- drivers/staging/comedi/drivers/jr3_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/jr3_pci.c +1 -1
@@ -913,7 +913,7 @@ static int jr3_pci_attach(struct comedi_ }/* Reset DSP card */ - devpriv->iobase->channel[0 ].reset =0 ; +writel (0 , &devpriv->iobase->channel[0 ].reset); result =comedi_load_firmware (dev,"jr3pci.idm" , jr3_download_firmware);printk ("Firmare load %d\n" , result);
Greg Kroah-Hartman
maintainerPATCH 9/33 staging: comedi: dont dereference user memory for INSN_INTTRIG
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 5d06e3df280bd230e2eadc16372e62818c63e894 upstream.
parse_insn() is dereferencing the user-space pointer insn->data directly when handling the INSN_INTTRIG comedi instruction. It shouldn't be using insn->data at all; it should be using the separate data pointer passed to the function. Fix it.
--- drivers/staging/comedi/comedi_fops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/comedi_fops.c +1 -1
@@ -843,7 +843,7 @@ static int parse_insn(struct comedi_devi ret = -EAGAIN ;break ; } - ret = s->async->inttrig (dev, s, insn->data[0 ]); + ret = s->async->inttrig (dev, s, data[0 ]);if (ret >=0 ) ret =1 ;break ;
Greg Kroah-Hartman
maintainerPATCH 10/33 staging: comedi: fix memory leak for saved channel list
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit c8cad4c89ee3b15935c532210ae6ebb5c0a2734d upstream.
When do_cmd_ioctl() allocates memory for the kernel copy of a channel list, it frees any previously allocated channel list in async->cmd.chanlist and replaces it with the new one. However, if the device is ever removed (or "detached") the cleanup code in cleanup_device() in "drivers.c" does not free this memory so it is lost.
A sensible place to free the kernel copy of the channel list is in do_become_nonbusy() as at that point the comedi asynchronous command associated with the channel list is no longer valid. Free the channel list in do_become_nonbusy() instead of do_cmd_ioctl() and clear the pointer to prevent it being freed more than once.
Note that cleanup_device() could be called at an inappropriate time while the comedi device is open, but that's a separate bug not related to this this patch.
--- drivers/staging/comedi/comedi_fops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/comedi/comedi_fops.c +2 -1
@@ -1088,7 +1088,6 @@ static int do_cmd_ioctl(struct comedi_de goto cleanup; } -kfree (async->cmd.chanlist); async->cmd = user_cmd; async->cmd.data =NULL ;/* load channel/gain list */
@@ -1833,6 +1832,8 @@ void do_become_nonbusy(struct comedi_devif (async) {comedi_reset_async_buf (async); async->inttrig =NULL ; +kfree (async->cmd.chanlist); + async->cmd.chanlist =NULL ; }else {printk (KERN_ERR "BUG: (?) do_become_nonbusy called with async=0\n" );
Greg Kroah-Hartman
maintainerPATCH 11/33 Remove BUG_ON from n_tty_read()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Kozina <[email protected]>
commit e9490e93c1978b6669f3e993caa3189be13ce459 upstream.
Change the BUG_ON to WARN_ON and return in case of tty->read_buf==NULL. We want to track a couple of long standing reports of this but at the same time we can avoid killing the box.
--- drivers/tty/n_tty.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/n_tty.c +2 -1
@@ -1728,7 +1728,8 @@ static ssize_t n_tty_read(struct tty_str do_it_again: -BUG_ON (!tty->read_buf); +if (WARN_ON (!tty->read_buf)) +return -EAGAIN ; c =job_control (tty, file);if (c <0 )
Greg Kroah-Hartman
maintainerPATCH 12/33 TTY: ttyprintk, dont touch behind tty->write_buf
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby <[email protected]>
commit ee8b593affdf893012e57f4c54a21984d1b0d92e upstream.
If a user provides a buffer larger than a tty->write_buf chunk and passes '\r' at the end of the buffer, we touch an out-of-bound memory.
Add a check there to prevent this.
--- drivers/char/ttyprintk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/ttyprintk.c +1 -1
@@ -66,7 +66,7 @@ static int tpk_printk(const unsigned cha tmp[tpk_curr +1 ] ='\0' ;printk (KERN_INFO "%s%s" , tpk_tag, tmp); tpk_curr =0 ; -if (buf[i +1 ] =='\n' ) +if ((i +1 ) < count && buf[i +1 ] =='\n' ) i++;break ;case '\n' :
Greg Kroah-Hartman
maintainerPATCH 13/33 serial: pl011: handle corruption at high clock speeds
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
commit c5dd553b9fd069892c9e2de734f4f604e280fa7a upstream.
This works around a few glitches in the ST version of the PL011 serial driver when using very high baud rates, as we do in the
Ux500: 3, 3.25, 4 and 4.05 Mbps.
Problem Observed/rootcause:
When using high baud-rates, and the baudrate*8 is getting close to the provided clock frequency (so a division factor close to 1), when using bursts of characters (so they are abutted), then it seems as if there is not enough time to detect the beginning of the start-bit which is a timing reference for the entire character, and thus the sampling moment of character bits is moving towards the end of each bit, instead of the middle.
Fix:
Increase slightly the RX baud rate of the UART above the theoretical baudrate by 5%. This will definitely give more margin time to the UART_RX to correctly sample the data at the middle of the bit period.
Also fix the ages old copy-paste error in the very stressed comment, it's referencing the registers used in the PL010 driver rather than the PL011 ones.
--- drivers/tty/serial/amba-pl011.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/tty/serial/amba-pl011.c +14 -1
@@ -1620,13 +1620,26 @@ pl011_set_termios(struct uart_port *port old_cr &= ~ST_UART011_CR_OVSFACT ; } +/* +* Workaround for the ST Micro oversampling variants to +* increase the bitrate slightly, by lowering the divisor, +* to avoid delayed sampling of start bit at high speeds, +* else we see data corruption. +*/ +if (uap->vendor->oversampling) { +if ((baud >=3000000 ) && (baud <3250000 ) && (quot >1 )) + quot -=1 ; +else if ((baud >3250000 ) && (quot >2 )) + quot -=2 ; + }/* Set baud rate */ writew (quot &0x3f , port->membase +UART011_FBRD );writew (quot >>6 , port->membase +UART011_IBRD );/* * ----------v----------v----------v----------v----- -* NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L +* NOTE: lcrh_tx and lcrh_rx MUST BE WRITTEN AFTER +* UART011_FBRD & UART011_IBRD. * ----------^----------^----------^----------^----- */ writew (lcr_h, port->membase + uap->lcrh_rx);
Greg Kroah-Hartman
maintainerPATCH 14/33 serial: set correct baud_base for EXSYS EX-41092 Dual 16950
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Flavio Leitner <[email protected]>
commit 26e8220adb0aec43b7acafa0f1431760eee28522 upstream.
Apparently the same card model has two IDs, so this patch complements the commit 39aced68d664291db3324d0fcf0985ab5626aac2 adding the missing one.
--- drivers/tty/serial/8250_pci.c | 9 +++++++-- include/linux/pci_ids.h | 1 - 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/tty/serial/8250_pci.c +7 -2
@@ -1011,6 +1011,8 @@ static int pci_eg20t_init(struct pci_dev#define PCI_SUBDEVICE_ID_OCTPRO422 0x0208#define PCI_SUBDEVICE_ID_POCTAL232 0x0308#define PCI_SUBDEVICE_ID_POCTAL422 0x0408 +#define PCI_SUBDEVICE_ID_SIIG_DUAL_00 0x2500 +#define PCI_SUBDEVICE_ID_SIIG_DUAL_30 0x2530#define PCI_VENDOR_ID_ADVANTECH 0x13fe#define PCI_DEVICE_ID_INTEL_CE4100_UART 0x2e66#define PCI_DEVICE_ID_ADVANTECH_PCI3620 0x3620
@@ -3009,8 +3011,11 @@ static struct pci_device_id serial_pci_t* For now just used the hex ID 0x950a. */ {PCI_VENDOR_ID_OXSEMI ,0x950a , -PCI_SUBVENDOR_ID_SIIG ,PCI_SUBDEVICE_ID_SIIG_DUAL_SERIAL ,0 ,0 , - pbn_b0_2_115200 }, +PCI_SUBVENDOR_ID_SIIG ,PCI_SUBDEVICE_ID_SIIG_DUAL_00 , + 0, 0, pbn_b0_2_115200 }, + { PCI_VENDOR_ID_OXSEMI, 0x950a, +PCI_SUBVENDOR_ID_SIIG ,PCI_SUBDEVICE_ID_SIIG_DUAL_30 , + 0, 0, pbn_b0_2_115200 }, { PCI_VENDOR_ID_OXSEMI, 0x950a,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , pbn_b0_2_1130000 },
include/linux/pci_ids.h +0 -1
@@ -1818,7 +1818,6 @@#define PCI_DEVICE_ID_SIIG_8S_20x_650 0x2081#define PCI_DEVICE_ID_SIIG_8S_20x_850 0x2082#define PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL 0x2050 -#define PCI_SUBDEVICE_ID_SIIG_DUAL_SERIAL 0x2530#define PCI_VENDOR_ID_RADISYS 0x1331
Greg Kroah-Hartman
maintainerPATCH 15/33 b43legacy: Fix crash on unload when firmware not available
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 2d838bb608e2d1f6cb4280e76748cb812dc822e7 upstream.
When b43legacy is loaded without the firmware being available, a following unload generates a kernel NULL pointer dereference BUG as follows:
[ 214.330789] BUG: unable to handle kernel NULL pointer dereference at 0000004c [ 214.330997] IP: [<c104c395>] drain_workqueue+0x15/0x170 [ 214.331179] *pde = 00000000 [ 214.331311] Oops: 0000 [#1] SMP [ 214.331471] Modules linked in: b43legacy(-) ssb pcmcia mac80211 cfg80211 af_packet mperf arc4 ppdev sr_mod cdrom sg shpchp yenta_socket pcmcia_rsrc pci_hotplug pcmcia_core battery parport_pc parport floppy container ac button edd autofs4 ohci_hcd ehci_hcd usbcore usb_common thermal processor scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh_alua scsi_dh fan thermal_sys hwmon ata_generic pata_ali libata [last unloaded: cfg80211] [ 214.333421] Pid: 3639, comm: modprobe Not tainted 3.6.0-rc6-wl+ #163 Source Technology VIC 9921/ALI Based Notebook [ 214.333580] EIP: 0060:[<c104c395>] EFLAGS: 00010246 CPU: 0 [ 214.333687] EIP is at drain_workqueue+0x15/0x170 [ 214.333788] EAX: c162ac40 EBX: cdfb8360 ECX: 0000002a EDX: 00002a2a [ 214.333890] ESI: 00000000 EDI: 00000000 EBP: cd767e7c ESP: cd767e5c [ 214.333957] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 [ 214.333957] CR0: 8005003b CR2: 0000004c CR3: 0c96a000 CR4: 00000090 [ 214.333957] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000 [ 214.333957] DR6: ffff0ff0 DR7: 00000400 [ 214.333957] Process modprobe (pid: 3639, ti=cd766000 task=cf802e90 task.ti=cd766000) [ 214.333957] Stack: [ 214.333957] 00000292 cd767e74 c12c5e09 00000296 00000296 cdfb8360 cdfb9220 00000000 [ 214.333957] cd767e90 c104c4fd cdfb8360 cdfb9220 cd682800 cd767ea4 d0c10184 cd682800 [ 214.333957] cd767ea4 cba31064 cd767eb8 d0867908 cba31064 d087e09c cd96f034 cd767ec4 [ 214.333957] Call Trace: [ 214.333957] [<c12c5e09>] ? skb_dequeue+0x49/0x60 [ 214.333957] [<c104c4fd>] destroy_workqueue+0xd/0x150 [ 214.333957] [<d0c10184>] ieee80211_unregister_hw+0xc4/0x100 [mac80211] [ 214.333957] [<d0867908>] b43legacy_remove+0x78/0x80 [b43legacy] [ 214.333957] [<d083654d>] ssb_device_remove+0x1d/0x30 [ssb] [ 214.333957] [<c126f15a>] __device_release_driver+0x5a/0xb0 [ 214.333957] [<c126fb07>] driver_detach+0x87/0x90 [ 214.333957] [<c126ef4c>] bus_remove_driver+0x6c/0xe0 [ 214.333957] [<c1270120>] driver_unregister+0x40/0x70 [ 214.333957] [<d083686b>] ssb_driver_unregister+0xb/0x10 [ssb] [ 214.333957] [<d087c488>] b43legacy_exit+0xd/0xf [b43legacy] [ 214.333957] [<c1089dde>] sys_delete_module+0x14e/0x2b0 [ 214.333957] [<c110a4a7>] ? vfs_write+0xf7/0x150 [ 214.333957] [<c1240050>] ? tty_write_lock+0x50/0x50 [ 214.333957] [<c110a6f8>] ? sys_write+0x38/0x70 [ 214.333957] [<c1397c55>] syscall_call+0x7/0xb [ 214.333957] Code: bc 27 00 00 00 00 a1 74 61 56 c1 55 89 e5 e8 a3 fc ff ff 5d c3 90 55 89 e5 57 56 89 c6 53 b8 40 ac 62 c1 83 ec 14 e8 bb b7 34 00 <8b> 46 4c 8d 50 01 85 c0 89 56 4c 75 03 83 0e 40 80 05 40 ac 62 [ 214.333957] EIP: [<c104c395>] drain_workqueue+0x15/0x170 SS:ESP 0068:cd767e5c [ 214.333957] CR2: 000000000000004c [ 214.341110] ---[ end trace c7e90ec026d875a6 ]---Index: wireless-testing/drivers/net/wireless/b43legacy/main.c
The problem is fixed by making certain that the ucode pointer is not NULL before deregistering the driver in mac80211.
--- drivers/net/wireless/b43legacy/main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/b43legacy/main.c +2 -0
@@ -3843,6 +3843,8 @@ static void b43legacy_remove(struct ssb_cancel_work_sync (&wldev->restart_work);B43legacy_WARN_ON (!wl); +if (!wldev->fw.ucode) +return ;/* NULL if fw never loaded */ if (wl->current_dev == wldev)ieee80211_unregister_hw (wl->hw);
Greg Kroah-Hartman
maintainerPATCH 16/33 firmware: Add missing attributes to EFI variable attribute print out from sysfs
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Khalid Aziz <[email protected]>
commit 7083909023bbe29b3176e92d2d089def1aa7aa1e upstream.
Some of the EFI variable attributes are missing from print out from /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also updates code to use pre-defined constants for masking current value of attributes.
--- drivers/firmware/efivars.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/firmware/efivars.c +14 -3
@@ -400,12 +400,23 @@ efivar_attr_read(struct efivar_entry *enif (status !=EFI_SUCCESS )return -EIO ; -if (var->Attributes &0x1 ) +if (var->Attributes &EFI_VARIABLE_NON_VOLATILE ) str +=sprintf (str,"EFI_VARIABLE_NON_VOLATILE\n" ); -if (var->Attributes &0x2 ) +if (var->Attributes &EFI_VARIABLE_BOOTSERVICE_ACCESS ) str +=sprintf (str,"EFI_VARIABLE_BOOTSERVICE_ACCESS\n" ); -if (var->Attributes &0x4 ) +if (var->Attributes &EFI_VARIABLE_RUNTIME_ACCESS ) str +=sprintf (str,"EFI_VARIABLE_RUNTIME_ACCESS\n" ); +if (var->Attributes &EFI_VARIABLE_HARDWARE_ERROR_RECORD ) + str +=sprintf (str,"EFI_VARIABLE_HARDWARE_ERROR_RECORD\n" ); +if (var->Attributes &EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS ) + str +=sprintf (str, +"EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\n" ); +if (var->Attributes & +EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS ) + str +=sprintf (str, +"EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\n" ); +if (var->Attributes &EFI_VARIABLE_APPEND_WRITE ) + str +=sprintf (str,"EFI_VARIABLE_APPEND_WRITE\n" );return str - buf; }
Greg Kroah-Hartman
maintainerPATCH 17/33 xhci: Intel Panther Point BEI quirk.
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 80fab3b244a22e0ca539d2439bdda50e81e5666f upstream.
When a device with an isochronous endpoint is behind a hub plugged into the Intel Panther Point xHCI host controller, and the driver submits multiple frames per URB, the xHCI driver will set the Block Event Interrupt (BEI) flag on all but the last TD for the URB. This causes the host controller to place an event on the event ring, but not send an interrupt. When the last TD for the URB completes, BEI is cleared, and we get an interrupt for the whole URB.
However, under a Panther Point xHCI host controller, if the parent hub is unplugged when one or more events from transfers with BEI set are on the event ring, a port status change event is placed on the event ring, but no interrupt is generated. This means URBs stop completing, and the USB device disconnect is not noticed. Something like a USB headset will cause mplayer to hang when the device is disconnected.
If another transfer is sent (such as running sudo lsusb -v), the next transfer event seems to "unstick" the event ring, the xHCI driver gets an interrupt, and the disconnect is reported to the USB core.
The fix is not to use the BEI flag under the Panther Point xHCI host. This will impact power consumption and system responsiveness, because the xHCI driver will receive an interrupt for every frame in all isochronous URBs instead of once per URB.
Intel chipset developers confirm that this bug will be hit if the BEI flag is used on any endpoint, not just ones that are behind a hub.
This patch should be backported to kernels as old as 3.0, that contain the commit 69e848c2090aebba5698a1620604c7dccb448684 "Intel xhci: Support EHCI/xHCI port switching."
--- drivers/usb/host/xhci-pci.c | 1 + drivers/usb/host/xhci-ring.c | 4 +++- drivers/usb/host/xhci.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +1 -0
@@ -149,6 +149,7 @@ static int xhci_pci_setup(struct usb_hcd* PPT chipsets. */ xhci->quirks |=XHCI_SPURIOUS_REBOOT ; + xhci->quirks |=XHCI_AVOID_BEI ; }if (pdev->vendor ==PCI_VENDOR_ID_ETRON && pdev->device ==PCI_DEVICE_ID_ASROCK_P67 ) {
drivers/usb/host/xhci-ring.c +3 -1
@@ -3365,7 +3365,9 @@ static int xhci_queue_isoc_tx(struct xhc }else { td->last_trb = ep_ring->enqueue; field |=TRB_IOC ; -if (xhci->hci_version ==0x100 ) { +if (xhci->hci_version ==0x100 && + !(xhci->quirks & +XHCI_AVOID_BEI )) {/* Set BEI bit except for the last td */ if (i < num_tds -1 ) field |=TRB_BEI ;
drivers/usb/host/xhci.h +1 -0
@@ -1317,6 +1317,7 @@ struct xhci_hcd {#define XHCI_AMD_0x96_HOST (1 << 9)#define XHCI_TRUST_TX_LENGTH (1 << 10)#define XHCI_SPURIOUS_REBOOT (1 << 13) +#define XHCI_AVOID_BEI (1 << 15)unsigned int num_active_eps;unsigned int limit_active_eps;/* There are two roothubs to keep track of bus suspend info for */
Greg Kroah-Hartman
maintainerPATCH 18/33 n_gsm: added interlocking for gsm_data_lock for certain code paths
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russ Gorby <[email protected]>
commit 5e44708f75b0f8712da715d6babb0c21089b2317 upstream.
There were some locking holes in the management of the MUX's message queue for 2 code paths:
1) gsmld_write_wakeup
2) receipt of CMD_FCON flow-control message
In both cases gsm_data_kick is called w/o locking so it can collide with other other instances of gsm_data_kick (pulling messages tx_tail) or potentially other instances of __gsm_data_queu (adding messages to tx_head)
Changed to take the tx_lock in these 2 cases
--- drivers/tty/n_gsm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/tty/n_gsm.c +6 -2
@@ -1152,6 +1152,8 @@ static void gsm_control_message(struct g u8 *data, int clen) {u8 buf[1 ]; +unsigned long flags; +switch (command) {case CMD_CLD : {struct gsm_dlci *dlci = gsm->dlci[0 ];
@@ -1177,7 +1179,9 @@ static void gsm_control_message(struct g gsm->constipated =0 ;gsm_control_reply (gsm,CMD_FCOFF ,NULL ,0 );/* Kick the link in case it is idling */ +spin_lock_irqsave (&gsm->tx_lock, flags);gsm_data_kick (gsm); +spin_unlock_irqrestore (&gsm->tx_lock, flags);break ;case CMD_MSC :/* Out of band modem line change indicator for a DLCI */
@@ -2269,12 +2273,12 @@ static void gsmld_write_wakeup(struct tt/* Queue poll */ clear_bit (TTY_DO_WRITE_WAKEUP , &tty->flags); +spin_lock_irqsave (&gsm->tx_lock, flags);gsm_data_kick (gsm);if (gsm->tx_bytes <TX_THRESH_LO ) { -spin_lock_irqsave (&gsm->tx_lock, flags);gsm_dlci_data_sweep (gsm); -spin_unlock_irqrestore (&gsm->tx_lock, flags); } +spin_unlock_irqrestore (&gsm->tx_lock, flags); }/**
Greg Kroah-Hartman
maintainerPATCH 19/33 coredump: prevent double-free on an error path in core dumper
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denys Vlasenko <[email protected]>
commit f34f9d186df35e5c39163444c43b4fc6255e39c5 upstream.
In !CORE_DUMP_USE_REGSET case, if elf_note_info_init fails to allocate memory for info->fields, it frees already allocated stuff and returns error to its caller, fill_note_info. Which in turn returns error to its caller, elf_core_dump. Which jumps to cleanup label and calls free_note_info, which will happily try to free all info->fields again. BOOM.
This is the fix.
--- fs/binfmt_elf.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
fs/binfmt_elf.c +4 -15
@@ -1669,30 +1669,19 @@ static int elf_note_info_init(struct elfreturn 0 ; info->psinfo =kmalloc (sizeof (*info->psinfo),GFP_KERNEL );if (!info->psinfo) - goto notes_free; +return 0 ; info->prstatus =kmalloc (sizeof (*info->prstatus),GFP_KERNEL );if (!info->prstatus) - goto psinfo_free; +return 0 ; info->fpu =kmalloc (sizeof (*info->fpu),GFP_KERNEL );if (!info->fpu) - goto prstatus_free; +return 0 ;#ifdef ELF_CORE_COPY_XFPREGS info->xfpu =kmalloc (sizeof (*info->xfpu),GFP_KERNEL );if (!info->xfpu) - goto fpu_free; +return 0 ;#endif return 1 ; -#ifdef ELF_CORE_COPY_XFPREGS - fpu_free: -kfree (info->fpu); -#endif - prstatus_free: -kfree (info->prstatus); - psinfo_free: -kfree (info->psinfo); - notes_free: -kfree (info->notes); -return 0 ; } static int fill_note_info(struct elfhdr *elf, int phdrs,
Greg Kroah-Hartman
maintainerPATCH 20/33 Increase XHCI suspend timeout to 16ms
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Spang <[email protected]>
commit a6e097dfdfd189b6929af6efa1d289af61858386 upstream.
The Intel XHCI specification says that after clearing the run/stop bit the controller may take up to 16ms to halt. We've seen a device take 14ms, which with the current timeout of 10ms causes the kernel to abort the suspend. Increasing the timeout to the recommended value fixes the problem.
This patch should be backported to kernels as old as 2.6.37, that contain the commit 5535b1d5f8885695c6ded783c692e3c0d0eda8ca "USB: xHCI:
PCI power management implementation".
--- drivers/usb/host/xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci.c +1 -1
@@ -720,7 +720,7 @@ int xhci_suspend(struct xhci_hcd *xhci) command &= ~CMD_RUN ;xhci_writel (xhci, command, &xhci->op_regs->command);if (handshake (xhci, &xhci->op_regs->status, -STS_HALT ,STS_HALT ,100 *100 )) { +STS_HALT ,STS_HALT ,XHCI_MAX_HALT_USEC )) {xhci_warn (xhci,"WARN: xHC CMD_RUN timeout\n" );spin_unlock_irq (&xhci->lock);return -ETIMEDOUT ;
Greg Kroah-Hartman
maintainerPATCH 21/33 n_gsm: memory leak in uplink error path
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russ Gorby <[email protected]>
commit 88ed2a60610974443335c924d7cb8e5dcf9dbdc1 upstream.
Uplink (TX) network data will go through gsm_dlci_data_output_framed there is a bug where if memory allocation fails, the skb which has already been pulled off the list will be lost.
In addition TX skbs were being processed in LIFO order
Fixed the memory leak, and changed to FIFO order processing
--- drivers/tty/n_gsm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/tty/n_gsm.c +5 -2
@@ -842,7 +842,7 @@ static int gsm_dlci_data_output_framed(s/* dlci->skb is locked by tx_lock */ if (dlci->skb ==NULL ) { - dlci->skb =skb_dequeue (&dlci->skb_list); + dlci->skb =skb_dequeue_tail (&dlci->skb_list);if (dlci->skb ==NULL )return 0 ; first =1 ;
@@ -866,8 +866,11 @@ static int gsm_dlci_data_output_framed(s/* FIXME: need a timer or something to kick this so it can't get stuck with no work outstanding and no buffer free */ -if (msg ==NULL ) +if (msg ==NULL ) { +skb_queue_tail (&dlci->skb_list, dlci->skb); + dlci->skb =NULL ;return -ENOMEM ; + } dp = msg->data;if (dlci->adaption ==4 ) {/* Interruptible framed (Packetised Data) */
Greg Kroah-Hartman
maintainerPATCH 22/33 UBI: fix autoresize handling in R/O mode
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Bityutskiy <[email protected]>
commit abb3e01103eb4e2ea5c15e6fedbc74e08bd4cc2b upstream.
Currently UBI fails in autoresize when it is in R/O mode (e.g., because the underlying MTD device is R/O). This patch fixes the issue - we just skip autoresize and print a warning.
--- drivers/mtd/ubi/build.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mtd/ubi/build.c +5 -0
@@ -816,6 +816,11 @@ static int autoresize(struct ubi_devicestruct ubi_volume *vol = ubi->volumes[vol_id];int err, old_reserved_pebs = vol->reserved_pebs; +if (ubi->ro_mode) { +ubi_warn ("skip auto-resize because of R/O mode" ); +return 0 ; + } +/* * Clear the auto-resize flag in the volume in-memory copy of the * volume table, and 'ubi_resize_volume()' will propagate this change
Greg Kroah-Hartman
maintainerPATCH 23/33 SCSI: ibmvscsi: Fix host config length field overflow
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Herrenschmidt <[email protected]>
commit 225c56960fcafeccc2b6304f96cd3f0dbf42a16a upstream.
The length field in the host config packet is only 16-bit long, so passing it 0x10000 (64K which is our standard PAGE_SIZE) doesn't work and result in an empty config from the server.
--- drivers/scsi/ibmvscsi/ibmvscsi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/ibmvscsi/ibmvscsi.c +3 -0
@@ -1547,6 +1547,9 @@ static int ibmvscsi_do_host_config(struc host_config = &evt_struct->iu.mad.host_config; +/* The transport length field is only 16-bit */ + length =min (0xffff , length); +/* Set up a lun reset SRP command */ memset (host_config,0x00 ,sizeof (*host_config)); host_config->common.type =VIOSRP_HOST_CONFIG_TYPE ;
Greg Kroah-Hartman
maintainerPATCH 24/33 SCSI: hpsa: Use LUN reset instead of target reset
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Stephen M. Cameron" <[email protected]>
commit 21e89afd325849eb38adccf382df16cc895911f9 upstream.
It turns out Smart Array logical drives do not support target reset and when the target reset fails, the logical drive will be taken off line. Symptoms look like this:
hpsa 0000:03:00.0: Abort request on C1:B0:T0:L0
hpsa 0000:03:00.0: resetting device 1:0:0:0
hpsa 0000:03:00.0: cp ffff880037c56000 is reported invalid (probably means target device no longer present) hpsa 0000:03:00.0: resetting device failed.
sd 1:0:0:0: Device offlined - not ready after error recovery
sd 1:0:0:0: rejecting I/O to offline device
EXT3-fs error (device sdb1): read_block_bitmap:
LUN reset is supported though, and is what we should be using. Target reset is also disruptive in shared SAS situations, for example, an external MSA1210m which does support target reset attached to Smart Arrays in multiple hosts -- a target reset from one host is disruptive to other hosts as all LUNs on the target will be reset and will abort all outstanding i/os back to all the attached hosts. So we should use LUN reset, not target reset.
Tested this with Smart Array logical drives and with tape drives. Not sure how this bug survived since 2009, except it must be very rare for a Smart Array to require more than 30s to complete a request.
--- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hpsa.c +1 -1
@@ -2893,7 +2893,7 @@ static void fill_cmd(struct CommandList c->Request.Timeout =0 ;/* Don't time out */ memset (&c->Request.CDB[0 ],0 ,sizeof (c->Request.CDB)); c->Request.CDB[0 ] = cmd; - c->Request.CDB[1 ] =0x03 ;/* Reset target above */ + c->Request.CDB[1 ] =HPSA_RESET_TYPE_LUN ;/* If bytes 4-7 are zero, it means reset the */ /* LunID device */ c->Request.CDB[4 ] =0x00 ;
Greg Kroah-Hartman
maintainerPATCH 25/33 can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit f61bd0585dfc7d99db4936d7467de4ca8e2f7ea0 upstream.
In case of error, the function clk_get() returns ERR_PTR() and never returns NULL pointer. The NULL test in the error handling should be replaced with IS_ERR().
dpatch engine is used to auto generated this patch.
(https://github.com/weiyj/dpatch)
--- drivers/net/can/mscan/mpc5xxx_can.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/mscan/mpc5xxx_can.c +2 -2
@@ -181,7 +181,7 @@ static u32 __devinit mpc512x_can_get_cloif (!clock_name || !strcmp (clock_name,"sys" )) { sys_clk =clk_get (&ofdev->dev,"sys_clk" ); -if (!sys_clk) { +if (IS_ERR (sys_clk)) {dev_err (&ofdev->dev,"couldn't get sys_clk\n" ); goto exit_unmap; }
@@ -204,7 +204,7 @@ static u32 __devinit mpc512x_can_get_cloif (clocksrc <0 ) { ref_clk =clk_get (&ofdev->dev,"ref_clk" ); -if (!ref_clk) { +if (IS_ERR (ref_clk)) {dev_err (&ofdev->dev,"couldn't get ref_clk\n" ); goto exit_unmap; }
Greg Kroah-Hartman
maintainerPATCH 26/33 IPoIB: Fix use-after-free of multicast object
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrick McHardy <[email protected]>
commit bea1e22df494a729978e7f2c54f7bda328f74bc3 upstream.
Fix a crash in ipoib_mcast_join_task(). (with help from Or Gerlitz)
Commit c8c2afe360b7 ("IPoIB: Use rtnl lock/unlock when changing device flags") added a call to rtnl_lock() in ipoib_mcast_join_task(), which is run from the ipoib_workqueue, and hence the workqueue can't be flushed from the context of ipoib_stop().
In the current code, ipoib_stop() (which doesn't flush the workqueue) calls ipoib_mcast_dev_flush(), which goes and deletes all the multicast entries. This takes place without any synchronization with a possible running instance of ipoib_mcast_join_task() for the same ipoib device, leading to a crash due to NULL pointer dereference.
Fix this by making sure that the workqueue is flushed before ipoib_mcast_dev_flush() is called. To make that possible, we move the RTNL-lock wrapped code to ipoib_mcast_join_finish().
--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 +- drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_main.c +1 -1
@@ -148,7 +148,7 @@ static int ipoib_stop(struct net_devicenetif_stop_queue (dev); -ipoib_ib_dev_down (dev,0 ); +ipoib_ib_dev_down (dev,1 );ipoib_ib_dev_stop (dev,0 );if (!test_bit (IPOIB_FLAG_SUBINTERFACE , &priv->flags)) {
drivers/infiniband/ulp/ipoib/ipoib_multicast.c +10 -9
@@ -189,7 +189,9 @@ static int ipoib_mcast_join_finish(struc mcast->mcmember = *mcmember; -/* Set the cached Q_Key before we attach if it's the broadcast group */ +/* Set the multicast MTU and cached Q_Key before we attach if it's +* the broadcast group. +*/ if (!memcmp (mcast->mcmember.mgid.raw, priv->dev->broadcast +4 ,sizeof (union ib_gid ))) {spin_lock_irq (&priv->lock);
@@ -197,10 +199,17 @@ static int ipoib_mcast_join_finish(strucspin_unlock_irq (&priv->lock);return -EAGAIN ; } + priv->mcast_mtu =IPOIB_UD_MTU (ib_mtu_enum_to_int (priv->broadcast->mcmember.mtu)); priv->qkey =be32_to_cpu (priv->broadcast->mcmember.qkey);spin_unlock_irq (&priv->lock); priv->tx_wr.wr.ud.remote_qkey = priv->qkey; set_qkey =1 ; + +if (!ipoib_cm_admin_enabled (dev)) { +rtnl_lock (); +dev_set_mtu (dev,min (priv->mcast_mtu, priv->admin_mtu)); +rtnl_unlock (); + } }if (!test_bit (IPOIB_MCAST_FLAG_SENDONLY , &mcast->flags)) {
@@ -586,14 +595,6 @@ void ipoib_mcast_join_task(struct work_sreturn ; } - priv->mcast_mtu =IPOIB_UD_MTU (ib_mtu_enum_to_int (priv->broadcast->mcmember.mtu)); - -if (!ipoib_cm_admin_enabled (dev)) { -rtnl_lock (); -dev_set_mtu (dev,min (priv->mcast_mtu, priv->admin_mtu)); -rtnl_unlock (); - } -ipoib_dbg_mcast (priv,"successfully joined all multicast groups\n" );clear_bit (IPOIB_MCAST_RUN , &priv->flags);
Greg Kroah-Hartman
maintainerPATCH 27/33 IB/srp: Fix use-after-free in srp_reset_req()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 9b796d06d5d1b1e85ae2316a283ea11dd739ef96 upstream.
srp_free_req() uses the scsi_cmnd structure contents to unmap buffers, so we must invoke srp_free_req() before we release ownership of that structure.
--- drivers/infiniband/ulp/srp/ib_srp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/srp/ib_srp.c +1 -1
@@ -620,9 +620,9 @@ static void srp_reset_req(struct srp_tarstruct scsi_cmnd *scmnd =srp_claim_req (target, req,NULL );if (scmnd) { +srp_free_req (target, req, scmnd,0 ); scmnd->result =DID_RESET <<16 ; scmnd->scsi_done (scmnd); -srp_free_req (target, req, scmnd,0 ); } }
Greg Kroah-Hartman
maintainerPATCH 28/33 IB/srp: Avoid having aborted requests hang
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit d8536670916a685df116b5c2cb256573fd25e4e3 upstream.
We need to call scsi_done() for commands after we abort them.
--- drivers/infiniband/ulp/srp/ib_srp.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/srp/ib_srp.c +1 -0
@@ -1669,6 +1669,7 @@ static int srp_abort(struct scsi_cmnd *s SRP_TSK_ABORT_TASK);srp_free_req (target, req, scmnd,0 ); scmnd->result =DID_ABORT <<16 ; + scmnd->scsi_done (scmnd);return SUCCESS ; }
Greg Kroah-Hartman
maintainerPATCH 29/33 isci: fix isci_pci_probe() generates warning on efi failure path
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 6d70a74ffd616073a68ae0974d98819bfa8e6da6 upstream.
The oem parameter image embedded in the efi variable is at an offset from the start of the variable. However, in the failure path we try to free the 'orom' pointer which is only valid when the paramaters are being read from the legacy option-rom space.
Since failure to load the oem parameters is unlikely and we keep the memory around in the success case just defer all de-allocation to devm.
--- drivers/scsi/isci/init.c | 1 - drivers/scsi/isci/probe_roms.c | 1 - 2 files changed, 2 deletions(-)
drivers/scsi/isci/init.c +0 -1
@@ -458,7 +458,6 @@ static int __devinit isci_pci_probe(struif (sci_oem_parameters_validate (&orom->ctrl[i])) {dev_warn (&pdev->dev,"[%d]: invalid oem parameters detected, falling back to firmware\n" , i); -devm_kfree (&pdev->dev, orom); orom =NULL ;break ; }
drivers/scsi/isci/probe_roms.c +0 -1
@@ -104,7 +104,6 @@ struct isci_orom *isci_request_oprom(strif (i >= len) {dev_err (&pdev->dev,"oprom parse error\n" ); -devm_kfree (&pdev->dev, rom); rom =NULL ; }pci_unmap_biosrom (oprom);
Greg Kroah-Hartman
maintainerPATCH 30/33 x86/alternatives: Fix p6 nops on non-modular kernels
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Kivity <[email protected]>
commit cb09cad44f07044d9810f18f6f9a6a6f3771f979 upstream.
Probably a leftover from the early days of self-patching, p6nops are marked __initconst_or_module, which causes them to be discarded in a non-modular kernel. If something later triggers patching, it will overwrite kernel code with garbage.
--- arch/x86/kernel/alternative.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/alternative.c +1 -1
@@ -161,7 +161,7 @@ static const unsigned char * const k7_no#endif #ifdef P6_NOP1 -static const unsigned char __initconst_or_module p6nops[] = +static const unsigned char p6nops[] = {P6_NOP1 , P6_NOP2,
Greg Kroah-Hartman
maintainerPATCH 31/33 PCI: honor child buses add_size in hot plug configuration
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yinghai Lu <[email protected]>
commit be768912a49b10b68e96fbd8fa3cab0adfbd3091 upstream.
git commit c8adf9a3e873eddaaec11ac410a99ef6b9656938
"PCI: pre-allocate additional resources to devices only after
successful allocation of essential resources."
fails to take into consideration the optional-resources needed by children devices while calculating the optional-resource needed by the bridge.
This can be a problem on some setup. For example, if a hotplug bridge has 8 children hotplug bridges, the bridge should have enough resources to accomodate the hotplug requirements for each of its children hotplug bridges. Currently this is not the case.
This patch fixes the problem.
--- drivers/pci/setup-bus.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/pci/setup-bus.c +26 -0
@@ -543,6 +543,20 @@ static resource_size_t calculate_memsizereturn size; } +static resource_size_t get_res_add_size (struct resource_list_x *add_head, +struct resource *res) +{ +struct resource_list_x *list; + +/* check if it is in add_head list */ +for (list = add_head->next; list && list->res != res; + list = list->next); +if (list) +return list->add_size; + +return 0 ; +} +/** * pbus_size_io() - size the io window of a given bus *
@@ -562,6 +576,7 @@ static void pbus_size_io(struct pci_busstruct pci_dev *dev;struct resource *b_res =find_free_bus_resource (bus,IORESOURCE_IO );unsigned long size =0 , size0 =0 , size1 =0 ; +resource_size_t children_add_size =0 ;if (!b_res)return ;
@@ -582,10 +597,15 @@ static void pbus_size_io(struct pci_bus size += r_size; else size1 += r_size; + +if (add_head) + children_add_size +=get_res_add_size (add_head, r); } } size0 =calculate_iosize (size, min_size, size1,resource_size (b_res),4096 ); +if (children_add_size > add_size) + add_size = children_add_size; size1 = (!add_head || (add_head && !add_size)) ? size0 :calculate_iosize (size, min_size+add_size, size1,resource_size (b_res),4096 );
@@ -627,6 +647,7 @@ static int pbus_size_mem(struct pci_busint order, max_order;struct resource *b_res =find_free_bus_resource (bus, type);unsigned int mem64_mask =0 ; +resource_size_t children_add_size =0 ;if (!b_res)return 0 ;
@@ -668,6 +689,9 @@ static int pbus_size_mem(struct pci_busif (order > max_order) max_order = order; mem64_mask &= r->flags &IORESOURCE_MEM_64 ; + +if (add_head) + children_add_size +=get_res_add_size (add_head, r); } } align =0 ;
@@ -684,6 +708,8 @@ static int pbus_size_mem(struct pci_bus align += aligns[order]; } size0 =calculate_memsize (size, min_size,0 ,resource_size (b_res), min_align); +if (children_add_size > add_size) + add_size = children_add_size; size1 = (!add_head || (add_head && !add_size)) ? size0 :calculate_memsize (size, min_size+add_size,0 ,resource_size (b_res), min_align);
Greg Kroah-Hartman
maintainerPATCH 32/33 SCSI: scsi_remove_target: fix softlockup regression on hot remove
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit bc3f02a795d3b4faa99d37390174be2a75d091bd upstream.
John reports:
BUG: soft lockup - CPU#2 stuck for 23s! [kworker/u:8:2202] [..] Call Trace: [<ffffffff8141782a>] scsi_remove_target+0xda/0x1f0 [<ffffffff81421de5>] sas_rphy_remove+0x55/0x60 [<ffffffff81421e01>] sas_rphy_delete+0x11/0x20 [<ffffffff81421e35>] sas_port_delete+0x25/0x160 [<ffffffff814549a3>] mptsas_del_end_device+0x183/0x270
...introduced by commit 3b661a9 "[SCSI] fix hot unplug vs async scan race".
Don't restart lookup of more stargets in the multi-target case, just arrange to traverse the list once, on the assumption that new targets are always added at the end. There is no guarantee that the target will change state in scsi_target_reap() so we can end up spinning if we restart.
LKML-Reference: <CAEhu1-6wq1YsNiscGMwP4ud0Q+MrViRzv=kcWCQSBNc8c68N5Q@mail.gmail.com>
--- drivers/scsi/scsi_sysfs.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)
drivers/scsi/scsi_sysfs.c +14 -16
@@ -988,33 +988,31 @@ static void __scsi_remove_target(structvoid scsi_remove_target (struct device *dev) {struct Scsi_Host *shost =dev_to_shost (dev->parent); -struct scsi_target *starget, *found; +struct scsi_target *starget, *last =NULL ;unsigned long flags; - restart: - found =NULL ; +/* remove targets being careful to lookup next entry before +* deleting the last +*/ spin_lock_irqsave (shost->host_lock, flags);list_for_each_entry (starget, &shost->__targets, siblings) {if (starget->state ==STARGET_DEL )continue ;if (starget->dev.parent == dev || &starget->dev == dev) { - found = starget; - found->reap_ref++; -break ; +/* assuming new targets arrive at the end */ + starget->reap_ref++; +spin_unlock_irqrestore (shost->host_lock, flags); +if (last) +scsi_target_reap (last); + last = starget; +__scsi_remove_target (starget); +spin_lock_irqsave (shost->host_lock, flags); } }spin_unlock_irqrestore (shost->host_lock, flags); -if (found) { -__scsi_remove_target (found); -scsi_target_reap (found); -/* in the case where @dev has multiple starget children, -* continue removing. -* -* FIXME: does such a case exist? -*/ - goto restart; - } +if (last) +scsi_target_reap (last); }EXPORT_SYMBOL (scsi_remove_target);
Greg Kroah-Hartman
maintainerPATCH 33/33 SCSI: scsi_dh_alua: Enable STPG for unavailable ports
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit e47f8976d8e573928824a06748f7bc82c58d747f upstream.
A quote from SPC-4: "While in the unavailable primary target port asymmetric access state, the device server shall support those of the following commands that it supports while in the active/optimized
state: [ ... ] d) SET TARGET PORT GROUPS; [ ... ]". Hence enable sending STPG to a target port group that is in the unavailable state.
--- drivers/scsi/device_handler/scsi_dh_alua.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/device_handler/scsi_dh_alua.c +1 -2
@@ -619,8 +619,7 @@ static int alua_rtpg(struct scsi_device h->state =TPGS_STATE_STANDBY ;break ;case TPGS_STATE_OFFLINE : -case TPGS_STATE_UNAVAILABLE : -/* Path unusable for unavailable/offline */ +/* Path unusable */ err =SCSI_DH_DEV_OFFLINED ;break ;default :