4.14.135-stable review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 147/293 padata: use smp_mb in padata_reorder to avoid orphaned padata jobs
In reply to Greg Kroah-HartmanFrom: Daniel Jordan <[email protected]>
commit cf144f81a99d1a3928f90b0936accfd3f45c9a0a upstream.
Testing padata with the tcrypt module on a 5.2 kernel...
# modprobe tcrypt alg="pcrypt(rfc4106(gcm(aes)))" type=3
# modprobe tcrypt mode=211 sec=1...produces this splat:
INFO: task modprobe:10075 blocked for more than 120 seconds.
Not tainted 5.2.0-base+ #16
modprobe D 0 10075 10064 0x80004080
Call Trace:
? __schedule+0x4dd/0x610
? ring_buffer_unlock_commit+0x23/0x100
schedule+0x6c/0x90
schedule_timeout+0x3b/0x320
? trace_buffer_unlock_commit_regs+0x4f/0x1f0
wait_for_common+0x160/0x1a0
? wake_up_q+0x80/0x80
{ crypto_wait_req } # entries in braces added by hand
{ do_one_aead_op }
{ test_aead_jiffies }
test_aead_speed.constprop.17+0x681/0xf30 [tcrypt]
do_test+0x4053/0x6a2b [tcrypt]
? 0xffffffffa00f4000
tcrypt_mod_init+0x50/0x1000 [tcrypt]
...The second modprobe command never finishes because in padata_reorder, CPU0's load of reorder_objects is executed before the unlocking store in spin_unlock_bh(pd->lock), causing CPU0 to miss CPU1's increment:
CPU0 CPU1
padata_reorder padata_do_serial
LOAD reorder_objects // 0
INC reorder_objects // 1 padata_reorder
TRYLOCK pd->lock // failed
UNLOCK pd->lock
CPU0 deletes the timer before returning from padata_reorder and since no other job is submitted to padata, modprobe waits indefinitely.
Add a pair of full barriers to guarantee proper ordering:
CPU0 CPU1
padata_reorder padata_do_serial
UNLOCK pd->lock
smp_mb()
LOAD reorder_objects
INC reorder_objects
smp_mb__after_atomic()
padata_reorder
TRYLOCK pd->locksmp_mb__after_atomic is needed so the read part of the trylock operation
comes after the INC, as Andrea points out. Thanks also to Andrea for
help with writing a litmus test.
--- kernel/padata.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
kernel/padata.c +12 -0
@@ -265,7 +265,12 @@ static void padata_reorder(struct parall* The next object that needs serialization might have arrived to * the reorder queues in the meantime, we will be called again * from the timer function if no one else cares for it. +* +* Ensure reorder_objects is read after pd->lock is dropped so we see +* an increment from another task in padata_do_serial. Pairs with +* smp_mb__after_atomic in padata_do_serial. */ +smp_mb ();if (atomic_read (&pd->reorder_objects) && !(pinst->flags &PADATA_RESET ))mod_timer (&pd->timer, jiffies +HZ );
@@ -334,6 +339,13 @@ void padata_do_serial(struct padata_privlist_add_tail (&padata->list, &pqueue->reorder.list);spin_unlock (&pqueue->reorder.lock); +/* +* Ensure the atomic_inc of reorder_objects above is ordered correctly +* with the trylock of pd->lock in padata_reorder. Pairs with smp_mb +* in padata_reorder. +*/ +smp_mb__after_atomic (); +put_cpu ();padata_reorder (pd);
Greg Kroah-Hartman
maintainerPATCH 225/293 pinctrl: rockchip: fix leaked of_node references
In reply to Greg Kroah-Hartman[ Upstream commit 3c89c70634bb0b6f48512de873e7a45c7e1fbaa5 ]
The call to of_parse_phandle returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/pinctrl/pinctrl-rockchip.c:3221:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 3196, but without a corresponding object release within this function. ./drivers/pinctrl/pinctrl-rockchip.c:3223:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 3196, but without a corresponding object release within this function.
--- drivers/pinctrl/pinctrl-rockchip.c | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/pinctrl-rockchip.c +1 -0
@@ -2941,6 +2941,7 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank, base, &rockchip_regmap_config); } +of_node_put (node); } bank->irq =irq_of_parse_and_map (bank->of_node,0 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 1/293 MIPS: ath79: fix ar933x uart parity mode
In reply to Greg Kroah-Hartman[ Upstream commit db13a5ba2732755cf13320f3987b77cf2a71e790 ]
While trying to get the uart with parity working I found setting even parity enabled odd parity insted. Fix the register settings to match the datasheet of AR9331.
A similar patch was created by 8devices, but not sent upstream.
https://github.com/8devices/openwrt-8devices/commit/77c5586ade3bb72cda010afad3f209ed0c98ea7c
--- arch/mips/include/asm/mach-ath79/ar933x_uart.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/include/asm/mach-ath79/ar933x_uart.h +2 -2
@@ -27,8 +27,8 @@#define AR933X_UART_CS_PARITY_S 0#define AR933X_UART_CS_PARITY_M 0x3#define AR933X_UART_CS_PARITY_NONE 0 -#define AR933X_UART_CS_PARITY_ODD 1 -#define AR933X_UART_CS_PARITY_EVEN 2 +#define AR933X_UART_CS_PARITY_ODD 2 +#define AR933X_UART_CS_PARITY_EVEN 3#define AR933X_UART_CS_IF_MODE_S 2#define AR933X_UART_CS_IF_MODE_M 0x3#define AR933X_UART_CS_IF_MODE_NONE 0
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 10/293 ath: DFS JP domain W56 fixed pulse type 3 RADAR detection
In reply to Greg Kroah-Hartman[ Upstream commit d8792393a783158cbb2c39939cb897dc5e5299b6 ]
Increase pulse width range from 1-2usec to 0-4usec.
During data traffic HW occasionally fails detecting radar pulses, so that SW cannot get enough radar reports to achieve the success rate.
Tested ath10k hw and fw:
* QCA9888(10.4-3.5.1-00052)
* QCA4019(10.4-3.2.1.1-00017)
* QCA9984(10.4-3.6-00104)
* QCA988X(10.2.4-1.0-00041)
Tested ath9k hw: AR9300
--- drivers/net/wireless/ath/dfs_pattern_detector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/dfs_pattern_detector.c +1 -1
@@ -111,7 +111,7 @@ static const struct radar_detector_specs jp_radar_ref_types[] = {JP_PATTERN (0 ,0 ,1 ,1428 ,1428 ,1 ,18 ,29 , false),JP_PATTERN (1 ,2 ,3 ,3846 ,3846 ,1 ,18 ,29 , false),JP_PATTERN (2 ,0 ,1 ,1388 ,1388 ,1 ,18 ,50 , false), -JP_PATTERN (3 ,1 ,2 ,4000 ,4000 ,1 ,18 ,50 , false), +JP_PATTERN (3 ,0 ,4 ,4000 ,4000 ,1 ,18 ,50 , false),JP_PATTERN (4 ,0 ,5 ,150 ,230 ,1 ,23 ,50 , false),JP_PATTERN (5 ,6 ,10 ,200 ,500 ,1 ,16 ,50 , false), JP_PATTERN(6, 11, 20, 200, 500, 1, 12, 50, false),
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 11/293 batman-adv: fix for leaked TVLV handler.
In reply to Greg Kroah-Hartman[ Upstream commit 17f78dd1bd624a4dd78ed5db3284a63ee807fcc3 ]
A handler for BATADV_TVLV_ROAM was being registered when the translation-table was initialized, but not unregistered when the translation-table was freed. Unregister it.
--- net/batman-adv/translation-table.c | 2 ++ 1 file changed, 2 insertions(+)
net/batman-adv/translation-table.c +2 -0
@@ -3750,6 +3750,8 @@ static void batadv_tt_purge(struct work_struct *work)void batadv_tt_free (struct batadv_priv *bat_priv) { +batadv_tvlv_handler_unregister (bat_priv,BATADV_TVLV_ROAM ,1 ); +batadv_tvlv_container_unregister (bat_priv,BATADV_TVLV_TT ,1 );batadv_tvlv_handler_unregister (bat_priv,BATADV_TVLV_TT ,1 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 12/293 media: dvb: usb: fix use after free in dvb_usb_device_exit
In reply to Greg Kroah-Hartman[ Upstream commit 6cf97230cd5f36b7665099083272595c55d72be7 ]
dvb_usb_device_exit() frees and uses the device name in that order. Fix by storing the name in a buffer before freeing it.
--- drivers/media/usb/dvb-usb/dvb-usb-init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/usb/dvb-usb/dvb-usb-init.c +5 -2
@@ -287,12 +287,15 @@ EXPORT_SYMBOL(dvb_usb_device_init);void dvb_usb_device_exit (struct usb_interface *intf) {struct dvb_usb_device *d =usb_get_intfdata (intf); -const char *name ="generic DVB-USB module" ; +const char *default_name ="generic DVB-USB module" ; +char name[40 ];usb_set_intfdata (intf,NULL );if (d !=NULL && d->desc !=NULL ) { - name = d->desc->name; +strscpy (name, d->desc->name,sizeof (name));dvb_usb_exit (d); + }else { +strscpy (name, default_name,sizeof (name)); }info ("%s successfully deinitialized and disconnected." , name);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 13/293 media: spi: IR LED: add missing of table registration
In reply to Greg Kroah-Hartman[ Upstream commit 24e4cf770371df6ad49ed873f21618d9878f64c8 ]
MODULE_DEVICE_TABLE(of, <of_match_table> should be called to complete DT OF mathing mechanism and register it.
Before this patch:
modinfo drivers/media/rc/ir-spi.ko | grep alias
After this patch:
modinfo drivers/media/rc/ir-spi.ko | grep alias
alias: of:N*T*Cir-spi-ledC* alias: of:N*T*Cir-spi-led
--- drivers/media/rc/ir-spi.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/rc/ir-spi.c +1 -0
@@ -186,6 +186,7 @@ static const struct of_device_id ir_spi_of_match[] = { { .compatible = "ir-spi-led" }, {}, }; +MODULE_DEVICE_TABLE (of, ir_spi_of_match);static struct spi_driver ir_spi_driver = { .probe = ir_spi_probe,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 14/293 crypto: talitos - fix skcipher failure due to wrong output IV
In reply to Greg Kroah-Hartman[ Upstream commit 3e03e792865ae48b8cfc69a0b4d65f02f467389f ]
Selftests report the following:
[ 2.984845] alg: skcipher: cbc-aes-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 2.995377] 00000000: 3d af ba 42 9d 9e b4 30 b4 22 da 80 2c 9f ac 41 [ 3.032673] alg: skcipher: cbc-des-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 3.043185] 00000000: fe dc ba 98 76 54 32 10 [ 3.063238] alg: skcipher: cbc-3des-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 3.073818] 00000000: 7d 33 88 93 0f 93 b2 42
This above dumps show that the actual output IV is indeed the input IV. This is due to the IV not being copied back into the request.
This patch fixes that.
--- drivers/crypto/talitos.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/crypto/talitos.c +4 -0
@@ -1544,11 +1544,15 @@ static void ablkcipher_done(struct device *dev, int err) {struct ablkcipher_request *areq = context; +struct crypto_ablkcipher *cipher =crypto_ablkcipher_reqtfm (areq); +struct talitos_ctx *ctx =crypto_ablkcipher_ctx (cipher); +unsigned int ivsize =crypto_ablkcipher_ivsize (cipher);struct talitos_edesc *edesc; edesc = container_of(desc, struct talitos_edesc, desc);common_nonsnoop_unmap (dev, edesc, areq); +memcpy (areq->info, ctx->iv, ivsize);kfree (edesc);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 15/293 media: marvell-ccic: fix DMA s/g desc number calculation
In reply to Greg Kroah-Hartman[ Upstream commit 0c7aa32966dab0b8a7424e1b34c7f206817953ec ]
The commit d790b7eda953 ("[media] vb2-dma-sg: move dma_(un)map_sg here") left dma_desc_nent unset. It previously contained the number of DMA descriptors as returned from dma_map_sg().
We can now (since the commit referred to above) obtain the same value from the sg_table and drop dma_desc_nent altogether.
Tested on OLPC XO-1.75 machine. Doesn't affect the OLPC XO-1's Cafe driver, since that one doesn't do DMA.
[[email protected]: fix a checkpatch warning]
--- drivers/media/platform/marvell-ccic/mcam-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/platform/marvell-ccic/mcam-core.c +3 -2
@@ -200,7 +200,6 @@ struct mcam_vb_buffer {struct list_head queue;struct mcam_dma_desc *dma_desc;/* Descriptor virtual address */ dma_addr_t dma_desc_pa;/* Descriptor physical address */ -int dma_desc_nent;/* Number of mapped descriptors */ };static inline struct mcam_vb_buffer *vb_to_mvb (struct vb2_v4l2_buffer *vb)
@@ -608,9 +607,11 @@ static void mcam_dma_contig_done(struct mcam_camera *cam, int frame)static void mcam_sg_next_buffer (struct mcam_camera *cam) {struct mcam_vb_buffer *buf; +struct sg_table *sg_table; buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer, queue);list_del_init (&buf->queue); + sg_table =vb2_dma_sg_plane_desc (&buf->vb_buf.vb2_buf,0 );/* * Very Bad Not Good Things happen if you don't clear * C1_DESC_ENA before making any descriptor changes.
@@ -618,7 +619,7 @@ static void mcam_sg_next_buffer(struct mcam_camera *cam)mcam_reg_clear_bit (cam,REG_CTRL1 ,C1_DESC_ENA );mcam_reg_write (cam,REG_DMA_DESC_Y , buf->dma_desc_pa);mcam_reg_write (cam,REG_DESC_LEN_Y , - buf->dma_desc_nent*sizeof (struct mcam_dma_desc )); + sg_table->nents *sizeof (struct mcam_dma_desc ));mcam_reg_write (cam,REG_DESC_LEN_U ,0 );mcam_reg_write (cam,REG_DESC_LEN_V ,0 );mcam_reg_set_bit (cam,REG_CTRL1 ,C1_DESC_ENA );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 2/293 MIPS: fix build on non-linux hosts
In reply to Greg Kroah-Hartman[ Upstream commit 1196364f21ffe5d1e6d83cafd6a2edb89404a3ae ]
calc_vmlinuz_load_addr.c requires SZ_64K to be defined for alignment purposes. It included "../../../../include/linux/sizes.h" to define that size, however "sizes.h" tries to include <linux/const.h> which assumes linux system headers. These may not exist eg. the following error was encountered when building Linux for OpenWrt under macOS:
In file included from arch/mips/boot/compressed/calc_vmlinuz_load_addr.c:16:arch/mips/boot/compressed/../../../../include/linux/sizes.h:11:10: fatal error: 'linux/const.h' file not found
^~~~~~~~~~
Change makefile to force building on local linux headers instead of system headers. Also change eye-watering relative reference in include file spec.
Thanks to Jo-Philip Wich & Petr Štetiar for assistance in tracking this down & fixing.
--- arch/mips/boot/compressed/Makefile | 2 ++ arch/mips/boot/compressed/calc_vmlinuz_load_addr.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
arch/mips/boot/compressed/Makefile +2 -0
@@ -75,6 +75,8 @@ OBJCOPYFLAGS_piggy.o := --add-section=.image=$(obj)/vmlinux.bin.z \ $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE $(call if_changed,objcopy) +HOSTCFLAGS_calc_vmlinuz_load_addr.o += $(LINUXINCLUDE) + # Calculate the load address of the compressed kernel image hostprogs-y := calc_vmlinuz_load_addr
arch/mips/boot/compressed/calc_vmlinuz_load_addr.c +1 -1
@@ -13,7 +13,7 @@#include <stdint.h> #include <stdio.h> #include <stdlib.h> -#include "../../../../include/linux/sizes.h" +#include <linux/sizes.h> int main (int argc,char *argv[]) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 5/293 dmaengine: imx-sdma: fix use-after-free on probe error path
In reply to Greg Kroah-Hartman[ Upstream commit 2b8066c3deb9140fdf258417a51479b2aeaa7622 ]
If probe() fails anywhere beyond the point where sdma_get_firmware() is called, then a kernel oops may occur.
Problematic sequence of events:
1. probe() calls sdma_get_firmware(), which schedules the firmware callback to run when firmware becomes available, using the sdma instance structure as the context
2. probe() encounters an error, which deallocates the sdma instance structure
3. firmware becomes available, firmware callback is called with deallocated sdma instance structure
4. use after free - kernel oops !
Solution: only attempt to load firmware when we're certain that probe() will succeed. This guarantees that the firmware callback's context will remain valid.
Note that the remove() path is unaffected by this issue: the firmware loader will increment the driver module's use count, ensuring that the module cannot be unloaded while the firmware callback is pending or running.
--- drivers/dma/imx-sdma.c | 48 ++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 21 deletions(-)
drivers/dma/imx-sdma.c +27 -21
@@ -1821,27 +1821,6 @@ static int sdma_probe(struct platform_device *pdev)if (pdata && pdata->script_addrs)sdma_add_scripts (sdma, pdata->script_addrs); -if (pdata) { - ret =sdma_get_firmware (sdma, pdata->fw_name); -if (ret) -dev_warn (&pdev->dev,"failed to get firmware from platform data\n" ); - }else { -/* -* Because that device tree does not encode ROM script address, -* the RAM script in firmware is mandatory for device tree -* probe, otherwise it fails. -*/ - ret =of_property_read_string (np,"fsl,sdma-ram-script-name" , - &fw_name); -if (ret) -dev_warn (&pdev->dev,"failed to get firmware name\n" ); -else { - ret =sdma_get_firmware (sdma, fw_name); -if (ret) -dev_warn (&pdev->dev,"failed to get firmware from device tree\n" ); - } - } - sdma->dma_device.dev = &pdev->dev; sdma->dma_device.device_alloc_chan_resources = sdma_alloc_chan_resources;
@@ -1883,6 +1862,33 @@ static int sdma_probe(struct platform_device *pdev)of_node_put (spba_bus); } +/* +* Kick off firmware loading as the very last step: +* attempt to load firmware only if we're not on the error path, because +* the firmware callback requires a fully functional and allocated sdma +* instance. +*/ +if (pdata) { + ret =sdma_get_firmware (sdma, pdata->fw_name); +if (ret) +dev_warn (&pdev->dev,"failed to get firmware from platform data\n" ); + }else { +/* +* Because that device tree does not encode ROM script address, +* the RAM script in firmware is mandatory for device tree +* probe, otherwise it fails. +*/ + ret =of_property_read_string (np,"fsl,sdma-ram-script-name" , + &fw_name); +if (ret) { +dev_warn (&pdev->dev,"failed to get firmware name\n" ); + }else { + ret =sdma_get_firmware (sdma, fw_name); +if (ret) +dev_warn (&pdev->dev,"failed to get firmware from device tree\n" ); + } + } +return 0 ; err_register:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 4/293 scsi: iscsi: set auth_protocol back to NULL if CHAP_A value is not supported
In reply to Greg Kroah-Hartman[ Upstream commit 5dd6c49339126c2c8df2179041373222362d6e49 ]
If the CHAP_A value is not supported, the chap_server_open() function should free the auth_protocol pointer and set it to NULL, or we will leave a dangling pointer around.
[ 66.010905] Unsupported CHAP_A value [ 66.011660] Security negotiation failed. [ 66.012443] iSCSI Login negotiation failed. [ 68.413924] general protection fault: 0000 [#1] SMP PTI [ 68.414962] CPU: 0 PID: 1562 Comm: targetcli Kdump: loaded Not tainted 4.18.0-80.el8.x86_64 #1 [ 68.416589] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 [ 68.417677] RIP: 0010:__kmalloc_track_caller+0xc2/0x210
--- drivers/target/iscsi/iscsi_target_auth.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/target/iscsi/iscsi_target_auth.c +8 -8
@@ -89,6 +89,12 @@ static int chap_check_algorithm(const char *a_str)return CHAP_DIGEST_UNKNOWN ; } +static void chap_close (struct iscsi_conn *conn) +{ +kfree (conn->auth_protocol); + conn->auth_protocol =NULL ; +} + static struct iscsi_chap *chap_server_open( struct iscsi_conn *conn, struct iscsi_node_auth *auth,
@@ -126,7 +132,7 @@ static struct iscsi_chap *chap_server_open(case CHAP_DIGEST_UNKNOWN :default :pr_err ("Unsupported CHAP_A value\n" ); -kfree (conn->auth_protocol); +chap_close (conn);return NULL ; }
@@ -141,19 +147,13 @@ static struct iscsi_chap *chap_server_open(* Generate Challenge. */ if (chap_gen_challenge (conn,1 , aic_str, aic_len) <0 ) { -kfree (conn->auth_protocol); +chap_close (conn);return NULL ; }return chap; } -static void chap_close (struct iscsi_conn *conn) -{ -kfree (conn->auth_protocol); - conn->auth_protocol =NULL ; -} - static int chap_server_compute_md5( struct iscsi_conn *conn, struct iscsi_node_auth *auth,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 7/293 ath10k: Do not send probe response template for mesh
In reply to Greg Kroah-Hartman[ Upstream commit 97354f2c432788e3163134df6bb144f4b6289d87 ]
Currently mac80211 do not support probe response template for mesh point. When WMI_SERVICE_BEACON_OFFLOAD is enabled, host driver tries to configure probe response template for mesh, but it fails because the interface type is not NL80211_IFTYPE_AP but NL80211_IFTYPE_MESH_POINT.
To avoid this failure, skip sending probe response template to firmware for mesh point.
Tested HW: WCN3990/QCA6174/QCA9984
--- drivers/net/wireless/ath/ath10k/mac.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath10k/mac.c +4 -0
@@ -1611,6 +1611,10 @@ static int ath10k_mac_setup_prb_tmpl(struct ath10k_vif *arvif)if (arvif->vdev_type !=WMI_VDEV_TYPE_AP )return 0 ; +/* For mesh, probe response and beacon share the same template */ +if (ieee80211_vif_is_mesh (vif)) +return 0 ; + prb =ieee80211_proberesp_get (hw, vif);if (!prb) {ath10k_warn (ar,"failed to get probe resp template from mac80211\n" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 8/293 ath9k: Check for errors when reading SREV register
In reply to Greg Kroah-Hartman[ Upstream commit 2f90c7e5d09437a4d8d5546feaae9f1cf48cfbe1 ]
Right now, if an error is encountered during the SREV register read (i.e. an EIO in ath9k_regread()), that error code gets passed all the way to __ath9k_hw_init(), where it is visible during the "Chip rev not supported" message.
ath9k_htc 1-1.4:1.0: ath9k_htc: HTC initialized with 33 credits
ath: phy2: Mac Chip Rev 0x0f.3 is not supported by this driver
ath: phy2: Unable to initialize hardware; initialization status: -95
ath: phy2: Unable to initialize hardware; initialization status: -95
ath9k_htc: Failed to initialize the device
Check for -EIO explicitly in ath9k_hw_read_revisions() and return a boolean based on the success of the operation. Check for that in __ath9k_hw_init() and abort with a more debugging-friendly message if reading the revisions wasn't successful.
ath9k_htc 1-1.4:1.0: ath9k_htc: HTC initialized with 33 credits
ath: phy2: Failed to read SREV register
ath: phy2: Could not read hardware revision
ath: phy2: Unable to initialize hardware; initialization status: -95
ath: phy2: Unable to initialize hardware; initialization status: -95
ath9k_htc: Failed to initialize the device
This helps when debugging by directly showing the first point of failure and it could prevent possible errors if a 0x0f.3 revision is ever supported.
--- drivers/net/wireless/ath/ath9k/hw.c | 32 +++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +23 -9
@@ -250,8 +250,9 @@ void ath9k_hw_get_channel_centers(struct ath_hw *ah,/* Chip Revisions */ /******************/ -static void ath9k_hw_read_revisions (struct ath_hw *ah) +static bool ath9k_hw_read_revisions (struct ath_hw *ah) { +u32 srev;u32 val;if (ah->get_mac_revision)
@@ -267,25 +268,33 @@ static void ath9k_hw_read_revisions(struct ath_hw *ah) val =REG_READ (ah,AR_SREV ); ah->hw_version.macRev =MS (val,AR_SREV_REVISION2 ); } -return ; +return true;case AR9300_DEVID_AR9340 : ah->hw_version.macVersion =AR_SREV_VERSION_9340 ; -return ; +return true;case AR9300_DEVID_QCA955X : ah->hw_version.macVersion =AR_SREV_VERSION_9550 ; -return ; +return true;case AR9300_DEVID_AR953X : ah->hw_version.macVersion =AR_SREV_VERSION_9531 ; -return ; +return true;case AR9300_DEVID_QCA956X : ah->hw_version.macVersion =AR_SREV_VERSION_9561 ; -return ; +return true; } - val =REG_READ (ah,AR_SREV ) &AR_SREV_ID ; + srev =REG_READ (ah,AR_SREV ); + +if (srev == -EIO ) { +ath_err (ath9k_hw_common (ah), +"Failed to read SREV register" ); +return false; + } + + val = srev &AR_SREV_ID ;if (val ==0xFF ) { - val =REG_READ (ah,AR_SREV ); + val = srev; ah->hw_version.macVersion = (val &AR_SREV_VERSION2 ) >>AR_SREV_TYPE2_S ; ah->hw_version.macRev =MS (val,AR_SREV_REVISION2 );
@@ -304,6 +313,8 @@ static void ath9k_hw_read_revisions(struct ath_hw *ah)if (ah->hw_version.macVersion ==AR_SREV_VERSION_5416_PCIE ) ah->is_pciexpress = true; } + +return true; }/************************************/
@@ -557,7 +568,10 @@ static int __ath9k_hw_init(struct ath_hw *ah)struct ath_common *common =ath9k_hw_common (ah);int r =0 ; -ath9k_hw_read_revisions (ah); +if (!ath9k_hw_read_revisions (ah)) { +ath_err (common,"Could not read hardware revisions" ); +return -EOPNOTSUPP ; + }switch (ah->hw_version.macVersion) {case AR_SREV_VERSION_5416_PCI :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 9/293 ath6kl: add some bounds checking
In reply to Greg Kroah-Hartman[ Upstream commit 5d6751eaff672ea77642e74e92e6c0ac7f9709ab ]
The "ev->traffic_class" and "reply->ac" variables come from the network and they're used as an offset into the wmi->stream_exist_for_ac[] array. Those variables are u8 so they can be 0-255 but the stream_exist_for_ac[] array only has WMM_NUM_AC (4) elements. We need to add a couple bounds checks to prevent array overflows.
I also modified one existing check from "if (traffic_class > 3) {" to "if (traffic_class >= WMM_NUM_AC) {" just to make them all consistent.
--- drivers/net/wireless/ath/ath6kl/wmi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/wmi.c +9 -1
@@ -1178,6 +1178,10 @@ static int ath6kl_wmi_pstream_timeout_event_rx(struct wmi *wmi, u8 *datap,return -EINVAL ; ev = (struct wmi_pstream_timeout_event *) datap; +if (ev->traffic_class >=WMM_NUM_AC ) { +ath6kl_err ("invalid traffic class: %d\n" , ev->traffic_class); +return -EINVAL ; + }/* * When the pstream (fat pipe == AC) timesout, it means there were
@@ -1519,6 +1523,10 @@ static int ath6kl_wmi_cac_event_rx(struct wmi *wmi, u8 *datap, int len,return -EINVAL ; reply = (struct wmi_cac_event *) datap; +if (reply->ac >=WMM_NUM_AC ) { +ath6kl_err ("invalid AC: %d\n" , reply->ac); +return -EINVAL ; + }if ((reply->cac_indication ==CAC_INDICATION_ADMISSION_RESP ) && (reply->status_code !=IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED )) {
@@ -2635,7 +2643,7 @@ int ath6kl_wmi_delete_pstream_cmd(struct wmi *wmi, u8 if_idx, u8 traffic_class,u16 active_tsids =0 ;int ret; -if (traffic_class >3 ) { +if (traffic_class >=WMM_NUM_AC ) {ath6kl_err ("invalid traffic class: %d\n" , traffic_class);return -EINVAL ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainercover 4.14.135-stable review
This is the start of the stable review cycle for the 4.14.135 release. There are 293 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 Wed 31 Jul 2019 07:05:01 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.135-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.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.14.135-rc1
Linus Torvalds <[email protected]>
access: avoid the RCU grace period for the temporary subjective credentials
Michael Neuling <[email protected]>
powerpc/tm: Fix oops on sigreturn on systems without TM
Gautham R. Shenoy <[email protected]>
powerpc/xive: Fix loop exit-condition in xive_find_target_in_mask()
Hui Wang <[email protected]>
ALSA: hda - Add a conexant codec entry to let mute led work
Kai-Heng Feng <[email protected]>
ALSA: line6: Fix wrong altsetting for LINE6_PODHD500_1
Kefeng Wang <[email protected]>
hpet: Fix division by zero in hpet_time_div()
YueHaibing <[email protected]>
fpga-manager: altera-ps-spi: Fix build error
Hridya Valsaraju <[email protected]>
binder: prevent transactions to context manager from its own process.
Zhenzhong Duan <[email protected]>
x86/speculation/mds: Apply more accurate check on hypervisor platform
Hans de Goede <[email protected]>
x86/sysfb_efi: Add quirks for some devices with swapped width and height
Qu Wenruo <[email protected]>
btrfs: inode: Don't compress if NODATASUM or NODATACOW set
Paolo Bonzini <[email protected]>
KVM: nVMX: do not use dangling shadow VMCS after guest reset
Ryan Kennedy <[email protected]>
usb: pci-quirks: Correct AMD PLL quirk detection
Phong Tran <[email protected]>
usb: wusbcore: fix unbalanced get/put cluster_id
Daniel Vetter <[email protected]>
drm/crc-debugfs: Also sprinkle irqrestore over early exits
Maarten Lankhorst <[email protected]>
drm/crc: Only report a single overflow when a CRC fd is opened
Arnd Bergmann <[email protected]>
locking/lockdep: Hide unused 'class' variable
Yuyang Du <[email protected]>
locking/lockdep: Fix lock used or unused stats error
Jean-Philippe Brucker <[email protected]>
mm/mmu_notifier: use hlist_add_head_rcu()
Andy Lutomirski <[email protected]>
mm/gup.c: remove some BUG_ONs from get_gate_page()
Guenter Roeck <[email protected]>
mm/gup.c: mark undo_dev_pagemap as __maybe_unused
Christoph Hellwig <[email protected]>
9p: pass the correct prototype to read_cache_page
Dmitry Vyukov <[email protected]>
mm/kmemleak.c: fix check for softirq context
Sam Ravnborg <[email protected]>
sh: prevent warnings when using iounmap
Wenwen Wang <[email protected]>
block/bio-integrity: fix a memory leak bug
Oliver O'Halloran <[email protected]>
powerpc/eeh: Handle hugepages in ioremap space
morten petersen <[email protected]>
mailbox: handle failed named mailbox channel request
Ocean Chen <[email protected]>
f2fs: avoid out-of-range memory access
Masahiro Yamada <[email protected]>
powerpc/boot: add {get, put}_unaligned_be32 to xz_config.h
YueHaibing <[email protected]>
PCI: dwc: pci-dra7xx: Fix compilation when !CONFIG_GPIOLIB
Konstantin Taranov <[email protected]>
RDMA/rxe: Fill in wc byte_len with IB_WC_RECV_RDMA_WITH_IMM
Leo Yan <[email protected]>
perf annotate: Fix dereferencing freed memory found by the smatch tool
Leo Yan <[email protected]>
perf session: Fix potential NULL pointer dereference found by the smatch tool
Numfor Mbiziwo-Tiapo <[email protected]>
perf test mmap-thread-lookup: Initialize variable to suppress memory sanitizer warning
Vasily Gorbik <[email protected]>
kallsyms: exclude kasan local symbols on s390
Geert Uytterhoeven <[email protected]>
serial: sh-sci: Fix TX DMA buffer flushing and workqueue races
Geert Uytterhoeven <[email protected]>
serial: sh-sci: Terminate TX DMA during buffer flushing
Liu, Changcheng <[email protected]>
RDMA/i40iw: Set queue pair state when being queried
Christian Lamparter <[email protected]>
powerpc/4xx/uic: clear pending interrupt after irq type/pol change
Johannes Berg <[email protected]>
um: Silence lockdep complaint about mmap_sem
Axel Lin <[email protected]>
mfd: hi655x-pmic: Fix missing return value check for devm_regmap_init_mmio_clk
Arnd Bergmann <[email protected]>
mfd: arizona: Fix undefined behavior
Robert Hancock <[email protected]>
mfd: core: Set fwnode for created devices
Naveen N. Rao <[email protected]>
recordmcount: Fix spurious mcount entries on powerpc
Naveen N. Rao <[email protected]>
powerpc/xmon: Fix disabling tracing while in xmon
Bastien Nocera <[email protected]>
iio: iio-utils: Fix possible incorrect mask calculation
Bharat Kumar Gogada <[email protected]>
PCI: xilinx-nwl: Fix Multi MSI data programming
Nathan Chancellor <[email protected]>
kbuild: Add -Werror=unknown-warning-option to CLANG_FLAGS
Marek Vasut <[email protected]>
PCI: sysfs: Ignore lockdep for remove attribute
Stefan Roese <[email protected]>
serial: mctrl_gpio: Check if GPIO property exisits before requesting it
Sean Paul <[email protected]>
drm/msm: Depopulate platform on probe failure
Alexey Kardashevskiy <[email protected]>
powerpc/pci/of: Fix OF flags parsing for 64bit BARs
Andrzej Pietrasiewicz <[email protected]>
usb: gadget: Zero ffs_io_data
Serge Semin <[email protected]>
tty: serial_core: Set port active bit in uart_port_activate
Douglas Anderson <[email protected]>
drm/rockchip: Properly adjust to a true clock in adjusted_mode
Nathan Lynch <[email protected]>
powerpc/pseries/mobility: prevent cpu hotplug during DT update
Yoshihiro Shimoda <[email protected]>
phy: renesas: rcar-gen2: Fix memory leak at error paths
David Riley <[email protected]>
drm/virtio: Add memory barriers for capset cache.
Rautkoski Kimmo EXT <[email protected]>
serial: 8250: Fix TX interrupt handling condition
Jorge Ramirez-Ortiz <[email protected]>
tty: serial: msm_serial: avoid system lockup condition
Kefeng Wang <[email protected]>
tty/serial: digicolor: Fix digicolor-usart already registered warning
Wang Hai <[email protected]>
memstick: Fix error cleanup path of memstick_init
Daniel Vetter <[email protected]>
drm/crc-debugfs: User irqsafe spinlock in drm_crtc_add_crc_entry
Jyri Sarha <[email protected]>
drm/bridge: sii902x: pixel clock unit is 10kHz instead of 1kHz
Tomi Valkeinen <[email protected]>
drm/bridge: tc358767: read display_props in get_modes()
Alex Williamson <[email protected]>
PCI: Return error if cannot probe VF
Gen Zhang <[email protected]>
drm/edid: Fix a missing-check bug in drm_load_edid_firmware()
Christophe Leroy <[email protected]>
tty: serial: cpm_uart - fix init when SMC is relocated
Wen Yang <[email protected]>
pinctrl: rockchip: fix leaked of_node references
Serge Semin <[email protected]>
tty: max310x: Fix invalid baudrate divisors calculator
Thinh Nguyen <[email protected]>
usb: core: hub: Disable hub-initiated U1/U2
Peter Ujfalusi <[email protected]>
drm/panel: simple: Fix panel_simple_dsi_probe
Sunil Muthuswamy <[email protected]>
hvsock: fix epollout hang from race condition
Paul Menzel <[email protected]>
nfsd: Fix overflow causing non-working mounts on 1 TB machines
J. Bruce Fields <[email protected]>
nfsd: fix performance-limiting session calculation
J. Bruce Fields <[email protected]>
nfsd: give out fewer session slots as limit approaches
J. Bruce Fields <[email protected]>
nfsd: increase DRC cache limit
Trond Myklebust <[email protected]>
NFSv4: Fix open create exclusive when the server reboots
Suravee Suthikulpanit <[email protected]>
perf/events/amd/uncore: Fix amd_uncore_llc ID to use pre-defined cpu_llc_id
Kuo-Hsin Yang <[email protected]>
mm: vmscan: scan anonymous pages on file refaults
Theodore Ts'o <[email protected]>
ext4: allow directory holes
Ross Zwisler <[email protected]>
ext4: use jbd2_inode dirty range scoping
Ross Zwisler <[email protected]>
jbd2: introduce jbd2_inode dirty range scoping
Ross Zwisler <[email protected]>
mm: add filemap_fdatawait_range_keep_errors()
Theodore Ts'o <[email protected]>
ext4: enforce the immutable flag on open files
Darrick J. Wong <[email protected]>
ext4: don't allow any modifications to an immutable file
Paul Cercueil <[email protected]>
MIPS: lb60: Fix pin mappings
Chris Wilson <[email protected]>
dma-buf: Discard old fence_excl on retrying get_fences_rcu for realloc
Jérôme Glisse <[email protected]>
dma-buf: balance refcount inbalance
Nikolay Aleksandrov <[email protected]>
net: bridge: stp: don't cache eth dest pointer before skb pull
Nikolay Aleksandrov <[email protected]>
net: bridge: mcast: fix stale ipv6 hdr pointer when handling v6 query
Nikolay Aleksandrov <[email protected]>
net: bridge: mcast: fix stale nsrcs pointer in igmp3/mld2 report handling
Christoph Paasch <[email protected]>
tcp: Reset bytes_acked and bytes_received when disconnecting
Eric Dumazet <[email protected]>
tcp: fix tcp_set_congestion_control() use from bpf hook
Florian Westphal <[email protected]>
net: make skb_dst_force return true when dst is refcounted
Cong Wang <[email protected]>
bonding: validate ip header before check IPPROTO_IGMP
Cong Wang <[email protected]>
netrom: hold sock when setting skb->destructor
Cong Wang <[email protected]>
netrom: fix a memory leak in nr_rx_frame()
Andreas Steinmetz <[email protected]>
macsec: fix checksumming after decryption
Andreas Steinmetz <[email protected]>
macsec: fix use-after-free of skb during RX
Peter Kosyh <[email protected]>
vrf: make sure skb->data contains ip header to make routing
Takashi Iwai <[email protected]>
sky2: Disable MSI on ASUS P6T
David Howells <[email protected]>
rxrpc: Fix send on a connected, but unbound socket
Yang Wei <[email protected]>
nfc: fix potential illegal memory access
John Hurley <[email protected]>
net: openvswitch: fix csum updates for MPLS actions
Lorenzo Bianconi <[email protected]>
net: neigh: fix multiple neigh timer scheduling
Baruch Siach <[email protected]>
net: dsa: mv88e6xxx: wait after reset deactivation
Justin Chen <[email protected]>
net: bcmgenet: use promisc for unsupported filters
Matteo Croce <[email protected]>
ipv4: don't set IPv6 only flags to IPv4 addresses
Eric Dumazet <[email protected]>
igmp: fix memory leak in igmpv3_del_delrec()
Taehee Yoo <[email protected]>
caif-hsi: fix possible deadlock in cfhsi_exit_module()
Guilherme G. Piccoli <[email protected]>
bnx2x: Prevent ptp_task to be rescheduled indefinitely
Brian King <[email protected]>
bnx2x: Prevent load reordering in tx completion processing
Andrey Ryabinin <[email protected]>
lib/strscpy: Shut up KASAN false-positives in strscpy()
Andrey Ryabinin <[email protected]>
compiler.h: Add read_word_at_a_time() function.
Andrey Ryabinin <[email protected]>
compiler.h, kasan: Avoid duplicating __read_once_size_nocheck()
Junxiao Bi <[email protected]>
dm bufio: fix deadlock with loop device
Josua Mayer <[email protected]>
dt-bindings: allow up to four clocks for orion-mdio
Josua Mayer <[email protected]>
net: mvmdio: allow up to four clocks to be specified for orion-mdio
Lee, Chiasheng <[email protected]>
usb: Handle USB3 remote wakeup for LPM enabled devices correctly
Szymon Janc <[email protected]>
Bluetooth: Add SMP workaround Microsoft Surface Precision Mouse bug
Alexander Shishkin <[email protected]>
intel_th: msu: Fix single mode with disabled IOMMU
Dan Carpenter <[email protected]>
eCryptfs: fix a couple type promotion bugs
Ravi Bangoria <[email protected]>
powerpc/watchpoint: Restore NV GPRs while returning from exception
Christophe Leroy <[email protected]>
powerpc/32s: fix suspend/resume when IBATs 4-7 are used
Helge Deller <[email protected]>
parisc: Fix kernel panic due invalid values in IAOQ0 or IAOQ1
Helge Deller <[email protected]>
parisc: Ensure userspace privilege for ptraced processes in regset functions
Ard Biesheuvel <[email protected]>
crypto: caam - limit output IV to CBC to work around CTR mode DMA issue
Dexuan Cui <[email protected]>
PCI: hv: Fix a use-after-free bug in hv_eject_device_work()
Steve Longerbeam <[email protected]>
gpu: ipu-v3: ipu-ic: Fix saturation bit offset in TPMEM
Jan Harkes <[email protected]>
coda: pass the host file in vma->vm_file on mmap
Dan Williams <[email protected]>
libnvdimm/pfn: fix fsdax-mode namespace info-block zero-fields
Aaron Armstrong Skomra <[email protected]>
HID: wacom: correct touch resolution x/y typo
Aaron Armstrong Skomra <[email protected]>
HID: wacom: generic: only switch the mode on devices with LEDs
Filipe Manana <[email protected]>
Btrfs: add missing inode version, ctime and mtime updates when punching hole
Filipe Manana <[email protected]>
Btrfs: fix fsync not persisting dentry deletions due to inode evictions
Filipe Manana <[email protected]>
Btrfs: fix data loss after inode eviction, renaming it, and fsync it
Mika Westerberg <[email protected]>
PCI: Do not poll for PME if the device is in D3cold
Alexander Shishkin <[email protected]>
intel_th: pci: Add Ice Lake NNPI support
Kim Phillips <[email protected]>
perf/x86/amd/uncore: Set the thread mask for F17h L3 PMCs
Kim Phillips <[email protected]>
perf/x86/amd/uncore: Do not set 'ThreadMask' and 'SliceMask' for non-L3 PMCs
David Rientjes <[email protected]>
x86/boot: Fix memory leak in default_get_smp_config()
YueHaibing <[email protected]>
9p/virtio: Add cleanup path in p9_virtio_init
YueHaibing <[email protected]>
9p/xen: Add cleanup path in p9_trans_xen_init
Juergen Gross <[email protected]>
xen/events: fix binding user event channels to cpus
Damien Le Moal <[email protected]>
dm zoned: fix zone state management race
Daniel Jordan <[email protected]>
padata: use smp_mb in padata_reorder to avoid orphaned padata jobs
Lyude Paul <[email protected]>
drm/nouveau/i2c: Enable i2c pads & busses during preinit
Radoslaw Burny <[email protected]>
fs/proc/proc_sysctl.c: fix the default values of i_uid/i_gid on /proc/sys inodes.
Jon Hunter <[email protected]>
arm64: tegra: Fix AGIC register range
Like Xu <[email protected]>
KVM: x86/vPMU: refine kvm_pmu err msg when event creation failed
Ezequiel Garcia <[email protected]>
media: coda: Remove unbalanced and unneeded mutex unlock
Boris Brezillon <[email protected]>
media: v4l2: Test type instead of cfg->type in v4l2_ctrl_new_custom()
Hui Wang <[email protected]>
ALSA: hda/realtek: apply ALC891 headset fixup to one Dell machine
Takashi Iwai <[email protected]>
ALSA: seq: Break too long mutex context in the write loop
Mark Brown <[email protected]>
ASoC: dapm: Adapt for debugfs API change
Christophe Leroy <[email protected]>
lib/scatterlist: Fix mapping iterator when sg->offset is greater than PAGE_SIZE
Trond Myklebust <[email protected]>
pnfs/flexfiles: Fix PTR_ERR() dereferences in ff_layout_track_ds_error
Trond Myklebust <[email protected]>
NFSv4: Handle the special Linux file open access mode
Emmanuel Grumbach <[email protected]>
iwlwifi: pcie: fix ALIVE interrupt handling for gen2 devices w/o MSI-X
Emmanuel Grumbach <[email protected]>
iwlwifi: pcie: don't service an interrupt that was masked
Jon Hunter <[email protected]>
arm64: tegra: Update Jetson TX1 GPU regulator timings
Krzysztof Kozlowski <[email protected]>
regulator: s2mps11: Fix buck7 and buck8 wrong voltages
Hui Wang <[email protected]>
Input: alps - fix a mismatch between a condition check and its comment
Nick Black <[email protected]>
Input: synaptics - whitelist Lenovo T580 SMBus intertouch
Hui Wang <[email protected]>
Input: alps - don't handle ALPS cs19 trackpoint-only device
Grant Hernandez <[email protected]>
Input: gtco - bounds check collection indent level
Wen Yang <[email protected]>
crypto: crypto4xx - fix a potential double free in ppc4xx_trng_probe
Cfir Cohen <[email protected]>
crypto: ccp/gcm - use const time tag comparison.
Hook, Gary <[email protected]>
crypto: ccp - memset structure fields to zero before reuse
Eric Biggers <[email protected]>
crypto: chacha20poly1305 - fix atomic sleep when using async algorithm
Elena Petrova <[email protected]>
crypto: arm64/sha2-ce - correct digest for empty data in finup
Elena Petrova <[email protected]>
crypto: arm64/sha1-ce - correct digest for empty data in finup
Hook, Gary <[email protected]>
crypto: ccp - Validate the the error value used to index error messages
Eric Biggers <[email protected]>
crypto: ghash - fix unaligned memory access in ghash_setkey()
Finn Thain <[email protected]>
scsi: mac_scsi: Fix pseudo DMA implementation, take 2
Finn Thain <[email protected]>
scsi: mac_scsi: Increase PIO/PDMA transfer length threshold
Shivasharan S <[email protected]>
scsi: megaraid_sas: Fix calculation of target ID
Ming Lei <[email protected]>
scsi: core: Fix race on creating sense cache
Finn Thain <[email protected]>
Revert "scsi: ncr5380: Increase register polling limit"
Finn Thain <[email protected]>
scsi: NCR5380: Always re-enable reselection interrupt
Finn Thain <[email protected]>
scsi: NCR5380: Reduce goto statements in NCR5380_select()
Juergen Gross <[email protected]>
xen: let alloc_xenballooned_pages() fail if not enough memory free
Denis Efremov <[email protected]>
floppy: fix out-of-bounds read in copy_buffer
Denis Efremov <[email protected]>
floppy: fix invalid pointer dereference in drive_name
Denis Efremov <[email protected]>
floppy: fix out-of-bounds read in next_valid_format
Denis Efremov <[email protected]>
floppy: fix div-by-zero in setup_format_params
Colin Ian King <[email protected]>
iavf: fix dereference of null rx_buffer pointer
Josua Mayer <[email protected]>
net: mvmdio: defer probe of orion-mdio if a clock is not ready
Taehee Yoo <[email protected]>
gtp: fix use-after-free in gtp_newlink()
Taehee Yoo <[email protected]>
gtp: fix use-after-free in gtp_encap_destroy()
Taehee Yoo <[email protected]>
gtp: fix Illegal context switch in RCU read-side critical section.
Taehee Yoo <[email protected]>
gtp: fix suspicious RCU usage
csonsino <[email protected]>
Bluetooth: validate BLE connection interval updates
Taehee Yoo <[email protected]>
gtp: add missing gtp_encap_disable_sock() in gtp_encap_enable()
Matias Karhumaa <[email protected]>
Bluetooth: Check state in l2cap_disconnect_rsp
Josua Mayer <[email protected]>
Bluetooth: 6lowpan: search for destination address in all peers
Tomas Bortoli <[email protected]>
Bluetooth: hci_bcsp: Fix memory leak in rx_skb
Geert Uytterhoeven <[email protected]>
gpiolib: Fix references to gpiod_[gs]et_*value_cansleep() variants
Phong Tran <[email protected]>
net: usb: asix: init MAC address buffers
Andi Kleen <[email protected]>
perf stat: Make metric event lookup more robust
Andrei Otcheretianski <[email protected]>
iwlwifi: mvm: Drop large non sta frames
Wen Gong <[email protected]>
ath10k: destroy sdio workqueue while remove sdio module
Yunsheng Lin <[email protected]>
net: hns3: add some error checking in hclge_tm module
Yonglong Liu <[email protected]>
net: hns3: fix a -Wformat-nonliteral compile warning
Coly Li <[email protected]>
bcache: check c->gc_thread by IS_ERR_OR_NULL in cache_set_flush()
Eiichi Tsukata <[email protected]>
EDAC: Fix global-out-of-bounds write when setting edac_mc_poll_msec
Arnd Bergmann <[email protected]>
crypto: asymmetric_keys - select CRYPTO_HASH where needed
Arnd Bergmann <[email protected]>
crypto: serpent - mark __serpent_setkey_sbox noinline
Mauro S. M. Rodrigues <[email protected]>
ixgbe: Check DDM existence in transceiver before access
Ferdinand Blomqvist <[email protected]>
rslib: Fix handling of of caller provided syndrome
Ferdinand Blomqvist <[email protected]>
rslib: Fix decoding of shortened codes
Marek Szyprowski <[email protected]>
clocksource/drivers/exynos_mct: Increase priority over ARM arch timer
Tejun Heo <[email protected]>
libata: don't request sense data on !ZAC ATA devices
Kyle Meyer <[email protected]>
perf tools: Increase MAX_NR_CPUS and MAX_CACHES
Miaoqing Pan <[email protected]>
ath10k: fix PCIE device wake up failed
Claire Chang <[email protected]>
ath10k: add missing error handling
Julian Anastasov <[email protected]>
ipvs: fix tinfo memory leak in start_sync_thread
Lorenzo Bianconi <[email protected]>
mt7601u: fix possible memory leak when the device is disconnected
Masahiro Yamada <[email protected]>
x86/build: Add 'set -e' to mkcapflags.sh to delete broken capflags.c
Lorenzo Bianconi <[email protected]>
mt7601u: do not schedule rx_tasklet when the device has been disconnected
Ping-Ke Shih <[email protected]>
rtlwifi: rtl8192cu: fix error handle when usb probe failed
Hans Verkuil <[email protected]>
media: hdpvr: fix locking and a missing msleep
André Almeida <[email protected]>
media: vimc: cap: check v4l2_fill_pixfmt return value
Philipp Zabel <[email protected]>
media: coda: increment sequence offset for the last returned frame
Marco Felsch <[email protected]>
media: coda: fix last buffer handling in V4L2_ENC_CMD_STOP
Philipp Zabel <[email protected]>
media: coda: fix mpeg2 sequence number handling
Ard Biesheuvel <[email protected]>
acpi/arm64: ignore 5.1 FADTs that are reported as 5.0
Nathan Huckleberry <[email protected]>
timer_list: Guard procfs specific code
Miroslav Lichvar <[email protected]>
ntp: Limit TAI-UTC offset
Anders Roxell <[email protected]>
media: i2c: fix warning same module names
Marek Szyprowski <[email protected]>
media: s5p-mfc: Make additional clocks optional
Julian Anastasov <[email protected]>
ipvs: defer hook registration to avoid leaks
Arnd Bergmann <[email protected]>
ipsec: select crypto ciphers for xfrm_algo
Pan Bian <[email protected]>
EDAC/sysfs: Fix memory leak when creating a csrow object
Denis Kirjanov <[email protected]>
ipoib: correcly show a VF hardware address
Jason Wang <[email protected]>
vhost_net: disable zerocopy by default
Arnaldo Carvalho de Melo <[email protected]>
perf evsel: Make perf_evsel__name() accept a NULL argument
Peter Zijlstra <[email protected]>
x86/atomic: Fix smp_mb__{before,after}_atomic()Qian Cai <[email protected]>
sched/fair: Fix "runnable_avg_yN_inv" not used warnings
Gao Xiang <[email protected]>
sched/core: Add __sched tag for io_schedule()
Nicolas Dichtel <[email protected]>
xfrm: fix sa selector validation
Tejun Heo <[email protected]>
blkcg, writeback: dead memcgs shouldn't contribute to writeback ownership arbitration
Aaron Lewis <[email protected]>
x86/cpufeatures: Add FDP_EXCPTN_ONLY and ZERO_FCS_FDS
Waiman Long <[email protected]>
rcu: Force inlining of rcu_read_lock()
Valdis Kletnieks <[email protected]>
bpf: silence warning messages in core
Srinivas Kandagatla <[email protected]>
regmap: fix bulk writes on paged registers
Russell King <[email protected]>
gpio: omap: ensure irq is enabled before wakeup
Russell King <[email protected]>
gpio: omap: fix lack of irqstatus_raw0 for OMAP4
Eric Auger <[email protected]>
iommu: Fix a leak in iommu_insert_resv_region
Kieran Bingham <[email protected]>
media: fdp1: Support M3N and E3 platforms
Thomas Richter <[email protected]>
perf test 6: Fix missing kvm module load for s390
Mathieu Poirier <[email protected]>
perf cs-etm: Properly set the value of 'old' and 'head' in snapshot mode
Stefano Brivio <[email protected]>
ipset: Fix memory accounting for hash types on resize
Robert Hancock <[email protected]>
net: sfp: add mutex to prevent concurrent state checks
Borislav Petkov <[email protected]>
RAS/CEC: Fix pfn insertion
Julian Wiedmann <[email protected]>
s390/qdio: handle PENDING state for QEBSM devices
Robert Hancock <[email protected]>
net: axienet: Fix race condition causing TX hang
Fabio Estevam <[email protected]>
net: fec: Do not use netdev messages too early
Biao Huang <[email protected]>
net: stmmac: dwmac4: fix flow control issue
Abhishek Goel <[email protected]>
cpupower : frequency-set -r option misses the last cpu in related cpu list
Kefeng Wang <[email protected]>
media: wl128x: Fix some error handling in fm_v4l2_init_video_device()
Imre Deak <[email protected]>
locking/lockdep: Fix merging of hlocks with non-zero references
David S. Miller <[email protected]>
tua6100: Avoid build warnings.
Christophe Leroy <[email protected]>
crypto: talitos - Align SEC1 accesses to 32 bits boundaries.
Christophe Leroy <[email protected]>
crypto: talitos - properly handle split ICV.
Ioana Ciornei <[email protected]>
net: phy: Check against net_device being NULL
Shailendra Verma <[email protected]>
media: staging: media: davinci_vpfe: - Fix for memory leak if decoder initialization fails.
Hans Verkuil <[email protected]>
media: mc-device.c: don't memset __user pointer contents
Eric Biggers <[email protected]>
fscrypt: clean up some BUG_ON()s in block encryption/decryption
Anirudh Gupta <[email protected]>
xfrm: Fix xfrm sel prefix length validation
Jeremy Sowden <[email protected]>
af_key: fix leaks in key_pol_get_resp and dump_sp.
Eric W. Biederman <[email protected]>
signal/pid_namespace: Fix reboot_pid_ns to use send_sig not force_sig
Michal Kalderon <[email protected]>
qed: Set the doorbell address correctly
Jose Abreu <[email protected]>
net: stmmac: dwmac4/5: Clear unused address entries
Jose Abreu <[email protected]>
net: stmmac: dwmac1000: Clear unused address entries
Jungo Lin <[email protected]>
media: media_device_enum_links32: clean a reserved field
Kangjie Lu <[email protected]>
media: vpss: fix a potential NULL pointer dereference
Lubomir Rintel <[email protected]>
media: marvell-ccic: fix DMA s/g desc number calculation
Christophe Leroy <[email protected]>
crypto: talitos - fix skcipher failure due to wrong output IV
Daniel Gomez <[email protected]>
media: spi: IR LED: add missing of table registration
Oliver Neukum <[email protected]>
media: dvb: usb: fix use after free in dvb_usb_device_exit
Jeremy Sowden <[email protected]>
batman-adv: fix for leaked TVLV handler.
Anilkumar Kolli <[email protected]>
ath: DFS JP domain W56 fixed pulse type 3 RADAR detection
Dan Carpenter <[email protected]>
ath6kl: add some bounds checking
Tim Schumacher <[email protected]>
ath9k: Check for errors when reading SREV register
Surabhi Vishnoi <[email protected]>
ath10k: Do not send probe response template for mesh
Gustavo A. R. Silva <[email protected]>
wil6210: fix potential out-of-bounds read
Sven Van Asbroeck <[email protected]>
dmaengine: imx-sdma: fix use-after-free on probe error path
Maurizio Lombardi <[email protected]>
scsi: iscsi: set auth_protocol back to NULL if CHAP_A value is not supported
Nathan Chancellor <[email protected]>
arm64/efi: Mark __efistub_stext_offset as an absolute symbol explicitly
Kevin Darbyshire-Bryant <[email protected]>
MIPS: fix build on non-linux hosts
Stefan Hellermann <[email protected]>
MIPS: ath79: fix ar933x uart parity mode
-------------
Diffstat:
Documentation/atomic_t.txt | 3 +
.../devicetree/bindings/net/marvell-orion-mdio.txt | 2 +-
Documentation/scheduler/sched-pelt.c | 3 +-
Makefile | 5 +-
arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi | 3 +-
arch/arm64/boot/dts/nvidia/tegra210.dtsi | 2 +-
arch/arm64/crypto/sha1-ce-glue.c | 2 +-
arch/arm64/crypto/sha2-ce-glue.c | 2 +-
arch/arm64/kernel/acpi.c | 10 +-
arch/arm64/kernel/image.h | 6 +-
arch/mips/boot/compressed/Makefile | 2 +
arch/mips/boot/compressed/calc_vmlinuz_load_addr.c | 2 +-
arch/mips/include/asm/mach-ath79/ar933x_uart.h | 4 +-
arch/mips/jz4740/board-qi_lb60.c | 16 +-
arch/parisc/kernel/ptrace.c | 31 +-
arch/powerpc/boot/xz_config.h | 20 ++
arch/powerpc/kernel/eeh.c | 15 +-
arch/powerpc/kernel/exceptions-64s.S | 9 +-
arch/powerpc/kernel/pci_of_scan.c | 2 +
arch/powerpc/kernel/signal_32.c | 3 +
arch/powerpc/kernel/signal_64.c | 5 +
arch/powerpc/kernel/swsusp_32.S | 73 +++-
arch/powerpc/platforms/4xx/uic.c | 1 +
arch/powerpc/platforms/powermac/sleep.S | 68 +++-
arch/powerpc/platforms/pseries/mobility.c | 9 +
arch/powerpc/sysdev/xive/common.c | 7 +-
arch/powerpc/xmon/xmon.c | 6 +-
arch/sh/include/asm/io.h | 6 +-
arch/um/include/asm/mmu_context.h | 2 +-
arch/x86/events/amd/uncore.c | 36 +-
arch/x86/include/asm/atomic.h | 8 +-
arch/x86/include/asm/atomic64_64.h | 8 +-
arch/x86/include/asm/barrier.h | 4 +-
arch/x86/include/asm/cpufeatures.h | 2 +
arch/x86/kernel/cpu/bugs.c | 2 +-
arch/x86/kernel/cpu/mkcapflags.sh | 2 +
arch/x86/kernel/mpparse.c | 10 +-
arch/x86/kernel/sysfb_efi.c | 46 +++
arch/x86/kvm/pmu.c | 4 +-
arch/x86/kvm/vmx.c | 8 +-
block/bio-integrity.c | 8 +-
crypto/asymmetric_keys/Kconfig | 3 +
crypto/chacha20poly1305.c | 30 +-
crypto/ghash-generic.c | 8 +-
crypto/serpent_generic.c | 8 +-
drivers/android/binder.c | 2 +-
drivers/ata/libata-eh.c | 8 +-
drivers/base/regmap/regmap.c | 2 +
drivers/block/floppy.c | 34 +-
drivers/bluetooth/hci_bcsp.c | 5 +
drivers/char/hpet.c | 3 +-
drivers/clocksource/exynos_mct.c | 4 +-
drivers/crypto/amcc/crypto4xx_trng.c | 1 -
drivers/crypto/caam/caamalg.c | 15 +-
drivers/crypto/ccp/ccp-dev.c | 96 +++---
drivers/crypto/ccp/ccp-dev.h | 2 +-
drivers/crypto/ccp/ccp-ops.c | 15 +-
drivers/crypto/talitos.c | 35 +-
drivers/dma-buf/dma-buf.c | 1 +
drivers/dma-buf/reservation.c | 4 +
drivers/dma/imx-sdma.c | 48 +--
drivers/edac/edac_mc_sysfs.c | 24 +-
drivers/edac/edac_module.h | 2 +-
drivers/fpga/Kconfig | 1 +
drivers/gpio/gpio-omap.c | 17 +-
drivers/gpio/gpiolib.c | 6 +-
drivers/gpu/drm/bridge/sii902x.c | 5 +-
drivers/gpu/drm/bridge/tc358767.c | 7 +
drivers/gpu/drm/drm_debugfs_crc.c | 18 +-
drivers/gpu/drm/drm_edid_load.c | 2 +
drivers/gpu/drm/msm/msm_drv.c | 14 +-
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c | 20 ++
drivers/gpu/drm/panel/panel-simple.c | 9 +-
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 3 +-
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 3 +
drivers/gpu/drm/virtio/virtgpu_vq.c | 2 +
drivers/gpu/ipu-v3/ipu-ic.c | 2 +-
drivers/hid/wacom_sys.c | 3 +
drivers/hid/wacom_wac.c | 4 +-
drivers/hid/wacom_wac.h | 1 +
drivers/hwtracing/intel_th/msu.c | 2 +-
drivers/hwtracing/intel_th/pci.c | 5 +
drivers/infiniband/hw/i40iw/i40iw_verbs.c | 2 +
drivers/infiniband/sw/rxe/rxe_resp.c | 5 +-
drivers/infiniband/sw/rxe/rxe_verbs.h | 1 +
drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 +
drivers/input/mouse/alps.c | 32 ++
drivers/input/mouse/synaptics.c | 1 +
drivers/input/tablet/gtco.c | 20 +-
drivers/iommu/iommu.c | 8 +-
drivers/mailbox/mailbox.c | 6 +-
drivers/md/bcache/super.c | 2 +-
drivers/md/dm-bufio.c | 4 +-
drivers/md/dm-zoned-metadata.c | 24 --
drivers/md/dm-zoned.h | 28 +-
drivers/media/dvb-frontends/tua6100.c | 22 +-
drivers/media/i2c/Makefile | 2 +-
drivers/media/i2c/{adv7511.c => adv7511-v4l2.c} | 5 +
drivers/media/media-device.c | 10 +-
drivers/media/platform/coda/coda-bit.c | 9 +-
drivers/media/platform/coda/coda-common.c | 2 +
drivers/media/platform/davinci/vpss.c | 5 +
drivers/media/platform/marvell-ccic/mcam-core.c | 5 +-
drivers/media/platform/rcar_fdp1.c | 8 +
drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | 5 +
drivers/media/platform/vimc/vimc-capture.c | 5 +-
drivers/media/radio/wl128x/fmdrv_v4l2.c | 3 +
drivers/media/rc/ir-spi.c | 1 +
drivers/media/usb/dvb-usb/dvb-usb-init.c | 7 +-
drivers/media/usb/hdpvr/hdpvr-video.c | 17 +-
drivers/media/v4l2-core/v4l2-ctrls.c | 9 +-
drivers/memstick/core/memstick.c | 13 +-
drivers/mfd/arizona-core.c | 2 +-
drivers/mfd/hi655x-pmic.c | 2 +
drivers/mfd/mfd-core.c | 1 +
drivers/net/bonding/bond_main.c | 37 +-
drivers/net/caif/caif_hsi.c | 2 +-
drivers/net/dsa/mv88e6xxx/chip.c | 2 +
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 8 +-
.../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 4 +-
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 33 +-
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h | 3 +
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 57 ++--
drivers/net/ethernet/freescale/fec_main.c | 6 +-
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +-
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 6 +-
drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 6 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 3 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h | 1 +
drivers/net/ethernet/marvell/mvmdio.c | 7 +-
drivers/net/ethernet/marvell/sky2.c | 7 +
drivers/net/ethernet/qlogic/qed/qed_dev.c | 29 +-
drivers/net/ethernet/qlogic/qed/qed_rdma.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac1000_core.c | 6 +
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 18 +-
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 20 +-
drivers/net/gtp.c | 36 +-
drivers/net/macsec.c | 6 +-
drivers/net/phy/phy_device.c | 6 +
drivers/net/phy/sfp.c | 6 +-
drivers/net/usb/asix_devices.c | 6 +-
drivers/net/vrf.c | 58 ++--
drivers/net/wireless/ath/ath10k/hw.c | 2 +-
drivers/net/wireless/ath/ath10k/mac.c | 4 +
drivers/net/wireless/ath/ath10k/sdio.c | 7 +
drivers/net/wireless/ath/ath6kl/wmi.c | 10 +-
drivers/net/wireless/ath/ath9k/hw.c | 32 +-
drivers/net/wireless/ath/dfs_pattern_detector.c | 2 +-
drivers/net/wireless/ath/wil6210/txrx.c | 1 +
drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 3 +
drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 61 ++--
drivers/net/wireless/mediatek/mt7601u/dma.c | 54 +--
drivers/net/wireless/mediatek/mt7601u/tx.c | 4 +-
drivers/net/wireless/realtek/rtlwifi/usb.c | 5 +-
drivers/nvdimm/dax_devs.c | 2 +-
drivers/nvdimm/pfn.h | 1 +
drivers/nvdimm/pfn_devs.c | 18 +-
drivers/pci/dwc/pci-dra7xx.c | 1 +
drivers/pci/host/pci-hyperv.c | 15 +-
drivers/pci/host/pcie-xilinx-nwl.c | 11 +-
drivers/pci/pci-driver.c | 13 +-
drivers/pci/pci-sysfs.c | 2 +-
drivers/pci/pci.c | 7 +
drivers/phy/renesas/phy-rcar-gen2.c | 2 +
drivers/pinctrl/pinctrl-rockchip.c | 1 +
drivers/ras/cec.c | 4 +-
drivers/regulator/s2mps11.c | 4 +-
drivers/s390/cio/qdio_main.c | 1 +
drivers/scsi/NCR5380.c | 33 +-
drivers/scsi/NCR5380.h | 2 +-
drivers/scsi/mac_scsi.c | 375 ++++++++++++---------
drivers/scsi/megaraid/megaraid_sas_base.c | 3 +-
drivers/scsi/scsi_lib.c | 6 +-
drivers/staging/media/davinci_vpfe/vpfe_video.c | 3 +
drivers/target/iscsi/iscsi_target_auth.c | 16 +-
drivers/tty/serial/8250/8250_port.c | 3 +-
drivers/tty/serial/cpm_uart/cpm_uart_core.c | 17 +-
drivers/tty/serial/digicolor-usart.c | 6 +-
drivers/tty/serial/max310x.c | 51 +--
drivers/tty/serial/msm_serial.c | 4 +
drivers/tty/serial/serial_core.c | 7 +-
drivers/tty/serial/serial_mctrl_gpio.c | 14 +
drivers/tty/serial/sh-sci.c | 33 +-
drivers/usb/core/hub.c | 35 +-
drivers/usb/gadget/function/f_fs.c | 6 +-
drivers/usb/host/hwa-hc.c | 2 +-
drivers/usb/host/pci-quirks.c | 31 +-
drivers/vhost/net.c | 2 +-
drivers/xen/balloon.c | 16 +-
drivers/xen/events/events_base.c | 12 +-
drivers/xen/evtchn.c | 2 +-
fs/9p/vfs_addr.c | 6 +-
fs/btrfs/file.c | 5 +
fs/btrfs/inode.c | 24 +-
fs/btrfs/tree-log.c | 40 ++-
fs/coda/file.c | 70 +++-
fs/crypto/crypto.c | 15 +-
fs/ecryptfs/crypto.c | 12 +-
fs/ext4/dir.c | 19 +-
fs/ext4/ext4_jbd2.h | 12 +-
fs/ext4/file.c | 4 +
fs/ext4/inode.c | 24 +-
fs/ext4/ioctl.c | 46 ++-
fs/ext4/move_extent.c | 3 +-
fs/ext4/namei.c | 45 ++-
fs/f2fs/segment.c | 5 +
fs/fs-writeback.c | 8 +-
fs/jbd2/commit.c | 23 +-
fs/jbd2/journal.c | 4 +
fs/jbd2/transaction.c | 49 +--
fs/nfs/flexfilelayout/flexfilelayoutdev.c | 2 +-
fs/nfs/inode.c | 1 +
fs/nfs/nfs4file.c | 2 +-
fs/nfs/nfs4proc.c | 41 ++-
fs/nfsd/nfs4state.c | 11 +-
fs/nfsd/nfssvc.c | 2 +-
fs/open.c | 19 ++
fs/proc/proc_sysctl.c | 4 +
include/drm/drm_debugfs_crc.h | 3 +-
include/linux/compiler.h | 22 +-
include/linux/cpuhotplug.h | 2 +-
include/linux/cred.h | 7 +-
include/linux/fs.h | 2 +
include/linux/jbd2.h | 22 ++
include/linux/rcupdate.h | 2 +-
include/net/dst.h | 5 +-
include/net/ip_vs.h | 6 +-
include/net/tcp.h | 3 +-
include/xen/events.h | 3 +-
kernel/bpf/Makefile | 1 +
kernel/cred.c | 21 +-
kernel/locking/lockdep.c | 18 +-
kernel/locking/lockdep_proc.c | 8 +-
kernel/padata.c | 12 +
kernel/pid_namespace.c | 2 +-
kernel/sched/core.c | 2 +-
kernel/sched/sched-pelt.h | 2 +-
kernel/time/ntp.c | 4 +-
kernel/time/timer_list.c | 36 +-
lib/reed_solomon/decode_rs.c | 18 +-
lib/scatterlist.c | 9 +-
lib/string.c | 2 +-
mm/filemap.c | 22 ++
mm/gup.c | 12 +-
mm/kmemleak.c | 2 +-
mm/mmu_notifier.c | 2 +-
mm/vmscan.c | 6 +-
net/9p/trans_virtio.c | 8 +-
net/9p/trans_xen.c | 8 +-
net/batman-adv/translation-table.c | 2 +
net/bluetooth/6lowpan.c | 14 +-
net/bluetooth/hci_event.c | 5 +
net/bluetooth/l2cap_core.c | 15 +-
net/bluetooth/smp.c | 13 +
net/bridge/br_multicast.c | 32 +-
net/bridge/br_stp_bpdu.c | 3 +-
net/core/filter.c | 3 +-
net/core/neighbour.c | 2 +
net/ipv4/devinet.c | 8 +
net/ipv4/igmp.c | 8 +-
net/ipv4/tcp.c | 6 +-
net/ipv4/tcp_cong.c | 6 +-
net/key/af_key.c | 8 +-
net/netfilter/ipset/ip_set_hash_gen.h | 2 +-
net/netfilter/ipvs/ip_vs_core.c | 21 +-
net/netfilter/ipvs/ip_vs_ctl.c | 4 -
net/netfilter/ipvs/ip_vs_sync.c | 134 ++++----
net/netfilter/nf_queue.c | 6 +-
net/netrom/af_netrom.c | 4 +-
net/nfc/nci/data.c | 2 +-
net/openvswitch/actions.c | 6 +-
net/rxrpc/af_rxrpc.c | 4 +-
net/vmw_vsock/hyperv_transport.c | 44 +--
net/xfrm/Kconfig | 2 +
net/xfrm/xfrm_user.c | 19 ++
scripts/kallsyms.c | 3 +
scripts/recordmcount.h | 3 +-
sound/core/seq/seq_clientmgr.c | 11 +-
sound/pci/hda/patch_conexant.c | 1 +
sound/pci/hda/patch_realtek.c | 5 +
sound/soc/soc-dapm.c | 18 +-
sound/usb/line6/podhd.c | 2 +-
tools/iio/iio_utils.c | 4 +-
tools/perf/arch/arm/util/cs-etm.c | 127 ++++++-
tools/perf/perf.h | 2 +-
tools/perf/tests/mmap-thread-lookup.c | 2 +-
tools/perf/tests/parse-events.c | 27 ++
tools/perf/util/annotate.c | 6 +-
tools/perf/util/evsel.c | 8 +-
tools/perf/util/header.c | 2 +-
tools/perf/util/session.c | 3 +
tools/perf/util/stat-shadow.c | 5 +-
tools/power/cpupower/utils/cpufreq-set.c | 2 +
293 files changed, 2749 insertions(+), 1145 deletions(-)Greg Kroah-Hartman
maintainerPATCH 17/293 media: media_device_enum_links32: clean a reserved field
[ Upstream commit f49308878d7202e07d8761238e01bd0e5fce2750 ]
In v4l2-compliance utility, test MEDIA_IOC_ENUM_ENTITIES will check whether reserved field of media_links_enum filled with zero.
However, for 32 bit program, the reserved field is missing copy from kernel space to user space in media_device_enum_links32 function.
This patch adds the cleaning a reserved field logic in media_device_enum_links32 function.
--- drivers/media/media-device.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/media/media-device.c +8 -1
@@ -470,6 +470,7 @@ static long media_device_enum_links32(struct media_device *mdev, {struct media_links_enum links;compat_uptr_t pads_ptr, links_ptr; +int ret;memset (&links,0 ,sizeof (links));
@@ -481,7 +482,13 @@ static long media_device_enum_links32(struct media_device *mdev, links.pads =compat_ptr (pads_ptr); links.links =compat_ptr (links_ptr); -return media_device_enum_links (mdev, &links); + ret =media_device_enum_links (mdev, &links); +if (ret) +return ret; + +memset (ulinks->reserved,0 ,sizeof (ulinks->reserved)); + +return 0 ; }#define MEDIA_IOC_ENUM_LINKS32 _IOWR('|', 0x02, struct media_links_enum32)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 26/293 media: staging: media: davinci_vpfe: - Fix for memory leak if decoder initialization fails.
In reply to Greg Kroah-Hartman[ Upstream commit 6995a659101bd4effa41cebb067f9dc18d77520d ]
Fix to avoid possible memory leak if the decoder initialization got failed.Free the allocated memory for file handle object before return in case decoder initialization fails.
--- drivers/staging/media/davinci_vpfe/vpfe_video.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/media/davinci_vpfe/vpfe_video.c +3 -0
@@ -422,6 +422,9 @@ static int vpfe_open(struct file *file)/* If decoder is not initialized. initialize it */ if (!video->initialized &&vpfe_update_pipe_state (video)) {mutex_unlock (&video->lock); +v4l2_fh_del (&handle->vfh); +v4l2_fh_exit (&handle->vfh); +kfree (handle);return -ENODEV ; }/* Increment device users counter */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 27/293 net: phy: Check against net_device being NULL
In reply to Greg Kroah-Hartman[ Upstream commit 82c76aca81187b3d28a6fb3062f6916450ce955e ]
In general, we don't want MAC drivers calling phy_attach_direct with the net_device being NULL. Add checks against this in all the functions calling it: phy_attach() and phy_connect_direct().
--- drivers/net/phy/phy_device.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/phy/phy_device.c +6 -0
@@ -729,6 +729,9 @@ int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, {int rc; +if (!dev) +return -EINVAL ; + rc =phy_attach_direct (dev, phydev, phydev->dev_flags, interface);if (rc)return rc;
@@ -1067,6 +1070,9 @@ struct phy_device *phy_attach(struct net_device *dev, const char *bus_id,struct device *d;int rc; +if (!dev) +return ERR_PTR (-EINVAL ); +/* Search the list of PHY devices on the mdio bus for the * PHY with the requested name */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 28/293 crypto: talitos - properly handle split ICV.
In reply to Greg Kroah-Hartman[ Upstream commit eae55a586c3c8b50982bad3c3426e9c9dd7a0075 ]
The driver assumes that the ICV is as a single piece in the last element of the scatterlist. This assumption is wrong.
This patch ensures that the ICV is properly handled regardless of the scatterlist layout.
--- drivers/crypto/talitos.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/crypto/talitos.c +15 -11
@@ -984,7 +984,6 @@ static void ipsec_esp_encrypt_done(struct device *dev,struct crypto_aead *authenc =crypto_aead_reqtfm (areq);unsigned int authsize =crypto_aead_authsize (authenc);struct talitos_edesc *edesc; -struct scatterlist *sg;void *icvdata; edesc = container_of(desc, struct talitos_edesc, desc);
@@ -998,9 +997,8 @@ static void ipsec_esp_encrypt_done(struct device *dev,else icvdata = &edesc->link_tbl[edesc->src_nents + edesc->dst_nents +2 ]; - sg =sg_last (areq->dst, edesc->dst_nents); -memcpy ((char *)sg_virt (sg) + sg->length - authsize, - icvdata, authsize); +sg_pcopy_from_buffer (areq->dst, edesc->dst_nents ? :1 , icvdata, + authsize, areq->assoclen + areq->cryptlen); }kfree (edesc);
@@ -1016,7 +1014,6 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev,struct crypto_aead *authenc =crypto_aead_reqtfm (req);unsigned int authsize =crypto_aead_authsize (authenc);struct talitos_edesc *edesc; -struct scatterlist *sg;char *oicv, *icv;struct talitos_private *priv =dev_get_drvdata (dev);bool is_sec1 =has_ftr_sec1 (priv);
@@ -1026,9 +1023,18 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev,ipsec_esp_unmap (dev, edesc, req);if (!err) { +char icvdata[SHA512_DIGEST_SIZE ]; +int nents = edesc->dst_nents ? :1 ; +unsigned int len = req->assoclen + req->cryptlen; +/* auth check */ - sg =sg_last (req->dst, edesc->dst_nents ? :1 ); - icv = (char *)sg_virt (sg) + sg->length - authsize; +if (nents >1 ) { +sg_pcopy_to_buffer (req->dst, nents, icvdata, authsize, + len - authsize); + icv = icvdata; + }else { + icv = (char *)sg_virt (req->dst) + len - authsize; + }if (edesc->dma_len) {if (is_sec1)
@@ -1458,7 +1464,6 @@ static int aead_decrypt(struct aead_request *req)struct talitos_ctx *ctx =crypto_aead_ctx (authenc);struct talitos_private *priv =dev_get_drvdata (ctx->dev);struct talitos_edesc *edesc; -struct scatterlist *sg;void *icvdata; req->cryptlen -= authsize;
@@ -1493,9 +1498,8 @@ static int aead_decrypt(struct aead_request *req)else icvdata = &edesc->link_tbl[0 ]; - sg =sg_last (req->src, edesc->src_nents ? :1 ); - -memcpy (icvdata, (char *)sg_virt (sg) + sg->length - authsize, authsize); +sg_pcopy_to_buffer (req->src, edesc->src_nents ? :1 , icvdata, authsize, + req->assoclen + req->cryptlen - authsize);return ipsec_esp (edesc, req, ipsec_esp_decrypt_swauth_done); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 29/293 crypto: talitos - Align SEC1 accesses to 32 bits boundaries.
In reply to Greg Kroah-Hartman[ Upstream commit c9cca7034b34a2d82e9a03b757de2485c294851c ]
The MPC885 reference manual states:
SEC Lite-initiated 8xx writes can occur only on 32-bit-word boundaries, but reads can occur on any byte boundary. Writing back a header read from a non-32-bit-word boundary will yield unpredictable results.
In order to ensure that, cra_alignmask is set to 3 for SEC1.
--- drivers/crypto/talitos.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/crypto/talitos.c +4 -1
@@ -3119,7 +3119,10 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev, alg->cra_priority = t_alg->algt.priority; else alg->cra_priority = TALITOS_CRA_PRIORITY; - alg->cra_alignmask =0 ; +if (has_ftr_sec1 (priv)) + alg->cra_alignmask =3 ; +else + alg->cra_alignmask =0 ; alg->cra_ctxsize =sizeof (struct talitos_ctx ); alg->cra_flags |=CRYPTO_ALG_KERN_DRIVER_ONLY ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 32/293 media: wl128x: Fix some error handling in fm_v4l2_init_video_device()
In reply to Greg Kroah-Hartman[ Upstream commit 69fbb3f47327d959830c94bf31893972b8c8f700 ]
X-Originating-IP: [10.175.113.25]
X-CFilter-Loop: Reflected
The fm_v4l2_init_video_device() forget to unregister v4l2/video device in the error path, it could lead to UAF issue, eg,
BUG: KASAN: use-after-free in atomic64_read include/asm-generic/atomic-instrumented.h:836 [inline] BUG: KASAN: use-after-free in atomic_long_read include/asm-generic/atomic-long.h:28 [inline] BUG: KASAN: use-after-free in __mutex_unlock_slowpath+0x92/0x690 kernel/locking/mutex.c:1206 Read of size 8 at addr ffff8881e84a7c70 by task v4l_id/3659 CPU: 1 PID: 3659 Comm: v4l_id Not tainted 5.1.0 #8 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xa9/0x10e lib/dump_stack.c:113 print_address_description+0x65/0x270 mm/kasan/report.c:187 kasan_report+0x149/0x18d mm/kasan/report.c:317 atomic64_read include/asm-generic/atomic-instrumented.h:836 [inline] atomic_long_read include/asm-generic/atomic-long.h:28 [inline] __mutex_unlock_slowpath+0x92/0x690 kernel/locking/mutex.c:1206 fm_v4l2_fops_open+0xac/0x120 [fm_drv] v4l2_open+0x191/0x390 [videodev] chrdev_open+0x20d/0x570 fs/char_dev.c:417 do_dentry_open+0x700/0xf30 fs/open.c:777 do_last fs/namei.c:3416 [inline] path_openat+0x7c4/0x2a90 fs/namei.c:3532 do_filp_open+0x1a5/0x2b0 fs/namei.c:3563 do_sys_open+0x302/0x490 fs/open.c:1069 do_syscall_64+0x9f/0x450 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f8180c17c8e ... Allocated by task 3642: set_track mm/kasan/common.c:87 [inline] __kasan_kmalloc.constprop.3+0xa0/0xd0 mm/kasan/common.c:497 fm_drv_init+0x13/0x1000 [fm_drv] do_one_initcall+0xbc/0x47d init/main.c:901 do_init_module+0x1b5/0x547 kernel/module.c:3456 load_module+0x6405/0x8c10 kernel/module.c:3804 __do_sys_finit_module+0x162/0x190 kernel/module.c:3898 do_syscall_64+0x9f/0x450 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 3642: set_track mm/kasan/common.c:87 [inline] __kasan_slab_free+0x130/0x180 mm/kasan/common.c:459 slab_free_hook mm/slub.c:1429 [inline] slab_free_freelist_hook mm/slub.c:1456 [inline] slab_free mm/slub.c:3003 [inline] kfree+0xe1/0x270 mm/slub.c:3958 fm_drv_init+0x1e6/0x1000 [fm_drv] do_one_initcall+0xbc/0x47d init/main.c:901 do_init_module+0x1b5/0x547 kernel/module.c:3456 load_module+0x6405/0x8c10 kernel/module.c:3804 __do_sys_finit_module+0x162/0x190 kernel/module.c:3898 do_syscall_64+0x9f/0x450 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe
Add relevant unregister functions to fix it.
--- drivers/media/radio/wl128x/fmdrv_v4l2.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/radio/wl128x/fmdrv_v4l2.c +3 -0
@@ -549,6 +549,7 @@ int fm_v4l2_init_video_device(struct fmdev *fmdev, int radio_nr)/* Register with V4L2 subsystem as RADIO device */ if (video_register_device (&gradio_dev,VFL_TYPE_RADIO , radio_nr)) { +v4l2_device_unregister (&fmdev->v4l2_dev);fmerr ("Could not register video device\n" );return -ENOMEM ; }
@@ -562,6 +563,8 @@ int fm_v4l2_init_video_device(struct fmdev *fmdev, int radio_nr)if (ret <0 ) {fmerr ("(fmdev): Can't init ctrl handler\n" );v4l2_ctrl_handler_free (&fmdev->ctrl_handler); +video_unregister_device (fmdev->radio_dev); +v4l2_device_unregister (&fmdev->v4l2_dev);return -EBUSY ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 33/293 cpupower : frequency-set -r option misses the last cpu in related cpu list
In reply to Greg Kroah-Hartman[ Upstream commit 04507c0a9385cc8280f794a36bfff567c8cc1042 ]
To set frequency on specific cpus using cpupower, following syntax can be used :
cpupower -c #i frequency-set -f #f -r
While setting frequency using cpupower frequency-set command, if we use '-r' option, it is expected to set frequency for all cpus related to cpu #i. But it is observed to be missing the last cpu in related cpu list. This patch fixes the problem.
--- tools/power/cpupower/utils/cpufreq-set.c | 2 ++ 1 file changed, 2 insertions(+)
tools/power/cpupower/utils/cpufreq-set.c +2 -0
@@ -306,6 +306,8 @@ int cmd_freq_set(int argc, char **argv)bitmask_setbit (cpus_chosen, cpus->cpu); cpus = cpus->next; } +/* Set the last cpu in related cpus list */ +bitmask_setbit (cpus_chosen, cpus->cpu);cpufreq_put_related_cpus (cpus); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 34/293 net: stmmac: dwmac4: fix flow control issue
In reply to Greg Kroah-Hartman[ Upstream commit ee326fd01e79dfa42014d55931260b68b9fa3273 ]
Current dwmac4_flow_ctrl will not clear GMAC_RX_FLOW_CTRL_RFE/GMAC_RX_FLOW_CTRL_RFE bits, so MAC hw will keep flow control on although expecting flow control off by ethtool. Add codes to fix it.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +6 -2
@@ -474,8 +474,9 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,if (fc &FLOW_RX ) {pr_debug ("\tReceive Flow-Control ON\n" ); flow |=GMAC_RX_FLOW_CTRL_RFE ; -writel (flow, ioaddr +GMAC_RX_FLOW_CTRL ); } +writel (flow, ioaddr +GMAC_RX_FLOW_CTRL ); +if (fc &FLOW_TX ) {pr_debug ("\tTransmit Flow-Control ON\n" );
@@ -483,7 +484,7 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,pr_debug ("\tduplex mode: PAUSE %d\n" , pause_time);for (queue =0 ; queue < tx_cnt; queue++) { - flow |=GMAC_TX_FLOW_CTRL_TFE ; + flow =GMAC_TX_FLOW_CTRL_TFE ;if (duplex) flow |=
@@ -491,6 +492,9 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,writel (flow, ioaddr +GMAC_QX_TX_FLOW_CTRL (queue)); } + }else { +for (queue =0 ; queue < tx_cnt; queue++) +writel (0 , ioaddr +GMAC_QX_TX_FLOW_CTRL (queue)); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 35/293 net: fec: Do not use netdev messages too early
In reply to Greg Kroah-Hartman[ Upstream commit a19a0582363b9a5f8ba812f34f1b8df394898780 ]
When a valid MAC address is not found the current messages are shown:
fec 2188000.ethernet (unnamed net_device) (uninitialized): Invalid MAC address: 00:00:00:00:00:00 fec 2188000.ethernet (unnamed net_device) (uninitialized): Using random MAC address: aa:9f:25:eb:7e:aa
Since the network device has not been registered at this point, it is better to use dev_err()/dev_info() instead, which will provide cleaner log messages like these:
fec 2188000.ethernet: Invalid MAC address: 00:00:00:00:00:00 fec 2188000.ethernet: Using random MAC address: aa:9f:25:eb:7e:aa
Tested on a imx6dl-pico-pi board.
--- drivers/net/ethernet/freescale/fec_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +3 -3
@@ -1690,10 +1690,10 @@ static void fec_get_mac(struct net_device *ndev)*/ if (!is_valid_ether_addr (iap)) {/* Report it and use a random ethernet address instead */ -netdev_err (ndev,"Invalid MAC address: %pM\n" , iap); +dev_err (&fep->pdev->dev,"Invalid MAC address: %pM\n" , iap);eth_hw_addr_random (ndev); -netdev_info (ndev,"Using random MAC address: %pM\n" , - ndev->dev_addr); +dev_info (&fep->pdev->dev,"Using random MAC address: %pM\n" , + ndev->dev_addr);return ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 18/293 net: stmmac: dwmac1000: Clear unused address entries
In reply to Greg Kroah-Hartman[ Upstream commit 9463c445590091202659cdfdd44b236acadfbd84 ]
In case we don't use a given address entry we need to clear it because it could contain previous values that are no longer valid.
Found out while running stmmac selftests.
--- drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +6 -0
@@ -217,6 +217,12 @@ static void dwmac1000_set_filter(struct mac_device_info *hw, GMAC_ADDR_LOW(reg)); reg++; } + +while (reg <= perfect_addr_number) { +writel (0 , ioaddr +GMAC_ADDR_HIGH (reg)); +writel (0 , ioaddr +GMAC_ADDR_LOW (reg)); + reg++; + } }#ifdef FRAME_FILTER_DEBUG
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 36/293 net: axienet: Fix race condition causing TX hang
In reply to Greg Kroah-Hartman[ Upstream commit 7de44285c1f69ccfbe8be1d6a16fcd956681fee6 ]
It is possible that the interrupt handler fires and frees up space in the TX ring in between checking for sufficient TX ring space and stopping the TX queue in axienet_start_xmit. If this happens, the queue wake from the interrupt handler will occur before the queue is stopped, causing a lost wakeup and the adapter's transmit hanging.
To avoid this, after stopping the queue, check again whether there is sufficient space in the TX ring. If so, wake up the queue again.
--- .../net/ethernet/xilinx/xilinx_axienet_main.c | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +17 -3
@@ -614,6 +614,10 @@ static void axienet_start_xmit_done(struct net_device *ndev) ndev->stats.tx_packets += packets; ndev->stats.tx_bytes += size; + +/* Matches barrier in axienet_start_xmit */ +smp_mb (); +netif_wake_queue (ndev); }
@@ -668,9 +672,19 @@ static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) cur_p = &lp->tx_bd_v[lp->tx_bd_tail];if (axienet_check_tx_bd_space (lp, num_frag)) { -if (!netif_queue_stopped (ndev)) -netif_stop_queue (ndev); -return NETDEV_TX_BUSY ; +if (netif_queue_stopped (ndev)) +return NETDEV_TX_BUSY ; + +netif_stop_queue (ndev); + +/* Matches barrier in axienet_start_xmit_done */ +smp_mb (); + +/* Space might have just been freed - check again */ +if (axienet_check_tx_bd_space (lp, num_frag)) +return NETDEV_TX_BUSY ; + +netif_wake_queue (ndev); }if (skb->ip_summed ==CHECKSUM_PARTIAL ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 37/293 s390/qdio: handle PENDING state for QEBSM devices
In reply to Greg Kroah-Hartman[ Upstream commit 04310324c6f482921c071444833e70fe861b73d9 ]
When a CQ-enabled device uses QEBSM for SBAL state inspection, get_buf_states() can return the PENDING state for an Output Queue. get_outbound_buffer_frontier() isn't prepared for this, and any PENDING buffer will permanently stall all further completion processing on this Queue.
This isn't a concern for non-QEBSM devices, as get_buf_states() for such devices will manually turn PENDING buffers into EMPTY ones.
--- drivers/s390/cio/qdio_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/s390/cio/qdio_main.c +1 -0
@@ -759,6 +759,7 @@ static int get_outbound_buffer_frontier(struct qdio_q *q)switch (state) {case SLSB_P_OUTPUT_EMPTY : +case SLSB_P_OUTPUT_PENDING :/* the adapter got it */ DBF_DEV_EVENT (DBF_INFO , q->irq_ptr,"out empty:%1d %02x" , q->nr, count);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 39/293 net: sfp: add mutex to prevent concurrent state checks
In reply to Greg Kroah-Hartman[ Upstream commit 2158e856f56bb762ef90f3ec244d41a519826f75 ]
sfp_check_state can potentially be called by both a threaded IRQ handler and delayed work. If it is concurrently called, it could result in incorrect state management. Add a st_mutex to protect the state - this lock gets taken outside of code that checks and handle state changes, and the existing sm_mutex nests inside of it.
--- drivers/net/phy/sfp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/phy/sfp.c +5 -1
@@ -115,10 +115,11 @@ struct sfp {struct gpio_desc *gpio[GPIO_MAX ];bool attached; +struct mutex st_mutex;/* Protects state */ unsigned int state;struct delayed_work poll;struct delayed_work timeout; -struct mutex sm_mutex; +struct mutex sm_mutex;/* Protects state machine */ unsigned char sm_mod_state;unsigned char sm_dev_state;unsigned short sm_state;
@@ -738,6 +739,7 @@ static void sfp_check_state(struct sfp *sfp) {unsigned int state, i, changed; +mutex_lock (&sfp->st_mutex); state =sfp_get_state (sfp); changed = state ^ sfp->state; changed &=SFP_F_PRESENT |SFP_F_LOS |SFP_F_TX_FAULT ;
@@ -763,6 +765,7 @@ static void sfp_check_state(struct sfp *sfp)sfp_sm_event (sfp, state &SFP_F_LOS ?SFP_E_LOS_HIGH :SFP_E_LOS_LOW );rtnl_unlock (); +mutex_unlock (&sfp->st_mutex); }static irqreturn_t sfp_irq (int irq,void *data)
@@ -793,6 +796,7 @@ static struct sfp *sfp_alloc(struct device *dev) sfp->dev = dev;mutex_init (&sfp->sm_mutex); +mutex_init (&sfp->st_mutex);INIT_DELAYED_WORK (&sfp->poll, sfp_poll);INIT_DELAYED_WORK (&sfp->timeout, sfp_timeout);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 40/293 ipset: Fix memory accounting for hash types on resize
In reply to Greg Kroah-Hartman[ Upstream commit 11921796f4799ca9c61c4b22cc54d84aa69f8a35 ]
If a fresh array block is allocated during resize, the current in-memory set size should be increased by the size of the block, not replaced by it.
Before the fix, adding entries to a hash set type, leading to a table resize, caused an inconsistent memory size to be reported. This becomes more obvious when swapping sets with similar sizes:
# cat hash_ip_size.sh #!/bin/sh FAIL_RETRIES=10
tries=0
while [ ${tries} -lt ${FAIL_RETRIES} ]; do
ipset create t1 hash:ip
for i in `seq 1 4345`; do
ipset add t1 1.2.$((i / 255)).$((i % 255))
done
t1_init="$(ipset list t1|sed -n 's/Size in memory: \(.*\)/\1/p')"
ipset create t2 hash:ip
for i in `seq 1 4360`; do
ipset add t2 1.2.$((i / 255)).$((i % 255))
done
t2_init="$(ipset list t2|sed -n 's/Size in memory: \(.*\)/\1/p')"
ipset swap t1 t2
t1_swap="$(ipset list t1|sed -n 's/Size in memory: \(.*\)/\1/p')"
t2_swap="$(ipset list t2|sed -n 's/Size in memory: \(.*\)/\1/p')"
ipset destroy t1
ipset destroy t2
tries=$((tries + 1))
if [ ${t1_init} -lt 10000 ] || [ ${t2_init} -lt 10000 ]; then
echo "FAIL after ${tries} tries:"
echo "T1 size ${t1_init}, after swap ${t1_swap}"
echo "T2 size ${t2_init}, after swap ${t2_swap}"
exit 1
fi
done
echo "PASS"
# echo -n 'func hash_ip4_resize +p' > /sys/kernel/debug/dynamic_debug/control
# ./hash_ip_size.sh
[ 2035.018673] attempt to resize set t1 from 10 to 11, t 00000000fe6551fa
[ 2035.078583] set t1 resized from 10 (00000000fe6551fa) to 11 (00000000172a0163)
[ 2035.080353] Table destroy by resize 00000000fe6551fa
FAIL after 4 tries:
T1 size 9064, after swap 71128
T2 size 71128, after swap 9064--- net/netfilter/ipset/ip_set_hash_gen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/ipset/ip_set_hash_gen.h +1 -1
@@ -624,7 +624,7 @@ mtype_resize(struct ip_set *set, bool retried) goto cleanup; } m->size =AHASH_INIT_SIZE ; - extsize =ext_size (AHASH_INIT_SIZE , dsize); + extsize +=ext_size (AHASH_INIT_SIZE , dsize);RCU_INIT_POINTER (hbucket (t, key), m); }else if (m->pos >= m->size) {struct hbucket *ht;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 41/293 perf cs-etm: Properly set the value of old and head in snapshot mode
In reply to Greg Kroah-Hartman[ Upstream commit e45c48a9a4d20ebc7b639a62c3ef8f4b08007027 ]
This patch adds the necessary intelligence to properly compute the value of 'old' and 'head' when operating in snapshot mode. That way we can get the latest information in the AUX buffer and be compatible with the generic AUX ring buffer mechanic.
Tester notes:
Quoted 1 line
Leo, have you had the chance to test/review this one? Suzuki?
Sure. I applied this patch on the perf/core branch (with latest commit 3e4fbf36c1e3 'perf augmented_raw_syscalls: Move reading filename to the loop') and passed testing with below steps:
# perf record -e cs_etm/@tmc_etr0/ -S -m,64 --per-thread ./sort & [1] 19097 Bubble sorting array of 30000 elements
# kill -USR2 19097 # kill -USR2 19097 # kill -USR2 19097 [ perf record: Woken up 4 times to write data ] [ perf record: Captured and wrote 0.753 MB perf.data ]
--- tools/perf/arch/arm/util/cs-etm.c | 127 +++++++++++++++++++++++++++++- 1 file changed, 123 insertions(+), 4 deletions(-)
tools/perf/arch/arm/util/cs-etm.c +123 -4
@@ -43,6 +43,8 @@ struct cs_etm_recording {struct auxtrace_record itr;struct perf_pmu *cs_etm_pmu;struct perf_evlist *evlist; +int wrapped_cnt; +bool *wrapped;bool snapshot_mode;size_t snapshot_size; };
@@ -485,16 +487,131 @@ static int cs_etm_info_fill(struct auxtrace_record *itr,return 0 ; } -static int cs_etm_find_snapshot (struct auxtrace_record *itr__maybe_unused , +static int cs_etm_alloc_wrapped_array (struct cs_etm_recording *ptr,int idx) +{ +bool *wrapped; +int cnt = ptr->wrapped_cnt; + +/* Make @ptr->wrapped as big as @idx */ +while (cnt <= idx) + cnt++; + +/* +* Free'ed in cs_etm_recording_free(). Using realloc() to avoid +* cross compilation problems where the host's system supports +* reallocarray() but not the target. +*/ + wrapped =realloc (ptr->wrapped, cnt *sizeof (bool )); +if (!wrapped) +return -ENOMEM ; + + wrapped[cnt -1 ] = false; + ptr->wrapped_cnt = cnt; + ptr->wrapped = wrapped; + +return 0 ; +} + +static bool cs_etm_buffer_has_wrapped (unsigned char *buffer, +size_t buffer_size,u64 head) +{ +u64 i, watermark; +u64 *buf = (u64 *)buffer; +size_t buf_size = buffer_size; + +/* +* We want to look the very last 512 byte (chosen arbitrarily) in +* the ring buffer. +*/ + watermark = buf_size -512 ; + +/* +* @head is continuously increasing - if its value is equal or greater +* than the size of the ring buffer, it has wrapped around. +*/ +if (head >= buffer_size) +return true; + +/* +* The value of @head is somewhere within the size of the ring buffer. +* This can be that there hasn't been enough data to fill the ring +* buffer yet or the trace time was so long that @head has numerically +* wrapped around. To find we need to check if we have data at the very +* end of the ring buffer. We can reliably do this because mmap'ed +* pages are zeroed out and there is a fresh mapping with every new +* session. +*/ + +/* @head is less than 512 byte from the end of the ring buffer */ +if (head > watermark) + watermark = head; + +/* +* Speed things up by using 64 bit transactions (see "u64 *buf" above) +*/ + watermark >>=3 ; + buf_size >>=3 ; + +/* +* If we find trace data at the end of the ring buffer, @head has +* been there and has numerically wrapped around at least once. +*/ +for (i = watermark; i < buf_size; i++) +if (buf[i]) +return true; + +return false; +} + +static int cs_etm_find_snapshot (struct auxtrace_record *itr,int idx,struct auxtrace_mmap *mm, -unsigned char *data__maybe_unused , +unsigned char *data,u64 *head,u64 *old) { +int err; +bool wrapped; +struct cs_etm_recording *ptr = + container_of(itr, struct cs_etm_recording, itr); + +/* +* Allocate memory to keep track of wrapping if this is the first +* time we deal with this *mm. +*/ +if (idx >= ptr->wrapped_cnt) { + err =cs_etm_alloc_wrapped_array (ptr, idx); +if (err) +return err; + } + +/* +* Check to see if *head has wrapped around. If it hasn't only the +* amount of data between *head and *old is snapshot'ed to avoid +* bloating the perf.data file with zeros. But as soon as *head has +* wrapped around the entire size of the AUX ring buffer it taken. +*/ + wrapped = ptr->wrapped[idx]; +if (!wrapped &&cs_etm_buffer_has_wrapped (data, mm->len, *head)) { + wrapped = true; + ptr->wrapped[idx] = true; + } +pr_debug3 ("%s: mmap index %d old head %zu new head %zu size %zu\n" , __func__, idx, (size_t )*old, (size_t )*head, mm->len); - *old = *head; - *head += mm->len; +/* No wrap has occurred, we can just use *head and *old. */ +if (!wrapped) +return 0 ; + +/* +* *head has wrapped around - adjust *head and *old to pickup the +* entire content of the AUX buffer. +*/ +if (*head >= mm->len) { + *old = *head - mm->len; + }else { + *head += mm->len; + *old = *head - mm->len; + }return 0 ; }
@@ -535,6 +652,8 @@ static void cs_etm_recording_free(struct auxtrace_record *itr) {struct cs_etm_recording *ptr = container_of(itr, struct cs_etm_recording, itr); + +zfree (&ptr->wrapped);free (ptr); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 43/293 media: fdp1: Support M3N and E3 platforms
In reply to Greg Kroah-Hartman[ Upstream commit 4e8c120de9268fc26f583268b9d22e7d37c4595f ]
New Gen3 R-Car platforms incorporate the FDP1 with an updated version register. No code change is required to support these targets, but they will currently report an error stating that the device can not be identified.
Update the driver to match against the new device types.
--- drivers/media/platform/rcar_fdp1.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/media/platform/rcar_fdp1.c +8 -0
@@ -261,6 +261,8 @@ MODULE_PARM_DESC(debug, "activate debug info");#define FD1_IP_H3_ES1 0x02010101#define FD1_IP_M3W 0x02010202#define FD1_IP_H3 0x02010203 +#define FD1_IP_M3N 0x02010204 +#define FD1_IP_E3 0x02010205/* LUTs */ #define FD1_LUT_DIF_ADJ 0x1000
@@ -2369,6 +2371,12 @@ static int fdp1_probe(struct platform_device *pdev)case FD1_IP_H3 :dprintk (fdp1,"FDP1 Version R-Car H3\n" );break ; +case FD1_IP_M3N : +dprintk (fdp1,"FDP1 Version R-Car M3N\n" ); +break ; +case FD1_IP_E3 : +dprintk (fdp1,"FDP1 Version R-Car E3\n" ); +break ;default :dev_err (fdp1->dev,"FDP1 Unidentifiable (0x%08x)\n" , hw_version);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 44/293 iommu: Fix a leak in iommu_insert_resv_region
In reply to Greg Kroah-Hartman[ Upstream commit ad0834dedaa15c3a176f783c0373f836e44b4700 ]
In case we expand an existing region, we unlink this latter and insert the larger one. In that case we should free the original region after the insertion. Also we can immediately return.
--- drivers/iommu/iommu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iommu/iommu.c +5 -3
@@ -205,18 +205,21 @@ static int iommu_insert_resv_region(struct iommu_resv_region *new, pos = pos->next; }else if ((start >= a) && (end <= b)) {if (new->type == type) - goto done; +return 0 ;else pos = pos->next; }else {if (new->type == type) {phys_addr_t new_start =min (a, start);phys_addr_t new_end =max (b, end); +int ret;list_del (&entry->list); entry->start = new_start; entry->length = new_end - new_start +1 ; -iommu_insert_resv_region (entry, regions); + ret =iommu_insert_resv_region (entry, regions); +kfree (entry); +return ret; }else { pos = pos->next; }
@@ -229,7 +232,6 @@ static int iommu_insert_resv_region(struct iommu_resv_region *new,return -ENOMEM ;list_add_tail (®ion->list, pos); -done:return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 45/293 gpio: omap: fix lack of irqstatus_raw0 for OMAP4
In reply to Greg Kroah-Hartman[ Upstream commit 64ea3e9094a1f13b96c33244a3fb3a0f45690bd2 ]
Commit 384ebe1c2849 ("gpio/omap: Add DT support to GPIO driver") added the register definition tables to the gpio-omap driver. Subsequently to that commit, commit 4e962e8998cc ("gpio/omap: remove cpu_is_omapxxxx() checks from *_runtime_resume()") added definitions for irqstatus_raw* registers to the legacy OMAP4 definitions, but missed the DT definitions.
This causes an unintentional change of behaviour for the 1.101 errata workaround on OMAP4 platforms. Fix this oversight.
--- drivers/gpio/gpio-omap.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpio/gpio-omap.c +2 -0
@@ -1604,6 +1604,8 @@ static struct omap_gpio_reg_offs omap4_gpio_regs = { .clr_dataout = OMAP4_GPIO_CLEARDATAOUT, .irqstatus = OMAP4_GPIO_IRQSTATUS0, .irqstatus2 = OMAP4_GPIO_IRQSTATUS1, + .irqstatus_raw0 = OMAP4_GPIO_IRQSTATUSRAW0, + .irqstatus_raw1 = OMAP4_GPIO_IRQSTATUSRAW1, .irqenable = OMAP4_GPIO_IRQSTATUSSET0, .irqenable2 = OMAP4_GPIO_IRQSTATUSSET1, .set_irqenable = OMAP4_GPIO_IRQSTATUSSET0,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 19/293 net: stmmac: dwmac4/5: Clear unused address entries
In reply to Greg Kroah-Hartman[ Upstream commit 0620ec6c62a5a07625b65f699adc5d1b90394ee6 ]
In case we don't use a given address entry we need to clear it because it could contain previous values that are no longer valid.
Found out while running stmmac selftests.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +8 -2
@@ -443,14 +443,20 @@ static void dwmac4_set_filter(struct mac_device_info *hw,* are required */ value |=GMAC_PACKET_FILTER_PR ; - }else if (!netdev_uc_empty (dev)) { -int reg =1 ; + }else {struct netdev_hw_addr *ha; +int reg =1 ;netdev_for_each_uc_addr (ha, dev) {dwmac4_set_umac_addr (hw, ha->addr, reg); reg++; } + +while (reg <=GMAC_MAX_PERFECT_ADDRESSES ) { +writel (0 , ioaddr +GMAC_ADDR_HIGH (reg)); +writel (0 , ioaddr +GMAC_ADDR_LOW (reg)); + reg++; + } }writel (value, ioaddr +GMAC_PACKET_FILTER );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 46/293 gpio: omap: ensure irq is enabled before wakeup
In reply to Greg Kroah-Hartman[ Upstream commit c859e0d479b3b4f6132fc12637c51e01492f31f6 ]
Documentation states:
NOTE: There must be a correlation between the wake-up enable and interrupt-enable registers. If a GPIO pin has a wake-up configured on it, it must also have the corresponding interrupt enabled (on one of the two interrupt lines).
Ensure that this condition is always satisfied by enabling the detection events after enabling the interrupt, and disabling the detection before disabling the interrupt. This ensures interrupt/wakeup events can not happen until both the wakeup and interrupt enables correlate.
If we do any clearing, clear between the interrupt enable/disable and trigger setting.
--- drivers/gpio/gpio-omap.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/gpio/gpio-omap.c +8 -7
@@ -790,9 +790,9 @@ static void omap_gpio_irq_shutdown(struct irq_data *d)raw_spin_lock_irqsave (&bank->lock, flags); bank->irq_usage &= ~(BIT (offset)); -omap_set_gpio_irqenable (bank, offset,0 ); -omap_clear_gpio_irqstatus (bank, offset);omap_set_gpio_triggering (bank, offset,IRQ_TYPE_NONE ); +omap_clear_gpio_irqstatus (bank, offset); +omap_set_gpio_irqenable (bank, offset,0 );if (!LINE_USED (bank->mod_usage, offset))omap_clear_gpio_debounce (bank, offset);omap_disable_gpio_module (bank, offset);
@@ -834,8 +834,8 @@ static void omap_gpio_mask_irq(struct irq_data *d)unsigned long flags;raw_spin_lock_irqsave (&bank->lock, flags); -omap_set_gpio_irqenable (bank, offset,0 );omap_set_gpio_triggering (bank, offset,IRQ_TYPE_NONE ); +omap_set_gpio_irqenable (bank, offset,0 );raw_spin_unlock_irqrestore (&bank->lock, flags); }
@@ -847,9 +847,6 @@ static void omap_gpio_unmask_irq(struct irq_data *d)unsigned long flags;raw_spin_lock_irqsave (&bank->lock, flags); -if (trigger) -omap_set_gpio_triggering (bank, offset, trigger); -omap_set_gpio_irqenable (bank, offset,1 );/*
@@ -857,9 +854,13 @@ static void omap_gpio_unmask_irq(struct irq_data *d)* is cleared, thus after the handler has run. OMAP4 needs this done * after enabing the interrupt to clear the wakeup status. */ -if (bank->level_mask &BIT (offset)) +if (bank->regs->leveldetect0 && bank->regs->wkup_en && + trigger & (IRQ_TYPE_LEVEL_HIGH |IRQ_TYPE_LEVEL_LOW ))omap_clear_gpio_irqstatus (bank, offset); +if (trigger) +omap_set_gpio_triggering (bank, offset, trigger); +raw_spin_unlock_irqrestore (&bank->lock, flags); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 47/293 regmap: fix bulk writes on paged registers
In reply to Greg Kroah-Hartman[ Upstream commit db057679de3e9e6a03c1bcd5aee09b0d25fd9f5b ]
On buses like SlimBus and SoundWire which does not support gather_writes yet in regmap, A bulk write on paged register would be silently ignored after programming page.
This is because local variable 'ret' value in regmap_raw_write_impl() gets reset to 0 once page register is written successfully and the code below checks for 'ret' value to be -ENOTSUPP before linearising the write buffer to send to bus->write().
Fix this by resetting the 'ret' value to -ENOTSUPP in cases where gather_writes() is not supported or single register write is not possible.
--- drivers/base/regmap/regmap.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/regmap/regmap.c +2 -0
@@ -1509,6 +1509,8 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg, map->format.reg_bytes + map->format.pad_bytes, val, val_len); + else + ret = -ENOTSUPP ;/* If that didn't work fall back on linearising by hand. */ if (ret == -ENOTSUPP ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 49/293 rcu: Force inlining of rcu_read_lock()
In reply to Greg Kroah-Hartman[ Upstream commit 6da9f775175e516fc7229ceaa9b54f8f56aa7924 ]
When debugging options are turned on, the rcu_read_lock() function might not be inlined. This results in lockdep's print_lock() function printing "rcu_read_lock+0x0/0x70" instead of rcu_read_lock()'s caller. For example:
[ 10.579995] =============================
[ 10.584033] WARNING: suspicious RCU usage
[ 10.588074] 4.18.0.memcg_v2+ #1 Not tainted
[ 10.593162] -----------------------------
[ 10.597203] include/linux/rcupdate.h:281 Illegal context switch in
RCU read-side critical section!
[ 10.606220]
[ 10.606220] other info that might help us debug this:
[ 10.606220]
[ 10.614280]
[ 10.614280] rcu_scheduler_active = 2, debug_locks = 1
[ 10.620853] 3 locks held by systemd/1:
[ 10.624632] #0: (____ptrval____) (&type->i_mutex_dir_key#5){.+.+}, at: lookup_slow+0x42/0x70
[ 10.633232] #1: (____ptrval____) (rcu_read_lock){....}, at: rcu_read_lock+0x0/0x70
[ 10.640954] #2: (____ptrval____) (rcu_read_lock){....}, at: rcu_read_lock+0x0/0x70These "rcu_read_lock+0x0/0x70" strings are not providing any useful information. This commit therefore forces inlining of the rcu_read_lock() function so that rcu_read_lock()'s caller is instead shown.
--- include/linux/rcupdate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcupdate.h +1 -1
@@ -622,7 +622,7 @@ static inline void rcu_preempt_sleep_check(void) { }* read-side critical sections may be preempted and they may also block, but * only when acquiring spinlocks that are subject to priority inheritance. */ -static inline void rcu_read_lock (void ) +static __always_inline void rcu_read_lock(void) {__rcu_read_lock ();__acquire (RCU );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 50/293 x86/cpufeatures: Add FDP_EXCPTN_ONLY and ZERO_FCS_FDS
In reply to Greg Kroah-Hartman[ Upstream commit cbb99c0f588737ec98c333558922ce47e9a95827 ]
Add the CPUID enumeration for Intel's de-feature bits to accommodate passing these de-features through to kvm guests.
These de-features are (from SDM vol 1, section 8.1.8):
- X86_FEATURE_FDP_EXCPTN_ONLY: If CPUID.(EAX=07H,ECX=0H):EBX[bit 6] = 1, the data pointer (FDP) is updated only for the x87 non-control instructions that incur unmasked x87 exceptions.
- X86_FEATURE_ZERO_FCS_FDS: If CPUID.(EAX=07H,ECX=0H):EBX[bit 13] = 1, the processor deprecates FCS and FDS; it saves each as 0000H.
--- arch/x86/include/asm/cpufeatures.h | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/include/asm/cpufeatures.h +2 -0
@@ -239,12 +239,14 @@#define X86_FEATURE_BMI1 ( 9*32+ 3)/* 1st group bit manipulation extensions */ #define X86_FEATURE_HLE ( 9*32+ 4)/* Hardware Lock Elision */ #define X86_FEATURE_AVX2 ( 9*32+ 5)/* AVX2 instructions */ +#define X86_FEATURE_FDP_EXCPTN_ONLY ( 9*32+ 6)/* "" FPU data pointer updated only on x87 exceptions */ #define X86_FEATURE_SMEP ( 9*32+ 7)/* Supervisor Mode Execution Protection */ #define X86_FEATURE_BMI2 ( 9*32+ 8)/* 2nd group bit manipulation extensions */ #define X86_FEATURE_ERMS ( 9*32+ 9)/* Enhanced REP MOVSB/STOSB instructions */ #define X86_FEATURE_INVPCID ( 9*32+10)/* Invalidate Processor Context ID */ #define X86_FEATURE_RTM ( 9*32+11)/* Restricted Transactional Memory */ #define X86_FEATURE_CQM ( 9*32+12)/* Cache QoS Monitoring */ +#define X86_FEATURE_ZERO_FCS_FDS ( 9*32+13)/* "" Zero out FPU CS and FPU DS */ #define X86_FEATURE_MPX ( 9*32+14)/* Memory Protection Extension */ #define X86_FEATURE_RDT_A ( 9*32+15)/* Resource Director Technology Allocation */ #define X86_FEATURE_AVX512F ( 9*32+16)/* AVX-512 Foundation */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 51/293 blkcg, writeback: dead memcgs shouldnt contribute to writeback ownership arbitration
In reply to Greg Kroah-Hartman[ Upstream commit 6631142229005e1b1c311a09efe9fb3cfdac8559 ]
wbc_account_io() collects information on cgroup ownership of writeback pages to determine which cgroup should own the inode. Pages can stay associated with dead memcgs but we want to avoid attributing IOs to dead blkcgs as much as possible as the association is likely to be stale. However, currently, pages associated with dead memcgs contribute to the accounting delaying and/or confusing the arbitration.
Fix it by ignoring pages associated with dead memcgs.
--- fs/fs-writeback.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/fs-writeback.c +7 -1
@@ -721,6 +721,7 @@ void wbc_detach_inode(struct writeback_control *wbc)void wbc_account_io (struct writeback_control *wbc,struct page *page,size_t bytes) { +struct cgroup_subsys_state *css;int id;/*
@@ -732,7 +733,12 @@ void wbc_account_io(struct writeback_control *wbc, struct page *page,if (!wbc->wb)return ; - id =mem_cgroup_css_from_page (page)->id; + css =mem_cgroup_css_from_page (page); +/* dead cgroups shouldn't contribute to inode ownership arbitration */ +if (!(css->flags &CSS_ONLINE )) +return ; + + id = css->id;if (id == wbc->wb_id) { wbc->wb_bytes += bytes;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 53/293 sched/core: Add __sched tag for io_schedule()
In reply to Greg Kroah-Hartman[ Upstream commit e3b929b0a184edb35531153c5afcaebb09014f9d ]
Non-inline io_schedule() was introduced in:
commit 10ab56434f2f ("sched/core: Separate out io_schedule_prepare() and io_schedule_finish()")
Keep in line with io_schedule_timeout(), otherwise "/proc/<pid>/wchan" will report io_schedule() rather than its callers when waiting for IO.
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -5026,7 +5026,7 @@ long __sched io_schedule_timeout(long timeout) }EXPORT_SYMBOL (io_schedule_timeout); -void io_schedule (void ) +void __sched io_schedule(void) {int token;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 54/293 sched/fair: Fix "runnable_avg_yN_inv" not used warnings
In reply to Greg Kroah-Hartman[ Upstream commit 509466b7d480bc5d22e90b9fbe6122ae0e2fbe39 ]
runnable_avg_yN_inv[] is only used in kernel/sched/pelt.c but was included in several other places because they need other macros all came from kernel/sched/sched-pelt.h which was generated by Documentation/scheduler/sched-pelt. As the result, it causes compilation a lot of warnings,
kernel/sched/sched-pelt.h:4:18: warning: 'runnable_avg_yN_inv' defined but not used [-Wunused-const-variable=] kernel/sched/sched-pelt.h:4:18: warning: 'runnable_avg_yN_inv' defined but not used [-Wunused-const-variable=] kernel/sched/sched-pelt.h:4:18: warning: 'runnable_avg_yN_inv' defined but not used [-Wunused-const-variable=]
...
Silence it by appending the __maybe_unused attribute for it, so all generated variables and macros can still be kept in the same file.
--- Documentation/scheduler/sched-pelt.c | 3 ++- kernel/sched/sched-pelt.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
Documentation/scheduler/sched-pelt.c +2 -1
@@ -20,7 +20,8 @@ void calc_runnable_avg_yN_inv(void)int i;unsigned int x; -printf ("static const u32 runnable_avg_yN_inv[] = {" ); +/* To silence -Wunused-but-set-variable warnings. */ +printf ("static const u32 runnable_avg_yN_inv[] __maybe_unused = {" );for (i =0 ; i <HALFLIFE ; i++) { x = ((1UL <<32 )-1 )*pow (y, i);
kernel/sched/sched-pelt.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 */ /* Generated by Documentation/scheduler/sched-pelt; do not modify. */ -static const u32 runnable_avg_yN_inv[] = { +static const u32 runnable_avg_yN_inv[]__maybe_unused = {0xffffffff ,0xfa83b2da ,0xf5257d14 ,0xefe4b99a ,0xeac0c6e6 ,0xe5b906e6 ,0xe0ccdeeb ,0xdbfbb796 ,0xd744fcc9 ,0xd2a81d91 ,0xce248c14 ,0xc9b9bd85 ,0xc5672a10 ,0xc12c4cc9 ,0xbd08a39e ,0xb8fbaf46 ,0xb504f333 ,0xb123f581 ,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 55/293 x86/atomic: Fix smp_mb__{before,after}_atomic()
In reply to Greg Kroah-Hartman[ Upstream commit 69d927bba39517d0980462efc051875b7f4db185 ]
Recent probing at the Linux Kernel Memory Model uncovered a 'surprise'. Strongly ordered architectures where the atomic RmW primitive implies full memory ordering and smp_mb__{before,after}_atomic() are a simple barrier() (such as x86) fail for:
*x = 1; atomic_inc(u); smp_mb__after_atomic(); r0 = *y;
Because, while the atomic_inc() implies memory order, it (surprisingly) does not provide a compiler barrier. This then allows the compiler to re-order like so:
atomic_inc(u); *x = 1; smp_mb__after_atomic(); r0 = *y;
Which the CPU is then allowed to re-order (under TSO rules) like:
atomic_inc(u); r0 = *y; *x = 1;
And this very much was not intended. Therefore strengthen the atomic RmW ops to include a compiler barrier.
NOTE: atomic_{or,and,xor} and the bitops already had the compiler barrier.
--- Documentation/atomic_t.txt | 3 +++ arch/x86/include/asm/atomic.h | 8 ++++---- arch/x86/include/asm/atomic64_64.h | 8 ++++---- arch/x86/include/asm/barrier.h | 4 ++-- 4 files changed, 13 insertions(+), 10 deletions(-)
Documentation/atomic_t.txt +3 -0
@@ -177,6 +177,9 @@ These helper barriers exist because architectures have varying implicit ordering on their SMP atomic primitives. For example our TSO architectures provide full ordered atomics and these barriers are no-ops. +NOTE: when the atomic RmW ops are fully ordered, they should also imply a +compiler barrier. + Thus: atomic_fetch_add();
arch/x86/include/asm/atomic.h +4 -4
@@ -50,7 +50,7 @@ static __always_inline void atomic_add(int i, atomic_t *v) { asmvolatile (LOCK_PREFIX "addl %1,%0" :"+m" (v->counter) - :"ir" (i)); + :"ir" (i) :"memory" ); }/**
@@ -64,7 +64,7 @@ static __always_inline void atomic_sub(int i, atomic_t *v) { asmvolatile (LOCK_PREFIX "subl %1,%0" :"+m" (v->counter) - :"ir" (i)); + :"ir" (i) :"memory" ); }/**
@@ -90,7 +90,7 @@ static __always_inline bool atomic_sub_and_test(int i, atomic_t *v) static __always_inline void atomic_inc(atomic_t *v) { asmvolatile (LOCK_PREFIX "incl %0" - :"+m" (v->counter)); + :"+m" (v->counter) ::"memory" ); }/**
@@ -102,7 +102,7 @@ static __always_inline void atomic_inc(atomic_t *v) static __always_inline void atomic_dec(atomic_t *v) { asmvolatile (LOCK_PREFIX "decl %0" - :"+m" (v->counter)); + :"+m" (v->counter) ::"memory" ); }/**
arch/x86/include/asm/atomic64_64.h +4 -4
@@ -45,7 +45,7 @@ static __always_inline void atomic64_add(long i, atomic64_t *v) { asmvolatile (LOCK_PREFIX "addq %1,%0" :"=m" (v->counter) - :"er" (i),"m" (v->counter)); + :"er" (i),"m" (v->counter) :"memory" ); }/**
@@ -59,7 +59,7 @@ static inline void atomic64_sub(long i, atomic64_t *v) { asmvolatile (LOCK_PREFIX "subq %1,%0" :"=m" (v->counter) - :"er" (i),"m" (v->counter)); + :"er" (i),"m" (v->counter) :"memory" ); }/**
@@ -86,7 +86,7 @@ static __always_inline void atomic64_inc(atomic64_t *v) { asmvolatile (LOCK_PREFIX "incq %0" :"=m" (v->counter) - :"m" (v->counter)); + :"m" (v->counter) :"memory" ); }/**
@@ -99,7 +99,7 @@ static __always_inline void atomic64_dec(atomic64_t *v) { asmvolatile (LOCK_PREFIX "decq %0" :"=m" (v->counter) - :"m" (v->counter)); + :"m" (v->counter) :"memory" ); }/**
arch/x86/include/asm/barrier.h +2 -2
@@ -106,8 +106,8 @@ do { \#endif /* Atomic operations are already serializing on x86 */ -#define __smp_mb__before_atomic () barrier() -#define __smp_mb__after_atomic () barrier() +#define __smp_mb__before_atomic () do { } while (0) +#define __smp_mb__after_atomic () do { } while (0)#include <asm-generic/barrier.h>
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 20/293 qed: Set the doorbell address correctly
In reply to Greg Kroah-Hartman[ Upstream commit 8366d520019f366fabd6c7a13032bdcd837e18d4 ]
In 100g mode the doorbell bar is united for both engines. Set the correct offset in the hwfn so that the doorbell returned for RoCE is in the affined hwfn.
--- drivers/net/ethernet/qlogic/qed/qed_dev.c | 29 ++++++++++++++-------- drivers/net/ethernet/qlogic/qed/qed_rdma.c | 2 +- 2 files changed, 19 insertions(+), 12 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_dev.c +18 -11
@@ -2947,6 +2947,7 @@ static int qed_get_dev_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)static int qed_hw_prepare_single (struct qed_hwfn *p_hwfn,void __iomem *p_regview,void __iomem *p_doorbells, +u64 db_phys_addr,enum qed_pci_personality personality) {int rc =0 ;
@@ -2954,6 +2955,7 @@ static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn,/* Split PCI bars evenly between hwfns */ p_hwfn->regview = p_regview; p_hwfn->doorbells = p_doorbells; + p_hwfn->db_phys_addr = db_phys_addr;if (IS_VF (p_hwfn->cdev))return qed_vf_hw_prepare (p_hwfn);
@@ -3036,7 +3038,9 @@ int qed_hw_prepare(struct qed_dev *cdev,/* Initialize the first hwfn - will learn number of hwfns */ rc =qed_hw_prepare_single (p_hwfn, cdev->regview, - cdev->doorbells, personality); + cdev->doorbells, + cdev->db_phys_addr, + personality);if (rc)return rc;
@@ -3045,22 +3049,25 @@ int qed_hw_prepare(struct qed_dev *cdev,/* Initialize the rest of the hwfns */ if (cdev->num_hwfns >1 ) {void __iomem *p_regview, *p_doorbell; -u8 __iomem *addr; +u64 db_phys_addr; +u32 offset;/* adjust bar offset for second engine */ - addr = cdev->regview + -qed_hw_bar_size (p_hwfn, p_hwfn->p_main_ptt, -BAR_ID_0 ) /2 ; - p_regview = addr; + offset =qed_hw_bar_size (p_hwfn, p_hwfn->p_main_ptt, +BAR_ID_0 ) /2 ; + p_regview = cdev->regview + offset; - addr = cdev->doorbells + -qed_hw_bar_size (p_hwfn, p_hwfn->p_main_ptt, -BAR_ID_1 ) /2 ; - p_doorbell = addr; + offset =qed_hw_bar_size (p_hwfn, p_hwfn->p_main_ptt, +BAR_ID_1 ) /2 ; + + p_doorbell = cdev->doorbells + offset; + + db_phys_addr = cdev->db_phys_addr + offset;/* prepare second hw function */ rc =qed_hw_prepare_single (&cdev->hwfns[1 ], p_regview, - p_doorbell, personality); + p_doorbell, db_phys_addr, + personality);/* in case of error, need to free the previously * initiliazed hwfn 0.
drivers/net/ethernet/qlogic/qed/qed_rdma.c +1 -1
@@ -753,7 +753,7 @@ static int qed_rdma_add_user(void *rdma_cxt, dpi_start_offset + ((out_params->dpi) * p_hwfn->dpi_size)); - out_params->dpi_phys_addr = p_hwfn->cdev->db_phys_addr + + out_params->dpi_phys_addr = p_hwfn->db_phys_addr + dpi_start_offset + ((out_params->dpi) * p_hwfn->dpi_size);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 56/293 perf evsel: Make perf_evsel__name() accept a NULL argument
In reply to Greg Kroah-Hartman[ Upstream commit fdbdd7e8580eac9bdafa532746c865644d125e34 ]
In which case it simply returns "unknown", like when it can't figure out the evsel->name value.
This makes this code more robust and fixes a problem in 'perf trace' where a NULL evsel was being passed to a routine that only used the evsel for printing its name when a invalid syscall id was passed.
--- tools/perf/util/evsel.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/perf/util/evsel.c +7 -1
@@ -587,6 +587,9 @@ const char *perf_evsel__name(struct perf_evsel *evsel) {char bf[128 ]; +if (!evsel) + goto out_unknown; +if (evsel->name)return evsel->name;
@@ -623,7 +626,10 @@ const char *perf_evsel__name(struct perf_evsel *evsel) evsel->name =strdup (bf); -return evsel->name ?:"unknown" ; +if (evsel->name) +return evsel->name; +out_unknown: +return "unknown" ; }const char *perf_evsel__group_name (struct perf_evsel *evsel)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 21/293 signal/pid_namespace: Fix reboot_pid_ns to use send_sig not force_sig
In reply to Greg Kroah-Hartman[ Upstream commit f9070dc94542093fd516ae4ccea17ef46a4362c5 ]
The locking in force_sig_info is not prepared to deal with a task that exits or execs (as sighand may change). The is not a locking problem in force_sig as force_sig is only built to handle synchronous exceptions.
Further the function force_sig_info changes the signal state if the signal is ignored, or blocked or if SIGNAL_UNKILLABLE will prevent the delivery of the signal. The signal SIGKILL can not be ignored and can not be blocked and SIGNAL_UNKILLABLE won't prevent it from being delivered.
So using force_sig rather than send_sig for SIGKILL is confusing and pointless.
Because it won't impact the sending of the signal and and because using force_sig is wrong, replace force_sig with send_sig.
--- kernel/pid_namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/pid_namespace.c +1 -1
@@ -351,7 +351,7 @@ int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd) }read_lock (&tasklist_lock); -force_sig (SIGKILL , pid_ns->child_reaper); +send_sig (SIGKILL , pid_ns->child_reaper,1 );read_unlock (&tasklist_lock);do_exit (0 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 22/293 af_key: fix leaks in key_pol_get_resp and dump_sp.
In reply to Greg Kroah-Hartman[ Upstream commit 7c80eb1c7e2b8420477fbc998971d62a648035d9 ]
In both functions, if pfkey_xfrm_policy2msg failed we leaked the newly allocated sk_buff. Free it on error.
--- net/key/af_key.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/key/af_key.c +6 -2
@@ -2438,8 +2438,10 @@ static int key_pol_get_resp(struct sock *sk, struct xfrm_policy *xp, const struc goto out; } err =pfkey_xfrm_policy2msg (out_skb, xp, dir); -if (err <0 ) +if (err <0 ) { +kfree_skb (out_skb); goto out; + } out_hdr = (struct sadb_msg *) out_skb->data; out_hdr->sadb_msg_version = hdr->sadb_msg_version;
@@ -2690,8 +2692,10 @@ static int dump_sp(struct xfrm_policy *xp, int dir, int count, void *ptr)return PTR_ERR (out_skb); err =pfkey_xfrm_policy2msg (out_skb, xp, dir); -if (err <0 ) +if (err <0 ) { +kfree_skb (out_skb);return err; + } out_hdr = (struct sadb_msg *) out_skb->data; out_hdr->sadb_msg_version = pfk->dump.msg_version;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 23/293 xfrm: Fix xfrm sel prefix length validation
In reply to Greg Kroah-Hartman[ Upstream commit b38ff4075a80b4da5cb2202d7965332ca0efb213 ]
Family of src/dst can be different from family of selector src/dst. Use xfrm selector family to validate address prefix length, while verifying new sa from userspace.
Validated patch with this command:
ip xfrm state add src 1.1.6.1 dst 1.1.6.2 proto esp spi 4260196 \
reqid 20004 mode tunnel aead "rfc4106(gcm(aes))" \0x1111016400000000000000000000000044440001 128 \
sel src 1011:1:4::2/128 sel dst 1021:1:4::2/128 dev Port5
--- net/xfrm/xfrm_user.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
net/xfrm/xfrm_user.c +16 -0
@@ -150,6 +150,22 @@ static int verify_newsa_info(struct xfrm_usersa_info *p, err = -EINVAL ;switch (p->family) { +case AF_INET : +break ; + +case AF_INET6 : +#if IS_ENABLED (CONFIG_IPV6 ) +break ; +#else + err = -EAFNOSUPPORT ; + goto out; +#endif + +default : + goto out; + } + +switch (p->sel.family) {case AF_INET :if (p->sel.prefixlen_d >32 || p->sel.prefixlen_s >32 ) goto out;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 24/293 fscrypt: clean up some BUG_ON()s in block encryption/decryption
In reply to Greg Kroah-Hartman[ Upstream commit eeacfdc68a104967162dfcba60f53f6f5b62a334 ]
Replace some BUG_ON()s with WARN_ON_ONCE() and returning an error code, and move the check for len divisible by FS_CRYPTO_BLOCK_SIZE into fscrypt_crypt_block() so that it's done for both encryption and decryption, not just encryption.
--- fs/crypto/crypto.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
fs/crypto/crypto.c +9 -6
@@ -157,7 +157,10 @@ int fscrypt_do_page_crypto(const struct inode *inode, fscrypt_direction_t rw,struct crypto_skcipher *tfm = ci->ci_ctfm;int res =0 ; -BUG_ON (len ==0 ); +if (WARN_ON_ONCE (len <=0 )) +return -EINVAL ; +if (WARN_ON_ONCE (len %FS_CRYPTO_BLOCK_SIZE !=0 )) +return -EINVAL ;BUILD_BUG_ON (sizeof (iv) !=FS_IV_SIZE );BUILD_BUG_ON (AES_BLOCK_SIZE !=FS_IV_SIZE );
@@ -257,8 +260,6 @@ struct page *fscrypt_encrypt_page(const struct inode *inode,struct page *ciphertext_page = page;int err; -BUG_ON (len %FS_CRYPTO_BLOCK_SIZE !=0 ); -if (inode->i_sb->s_cop->flags &FS_CFLG_OWN_PAGES ) {/* with inplace-encryption we just encrypt the page */ err = fscrypt_do_page_crypto(inode, FS_ENCRYPT, lblk_num, page,
@@ -270,7 +271,8 @@ struct page *fscrypt_encrypt_page(const struct inode *inode,return ciphertext_page; } -BUG_ON (!PageLocked (page)); +if (WARN_ON_ONCE (!PageLocked (page))) +return ERR_PTR (-EINVAL ); ctx =fscrypt_get_ctx (inode, gfp_flags);if (IS_ERR (ctx))
@@ -318,8 +320,9 @@ EXPORT_SYMBOL(fscrypt_encrypt_page);int fscrypt_decrypt_page (const struct inode *inode,struct page *page,unsigned int len,unsigned int offs,u64 lblk_num) { -if (!(inode->i_sb->s_cop->flags &FS_CFLG_OWN_PAGES )) -BUG_ON (!PageLocked (page)); +if (WARN_ON_ONCE (!PageLocked (page) && + !(inode->i_sb->s_cop->flags &FS_CFLG_OWN_PAGES ))) +return -EINVAL ;return fscrypt_do_page_crypto (inode,FS_DECRYPT , lblk_num, page, page, len, offs,GFP_NOFS );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 25/293 media: mc-device.c: dont memset __user pointer contents
In reply to Greg Kroah-Hartman[ Upstream commit 518fa4e0e0da97ea2e17c95ab57647ce748a96e2 ]
You can't memset the contents of a __user pointer. Instead, call copy_to_user to copy links.reserved (which is zeroed) to the user memory.
This fixes this sparse warning:
SPARSE:drivers/media/mc/mc-device.c drivers/media/mc/mc-device.c:521:16: warning: incorrect type in argument 1 (different address spaces)
--- drivers/media/media-device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/media-device.c +3 -2
@@ -486,8 +486,9 @@ static long media_device_enum_links32(struct media_device *mdev,if (ret)return ret; -memset (ulinks->reserved,0 ,sizeof (ulinks->reserved)); - +if (copy_to_user (ulinks->reserved, links.reserved, +sizeof (ulinks->reserved))) +return -EFAULT ;return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 58/293 ipoib: correcly show a VF hardware address
In reply to Greg Kroah-Hartman[ Upstream commit 64d701c608fea362881e823b666327f5d28d7ffd ]
in the case of IPoIB with SRIOV enabled hardware
ip link show command incorrecly prints
0 instead of a VF hardware address.
Before:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 MAC 00:00:00:00:00:00, spoof checking off, link-state disable,
trust off, query_rss off
...
After:
11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256
link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0 link/infiniband
80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof checking off, link-state disable, trust off, query_rss off
v1->v2: just copy an address without modifing ifla_vf_mac v2->v3: update the changelog
--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/ipoib/ipoib_main.c +1 -0
@@ -1833,6 +1833,7 @@ static int ipoib_get_vf_config(struct net_device *dev, int vf,return err; ivf->vf = vf; +memcpy (ivf->mac, dev->dev_addr, dev->addr_len);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 67/293 media: coda: fix mpeg2 sequence number handling
In reply to Greg Kroah-Hartman[ Upstream commit 56d159a4ec6d8da7313aac6fcbb95d8fffe689ba ]
Sequence number handling assumed that the BIT processor frame number starts counting at 1, but this is not true for the MPEG-2 decoder, which starts at 0. Fix the sequence counter offset detection to handle this.
--- drivers/media/platform/coda/coda-bit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/platform/coda/coda-bit.c +4 -1
@@ -1679,6 +1679,7 @@ static int __coda_start_decoding(struct coda_ctx *ctx)v4l2_err (&dev->v4l2_dev,"CODA_COMMAND_SEQ_INIT timeout\n" );return ret; } + ctx->sequence_offset = ~0U ; ctx->initialized =1 ;/* Update kfifo out pointer from coda bitstream read pointer */
@@ -2095,7 +2096,9 @@ static void coda_finish_decode(struct coda_ctx *ctx)v4l2_err (&dev->v4l2_dev,"decoded frame index out of range: %d\n" , decoded_idx); }else { - val =coda_read (dev,CODA_RET_DEC_PIC_FRAME_NUM ) -1 ; + val =coda_read (dev,CODA_RET_DEC_PIC_FRAME_NUM ); +if (ctx->sequence_offset ==-1 ) + ctx->sequence_offset = val; val -= ctx->sequence_offset;spin_lock_irqsave (&ctx->buffer_meta_lock, flags);if (!list_empty (&ctx->buffer_meta_list)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 68/293 media: coda: fix last buffer handling in V4L2_ENC_CMD_STOP
In reply to Greg Kroah-Hartman[ Upstream commit f3775f89852d167990b0d718587774cf00d22ac2 ]
coda_encoder_cmd() is racy, as the last scheduled picture run worker can still be in-flight while the ENC_CMD_STOP command is issued. Depending on the exact timing the sequence numbers might already be changed, but the last buffer might not have been put on the destination queue yet.
In this case the current implementation would prematurely wake the destination queue with last_buffer_dequeued=true, causing userspace to call streamoff before the last buffer is handled.
Close this race window by synchronizing with the pic_run_worker before doing the sequence check.
--- drivers/media/platform/coda/coda-common.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/coda/coda-common.c +2 -0
@@ -932,6 +932,8 @@ static int coda_encoder_cmd(struct file *file, void *fh,/* Set the stream-end flag on this context */ ctx->bit_stream_param |=CODA_BIT_STREAM_END_FLAG ; +flush_work (&ctx->pic_run_work); +/* If there is no buffer in flight, wake up */ if (!ctx->streamon_out || ctx->qsequence == ctx->osequence) { dst_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 69/293 media: coda: increment sequence offset for the last returned frame
In reply to Greg Kroah-Hartman[ Upstream commit b3b7d96817cdb8b6fc353867705275dce8f41ccc ]
If no more frames are decoded in bitstream end mode, and a previously decoded frame has been returned, the firmware still increments the frame number. To avoid a sequence number mismatch after decoder restart, increment the sequence_offset correction parameter.
--- drivers/media/platform/coda/coda-bit.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/coda/coda-bit.c +3 -0
@@ -2091,6 +2091,9 @@ static void coda_finish_decode(struct coda_ctx *ctx)else if (ctx->display_idx <0 ) ctx->hold = true; }else if (decoded_idx ==-2 ) { +if (ctx->display_idx >=0 && + ctx->display_idx < ctx->num_internal_frames) + ctx->sequence_offset++;/* no frame was decoded, we still return remaining buffers */ }else if (decoded_idx <0 || decoded_idx >= ctx->num_internal_frames) { v4l2_err(&dev->v4l2_dev,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 71/293 media: hdpvr: fix locking and a missing msleep
In reply to Greg Kroah-Hartman[ Upstream commit 6bc5a4a1927556ff9adce1aa95ea408c95453225 ]
This driver has three locking issues:
- The wait_event_interruptible() condition calls hdpvr_get_next_buffer(dev) which uses a mutex, which is not allowed. Rewrite with list_empty_careful() that doesn't need locking.
- In hdpvr_read() the call to hdpvr_stop_streaming() didn't lock io_mutex, but it should have since stop_streaming expects that.
- In hdpvr_device_release() io_mutex was locked when calling flush_work(), but there it shouldn't take that mutex since the work done by flush_work() also wants to lock that mutex.
There are also two other changes (suggested by Keith):
- msecs_to_jiffies(4000); (a NOP) should have been msleep(4000).
- Change v4l2_dbg to v4l2_info to always log if streaming had to be restarted.
--- drivers/media/usb/hdpvr/hdpvr-video.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/media/usb/hdpvr/hdpvr-video.c +11 -6
@@ -439,7 +439,7 @@ static ssize_t hdpvr_read(struct file *file, char __user *buffer, size_t count,/* wait for the first buffer */ if (!(file->f_flags &O_NONBLOCK )) {if (wait_event_interruptible (dev->wait_data, -hdpvr_get_next_buffer (dev))) + !list_empty_careful (&dev->rec_buff_list)))return -ERESTARTSYS ; }
@@ -465,10 +465,17 @@ static ssize_t hdpvr_read(struct file *file, char __user *buffer, size_t count, goto err; }if (!err) { -v4l2_dbg (MSG_INFO , hdpvr_debug, &dev->v4l2_dev, -"timeout: restart streaming\n" ); +v4l2_info (&dev->v4l2_dev, +"timeout: restart streaming\n" ); +mutex_lock (&dev->io_mutex);hdpvr_stop_streaming (dev); -msecs_to_jiffies (4000 ); +mutex_unlock (&dev->io_mutex); +/* +* The FW needs about 4 seconds after streaming +* stopped before it is ready to restart +* streaming. +*/ +msleep (4000 ); err =hdpvr_start_streaming (dev);if (err) { ret = err;
@@ -1133,9 +1140,7 @@ static void hdpvr_device_release(struct video_device *vdev)struct hdpvr_device *dev =video_get_drvdata (vdev);hdpvr_delete (dev); -mutex_lock (&dev->io_mutex);flush_work (&dev->worker); -mutex_unlock (&dev->io_mutex);v4l2_device_unregister (&dev->v4l2_dev);v4l2_ctrl_handler_free (&dev->hdl);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 72/293 rtlwifi: rtl8192cu: fix error handle when usb probe failed
In reply to Greg Kroah-Hartman[ Upstream commit 6c0ed66f1a5b84e2a812c7c2d6571a5621bf3396 ]
rtl_usb_probe() must do error handle rtl_deinit_core() only if rtl_init_core() is done, otherwise goto error_out2.
| usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 | rtl_usb: reg 0xf0, usbctrl_vendorreq TimeOut! status:0xffffffb9 value=0x0 | rtl8192cu: Chip version 0x10 | rtl_usb: reg 0xa, usbctrl_vendorreq TimeOut! status:0xffffffb9 value=0x0 | rtl_usb: Too few input end points found | INFO: trying to register non-static key. | the code is fine but needs lockdep annotation. | turning off the locking correctness validator. | CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.1.0-rc4-319354-g9a33b36 #3 | Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS | Google 01/01/2011 | Workqueue: usb_hub_wq hub_event | Call Trace: | __dump_stack lib/dump_stack.c:77 [inline] | dump_stack+0xe8/0x16e lib/dump_stack.c:113 | assign_lock_key kernel/locking/lockdep.c:786 [inline] | register_lock_class+0x11b8/0x1250 kernel/locking/lockdep.c:1095 | __lock_acquire+0xfb/0x37c0 kernel/locking/lockdep.c:3582 | lock_acquire+0x10d/0x2f0 kernel/locking/lockdep.c:4211 | __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] | _raw_spin_lock_irqsave+0x44/0x60 kernel/locking/spinlock.c:152 | rtl_c2hcmd_launcher+0xd1/0x390 | drivers/net/wireless/realtek/rtlwifi/base.c:2344 | rtl_deinit_core+0x25/0x2d0 drivers/net/wireless/realtek/rtlwifi/base.c:574 | rtl_usb_probe.cold+0x861/0xa70 | drivers/net/wireless/realtek/rtlwifi/usb.c:1093 | usb_probe_interface+0x31d/0x820 drivers/usb/core/driver.c:361 | really_probe+0x2da/0xb10 drivers/base/dd.c:509 | driver_probe_device+0x21d/0x350 drivers/base/dd.c:671 | __device_attach_driver+0x1d8/0x290 drivers/base/dd.c:778 | bus_for_each_drv+0x163/0x1e0 drivers/base/bus.c:454 | __device_attach+0x223/0x3a0 drivers/base/dd.c:844 | bus_probe_device+0x1f1/0x2a0 drivers/base/bus.c:514 | device_add+0xad2/0x16e0 drivers/base/core.c:2106 | usb_set_configuration+0xdf7/0x1740 drivers/usb/core/message.c:2021 | generic_probe+0xa2/0xda drivers/usb/core/generic.c:210 | usb_probe_device+0xc0/0x150 drivers/usb/core/driver.c:266 | really_probe+0x2da/0xb10 drivers/base/dd.c:509 | driver_probe_device+0x21d/0x350 drivers/base/dd.c:671 | __device_attach_driver+0x1d8/0x290 drivers/base/dd.c:778 | bus_for_each_drv+0x163/0x1e0 drivers/base/bus.c:454 | __device_attach+0x223/0x3a0 drivers/base/dd.c:844 | bus_probe_device+0x1f1/0x2a0 drivers/base/bus.c:514 | device_add+0xad2/0x16e0 drivers/base/core.c:2106 | usb_new_device.cold+0x537/0xccf drivers/usb/core/hub.c:2534 | hub_port_connect drivers/usb/core/hub.c:5089 [inline] | hub_port_connect_change drivers/usb/core/hub.c:5204 [inline] | port_event drivers/usb/core/hub.c:5350 [inline] | hub_event+0x138e/0x3b00 drivers/usb/core/hub.c:5432 | process_one_work+0x90f/0x1580 kernel/workqueue.c:2269 | worker_thread+0x9b/0xe20 kernel/workqueue.c:2415 | kthread+0x313/0x420 kernel/kthread.c:253 | ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352
--- drivers/net/wireless/realtek/rtlwifi/usb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/usb.c +3 -2
@@ -1099,13 +1099,13 @@ int rtl_usb_probe(struct usb_interface *intf, rtlpriv->cfg->ops->read_eeprom_info (hw); err =_rtl_usb_init (hw);if (err) - goto error_out; + goto error_out2;rtl_usb_init_sw (hw);/* Init mac80211 sw */ err =rtl_init_core (hw);if (err) {pr_err ("Can't allocate sw for mac80211\n" ); - goto error_out; + goto error_out2; }if (rtlpriv->cfg->ops->init_sw_vars (hw)) {pr_err ("Can't init_sw_vars\n" );
@@ -1126,6 +1126,7 @@ int rtl_usb_probe(struct usb_interface *intf, error_out:rtl_deinit_core (hw); +error_out2:_rtl_usb_io_handler_release (hw);usb_put_dev (udev);complete (&rtlpriv->firmware_loading_complete);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 73/293 mt7601u: do not schedule rx_tasklet when the device has been disconnected
In reply to Greg Kroah-Hartman[ Upstream commit 4079e8ccabc3b6d1b503f2376123cb515d14921f ]
Do not schedule rx_tasklet when the usb dongle is disconnected. Moreover do not grub rx_lock in mt7601u_kill_rx since usb_poison_urb can run concurrently with urb completion and we can unlink urbs from rx ring in any order.
This patch fixes the common kernel warning reported when
the device is removed.
[ 24.921354] usb 3-14: USB disconnect, device number 7 [ 24.921593] ------------[ cut here ]------------ [ 24.921594] RX urb mismatch [ 24.921675] WARNING: CPU: 4 PID: 163 at drivers/net/wireless/mediatek/mt7601u/dma.c:200 mt7601u_complete_rx+0xcb/0xd0 [mt7601u] [ 24.921769] CPU: 4 PID: 163 Comm: kworker/4:2 Tainted: G OE 4.19.31-041931-generic #201903231635 [ 24.921770] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./Z97 Extreme4, BIOS P1.30 05/23/2014 [ 24.921782] Workqueue: usb_hub_wq hub_event [ 24.921797] RIP: 0010:mt7601u_complete_rx+0xcb/0xd0 [mt7601u] [ 24.921800] RSP: 0018:ffff9bd9cfd03d08 EFLAGS: 00010086 [ 24.921802] RAX: 0000000000000000 RBX: ffff9bd9bf043540 RCX: 0000000000000006 [ 24.921803] RDX: 0000000000000007 RSI: 0000000000000096 RDI: ffff9bd9cfd16420 [ 24.921804] RBP: ffff9bd9cfd03d28 R08: 0000000000000002 R09: 00000000000003a8 [ 24.921805] R10: 0000002f485fca34 R11: 0000000000000000 R12: ffff9bd9bf043c1c [ 24.921806] R13: ffff9bd9c62fa3c0 R14: 0000000000000082 R15: 0000000000000000 [ 24.921807] FS: 0000000000000000(0000) GS:ffff9bd9cfd00000(0000) knlGS:0000000000000000 [ 24.921808] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 24.921808] CR2: 00007fb2648b0000 CR3: 0000000142c0a004 CR4: 00000000001606e0 [ 24.921809] Call Trace: [ 24.921812] <IRQ> [ 24.921819] __usb_hcd_giveback_urb+0x8b/0x140 [ 24.921821] usb_hcd_giveback_urb+0xca/0xe0 [ 24.921828] xhci_giveback_urb_in_irq.isra.42+0x82/0xf0 [ 24.921834] handle_cmd_completion+0xe02/0x10d0 [ 24.921837] xhci_irq+0x274/0x4a0 [ 24.921838] xhci_msi_irq+0x11/0x20 [ 24.921851] __handle_irq_event_percpu+0x44/0x190 [ 24.921856] handle_irq_event_percpu+0x32/0x80 [ 24.921861] handle_irq_event+0x3b/0x5a [ 24.921867] handle_edge_irq+0x80/0x190 [ 24.921874] handle_irq+0x20/0x30 [ 24.921889] do_IRQ+0x4e/0xe0 [ 24.921891] common_interrupt+0xf/0xf [ 24.921892] </IRQ> [ 24.921900] RIP: 0010:usb_hcd_flush_endpoint+0x78/0x180 [ 24.921354] usb 3-14: USB disconnect, device number 7
--- drivers/net/wireless/mediatek/mt7601u/dma.c | 33 +++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-)
drivers/net/wireless/mediatek/mt7601u/dma.c +18 -15
@@ -193,10 +193,23 @@ static void mt7601u_complete_rx(struct urb *urb)struct mt7601u_rx_queue *q = &dev->rx_q;unsigned long flags; -spin_lock_irqsave (&dev->rx_lock, flags); +/* do no schedule rx tasklet if urb has been unlinked +* or the device has been removed +*/ +switch (urb->status) { +case -ECONNRESET : +case -ESHUTDOWN : +case -ENOENT : +return ; +default : +dev_err_ratelimited (dev->dev,"rx urb failed: %d\n" , + urb->status); +/* fall through */ +case 0 : +break ; + } -if (mt7601u_urb_has_error (urb)) -dev_err (dev->dev,"Error: RX urb failed:%d\n" , urb->status); +spin_lock_irqsave (&dev->rx_lock, flags);if (WARN_ONCE (q->e[q->end].urb != urb,"RX urb mismatch" )) goto out;
@@ -363,19 +376,9 @@ int mt7601u_dma_enqueue_tx(struct mt7601u_dev *dev, struct sk_buff *skb,static void mt7601u_kill_rx (struct mt7601u_dev *dev) {int i; -unsigned long flags; -spin_lock_irqsave (&dev->rx_lock, flags); - -for (i =0 ; i < dev->rx_q.entries; i++) { -int next = dev->rx_q.end; - -spin_unlock_irqrestore (&dev->rx_lock, flags); -usb_poison_urb (dev->rx_q.e[next].urb); -spin_lock_irqsave (&dev->rx_lock, flags); - } - -spin_unlock_irqrestore (&dev->rx_lock, flags); +for (i =0 ; i < dev->rx_q.entries; i++) +usb_poison_urb (dev->rx_q.e[i].urb); } static int mt7601u_submit_rx_buf(struct mt7601u_dev *dev,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 74/293 x86/build: Add set -e to mkcapflags.sh to delete broken capflags.c
In reply to Greg Kroah-Hartman[ Upstream commit bc53d3d777f81385c1bb08b07bd1c06450ecc2c1 ]
Without 'set -e', shell scripts continue running even after any error occurs. The missed 'set -e' is a typical bug in shell scripting.
For example, when a disk space shortage occurs while this script is running, it actually ends up with generating a truncated capflags.c.
Yet, mkcapflags.sh continues running and exits with 0. So, the build system assumes it has succeeded.
It will not be re-generated in the next invocation of Make since its timestamp is newer than that of any of the source files.
Add 'set -e' so that any error in this script is caught and propagated to the build system.
Since 9c2af1c7377a ("kbuild: add .DELETE_ON_ERROR special target"), make automatically deletes the target on any failure. So, the broken capflags.c will be deleted automatically.
--- arch/x86/kernel/cpu/mkcapflags.sh | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/cpu/mkcapflags.sh +2 -0
@@ -4,6 +4,8 @@ # Generate the x86_cap/bug_flags[] arrays from include/asm/cpufeatures.h # +set -e + IN=$1 OUT=$2
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 75/293 mt7601u: fix possible memory leak when the device is disconnected
In reply to Greg Kroah-Hartman[ Upstream commit 23377c200b2eb48a60d0f228b2a2e75ed6ee6060 ]
When the device is disconnected while passing traffic it is possible to receive out of order urbs causing a memory leak since the skb linked to the current tx urb is not removed. Fix the issue deallocating the skb cleaning up the tx ring. Moreover this patch fixes the following kernel warning
[ 57.480771] usb 1-1: USB disconnect, device number 2 [ 57.483451] ------------[ cut here ]------------ [ 57.483462] TX urb mismatch [ 57.483481] WARNING: CPU: 1 PID: 32 at drivers/net/wireless/mediatek/mt7601u/dma.c:245 mt7601u_complete_tx+0x165/00 [ 57.483483] Modules linked in: [ 57.483496] CPU: 1 PID: 32 Comm: kworker/1:1 Not tainted 5.2.0-rc1+ #72 [ 57.483498] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.12.0-2.fc30 04/01/2014 [ 57.483502] Workqueue: usb_hub_wq hub_event [ 57.483507] RIP: 0010:mt7601u_complete_tx+0x165/0x1e0 [ 57.483510] Code: 8b b5 10 04 00 00 8b 8d 14 04 00 00 eb 8b 80 3d b1 cb e1 00 00 75 9e 48 c7 c7 a4 ea 05 82 c6 05 f [ 57.483513] RSP: 0000:ffffc900000a0d28 EFLAGS: 00010092 [ 57.483516] RAX: 000000000000000f RBX: ffff88802c0a62c0 RCX: ffffc900000a0c2c [ 57.483518] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff810a8371 [ 57.483520] RBP: ffff88803ced6858 R08: 0000000000000000 R09: 0000000000000001 [ 57.483540] R10: 0000000000000002 R11: 0000000000000000 R12: 0000000000000046 [ 57.483542] R13: ffff88802c0a6c88 R14: ffff88803baab540 R15: ffff88803a0cc078 [ 57.483548] FS: 0000000000000000(0000) GS:ffff88803eb00000(0000) knlGS:0000000000000000 [ 57.483550] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 57.483552] CR2: 000055e7f6780100 CR3: 0000000028c86000 CR4: 00000000000006a0 [ 57.483554] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 57.483556] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 57.483559] Call Trace: [ 57.483561] <IRQ> [ 57.483565] __usb_hcd_giveback_urb+0x77/0xe0 [ 57.483570] xhci_giveback_urb_in_irq.isra.0+0x8b/0x140 [ 57.483574] handle_cmd_completion+0xf5b/0x12c0 [ 57.483577] xhci_irq+0x1f6/0x1810 [ 57.483581] ? lockdep_hardirqs_on+0x9e/0x180 [ 57.483584] ? _raw_spin_unlock_irq+0x24/0x30 [ 57.483588] __handle_irq_event_percpu+0x3a/0x260 [ 57.483592] handle_irq_event_percpu+0x1c/0x60 [ 57.483595] handle_irq_event+0x2f/0x4c [ 57.483599] handle_edge_irq+0x7e/0x1a0 [ 57.483603] handle_irq+0x17/0x20 [ 57.483607] do_IRQ+0x54/0x110 [ 57.483610] common_interrupt+0xf/0xf [ 57.483612] </IRQ>
--- drivers/net/wireless/mediatek/mt7601u/dma.c | 21 ++++++++++++++++----- drivers/net/wireless/mediatek/mt7601u/tx.c | 4 ++-- 2 files changed, 18 insertions(+), 7 deletions(-)
drivers/net/wireless/mediatek/mt7601u/dma.c +16 -5
@@ -241,14 +241,25 @@ static void mt7601u_complete_tx(struct urb *urb)struct sk_buff *skb;unsigned long flags; -spin_lock_irqsave (&dev->tx_lock, flags); +switch (urb->status) { +case -ECONNRESET : +case -ESHUTDOWN : +case -ENOENT : +return ; +default : +dev_err_ratelimited (dev->dev,"tx urb failed: %d\n" , + urb->status); +/* fall through */ +case 0 : +break ; + } -if (mt7601u_urb_has_error (urb)) -dev_err (dev->dev,"Error: TX urb failed:%d\n" , urb->status); +spin_lock_irqsave (&dev->tx_lock, flags);if (WARN_ONCE (q->e[q->start].urb != urb,"TX urb mismatch" )) goto out; skb = q->e[q->start].skb; + q->e[q->start].skb =NULL ;trace_mt_tx_dma_done (dev, skb);__skb_queue_tail (&dev->tx_skb_done, skb);
@@ -448,10 +459,10 @@ static void mt7601u_free_tx_queue(struct mt7601u_tx_queue *q) {int i; -WARN_ON (q->used); -for (i =0 ; i < q->entries; i++) {usb_poison_urb (q->e[i].urb); +if (q->e[i].skb) +mt7601u_tx_status (q->dev, q->e[i].skb);usb_free_urb (q->e[i].urb); } }
drivers/net/wireless/mediatek/mt7601u/tx.c +2 -2
@@ -117,9 +117,9 @@ void mt7601u_tx_status(struct mt7601u_dev *dev, struct sk_buff *skb) info->status.rates[0 ].idx =-1 ; info->flags |=IEEE80211_TX_STAT_ACK ; -spin_lock (&dev->mac_lock); +spin_lock_bh (&dev->mac_lock);ieee80211_tx_status (dev->hw, skb); -spin_unlock (&dev->mac_lock); +spin_unlock_bh (&dev->mac_lock); }static int mt7601u_skb_rooms (struct mt7601u_dev *dev,struct sk_buff *skb)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 59/293 EDAC/sysfs: Fix memory leak when creating a csrow object
In reply to Greg Kroah-Hartman[ Upstream commit 585fb3d93d32dbe89e718b85009f9c322cc554cd ]
In edac_create_csrow_object(), the reference to the object is not released when adding the device to the device hierarchy fails (device_add()). This may result in a memory leak.
--- drivers/edac/edac_mc_sysfs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/edac/edac_mc_sysfs.c +7 -1
@@ -426,6 +426,8 @@ static inline int nr_pages_per_csrow(struct csrow_info *csrow)static int edac_create_csrow_object (struct mem_ctl_info *mci,struct csrow_info *csrow,int index) { +int err; + csrow->dev.type = &csrow_attr_type; csrow->dev.bus = mci->bus; csrow->dev.groups = csrow_dev_groups;
@@ -438,7 +440,11 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci,edac_dbg (0 ,"creating (virtual) csrow node %s\n" ,dev_name (&csrow->dev)); -return device_add (&csrow->dev); + err =device_add (&csrow->dev); +if (err) +put_device (&csrow->dev); + +return err; }/* Create a CSROW object under specifed edac_mc_device */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 77/293 ath10k: add missing error handling
In reply to Greg Kroah-Hartman[ Upstream commit 4b553f3ca4cbde67399aa3a756c37eb92145b8a1 ]
In function ath10k_sdio_mbox_rx_alloc() [sdio.c], ath10k_sdio_mbox_alloc_rx_pkt() is called without handling the error cases. This will make the driver think the allocation for skb is successful and try to access the skb. If we enable failslab, system will easily crash with NULL pointer dereferencing.
Call trace of CONFIG_FAILSLAB:
ath10k_sdio_irq_handler+0x570/0xa88 [ath10k_sdio] process_sdio_pending_irqs+0x4c/0x174 sdio_run_irqs+0x3c/0x64 sdio_irq_work+0x1c/0x28
--- drivers/net/wireless/ath/ath10k/sdio.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath10k/sdio.c +4 -0
@@ -610,6 +610,10 @@ static int ath10k_sdio_mbox_rx_alloc(struct ath10k *ar, full_len, last_in_bundle, last_in_bundle); +if (ret) { +ath10k_warn (ar,"alloc_rx_pkt error %d\n" , ret); + goto err; + } } ar_sdio->n_rx_pkts = i;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 79/293 perf tools: Increase MAX_NR_CPUS and MAX_CACHES
In reply to Greg Kroah-Hartman[ Upstream commit 9f94c7f947e919c343b30f080285af53d0fa9902 ]
Attempting to profile 1024 or more CPUs with perf causes two errors:
perf record -a
[ perf record: Woken up X times to write data ]
way too many cpu caches..
[ perf record: Captured and wrote X MB perf.data (X samples) ]
perf report -C 1024
Error: failed to set cpu bitmap
Requested CPU 1024 too large. Consider raising MAX_NR_CPUS
Increasing MAX_NR_CPUS from 1024 to 2048 and redefining MAX_CACHES as MAX_NR_CPUS * 4 returns normal functionality to perf:
perf record -a
[ perf record: Woken up X times to write data ]
[ perf record: Captured and wrote X MB perf.data (X samples) ]
perf report -C 1024
...
--- tools/perf/perf.h | 2 +- tools/perf/util/header.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/perf.h +1 -1
@@ -25,7 +25,7 @@ static inline unsigned long long rdclock(void) }#ifndef MAX_NR_CPUS -#define MAX_NR_CPUS 1024 +#define MAX_NR_CPUS 2048#endif extern const char *input_name;
tools/perf/util/header.c +1 -1
@@ -1122,7 +1122,7 @@ static int build_caches(struct cpu_cache_level caches[], u32 size, u32 *cntp)return 0 ; } -#define MAX_CACHES 2000 +#define MAX_CACHES (MAX_NR_CPUS * 4)static int write_cache (struct feat_fd *ff,struct perf_evlist *evlist__maybe_unused )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 80/293 libata: dont request sense data on !ZAC ATA devices
In reply to Greg Kroah-Hartman[ Upstream commit ca156e006add67e4beea7896be395160735e09b0 ]
ZAC support added sense data requesting on error for both ZAC and ATA devices. This seems to cause erratic error handling behaviors on some SSDs where the device reports sense data availability and then delivers the wrong content making EH take the wrong actions. The failure mode was sporadic on a LITE-ON ssd and couldn't be reliably reproduced.
There is no value in requesting sense data from non-ZAC ATA devices while there's a significant risk of introducing EH misbehaviors which are difficult to reproduce and fix. Let's do the sense data dancing only for ZAC devices.
--- drivers/ata/libata-eh.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/ata/libata-eh.c +5 -3
@@ -1535,7 +1535,7 @@ static int ata_eh_read_log_10h(struct ata_device *dev, tf->hob_lbah = buf[10 ]; tf->nsect = buf[12 ]; tf->hob_nsect = buf[13 ]; -if (ata_id_has_ncq_autosense (dev->id)) +if (dev->class ==ATA_DEV_ZAC &&ata_id_has_ncq_autosense (dev->id)) tf->auxiliary = buf[14 ] <<16 | buf[15 ] <<8 | buf[16 ];return 0 ;
@@ -1784,7 +1784,8 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)memcpy (&qc->result_tf, &tf,sizeof (tf)); qc->result_tf.flags =ATA_TFLAG_ISADDR |ATA_TFLAG_LBA |ATA_TFLAG_LBA48 ; qc->err_mask |=AC_ERR_DEV |AC_ERR_NCQ ; -if ((qc->result_tf.command &ATA_SENSE ) || qc->result_tf.auxiliary) { +if (dev->class ==ATA_DEV_ZAC && + ((qc->result_tf.command &ATA_SENSE ) || qc->result_tf.auxiliary)) {char sense_key, asc, ascq; sense_key = (qc->result_tf.auxiliary >>16 ) &0xff ;
@@ -1838,10 +1839,11 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, }switch (qc->dev->class) { -case ATA_DEV_ATA :case ATA_DEV_ZAC :if (stat &ATA_SENSE )ata_eh_request_sense (qc, qc->scsicmd); +/* fall through */ +case ATA_DEV_ATA :if (err &ATA_ICRC ) qc->err_mask |=AC_ERR_ATA_BUS ;if (err & (ATA_UNC |ATA_AMNF ))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 82/293 rslib: Fix decoding of shortened codes
In reply to Greg Kroah-Hartman[ Upstream commit 2034a42d1747fc1e1eeef2c6f1789c4d0762cb9c ]
The decoding of shortenend codes is broken. It only works as expected if there are no erasures.
When decoding with erasures, Lambda (the error and erasure locator polynomial) is initialized from the given erasure positions. The pad parameter is not accounted for by the initialisation code, and hence Lambda is initialized from incorrect erasure positions.
The fix is to adjust the erasure positions by the supplied pad.
--- lib/reed_solomon/decode_rs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/reed_solomon/decode_rs.c +2 -2
@@ -99,9 +99,9 @@if (no_eras >0 ) {/* Init lambda to be the erasure locator polynomial */ lambda[1 ] = alpha_to[rs_modnn (rs, - prim * (nn -1 - eras_pos[0 ]))]; + prim * (nn -1 - (eras_pos[0 ] + pad)))];for (i =1 ; i < no_eras; i++) { - u =rs_modnn (rs, prim * (nn -1 - eras_pos[i])); + u =rs_modnn (rs, prim * (nn -1 - (eras_pos[i] + pad)));for (j = i +1 ; j >0 ; j--) { tmp = index_of[lambda[j -1 ]];if (tmp != nn) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 83/293 rslib: Fix handling of of caller provided syndrome
In reply to Greg Kroah-Hartman[ Upstream commit ef4d6a8556b637ad27c8c2a2cff1dda3da38e9a9 ]
Check if the syndrome provided by the caller is zero, and act accordingly.
--- lib/reed_solomon/decode_rs.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
lib/reed_solomon/decode_rs.c +12 -2
@@ -42,8 +42,18 @@BUG_ON (pad <0 || pad >= nn);/* Does the caller provide the syndrome ? */ -if (s !=NULL ) - goto decode; +if (s !=NULL ) { +for (i =0 ; i < nroots; i++) { +/* The syndrome is in index form, +* so nn represents zero +*/ +if (s[i] != nn) + goto decode; + } + +/* syndrome is zero, no errors to correct */ +return 0 ; + }/* form the syndromes; i.e., evaluate data(x) at roots of * g(x) */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 84/293 ixgbe: Check DDM existence in transceiver before access
In reply to Greg Kroah-Hartman[ Upstream commit 655c91414579d7bb115a4f7898ee726fc18e0984 ]
Some transceivers may comply with SFF-8472 but not implement the Digital Diagnostic Monitoring (DDM) interface described in it. The existence of such area is specified by bit 6 of byte 92, set to 1 if implemented.
Currently, due to not checking this bit ixgbe fails trying to read SFP module's eeprom with the follow message:
ethtool -m enP51p1s0f0
Cannot get Module EEPROM data: Input/output error
Because it fails to read the additional 256 bytes in which it was assumed to exist the DDM data.
This issue was noticed using a Mellanox Passive DAC PN 01FT738. The eeprom data was confirmed by Mellanox as correct and present in other Passive DACs in from other manufacturers.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 3 ++- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +2 -1
@@ -3237,7 +3237,8 @@ static int ixgbe_get_module_info(struct net_device *dev, page_swap = true; } -if (sff8472_rev ==IXGBE_SFF_SFF_8472_UNSUP || page_swap) { +if (sff8472_rev ==IXGBE_SFF_SFF_8472_UNSUP || page_swap || + !(addr_mode &IXGBE_SFF_DDM_IMPLEMENTED )) {/* We have a SFP, but it does not support SFF-8472 */ modinfo->type =ETH_MODULE_SFF_8079 ; modinfo->eeprom_len =ETH_MODULE_SFF_8079_LEN ;
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h +1 -0
@@ -70,6 +70,7 @@#define IXGBE_SFF_SOFT_RS_SELECT_10G 0x8#define IXGBE_SFF_SOFT_RS_SELECT_1G 0x0#define IXGBE_SFF_ADDRESSING_MODE 0x4 +#define IXGBE_SFF_DDM_IMPLEMENTED 0x40#define IXGBE_SFF_QSFP_DA_ACTIVE_CABLE 0x1#define IXGBE_SFF_QSFP_DA_PASSIVE_CABLE 0x8#define IXGBE_SFF_QSFP_CONNECTOR_NOT_SEPARABLE 0x23
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 85/293 crypto: serpent - mark __serpent_setkey_sbox noinline
In reply to Greg Kroah-Hartman[ Upstream commit 473971187d6727609951858c63bf12b0307ef015 ]
The same bug that gcc hit in the past is apparently now showing up with clang, which decides to inline __serpent_setkey_sbox:
crypto/serpent_generic.c:268:5: error: stack frame size of 2112 bytes in function '__serpent_setkey' [-Werror,-Wframe-larger-than=]
Marking it 'noinline' reduces the stack usage from 2112 bytes to 192 and 96 bytes, respectively, and seems to generate more useful object code.
--- crypto/serpent_generic.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
crypto/serpent_generic.c +7 -1
@@ -229,7 +229,13 @@ x4 ^= x2; \ }) -static void __serpent_setkey_sbox (u32 r0,u32 r1,u32 r2,u32 r3,u32 r4,u32 *k) +/* +* both gcc and clang have misoptimized this function in the past, +* producing horrible object code from spilling temporary variables +* on the stack. Forcing this part out of line avoids that. +*/ +static noinline void __serpent_setkey_sbox(u32 r0, u32 r1, u32 r2, +u32 r3,u32 r4,u32 *k) { k +=100 ;S3 (r3, r4, r0, r1, r2);store_and_load_keys (r1, r2, r4, r3,28 ,24 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 86/293 crypto: asymmetric_keys - select CRYPTO_HASH where needed
In reply to Greg Kroah-Hartman[ Upstream commit 90acc0653d2bee203174e66d519fbaaa513502de ]
Build testing with some core crypto options disabled revealed a few modules that are missing CRYPTO_HASH:
crypto/asymmetric_keys/x509_public_key.o: In function `x509_get_sig_params':
x509_public_key.c:(.text+0x4c7): undefined reference to crypto_alloc_shash' x509_public_key.c:(.text+0x5e5): undefined reference to crypto_shash_digest' crypto/asymmetric_keys/pkcs7_verify.o: In function `pkcs7_digest.isra.0':
pkcs7_verify.c:(.text+0xab): undefined reference to crypto_alloc_shash' pkcs7_verify.c:(.text+0x1b2): undefined reference to crypto_shash_digest' pkcs7_verify.c:(.text+0x3c1): undefined reference to crypto_shash_update' pkcs7_verify.c:(.text+0x411): undefined reference to crypto_shash_finup'
This normally doesn't show up in randconfig tests because there is a large number of other options that select CRYPTO_HASH.
--- crypto/asymmetric_keys/Kconfig | 3 +++ 1 file changed, 3 insertions(+)
crypto/asymmetric_keys/Kconfig +3 -0
@@ -15,6 +15,7 @@ config ASYMMETRIC_PUBLIC_KEY_SUBTYPE select MPILIB select CRYPTO_HASH_INFO select CRYPTO_AKCIPHER + select CRYPTO_HASH help This option provides support for asymmetric public key type handling. If signature generation and/or verification are to be used,
@@ -34,6 +35,7 @@ config X509_CERTIFICATE_PARSER config PKCS7_MESSAGE_PARSER tristate "PKCS#7 message parser" depends on X509_CERTIFICATE_PARSER + select CRYPTO_HASH select ASN1 select OID_REGISTRY help
@@ -56,6 +58,7 @@ config SIGNED_PE_FILE_VERIFICATION bool "Support for PE file signature verification" depends on PKCS7_MESSAGE_PARSER=y depends on SYSTEM_DATA_VERIFICATION + select CRYPTO_HASH select ASN1 select OID_REGISTRY help
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 60/293 ipsec: select crypto ciphers for xfrm_algo
In reply to Greg Kroah-Hartman[ Upstream commit 597179b0ba550bd83fab1a9d57c42a9343c58514 ]
kernelci.org reports failed builds on arc because of what looks like an old missed 'select' statement:
net/xfrm/xfrm_algo.o: In function `xfrm_probe_algs':
xfrm_algo.c:(.text+0x1e8): undefined reference to `crypto_has_ahash'
I don't see this in randconfig builds on other architectures, but it's fairly clear we want to select the hash code for it, like we do for all its other users. As Herbert points out, CRYPTO_BLKCIPHER is also required even though it has not popped up in build tests.
--- net/xfrm/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
net/xfrm/Kconfig +2 -0
@@ -14,6 +14,8 @@ config XFRM_ALGO tristate select XFRM select CRYPTO + select CRYPTO_HASH + select CRYPTO_BLKCIPHER config XFRM_USER tristate "Transformation user configuration interface"
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 87/293 EDAC: Fix global-out-of-bounds write when setting edac_mc_poll_msec
In reply to Greg Kroah-Hartman[ Upstream commit d8655e7630dafa88bc37f101640e39c736399771 ]
Commit 9da21b1509d8 ("EDAC: Poll timeout cannot be zero, p2") assumes edac_mc_poll_msec to be unsigned long, but the type of the variable still remained as int. Setting edac_mc_poll_msec can trigger out-of-bounds write.
Reproducer:
# echo 1001 > /sys/module/edac_core/parameters/edac_mc_poll_msec
KASAN report:
BUG: KASAN: global-out-of-bounds in edac_set_poll_msec+0x140/0x150
Write of size 8 at addr ffffffffb91b2d00 by task bash/1996
CPU: 1 PID: 1996 Comm: bash Not tainted 5.2.0-rc6+ #23
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-2.fc30 04/01/2014
Call Trace:
dump_stack+0xca/0x13e
print_address_description.cold+0x5/0x246
__kasan_report.cold+0x75/0x9a
? edac_set_poll_msec+0x140/0x150
kasan_report+0xe/0x20
edac_set_poll_msec+0x140/0x150
? dimmdev_location_show+0x30/0x30
? vfs_lock_file+0xe0/0xe0
? _raw_spin_lock+0x87/0xe0
param_attr_store+0x1b5/0x310
? param_array_set+0x4f0/0x4f0
module_attr_store+0x58/0x80
? module_attr_show+0x80/0x80
sysfs_kf_write+0x13d/0x1a0
kernfs_fop_write+0x2bc/0x460
? sysfs_kf_bin_read+0x270/0x270
? kernfs_notify+0x1f0/0x1f0
__vfs_write+0x81/0x100
vfs_write+0x1e1/0x560
ksys_write+0x126/0x250
? __ia32_sys_read+0xb0/0xb0
? do_syscall_64+0x1f/0x390
do_syscall_64+0xc1/0x390
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fa7caa5e970
Code: 73 01 c3 48 8b 0d 28 d5 2b 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d 99 2d 2c 00 00 75 10 b8 01 00 00 00 04
RSP: 002b:00007fff6acfdfe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007fa7caa5e970
RDX: 0000000000000005 RSI: 0000000000e95c08 RDI: 0000000000000001
RBP: 0000000000e95c08 R08: 00007fa7cad1e760 R09: 00007fa7cb36a700
R10: 0000000000000073 R11: 0000000000000246 R12: 0000000000000005
R13: 0000000000000001 R14: 00007fa7cad1d600 R15: 0000000000000005
The buggy address belongs to the variable:
edac_mc_poll_msec+0x0/0x40
Memory state around the buggy address:
ffffffffb91b2c00: 00 00 00 00 fa fa fa fa 00 00 00 00 fa fa fa fa
ffffffffb91b2c80: 00 00 00 00 fa fa fa fa 00 00 00 00 fa fa fa fa
>ffffffffb91b2d00: 04 fa fa fa fa fa fa fa 04 fa fa fa fa fa fa fa
^
ffffffffb91b2d80: 04 fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
ffffffffb91b2e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00Fix it by changing the type of edac_mc_poll_msec to unsigned int. The reason why this patch adopts unsigned int rather than unsigned long is msecs_to_jiffies() assumes arg to be unsigned int. We can avoid integer conversion bugs and unsigned int will be large enough for edac_mc_poll_msec.
--- drivers/edac/edac_mc_sysfs.c | 16 ++++++++-------- drivers/edac/edac_module.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/edac/edac_mc_sysfs.c +8 -8
@@ -26,7 +26,7 @@static int edac_mc_log_ue =1 ;static int edac_mc_log_ce =1 ;static int edac_mc_panic_on_ue; -static int edac_mc_poll_msec =1000 ; +static unsigned int edac_mc_poll_msec =1000 ;/* Getter functions for above */ int edac_mc_get_log_ue (void )
@@ -45,30 +45,30 @@ int edac_mc_get_panic_on_ue(void) }/* this is temporary */ -int edac_mc_get_poll_msec (void ) +unsigned int edac_mc_get_poll_msec (void ) {return edac_mc_poll_msec; }static int edac_set_poll_msec (const char *val,struct kernel_param *kp) { -unsigned long l; +unsigned int i;int ret;if (!val)return -EINVAL ; - ret =kstrtoul (val,0 , &l); + ret =kstrtouint (val,0 , &i);if (ret)return ret; -if (l <1000 ) +if (i <1000 )return -EINVAL ; - *((unsigned long *)kp->arg) = l; + *((unsigned int *)kp->arg) = i;/* notify edac_mc engine to reset the poll period */ -edac_mc_reset_delay_period (l); +edac_mc_reset_delay_period (i);return 0 ; }
@@ -82,7 +82,7 @@ MODULE_PARM_DESC(edac_mc_log_ue,module_param (edac_mc_log_ce, int,0644 );MODULE_PARM_DESC (edac_mc_log_ce,"Log correctable error to console: 0=off 1=on" ); -module_param_call (edac_mc_poll_msec, edac_set_poll_msec, param_get_int, +module_param_call (edac_mc_poll_msec, edac_set_poll_msec, param_get_uint, &edac_mc_poll_msec,0644 );MODULE_PARM_DESC (edac_mc_poll_msec,"Polling period in milliseconds" );
drivers/edac/edac_module.h +1 -1
@@ -36,7 +36,7 @@ extern int edac_mc_get_log_ue(void);extern int edac_mc_get_log_ce (void );extern int edac_mc_get_panic_on_ue (void );extern int edac_get_poll_msec (void ); -extern int edac_mc_get_poll_msec (void ); +extern unsigned int edac_mc_get_poll_msec (void );unsigned edac_dimm_info_location (struct dimm_info *dimm,char *buf,unsigned len);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 88/293 bcache: check c->gc_thread by IS_ERR_OR_NULL in cache_set_flush()
In reply to Greg Kroah-Hartman[ Upstream commit b387e9b58679c60f5b1e4313939bd4878204fc37 ]
When system memory is in heavy pressure, bch_gc_thread_start() from run_cache_set() may fail due to out of memory. In such condition, c->gc_thread is assigned to -ENOMEM, not NULL pointer. Then in following failure code path bch_cache_set_error(), when cache_set_flush() gets called, the code piece to stop c->gc_thread is broken,
if (!IS_ERR_OR_NULL(c->gc_thread))
kthread_stop(c->gc_thread);And KASAN catches such NULL pointer deference problem, with the warning information:
[ 561.207881] ================================================================== [ 561.207900] BUG: KASAN: null-ptr-deref in kthread_stop+0x3b/0x440 [ 561.207904] Write of size 4 at addr 000000000000001c by task kworker/15:1/313
[ 561.207913] CPU: 15 PID: 313 Comm: kworker/15:1 Tainted: G W 5.0.0-vanilla+ #3 [ 561.207916] Hardware name: Lenovo ThinkSystem SR650 -[7X05CTO1WW]-/-[7X05CTO1WW]-, BIOS -[IVE136T-2.10]- 03/22/2019 [ 561.207935] Workqueue: events cache_set_flush [bcache] [ 561.207940] Call Trace: [ 561.207948] dump_stack+0x9a/0xeb [ 561.207955] ? kthread_stop+0x3b/0x440 [ 561.207960] ? kthread_stop+0x3b/0x440 [ 561.207965] kasan_report+0x176/0x192 [ 561.207973] ? kthread_stop+0x3b/0x440 [ 561.207981] kthread_stop+0x3b/0x440 [ 561.207995] cache_set_flush+0xd4/0x6d0 [bcache] [ 561.208008] process_one_work+0x856/0x1620 [ 561.208015] ? find_held_lock+0x39/0x1d0 [ 561.208028] ? drain_workqueue+0x380/0x380 [ 561.208048] worker_thread+0x87/0xb80 [ 561.208058] ? __kthread_parkme+0xb6/0x180 [ 561.208067] ? process_one_work+0x1620/0x1620 [ 561.208072] kthread+0x326/0x3e0 [ 561.208079] ? kthread_create_worker_on_cpu+0xc0/0xc0 [ 561.208090] ret_from_fork+0x3a/0x50 [ 561.208110] ================================================================== [ 561.208113] Disabling lock debugging due to kernel taint [ 561.208115] irq event stamp: 11800231 [ 561.208126] hardirqs last enabled at (11800231): [<ffffffff83008538>] do_syscall_64+0x18/0x410 [ 561.208127] BUG: unable to handle kernel NULL pointer dereference at 000000000000001c [ 561.208129] #PF error: [WRITE] [ 561.312253] hardirqs last disabled at (11800230): [<ffffffff830052ff>] trace_hardirqs_off_thunk+0x1a/0x1c [ 561.312259] softirqs last enabled at (11799832): [<ffffffff850005c7>] __do_softirq+0x5c7/0x8c3 [ 561.405975] PGD 0 P4D 0 [ 561.442494] softirqs last disabled at (11799821): [<ffffffff831add2c>] irq_exit+0x1ac/0x1e0 [ 561.791359] Oops: 0002 [#1] SMP KASAN NOPTI [ 561.791362] CPU: 15 PID: 313 Comm: kworker/15:1 Tainted: G B W 5.0.0-vanilla+ #3 [ 561.791363] Hardware name: Lenovo ThinkSystem SR650 -[7X05CTO1WW]-/-[7X05CTO1WW]-, BIOS -[IVE136T-2.10]- 03/22/2019 [ 561.791371] Workqueue: events cache_set_flush [bcache] [ 561.791374] RIP: 0010:kthread_stop+0x3b/0x440 [ 561.791376] Code: 00 00 65 8b 05 26 d5 e0 7c 89 c0 48 0f a3 05 ec aa df 02 0f 82 dc 02 00 00 4c 8d 63 20 be 04 00 00 00 4c 89 e7 e8 65 c5 53 00 <f0> ff 43 20 48 8d 7b 24 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 [ 561.791377] RSP: 0018:ffff88872fc8fd10 EFLAGS: 00010286 [ 561.838895] bcache: bch_count_io_errors() nvme0n1: IO error on writing btree. [ 561.838916] bcache: bch_count_io_errors() nvme0n1: IO error on writing btree. [ 561.838934] bcache: bch_count_io_errors() nvme0n1: IO error on writing btree. [ 561.838948] bcache: bch_count_io_errors() nvme0n1: IO error on writing btree. [ 561.838966] bcache: bch_count_io_errors() nvme0n1: IO error on writing btree. [ 561.838979] bcache: bch_count_io_errors() nvme0n1: IO error on writing btree. [ 561.838996] bcache: bch_count_io_errors() nvme0n1: IO error on writing btree. [ 563.067028] RAX: 0000000000000000 RBX: fffffffffffffffc RCX: ffffffff832dd314 [ 563.067030] RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000297 [ 563.067032] RBP: ffff88872fc8fe88 R08: fffffbfff0b8213d R09: fffffbfff0b8213d [ 563.067034] R10: 0000000000000001 R11: fffffbfff0b8213c R12: 000000000000001c [ 563.408618] R13: ffff88dc61cc0f68 R14: ffff888102b94900 R15: ffff88dc61cc0f68 [ 563.408620] FS: 0000000000000000(0000) GS:ffff888f7dc00000(0000) knlGS:0000000000000000 [ 563.408622] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 563.408623] CR2: 000000000000001c CR3: 0000000f48a1a004 CR4: 00000000007606e0 [ 563.408625] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 563.408627] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 563.904795] bcache: bch_count_io_errors() nvme0n1: IO error on writing btree. [ 563.915796] PKRU: 55555554 [ 563.915797] Call Trace: [ 563.915807] cache_set_flush+0xd4/0x6d0 [bcache] [ 563.915812] process_one_work+0x856/0x1620 [ 564.001226] bcache: bch_count_io_errors() nvme0n1: IO error on writing btree. [ 564.033563] ? find_held_lock+0x39/0x1d0 [ 564.033567] ? drain_workqueue+0x380/0x380 [ 564.033574] worker_thread+0x87/0xb80 [ 564.062823] bcache: bch_count_io_errors() nvme0n1: IO error on writing btree. [ 564.118042] ? __kthread_parkme+0xb6/0x180 [ 564.118046] ? process_one_work+0x1620/0x1620 [ 564.118048] kthread+0x326/0x3e0 [ 564.118050] ? kthread_create_worker_on_cpu+0xc0/0xc0 [ 564.167066] bcache: bch_count_io_errors() nvme0n1: IO error on writing btree. [ 564.252441] ret_from_fork+0x3a/0x50 [ 564.252447] Modules linked in: msr rpcrdma sunrpc rdma_ucm ib_iser ib_umad rdma_cm ib_ipoib i40iw configfs iw_cm ib_cm libiscsi scsi_transport_iscsi mlx4_ib ib_uverbs mlx4_en ib_core nls_iso8859_1 nls_cp437 vfat fat intel_rapl skx_edac x86_pkg_temp_thermal coretemp iTCO_wdt iTCO_vendor_support crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel ses raid0 aesni_intel cdc_ether enclosure usbnet ipmi_ssif joydev aes_x86_64 i40e scsi_transport_sas mii bcache md_mod crypto_simd mei_me ioatdma crc64 ptp cryptd pcspkr i2c_i801 mlx4_core glue_helper pps_core mei lpc_ich dca wmi ipmi_si ipmi_devintf nd_pmem dax_pmem nd_btt ipmi_msghandler device_dax pcc_cpufreq button hid_generic usbhid mgag200 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect xhci_pci sysimgblt fb_sys_fops xhci_hcd ttm megaraid_sas drm usbcore nfit libnvdimm sg dm_multipath dm_mod scsi_dh_rdac scsi_dh_emc scsi_dh_alua efivarfs [ 564.299390] bcache: bch_count_io_errors() nvme0n1: IO error on writing btree. [ 564.348360] CR2: 000000000000001c [ 564.348362] ---[ end trace b7f0e5cc7b2103b0 ]---
Therefore, it is not enough to only check whether c->gc_thread is NULL, we should use IS_ERR_OR_NULL() to check both NULL pointer and error value.
This patch changes the above buggy code piece in this way,
if (!IS_ERR_OR_NULL(c->gc_thread))
kthread_stop(c->gc_thread);--- drivers/md/bcache/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/super.c +1 -1
@@ -1402,7 +1402,7 @@ static void cache_set_flush(struct closure *cl)kobject_put (&c->internal);kobject_del (&c->kobj); -if (c->gc_thread) +if (!IS_ERR_OR_NULL (c->gc_thread))kthread_stop (c->gc_thread);if (!IS_ERR_OR_NULL (c->root))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 89/293 net: hns3: fix a -Wformat-nonliteral compile warning
In reply to Greg Kroah-Hartman[ Upstream commit 18d219b783da61a6cc77581f55fc4af2fa16bc36 ]
When setting -Wformat=2, there is a compiler warning like this:
hclge_main.c:xxx:x: warning: format not a string literal and no format arguments [-Wformat-nonliteral]
strs[i].desc);
^~~~
This patch adds missing format parameter "%s" to snprintf() to fix it.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +1 -2
@@ -619,8 +619,7 @@ static u8 *hclge_comm_get_strings(u32 stringset,return buff;for (i =0 ; i < size; i++) { -snprintf (buff,ETH_GSTRING_LEN , - strs[i].desc); +snprintf (buff,ETH_GSTRING_LEN ,"%s" , strs[i].desc); buff = buff +ETH_GSTRING_LEN ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 90/293 net: hns3: add some error checking in hclge_tm module
In reply to Greg Kroah-Hartman[ Upstream commit 04f25edb48c441fc278ecc154c270f16966cbb90 ]
When hdev->tx_sch_mode is HCLGE_FLAG_VNET_BASE_SCH_MODE, the hclge_tm_schd_mode_vnet_base_cfg calls hclge_tm_pri_schd_mode_cfg with vport->vport_id as pri_id, which is used as index for hdev->tm_info.tc_info, it will cause out of bound access issue if vport_id is equal to or larger than HNAE3_MAX_TC.
Also hardware only support maximum speed of HCLGE_ETHER_MAX_RATE.
So this patch adds two checks for above cases.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +5 -1
@@ -57,7 +57,8 @@ static int hclge_shaper_para_calc(u32 ir, u8 shaper_level,u32 tick;/* Calc tick */ -if (shaper_level >=HCLGE_SHAPER_LVL_CNT ) +if (shaper_level >=HCLGE_SHAPER_LVL_CNT || + ir >HCLGE_ETHER_MAX_RATE )return -EINVAL ; tick = tick_array[shaper_level];
@@ -893,6 +894,9 @@ static int hclge_tm_schd_mode_vnet_base_cfg(struct hclge_vport *vport)int ret;u8 i; +if (vport->vport_id >=HNAE3_MAX_TC ) +return -EINVAL ; + ret =hclge_tm_pri_schd_mode_cfg (hdev, vport->vport_id);if (ret)return ret;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 91/293 ath10k: destroy sdio workqueue while remove sdio module
In reply to Greg Kroah-Hartman[ Upstream commit 3ed39f8e747a7aafeec07bb244f2c3a1bdca5730 ]
The workqueue need to flush and destory while remove sdio module, otherwise it will have thread which is not destory after remove sdio modules.
Tested with QCA6174 SDIO with firmware
WLAN.RMH.4.4.1-00007-QCARMSWP-1.
--- drivers/net/wireless/ath/ath10k/sdio.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/ath/ath10k/sdio.c +3 -0
@@ -2076,6 +2076,9 @@ static void ath10k_sdio_remove(struct sdio_func *func)cancel_work_sync (&ar_sdio->wr_async_work);ath10k_core_unregister (ar);ath10k_core_destroy (ar); + +flush_workqueue (ar_sdio->workqueue); +destroy_workqueue (ar_sdio->workqueue); }static const struct sdio_device_id ath10k_sdio_devices[] = {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 92/293 iwlwifi: mvm: Drop large non sta frames
In reply to Greg Kroah-Hartman[ Upstream commit ac70499ee97231a418dc1a4d6c9dc102e8f64631 ]
In some buggy scenarios we could possible attempt to transmit frames larger than maximum MSDU size. Since our devices don't know how to handle this, it may result in asserts, hangs etc.
This can happen, for example, when we receive a large multicast frame and try to transmit it back to the air in AP mode.
Since in a legal scenario this should never happen, drop such frames and warn about it.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +3 -0
@@ -621,6 +621,9 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb)memcpy (&info, skb->cb,sizeof (info)); +if (WARN_ON_ONCE (skb->len >IEEE80211_MAX_DATA_LEN + hdrlen)) +return -1 ; +if (WARN_ON_ONCE (info.flags &IEEE80211_TX_CTL_AMPDU ))return -1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 94/293 net: usb: asix: init MAC address buffers
In reply to Greg Kroah-Hartman[ Upstream commit 78226f6eaac80bf30256a33a4926c194ceefdf36 ]
This is for fixing bug KMSAN: uninit-value in ax88772_bind
Tested by
https://groups.google.com/d/msg/syzkaller-bugs/aFQurGotng4/eB_HlNhhCwAJ
syzbot found the following crash on:
HEAD commit: f75e4cfe kmsan: use kmsan_handle_urb() in urb.c git tree: kmsan console output: https://syzkaller.appspot.com/x/log.txt?x=136d720ea00000
kernel config:
https://syzkaller.appspot.com/x/.config?x=602468164ccdc30a
dashboard link:
https://syzkaller.appspot.com/bug?extid=8a3fc6674bbc3978ed4e
compiler: clang version 9.0.0 (/home/glider/llvm/clang06d00afa61eef8f7f501ebdb4e8612ea43ec2d78)
syz repro:
https://syzkaller.appspot.com/x/repro.syz?x=12788316a00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=120359aaa00000
==================================================================
BUG: KMSAN: uninit-value in is_valid_ether_addr include/linux/etherdevice.h:200 [inline] BUG: KMSAN: uninit-value in asix_set_netdev_dev_addr drivers/net/usb/asix_devices.c:73 [inline] BUG: KMSAN: uninit-value in ax88772_bind+0x93d/0x11e0 drivers/net/usb/asix_devices.c:724 CPU: 0 PID: 3348 Comm: kworker/0:2 Not tainted 5.1.0+ #1 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: usb_hub_wq hub_event Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x191/0x1f0 lib/dump_stack.c:113 kmsan_report+0x130/0x2a0 mm/kmsan/kmsan.c:622 __msan_warning+0x75/0xe0 mm/kmsan/kmsan_instr.c:310 is_valid_ether_addr include/linux/etherdevice.h:200 [inline] asix_set_netdev_dev_addr drivers/net/usb/asix_devices.c:73 [inline] ax88772_bind+0x93d/0x11e0 drivers/net/usb/asix_devices.c:724 usbnet_probe+0x10f5/0x3940 drivers/net/usb/usbnet.c:1728 usb_probe_interface+0xd66/0x1320 drivers/usb/core/driver.c:361 really_probe+0xdae/0x1d80 drivers/base/dd.c:513 driver_probe_device+0x1b3/0x4f0 drivers/base/dd.c:671 __device_attach_driver+0x5b8/0x790 drivers/base/dd.c:778 bus_for_each_drv+0x28e/0x3b0 drivers/base/bus.c:454 __device_attach+0x454/0x730 drivers/base/dd.c:844 device_initial_probe+0x4a/0x60 drivers/base/dd.c:891 bus_probe_device+0x137/0x390 drivers/base/bus.c:514 device_add+0x288d/0x30e0 drivers/base/core.c:2106 usb_set_configuration+0x30dc/0x3750 drivers/usb/core/message.c:2027 generic_probe+0xe7/0x280 drivers/usb/core/generic.c:210 usb_probe_device+0x14c/0x200 drivers/usb/core/driver.c:266 really_probe+0xdae/0x1d80 drivers/base/dd.c:513 driver_probe_device+0x1b3/0x4f0 drivers/base/dd.c:671 __device_attach_driver+0x5b8/0x790 drivers/base/dd.c:778 bus_for_each_drv+0x28e/0x3b0 drivers/base/bus.c:454 __device_attach+0x454/0x730 drivers/base/dd.c:844 device_initial_probe+0x4a/0x60 drivers/base/dd.c:891 bus_probe_device+0x137/0x390 drivers/base/bus.c:514 device_add+0x288d/0x30e0 drivers/base/core.c:2106 usb_new_device+0x23e5/0x2ff0 drivers/usb/core/hub.c:2534 hub_port_connect drivers/usb/core/hub.c:5089 [inline] hub_port_connect_change drivers/usb/core/hub.c:5204 [inline] port_event drivers/usb/core/hub.c:5350 [inline] hub_event+0x48d1/0x7290 drivers/usb/core/hub.c:5432 process_one_work+0x1572/0x1f00 kernel/workqueue.c:2269 process_scheduled_works kernel/workqueue.c:2331 [inline] worker_thread+0x189c/0x2460 kernel/workqueue.c:2417 kthread+0x4b5/0x4f0 kernel/kthread.c:254 ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:355
--- drivers/net/usb/asix_devices.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/usb/asix_devices.c +3 -3
@@ -238,7 +238,7 @@ static void asix_phy_reset(struct usbnet *dev, unsigned int reset_bits)static int ax88172_bind (struct usbnet *dev,struct usb_interface *intf) {int ret =0 ; -u8 buf[ETH_ALEN ]; +u8 buf[ETH_ALEN ] = {0 };int i;unsigned long gpio_bits = dev->driver_info->data;
@@ -689,7 +689,7 @@ static int asix_resume(struct usb_interface *intf)static int ax88772_bind (struct usbnet *dev,struct usb_interface *intf) {int ret, i; -u8 buf[ETH_ALEN ], chipcode =0 ; +u8 buf[ETH_ALEN ] = {0 }, chipcode =0 ;u32 phyid;struct asix_common_private *priv;
@@ -1065,7 +1065,7 @@ static const struct net_device_ops ax88178_netdev_ops = {static int ax88178_bind (struct usbnet *dev,struct usb_interface *intf) {int ret; -u8 buf[ETH_ALEN ]; +u8 buf[ETH_ALEN ] = {0 };usbnet_get_endpoints (dev,intf);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 95/293 gpiolib: Fix references to gpiod_[gs]et_*value_cansleep() variants
In reply to Greg Kroah-Hartman[ Upstream commit 3285170f28a850638794cdfe712eb6d93e51e706 ]
Commit 372e722ea4dd4ca1 ("gpiolib: use descriptors internally") renamed the functions to use a "gpiod" prefix, and commit 79a9becda8940deb ("gpiolib: export descriptor-based GPIO interface") introduced the "raw" variants, but both changes forgot to update the comments.
Readd a similar reference to gpiod_set_value(), which was accidentally removed by commit 1e77fc82110ac36f ("gpio: Add missing open drain/source handling to gpiod_set_value_cansleep()").
--- drivers/gpio/gpiolib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpiolib.c +3 -3
@@ -2480,7 +2480,7 @@ static int _gpiod_get_raw_value(const struct gpio_desc *desc)int gpiod_get_raw_value (const struct gpio_desc *desc) {VALIDATE_DESC (desc); -/* Should be using gpio_get_value_cansleep() */ +/* Should be using gpiod_get_raw_value_cansleep() */ WARN_ON (desc->gdev->chip->can_sleep);return _gpiod_get_raw_value (desc); }
@@ -2501,7 +2501,7 @@ int gpiod_get_value(const struct gpio_desc *desc)int value;VALIDATE_DESC (desc); -/* Should be using gpio_get_value_cansleep() */ +/* Should be using gpiod_get_value_cansleep() */ WARN_ON (desc->gdev->chip->can_sleep); value =_gpiod_get_raw_value (desc);
@@ -2670,7 +2670,7 @@ void gpiod_set_array_value_complex(bool raw, bool can_sleep,void gpiod_set_raw_value (struct gpio_desc *desc,int value) {VALIDATE_DESC_VOID (desc); -/* Should be using gpiod_set_value_cansleep() */ +/* Should be using gpiod_set_raw_value_cansleep() */ WARN_ON (desc->gdev->chip->can_sleep);_gpiod_set_raw_value (desc, value); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 96/293 Bluetooth: hci_bcsp: Fix memory leak in rx_skb
In reply to Greg Kroah-Hartman[ Upstream commit 4ce9146e0370fcd573f0372d9b4e5a211112567c ]
Syzkaller found that it is possible to provoke a memory leak by never freeing rx_skb in struct bcsp_struct.
Fix by freeing in bcsp_close()
--- drivers/bluetooth/hci_bcsp.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/bluetooth/hci_bcsp.c +5 -0
@@ -757,6 +757,11 @@ static int bcsp_close(struct hci_uart *hu)skb_queue_purge (&bcsp->rel);skb_queue_purge (&bcsp->unrel); +if (bcsp->rx_skb) { +kfree_skb (bcsp->rx_skb); + bcsp->rx_skb =NULL ; + } +kfree (bcsp);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 61/293 ipvs: defer hook registration to avoid leaks
In reply to Greg Kroah-Hartman[ Upstream commit cf47a0b882a4e5f6b34c7949d7b293e9287f1972 ]
syzkaller reports for memory leak when registering hooks [1]
As we moved the nf_unregister_net_hooks() call into __ip_vs_dev_cleanup(), defer the nf_register_net_hooks() call, so that hooks are allocated and freed from same pernet_operations (ipvs_core_dev_ops).
[1]
BUG: memory leak
unreferenced object 0xffff88810acd8a80 (size 96):
comm "syz-executor073", pid 7254, jiffies 4294950560 (age 22.250s) hex dump (first 32 bytes):
02 00 00 00 00 00 00 00 50 8b bb 82 ff ff ff ff ........P....... 00 00 00 00 00 00 00 00 00 77 bb 82 ff ff ff ff .........w......
backtrace:
[<0000000013db61f1>] kmemleak_alloc_recursive include/linux/kmemleak.h:55 [inline] [<0000000013db61f1>] slab_post_alloc_hook mm/slab.h:439 [inline] [<0000000013db61f1>] slab_alloc_node mm/slab.c:3269 [inline] [<0000000013db61f1>] kmem_cache_alloc_node_trace+0x15b/0x2a0 mm/slab.c:3597 [<000000001a27307d>] __do_kmalloc_node mm/slab.c:3619 [inline] [<000000001a27307d>] __kmalloc_node+0x38/0x50 mm/slab.c:3627 [<0000000025054add>] kmalloc_node include/linux/slab.h:590 [inline] [<0000000025054add>] kvmalloc_node+0x4a/0xd0 mm/util.c:431 [<0000000050d1bc00>] kvmalloc include/linux/mm.h:637 [inline] [<0000000050d1bc00>] kvzalloc include/linux/mm.h:645 [inline] [<0000000050d1bc00>] allocate_hook_entries_size+0x3b/0x60 net/netfilter/core.c:61 [<00000000e8abe142>] nf_hook_entries_grow+0xae/0x270 net/netfilter/core.c:128 [<000000004b94797c>] __nf_register_net_hook+0x9a/0x170 net/netfilter/core.c:337 [<00000000d1545cbc>] nf_register_net_hook+0x34/0xc0 net/netfilter/core.c:464 [<00000000876c9b55>] nf_register_net_hooks+0x53/0xc0 net/netfilter/core.c:480 [<000000002ea868e0>] __ip_vs_init+0xe8/0x170 net/netfilter/ipvs/ip_vs_core.c:2280 [<000000002eb2d451>] ops_init+0x4c/0x140 net/core/net_namespace.c:130 [<000000000284ec48>] setup_net+0xde/0x230 net/core/net_namespace.c:316 [<00000000a70600fa>] copy_net_ns+0xf0/0x1e0 net/core/net_namespace.c:439 [<00000000ff26c15e>] create_new_namespaces+0x141/0x2a0 kernel/nsproxy.c:107 [<00000000b103dc79>] copy_namespaces+0xa1/0xe0 kernel/nsproxy.c:165 [<000000007cc008a2>] copy_process.part.0+0x11fd/0x2150 kernel/fork.c:2035 [<00000000c344af7c>] copy_process kernel/fork.c:1800 [inline] [<00000000c344af7c>] _do_fork+0x121/0x4f0 kernel/fork.c:2369
--- net/netfilter/ipvs/ip_vs_core.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
net/netfilter/ipvs/ip_vs_core.c +14 -7
@@ -2206,7 +2206,6 @@ static const struct nf_hook_ops ip_vs_ops[] = {static int __net_init __ip_vs_init (struct net *net) {struct netns_ipvs *ipvs; -int ret; ipvs =net_generic (net, ip_vs_net_id);if (ipvs ==NULL )
@@ -2238,17 +2237,11 @@ static int __net_init __ip_vs_init(struct net *net)if (ip_vs_sync_net_init (ipvs) <0 ) goto sync_fail; - ret =nf_register_net_hooks (net, ip_vs_ops,ARRAY_SIZE (ip_vs_ops)); -if (ret <0 ) - goto hook_fail; -return 0 ;/* * Error handling */ -hook_fail: -ip_vs_sync_net_cleanup (ipvs); sync_fail:ip_vs_conn_net_cleanup (ipvs); conn_fail:
@@ -2278,6 +2271,19 @@ static void __net_exit __ip_vs_cleanup(struct net *net) net->ipvs =NULL ; } +static int __net_init __ip_vs_dev_init (struct net *net) +{ +int ret; + + ret =nf_register_net_hooks (net, ip_vs_ops,ARRAY_SIZE (ip_vs_ops)); +if (ret <0 ) + goto hook_fail; +return 0 ; + +hook_fail: +return ret; +} + static void __net_exit __ip_vs_dev_cleanup(struct net *net) {struct netns_ipvs *ipvs =net_ipvs (net);
@@ -2297,6 +2303,7 @@ static struct pernet_operations ipvs_core_ops = { };static struct pernet_operations ipvs_core_dev_ops = { + .init = __ip_vs_dev_init, .exit = __ip_vs_dev_cleanup, };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 97/293 Bluetooth: 6lowpan: search for destination address in all peers
In reply to Greg Kroah-Hartman[ Upstream commit b188b03270b7f8568fc714101ce82fbf5e811c5a ]
Handle overlooked case where the target address is assigned to a peer and neither route nor gateway exist.
For one peer, no checks are performed to see if it is meant to receive packets for a given address.
As soon as there is a second peer however, checks are performed to deal with routes and gateways for handling complex setups with multiple hops to a target address.
This logic assumed that no route and no gateway imply that the destination address can not be reached, which is false in case of a direct peer.
--- net/bluetooth/6lowpan.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/bluetooth/6lowpan.c +10 -4
@@ -187,10 +187,16 @@ static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev, }if (!rt) { - nexthop = &lowpan_cb (skb)->gw; - -if (ipv6_addr_any (nexthop)) -return NULL ; +if (ipv6_addr_any (&lowpan_cb (skb)->gw)) { +/* There is neither route nor gateway, +* probably the destination is a direct peer. +*/ + nexthop = daddr; + }else { +/* There is a known gateway +*/ + nexthop = &lowpan_cb (skb)->gw; + } }else { nexthop =rt6_nexthop (rt, daddr);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 98/293 Bluetooth: Check state in l2cap_disconnect_rsp
In reply to Greg Kroah-Hartman[ Upstream commit 28261da8a26f4915aa257d12d506c6ba179d961f ]
Because of both sides doing L2CAP disconnection at the same time, it was possible to receive L2CAP Disconnection Response with CID that was already freed. That caused problems if CID was already reused and L2CAP Connection Request with same CID was sent out. Before this patch kernel deleted channel context regardless of the state of the channel.
Example where leftover Disconnection Response (frame #402) causes local device to delete L2CAP channel which was not yet connected. This in turn confuses remote device's stack because same CID is re-used without properly disconnecting.
Btmon capture before patch:
** snip **
Quoted 1 line
ACL Data RX: Handle 43 flags
0x02dlen 8 #394 [hci1] 10.748949
Channel: 65 len 4 [PSM 3 mode 0] {chan 2}
RFCOMM: Disconnect (DISC) (0x43)
Address: 0x03 cr 1 dlci 0x00
Control: 0x53 poll/final 1
Length: 0
FCS: 0xfd
< ACL Data TX: Handle 43 flags 0x00 dlen 8 #395 [hci1] 10.749062
Channel: 65 len 4 [PSM 3 mode 0] {chan 2}
RFCOMM: Unnumbered Ack (UA) (0x63)
Address: 0x03 cr 1 dlci 0x00
Control: 0x73 poll/final 1
Length: 0
FCS: 0xd7< ACL Data TX: Handle 43 flags 0x00 dlen 12 #396 [hci1] 10.749073
L2CAP: Disconnection Request (0x06) ident 17 len 4
Destination CID: 65
Source CID: 65
Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 #397 [hci1] 10.752391
Num handles: 1
Handle: 43
Count: 1
Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 #398 [hci1] 10.753394
Num handles: 1
Handle: 43
Count: 1
Quoted 1 line
ACL Data RX: Handle 43 flags
0x02dlen 12 #399 [hci1] 10.756499
L2CAP: Disconnection Request (0x06) ident 26 len 4
Destination CID: 65
Source CID: 65
< ACL Data TX: Handle 43 flags 0x00 dlen 12 #400 [hci1] 10.756548
L2CAP: Disconnection Response (0x07) ident 26 len 4
Destination CID: 65
Source CID: 65
< ACL Data TX: Handle 43 flags 0x00 dlen 12 #401 [hci1] 10.757459
L2CAP: Connection Request (0x02) ident 18 len 4
PSM: 1 (0x0001)
Source CID: 65Quoted 1 line
ACL Data RX: Handle 43 flags
0x02dlen 12 #402 [hci1] 10.759148
L2CAP: Disconnection Response (0x07) ident 17 len 4
Destination CID: 65
Source CID: 65
= bluetoothd: 00:1E:AB:4C:56:54: error updating services: Input/o.. 10.759447
Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 #403 [hci1] 10.759386
Num handles: 1
Handle: 43
Count: 1
Quoted 1 line
ACL Data RX: Handle 43 flags
0x02dlen 12 #404 [hci1] 10.760397
L2CAP: Connection Request (0x02) ident 27 len 4
PSM: 3 (0x0003)
Source CID: 65
< ACL Data TX: Handle 43 flags 0x00 dlen 16 #405 [hci1] 10.760441
L2CAP: Connection Response (0x03) ident 27 len 8
Destination CID: 65
Source CID: 65
Result: Connection successful (0x0000)
Status: No further information available (0x0000)< ACL Data TX: Handle 43 flags 0x00 dlen 27 #406 [hci1] 10.760449
L2CAP: Configure Request (0x04) ident 19 len 19
Destination CID: 65
Flags: 0x0000
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 1013
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Basic (0x00)
TX window size: 0
Max transmit: 0
Retransmission timeout: 0
Monitor timeout: 0
Maximum PDU size: 0
Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 #407 [hci1] 10.761399
Num handles: 1
Handle: 43
Count: 1
Quoted 1 line
ACL Data RX: Handle 43 flags
0x02dlen 16 #408 [hci1] 10.762942
L2CAP: Connection Response (0x03) ident 18 len 8
Destination CID: 66
Source CID: 65
Result: Connection successful (0x0000)
Status: No further information available (0x0000)*snip*
Similar case after the patch:
*snip*
Quoted 1 line
ACL Data RX: Handle 43 flags
0x02dlen 8 #22702 [hci0] 1664.411056
Channel: 65 len 4 [PSM 3 mode 0] {chan 3}
RFCOMM: Disconnect (DISC) (0x43)
Address: 0x03 cr 1 dlci 0x00
Control: 0x53 poll/final 1
Length: 0
FCS: 0xfd
< ACL Data TX: Handle 43 flags 0x00 dlen 8 #22703 [hci0] 1664.411136
Channel: 65 len 4 [PSM 3 mode 0] {chan 3}
RFCOMM: Unnumbered Ack (UA) (0x63)
Address: 0x03 cr 1 dlci 0x00
Control: 0x73 poll/final 1
Length: 0
FCS: 0xd7< ACL Data TX: Handle 43 flags 0x00 dlen 12 #22704 [hci0] 1664.411143
L2CAP: Disconnection Request (0x06) ident 11 len 4
Destination CID: 65
Source CID: 65
Quoted 1 line
HCI Event: Number of Completed Pac.. (
0x13) plen 5 #22705 [hci0] 1664.414009
Num handles: 1
Handle: 43
Count: 1
Quoted 1 line
HCI Event: Number of Completed Pac.. (
0x13) plen 5 #22706 [hci0] 1664.415007
Num handles: 1
Handle: 43
Count: 1
Quoted 1 line
ACL Data RX: Handle 43 flags
0x02dlen 12 #22707 [hci0] 1664.418674
L2CAP: Disconnection Request (0x06) ident 17 len 4
Destination CID: 65
Source CID: 65
< ACL Data TX: Handle 43 flags 0x00 dlen 12 #22708 [hci0] 1664.418762
L2CAP: Disconnection Response (0x07) ident 17 len 4
Destination CID: 65
Source CID: 65
< ACL Data TX: Handle 43 flags 0x00 dlen 12 #22709 [hci0] 1664.421073
L2CAP: Connection Request (0x02) ident 12 len 4
PSM: 1 (0x0001)
Source CID: 65Quoted 1 line
ACL Data RX: Handle 43 flags
0x02dlen 12 #22710 [hci0] 1664.421371
L2CAP: Disconnection Response (0x07) ident 11 len 4
Destination CID: 65
Source CID: 65
Quoted 1 line
HCI Event: Number of Completed Pac.. (
0x13) plen 5 #22711 [hci0] 1664.424082
Num handles: 1
Handle: 43
Count: 1
Quoted 1 line
HCI Event: Number of Completed Pac.. (
0x13) plen 5 #22712 [hci0] 1664.425040
Num handles: 1
Handle: 43
Count: 1
Quoted 1 line
ACL Data RX: Handle 43 flags
0x02dlen 12 #22713 [hci0] 1664.426103
L2CAP: Connection Request (0x02) ident 18 len 4
PSM: 3 (0x0003)
Source CID: 65
< ACL Data TX: Handle 43 flags 0x00 dlen 16 #22714 [hci0] 1664.426186
L2CAP: Connection Response (0x03) ident 18 len 8
Destination CID: 66
Source CID: 65
Result: Connection successful (0x0000)
Status: No further information available (0x0000)< ACL Data TX: Handle 43 flags 0x00 dlen 27 #22715 [hci0] 1664.426196
L2CAP: Configure Request (0x04) ident 13 len 19
Destination CID: 65
Flags: 0x0000
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 1013
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Basic (0x00)
TX window size: 0
Max transmit: 0
Retransmission timeout: 0
Monitor timeout: 0
Maximum PDU size: 0
Quoted 1 line
ACL Data RX: Handle 43 flags
0x02dlen 16 #22716 [hci0] 1664.428804
L2CAP: Connection Response (0x03) ident 12 len 8
Destination CID: 66
Source CID: 65
Result: Connection successful (0x0000)
Status: No further information available (0x0000)*snip*
Fix is to check that channel is in state BT_DISCONN before deleting the channel.
This bug was found while fuzzing Bluez's OBEX implementation using Synopsys Defensics.
--- net/bluetooth/l2cap_core.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/bluetooth/l2cap_core.c +6 -0
@@ -4384,6 +4384,12 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn,l2cap_chan_lock (chan); +if (chan->state !=BT_DISCONN ) { +l2cap_chan_unlock (chan); +mutex_unlock (&conn->chan_lock); +return 0 ; + } +l2cap_chan_hold (chan);l2cap_chan_del (chan,0 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 62/293 media: s5p-mfc: Make additional clocks optional
In reply to Greg Kroah-Hartman[ Upstream commit e08efef8fe7db87206314c19b341612c719f891a ]
Since the beginning the second clock ('special', 'sclk') was optional and it is not available on some variants of Exynos SoCs (i.e. Exynos5420 with v7 of MFC hardware).
However commit 1bce6fb3edf1 ("[media] s5p-mfc: Rework clock handling") made handling of all specified clocks mandatory. This patch restores original behavior of the driver and fixes its operation on Exynos5420 SoCs.
--- drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/media/platform/s5p-mfc/s5p_mfc_pm.c +5 -0
@@ -38,6 +38,11 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev)for (i =0 ; i < pm->num_clocks; i++) { pm->clocks[i] =devm_clk_get (pm->device, pm->clk_names[i]);if (IS_ERR (pm->clocks[i])) { +/* additional clocks are optional */ +if (i &&PTR_ERR (pm->clocks[i]) == -ENOENT ) { + pm->clocks[i] =NULL ; +continue ; + }mfc_err ("Failed to get clock: %s\n" , pm->clk_names[i]);return PTR_ERR (pm->clocks[i]);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 63/293 media: i2c: fix warning same module names
In reply to Greg Kroah-Hartman[ Upstream commit b2ce5617dad254230551feda3599f2cc68e53ad8 ]
When building with CONFIG_VIDEO_ADV7511 and CONFIG_DRM_I2C_ADV7511 enabled as loadable modules, we see the following warning:
drivers/gpu/drm/bridge/adv7511/adv7511.ko
drivers/media/i2c/adv7511.ko
Rework so that the file is named adv7511-v4l2.c.
---
drivers/media/i2c/Makefile | 2 +-
drivers/media/i2c/{adv7511.c => adv7511-v4l2.c} | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
rename drivers/media/i2c/{adv7511.c => adv7511-v4l2.c} (99%)drivers/media/i2c/Makefile +1 -1
@@ -33,7 +33,7 @@ obj-$(CONFIG_VIDEO_ADV748X) += adv748x/ obj-$(CONFIG_VIDEO_ADV7604) += adv7604.o obj-$(CONFIG_VIDEO_ADV7842) += adv7842.o obj-$(CONFIG_VIDEO_AD9389B) += ad9389b.o -obj-$(CONFIG_VIDEO_ADV7511) += adv7511.o +obj-$(CONFIG_VIDEO_ADV7511) += adv7511-v4l2.o obj-$(CONFIG_VIDEO_VPX3220) += vpx3220.o obj-$(CONFIG_VIDEO_VS6624) += vs6624.o obj-$(CONFIG_VIDEO_BT819) += bt819.o
drivers/media/i2c/adv7511-v4l2.c renamed from drivers/media/i2c/adv7511.c +5 -0
@@ -17,6 +17,11 @@* SOFTWARE. */ +/* +* This file is named adv7511-v4l2.c so it doesn't conflict with the Analog +* Device ADV7511 (config fragment CONFIG_DRM_I2C_ADV7511). +*/ +#include <linux/kernel.h> #include <linux/module.h>
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 64/293 ntp: Limit TAI-UTC offset
In reply to Greg Kroah-Hartman[ Upstream commit d897a4ab11dc8a9fda50d2eccc081a96a6385998 ]
Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 100000 seconds.
This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting too far ahead of the CLOCK_REALTIME clock, and it is still large enough to allow leap seconds to be inserted at the maximum rate currently supported by the kernel (once per day) for the next ~270 years, however unlikely it is that someone can survive a catastrophic event which slowed down the rotation of the Earth so much.
--- kernel/time/ntp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/time/ntp.c +3 -1
@@ -43,6 +43,7 @@ static u64 tick_length_base;#define MAX_TICKADJ 500LL/* usecs */ #define MAX_TICKADJ_SCALED \ (((MAX_TICKADJ * NSEC_PER_USEC) << NTP_SCALE_SHIFT) / NTP_INTERVAL_FREQ) +#define MAX_TAI_OFFSET 100000/* * phase-lock loop variables
@@ -640,7 +641,8 @@ static inline void process_adjtimex_modes(struct timex *txc, time_constant =max (time_constant,0l ); } -if (txc->modes &ADJ_TAI && txc->constant >=0 ) +if (txc->modes &ADJ_TAI && + txc->constant >=0 && txc->constant <=MAX_TAI_OFFSET ) *time_tai = txc->constant;if (txc->modes &ADJ_OFFSET )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 65/293 timer_list: Guard procfs specific code
In reply to Greg Kroah-Hartman[ Upstream commit a9314773a91a1d3b36270085246a6715a326ff00 ]
With CONFIG_PROC_FS=n the following warning is emitted:
kernel/time/timer_list.c:361:36: warning: unused variable 'timer_list_sops' [-Wunused-const-variable]
static const struct seq_operations timer_list_sops = {
Add #ifdef guard around procfs specific code.
--- kernel/time/timer_list.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-)
kernel/time/timer_list.c +19 -17
@@ -289,23 +289,6 @@ static inline void timer_list_header(struct seq_file *m, u64 now)SEQ_printf (m,"\n" ); } -static int timer_list_show (struct seq_file *m,void *v) -{ -struct timer_list_iter *iter = v; - -if (iter->cpu ==-1 && !iter->second_pass) -timer_list_header (m, iter->now); -else if (!iter->second_pass) -print_cpu (m, iter->cpu, iter->now); -#ifdef CONFIG_GENERIC_CLOCKEVENTS - else if (iter->cpu == -1 && iter->second_pass) - timer_list_show_tickdevices_header(m); - else - print_tickdevice(m, tick_get_device(iter->cpu), iter->cpu); -#endif -return 0 ; -} -void sysrq_timer_list_show (void ) {u64 now =ktime_to_ns (ktime_get ());
@@ -324,6 +307,24 @@ void sysrq_timer_list_show(void)return ; } +#ifdef CONFIG_PROC_FS +static int timer_list_show (struct seq_file *m,void *v) +{ +struct timer_list_iter *iter = v; + +if (iter->cpu ==-1 && !iter->second_pass) +timer_list_header (m, iter->now); +else if (!iter->second_pass) +print_cpu (m, iter->cpu, iter->now); +#ifdef CONFIG_GENERIC_CLOCKEVENTS + else if (iter->cpu == -1 && iter->second_pass) + timer_list_show_tickdevices_header(m); + else + print_tickdevice(m, tick_get_device(iter->cpu), iter->cpu); +#endif +return 0 ; +} +static void *move_iter (struct timer_list_iter *iter,loff_t offset) {for (; offset; offset--) {
@@ -395,3 +396,4 @@ static int __init init_timer_list_procfs(void) return 0; }__initcall (init_timer_list_procfs); +#endif
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 100/293 Bluetooth: validate BLE connection interval updates
In reply to Greg Kroah-Hartman[ Upstream commit c49a8682fc5d298d44e8d911f4fa14690ea9485e ]
Problem: The Linux Bluetooth stack yields complete control over the BLE connection interval to the remote device.
The Linux Bluetooth stack provides access to the BLE connection interval min and max values through /sys/kernel/debug/bluetooth/hci0/ conn_min_interval and /sys/kernel/debug/bluetooth/hci0/conn_max_interval. These values are used for initial BLE connections, but the remote device has the ability to request a connection parameter update. In the event that the remote side requests to change the connection interval, the Linux kernel currently only validates that the desired value is within the acceptable range in the Bluetooth specification (6 - 3200, corresponding to 7.5ms - 4000ms). There is currently no validation that the desired value requested by the remote device is within the min/max limits specified in the conn_min_interval/conn_max_interval configurations. This essentially leads to Linux yielding complete control over the connection interval to the remote device.
The proposed patch adds a verification step to the connection parameter update mechanism, ensuring that the desired value is within the min/max bounds of the current connection. If the desired value is outside of the current connection min/max values, then the connection parameter update request is rejected and the negative response is returned to the remote device. Recall that the initial connection is established using the local conn_min_interval/conn_max_interval values, so this allows the Linux administrator to retain control over the BLE connection interval.
The one downside that I see is that the current default Linux values for conn_min_interval and conn_max_interval typically correspond to 30ms and 50ms respectively. If this change were accepted, then it is feasible that some devices would no longer be able to negotiate to their desired connection interval values. This might be remedied by setting the default Linux conn_min_interval and conn_max_interval values to the widest supported range (6 - 3200 / 7.5ms - 4000ms). This could lead to the same behavior as the current implementation, where the remote device could request to change the connection interval value to any value that is permitted by the Bluetooth specification, and Linux would accept the desired value.
--- net/bluetooth/hci_event.c | 5 +++++ net/bluetooth/l2cap_core.c | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
net/bluetooth/hci_event.c +5 -0
@@ -5089,6 +5089,11 @@ static void hci_le_remote_conn_param_req_evt(struct hci_dev *hdev,return send_conn_param_neg_reply (hdev, handle,HCI_ERROR_UNKNOWN_CONN_ID ); +if (min < hcon->le_conn_min_interval || + max > hcon->le_conn_max_interval) +return send_conn_param_neg_reply (hdev, handle, +HCI_ERROR_INVALID_LL_PARAMS ); +if (hci_check_conn_params (min, max, latency, timeout))return send_conn_param_neg_reply (hdev, handle,HCI_ERROR_INVALID_LL_PARAMS );
net/bluetooth/l2cap_core.c +8 -1
@@ -5287,7 +5287,14 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,memset (&rsp,0 ,sizeof (rsp)); - err =hci_check_conn_params (min, max, latency, to_multiplier); +if (min < hcon->le_conn_min_interval || + max > hcon->le_conn_max_interval) { +BT_DBG ("requested connection interval exceeds current bounds." ); + err = -EINVAL ; + }else { + err =hci_check_conn_params (min, max, latency, to_multiplier); + } +if (err) rsp.result =cpu_to_le16 (L2CAP_CONN_PARAM_REJECTED );else
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 109/293 floppy: fix invalid pointer dereference in drive_name
In reply to Greg Kroah-Hartman[ Upstream commit 9b04609b784027968348796a18f601aed9db3789 ]
This fixes the invalid pointer dereference in the drive_name function of the floppy driver.
The native_format field of the struct floppy_drive_params is used as floppy_type array index in the drive_name function. Thus, the field should be checked the same way as the autodetect field.
To trigger the bug, one could use a value out of range and set the drive parameters with the FDSETDRVPRM ioctl. Next, FDGETDRVTYP ioctl should be used to call the drive_name. A floppy disk is not required to be inserted.
CAP_SYS_ADMIN is required to call FDSETDRVPRM.
The patch adds the check for a value of the native_format field to be in the '0 <= x < ARRAY_SIZE(floppy_type)' range of the floppy_type array indices.
The bug was found by syzkaller.
--- drivers/block/floppy.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/block/floppy.c +8 -3
@@ -3386,7 +3386,8 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo)return 0 ; } -static bool valid_floppy_drive_params (const short autodetect[8 ]) +static bool valid_floppy_drive_params (const short autodetect[8 ], +int native_format) {size_t floppy_type_size =ARRAY_SIZE (floppy_type);size_t i =0 ;
@@ -3397,6 +3398,9 @@ static bool valid_floppy_drive_params(const short autodetect[8])return false; } +if (native_format <0 || native_format >= floppy_type_size) +return false; +return true; }
@@ -3526,7 +3530,8 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned intSUPBOUND (size,strlen ((const char *)outparam) +1 );break ;case FDSETDRVPRM : -if (!valid_floppy_drive_params (inparam.dp.autodetect)) +if (!valid_floppy_drive_params (inparam.dp.autodetect, + inparam.dp.native_format))return -EINVAL ; *UDP = inparam.dp;break ;
@@ -3725,7 +3730,7 @@ static int compat_setdrvprm(int drive,return -EPERM ;if (copy_from_user (&v, arg,sizeof (struct compat_floppy_drive_params )))return -EFAULT ; -if (!valid_floppy_drive_params (v.autodetect)) +if (!valid_floppy_drive_params (v.autodetect, v.native_format))return -EINVAL ;mutex_lock (&floppy_mutex);UDP ->cmos = v.cmos;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 110/293 floppy: fix out-of-bounds read in copy_buffer
In reply to Greg Kroah-Hartman[ Upstream commit da99466ac243f15fbba65bd261bfc75ffa1532b6 ]
This fixes a global out-of-bounds read access in the copy_buffer function of the floppy driver.
The FDDEFPRM ioctl allows one to set the geometry of a disk. The sect and head fields (unsigned int) of the floppy_drive structure are used to compute the max_sector (int) in the make_raw_rw_request function. It is possible to overflow the max_sector. Next, max_sector is passed to the copy_buffer function and used in one of the memcpy calls.
An unprivileged user could trigger the bug if the device is accessible, but requires a floppy disk to be inserted.
The patch adds the check for the .sect * .head multiplication for not overflowing in the set_geometry function.
The bug was found by syzkaller.
--- drivers/block/floppy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/block/floppy.c +4 -2
@@ -3239,8 +3239,10 @@ static int set_geometry(unsigned int cmd, struct floppy_struct *g,int cnt;/* sanity checking for parameters. */ - if (g->sect <= 0 || - g->head <= 0 || + if ((int)g->sect <= 0 || + (int)g->head <= 0 || + /* check for overflow in max_sector */ + (int)(g->sect * g->head) <= 0 || /* check for zero in F_SECT_PER_TRACK */ (unsigned char)((g->sect << 2) >> FD_SIZECODE(g)) == 0 || g->track <= 0 || g->track > UDP->tracks >> STRETCH(g) ||
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 112/293 scsi: NCR5380: Reduce goto statements in NCR5380_select()
In reply to Greg Kroah-HartmanFrom: Finn Thain <[email protected]>
commit 6a162836997c10bbefb7c7ca772201cc45c0e4a6 upstream.
Replace a 'goto' statement with a simple 'return' where possible. This improves readability. No functional change.
--- drivers/scsi/NCR5380.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/scsi/NCR5380.c +12 -9
@@ -984,7 +984,7 @@ static struct scsi_cmnd *NCR5380_select(if (!hostdata->selecting) {/* Command was aborted */ NCR5380_write (MODE_REG ,MR_BASE ); - goto out; +return NULL ; }if (err <0 ) {NCR5380_write (MODE_REG ,MR_BASE );
@@ -1033,7 +1033,7 @@ static struct scsi_cmnd *NCR5380_select(if (!hostdata->selecting) {NCR5380_write (MODE_REG ,MR_BASE );NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); - goto out; +return NULL ; }dsprintk (NDEBUG_ARBITRATION , instance,"won arbitration\n" );
@@ -1116,13 +1116,16 @@ static struct scsi_cmnd *NCR5380_select(spin_lock_irq (&hostdata->lock);NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE );NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask); +/* Can't touch cmd if it has been reclaimed by the scsi ML */ -if (hostdata->selecting) { - cmd->result =DID_BAD_TARGET <<16 ; -complete_cmd (instance, cmd); -dsprintk (NDEBUG_SELECTION , instance,"target did not respond within 250ms\n" ); - cmd =NULL ; - } +if (!hostdata->selecting) +return NULL ; + + cmd->result =DID_BAD_TARGET <<16 ; +complete_cmd (instance, cmd); +dsprintk (NDEBUG_SELECTION , instance, +"target did not respond within 250ms\n" ); + cmd =NULL ; goto out; }
@@ -1155,7 +1158,7 @@ static struct scsi_cmnd *NCR5380_select( }if (!hostdata->selecting) {do_abort (instance); - goto out; +return NULL ; } dsprintk(NDEBUG_SELECTION, instance, "target %d selected, going into MESSAGE OUT phase.\n",
Greg Kroah-Hartman
maintainerPATCH 113/293 scsi: NCR5380: Always re-enable reselection interrupt
In reply to Greg Kroah-HartmanFrom: Finn Thain <[email protected]>
commit 57f31326518e98ee4cabf9a04efe00ed57c54147 upstream.
The reselection interrupt gets disabled during selection and must be re-enabled when hostdata->connected becomes NULL. If it isn't re-enabled a disconnected command may time-out or the target may wedge the bus while trying to reselect the host. This can happen after a command is aborted.
Fix this by enabling the reselection interrupt in NCR5380_main() after calls to NCR5380_select() and NCR5380_information_transfer() return.
--- drivers/scsi/NCR5380.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/scsi/NCR5380.c +2 -10
@@ -710,6 +710,8 @@ static void NCR5380_main(struct work_strNCR5380_information_transfer (instance); done =0 ; } +if (!hostdata->connected) +NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask);spin_unlock_irq (&hostdata->lock);if (!done)cond_resched ();
@@ -1106,8 +1108,6 @@ static struct scsi_cmnd *NCR5380_select(spin_lock_irq (&hostdata->lock);NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE );NCR5380_reselect (instance); -if (!hostdata->connected) -NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask);shost_printk (KERN_ERR , instance,"reselection after won arbitration?\n" ); goto out; }
@@ -1115,7 +1115,6 @@ static struct scsi_cmnd *NCR5380_select(if (err <0 ) {spin_lock_irq (&hostdata->lock);NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); -NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask);/* Can't touch cmd if it has been reclaimed by the scsi ML */ if (!hostdata->selecting)
@@ -1153,7 +1152,6 @@ static struct scsi_cmnd *NCR5380_select(if (err <0 ) {shost_printk (KERN_ERR , instance,"select: REQ timeout\n" );NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); -NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask); goto out; }if (!hostdata->selecting) {
@@ -1820,9 +1818,6 @@ static void NCR5380_information_transfer*/ NCR5380_write (TARGET_COMMAND_REG ,0 ); -/* Enable reselect interrupts */ -NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask); -maybe_release_dma_irq (instance);return ;case MESSAGE_REJECT :
@@ -1854,8 +1849,6 @@ static void NCR5380_information_transfer*/ NCR5380_write (TARGET_COMMAND_REG ,0 ); -/* Enable reselect interrupts */ -NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask);#ifdef SUN3_SCSI_VME dregs->csr |=CSR_DMA_ENABLE ;#endif
@@ -1963,7 +1956,6 @@ static void NCR5380_information_transfer cmd->result =DID_ERROR <<16 ;complete_cmd (instance, cmd);maybe_release_dma_irq (instance); -NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask);return ; } msgout =NOP ;
Greg Kroah-Hartman
maintainerPATCH 115/293 scsi: core: Fix race on creating sense cache
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
commit f9b0530fa02e0c73f31a49ef743e8f44eb8e32cc upstream.
When scsi_init_sense_cache(host) is called concurrently from different hosts, each code path may find that no cache has been created and allocate a new one. The lack of locking can lead to potentially overriding a cache allocated by a different host.
Fix the issue by moving 'mutex_lock(&scsi_sense_cache_mutex)' before scsi_select_sense_cache().
--- drivers/scsi/scsi_lib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/scsi_lib.c +3 -3
@@ -71,11 +71,11 @@ int scsi_init_sense_cache(struct Scsi_Hostruct kmem_cache *cache;int ret =0 ; +mutex_lock (&scsi_sense_cache_mutex); cache =scsi_select_sense_cache (shost->unchecked_isa_dma);if (cache) -return 0 ; + goto exit; -mutex_lock (&scsi_sense_cache_mutex);if (shost->unchecked_isa_dma) { scsi_sense_isadma_cache = kmem_cache_create("scsi_sense_cache(DMA)",
@@ -90,7 +90,7 @@ int scsi_init_sense_cache(struct Scsi_Hoif (!scsi_sense_cache) ret = -ENOMEM ; } - + exit:mutex_unlock (&scsi_sense_cache_mutex);return ret; }
Greg Kroah-Hartman
maintainerPATCH 114/293 Revert "scsi: ncr5380: Increase register polling limit"
In reply to Greg Kroah-HartmanFrom: Finn Thain <[email protected]>
commit 25fcf94a2fa89dd3e73e965ebb0b38a2a4f72aa4 upstream.
This reverts commit 4822827a69d7cd3bc5a07b7637484ebd2cf88db6.
The purpose of that commit was to suppress a timeout warning message which appeared to be caused by target latency. But suppressing the warning is undesirable as the warning may indicate a messed up transfer count.
Another problem with that commit is that 15 ms is too long to keep interrupts disabled as interrupt latency can cause system clock drift and other problems.
--- drivers/scsi/NCR5380.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/NCR5380.h +1 -1
@@ -235,7 +235,7 @@ struct NCR5380_cmd {#define NCR5380_PIO_CHUNK_SIZE 256/* Time limit (ms) to poll registers when IRQs are disabled, e.g. during PDMA */ -#define NCR5380_REG_POLL_TIME 15 +#define NCR5380_REG_POLL_TIME 10static inline struct scsi_cmnd *NCR5380_to_scmd (struct NCR5380_cmd *ncmd_ptr) {
Greg Kroah-Hartman
maintainerPATCH 116/293 scsi: megaraid_sas: Fix calculation of target ID
In reply to Greg Kroah-HartmanFrom: Shivasharan S <[email protected]>
commit c8f96df5b8e633056b7ebf5d52a9d6fb1b156ce3 upstream.
In megasas_get_target_prop(), driver is incorrectly calculating the target ID for devices with channel 1 and 3. Due to this, firmware will either fail the command (if there is no device with the target id sent from driver) or could return the properties for a target which was not intended. Devices could end up with the wrong queue depth due to this.
Fix target id calculation for channel 1 and 3.
--- drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/megaraid/megaraid_sas_base.c +2 -1
@@ -5806,7 +5806,8 @@ megasas_get_target_prop(struct megasas_iint ret;struct megasas_cmd *cmd;struct megasas_dcmd_frame *dcmd; -u16 targetId = (sdev->channel %2 ) + sdev->id; +u16 targetId = ((sdev->channel %2 ) *MEGASAS_MAX_DEV_PER_CHANNEL ) + + sdev->id; cmd =megasas_get_cmd (instance);
Greg Kroah-Hartman
maintainerPATCH 118/293 scsi: mac_scsi: Fix pseudo DMA implementation, take 2
In reply to Greg Kroah-HartmanFrom: Finn Thain <[email protected]>
commit 78ff751f8e6a9446e9fb26b2bff0b8d3f8974cbd upstream.
A system bus error during a PDMA transfer can mess up the calculation of the transfer residual (the PDMA handshaking hardware lacks a byte counter). This results in data corruption.
The algorithm in this patch anticipates a bus error by starting each transfer with a MOVE.B instruction. If a bus error is caught the transfer will be retried. If a bus error is caught later in the transfer (for a MOVE.W instruction) the transfer gets failed and subsequent requests for that target will use PIO instead of PDMA.
This avoids the "!REQ and !ACK" error so the severity level of that message is reduced to KERN_DEBUG.
--- drivers/scsi/mac_scsi.c | 369 ++++++++++++++++++++++++++++-------------------- 1 file changed, 217 insertions(+), 152 deletions(-)
drivers/scsi/mac_scsi.c +217 -152
@@ -3,6 +3,8 @@* * Copyright 1998, Michael Schmitz <[email protected]> * +* Copyright 2019 Finn Thain +* * derived in part from: */ /*
@@ -11,6 +13,7 @@* Copyright 1995, Russell King */ +#include <linux/delay.h> #include <linux/types.h> #include <linux/module.h> #include <linux/ioport.h>
@@ -89,101 +92,217 @@ static int __init mac_scsi_setup(char *s__setup ("mac5380=" , mac_scsi_setup);#endif /* !MODULE */ -/* Pseudo DMA asm originally by Ove Edlund */ +/* +* According to "Inside Macintosh: Devices", Mac OS requires disk drivers to +* specify the number of bytes between the delays expected from a SCSI target. +* This allows the operating system to "prevent bus errors when a target fails +* to deliver the next byte within the processor bus error timeout period." +* Linux SCSI drivers lack knowledge of the timing behaviour of SCSI targets +* so bus errors are unavoidable. +* +* If a MOVE.B instruction faults, we assume that zero bytes were transferred +* and simply retry. That assumption probably depends on target behaviour but +* seems to hold up okay. The NOP provides synchronization: without it the +* fault can sometimes occur after the program counter has moved past the +* offending instruction. Post-increment addressing can't be used. +*/ + +#define MOVE_BYTE (operands) \ + asm volatile ( \ + "1: moveb " operands " \n" \ + "11: nop \n" \ + " addq #1,%0 \n" \ + " subq #1,%1 \n" \ + "40: \n" \ + " \n" \ + ".section .fixup,\"ax\" \n" \ + ".even \n" \ + "90: movel #1, %2 \n" \ + " jra 40b \n" \ + ".previous \n" \ + " \n" \ + ".section __ex_table,\"a\" \n" \ + ".align 4 \n" \ + ".long 1b,90b \n" \ + ".long 11b,90b \n" \ + ".previous \n" \ + : "+a" (addr), "+r" (n), "+r" (result) : "a" (io)) -#define CP_IO_TO_MEM (s,d,n) \ -__asm__ __volatile__ \ - (" cmp.w #4,%2\n" \ - " bls 8f\n" \ - " move.w %1,%%d0\n" \ - " neg.b %%d0\n" \ - " and.w #3,%%d0\n" \ - " sub.w %%d0,%2\n" \ - " bra 2f\n" \ - " 1: move.b (%0),(%1)+\n" \ - " 2: dbf %%d0,1b\n" \ - " move.w %2,%%d0\n" \ - " lsr.w #5,%%d0\n" \ - " bra 4f\n" \ - " 3: move.l (%0),(%1)+\n" \ - "31: move.l (%0),(%1)+\n" \ - "32: move.l (%0),(%1)+\n" \ - "33: move.l (%0),(%1)+\n" \ - "34: move.l (%0),(%1)+\n" \ - "35: move.l (%0),(%1)+\n" \ - "36: move.l (%0),(%1)+\n" \ - "37: move.l (%0),(%1)+\n" \ - " 4: dbf %%d0,3b\n" \ - " move.w %2,%%d0\n" \ - " lsr.w #2,%%d0\n" \ - " and.w #7,%%d0\n" \ - " bra 6f\n" \ - " 5: move.l (%0),(%1)+\n" \ - " 6: dbf %%d0,5b\n" \ - " and.w #3,%2\n" \ - " bra 8f\n" \ - " 7: move.b (%0),(%1)+\n" \ - " 8: dbf %2,7b\n" \ - " moveq.l #0, %2\n" \ - " 9: \n" \ - ".section .fixup,\"ax\"\n" \ - " .even\n" \ - "91: moveq.l #1, %2\n" \ - " jra 9b\n" \ - "94: moveq.l #4, %2\n" \ - " jra 9b\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .align 4\n" \ - " .long 1b,91b\n" \ - " .long 3b,94b\n" \ - " .long 31b,94b\n" \ - " .long 32b,94b\n" \ - " .long 33b,94b\n" \ - " .long 34b,94b\n" \ - " .long 35b,94b\n" \ - " .long 36b,94b\n" \ - " .long 37b,94b\n" \ - " .long 5b,94b\n" \ - " .long 7b,91b\n" \ - ".previous" \ - : "=a"(s), "=a"(d), "=d"(n) \ - : "0"(s), "1"(d), "2"(n) \ - : "d0") +/* +* If a MOVE.W (or MOVE.L) instruction faults, it cannot be retried because +* the residual byte count would be uncertain. In that situation the MOVE_WORD +* macro clears n in the fixup section to abort the transfer. +*/ + +#define MOVE_WORD (operands) \ + asm volatile ( \ + "1: movew " operands " \n" \ + "11: nop \n" \ + " subq #2,%1 \n" \ + "40: \n" \ + " \n" \ + ".section .fixup,\"ax\" \n" \ + ".even \n" \ + "90: movel #0, %1 \n" \ + " movel #2, %2 \n" \ + " jra 40b \n" \ + ".previous \n" \ + " \n" \ + ".section __ex_table,\"a\" \n" \ + ".align 4 \n" \ + ".long 1b,90b \n" \ + ".long 11b,90b \n" \ + ".previous \n" \ + : "+a" (addr), "+r" (n), "+r" (result) : "a" (io)) + +#define MOVE_16_WORDS (operands) \ + asm volatile ( \ + "1: movew " operands " \n" \ + "2: movew " operands " \n" \ + "3: movew " operands " \n" \ + "4: movew " operands " \n" \ + "5: movew " operands " \n" \ + "6: movew " operands " \n" \ + "7: movew " operands " \n" \ + "8: movew " operands " \n" \ + "9: movew " operands " \n" \ + "10: movew " operands " \n" \ + "11: movew " operands " \n" \ + "12: movew " operands " \n" \ + "13: movew " operands " \n" \ + "14: movew " operands " \n" \ + "15: movew " operands " \n" \ + "16: movew " operands " \n" \ + "17: nop \n" \ + " subl #32,%1 \n" \ + "40: \n" \ + " \n" \ + ".section .fixup,\"ax\" \n" \ + ".even \n" \ + "90: movel #0, %1 \n" \ + " movel #2, %2 \n" \ + " jra 40b \n" \ + ".previous \n" \ + " \n" \ + ".section __ex_table,\"a\" \n" \ + ".align 4 \n" \ + ".long 1b,90b \n" \ + ".long 2b,90b \n" \ + ".long 3b,90b \n" \ + ".long 4b,90b \n" \ + ".long 5b,90b \n" \ + ".long 6b,90b \n" \ + ".long 7b,90b \n" \ + ".long 8b,90b \n" \ + ".long 9b,90b \n" \ + ".long 10b,90b \n" \ + ".long 11b,90b \n" \ + ".long 12b,90b \n" \ + ".long 13b,90b \n" \ + ".long 14b,90b \n" \ + ".long 15b,90b \n" \ + ".long 16b,90b \n" \ + ".long 17b,90b \n" \ + ".previous \n" \ + : "+a" (addr), "+r" (n), "+r" (result) : "a" (io)) + +#define MAC_PDMA_DELAY 32 + +static inline int mac_pdma_recv (void __iomem *io,unsigned char *start,int n) +{ +unsigned char *addr = start; +int result =0 ; + +if (n >=1 ) { +MOVE_BYTE ("%3@,%0@" ); +if (result) + goto out; + } +if (n >=1 && ((unsigned long )addr &1 )) { +MOVE_BYTE ("%3@,%0@" ); +if (result) + goto out; + } +while (n >=32 ) +MOVE_16_WORDS ("%3@,%0@+" ); +while (n >=2 ) +MOVE_WORD ("%3@,%0@+" ); +if (result) +return start - addr;/* Negated to indicate uncertain length */ +if (n ==1 ) +MOVE_BYTE ("%3@,%0@" ); +out: +return addr - start; +} + +static inline int mac_pdma_send (unsigned char *start,void __iomem *io,int n) +{ +unsigned char *addr = start; +int result =0 ; + +if (n >=1 ) { +MOVE_BYTE ("%0@,%3@" ); +if (result) + goto out; + } +if (n >=1 && ((unsigned long )addr &1 )) { +MOVE_BYTE ("%0@,%3@" ); +if (result) + goto out; + } +while (n >=32 ) +MOVE_16_WORDS ("%0@+,%3@" ); +while (n >=2 ) +MOVE_WORD ("%0@+,%3@" ); +if (result) +return start - addr;/* Negated to indicate uncertain length */ +if (n ==1 ) +MOVE_BYTE ("%0@,%3@" ); +out: +return addr - start; +}static inline int macscsi_pread (struct NCR5380_hostdata *hostdata,unsigned char *dst,int len) {u8 __iomem *s = hostdata->pdma_io + (INPUT_DATA_REG <<4 );unsigned char *d = dst; -int n = len; -int transferred; + + hostdata->pdma_residual = len;while (!NCR5380_poll_politely (hostdata,BUS_AND_STATUS_REG ,BASR_DRQ |BASR_PHASE_MATCH ,BASR_DRQ |BASR_PHASE_MATCH ,HZ /64 )) { -CP_IO_TO_MEM (s, d, n); +int bytes; + + bytes =mac_pdma_recv (s, d,min (hostdata->pdma_residual,512 )); - transferred = d - dst - n; - hostdata->pdma_residual = len - transferred; +if (bytes >0 ) { + d += bytes; + hostdata->pdma_residual -= bytes; + } -/* No bus error. */ -if (n ==0 ) +if (hostdata->pdma_residual ==0 )return 0 ; -/* Target changed phase early? */ if (NCR5380_poll_politely2 (hostdata,STATUS_REG ,SR_REQ ,SR_REQ , -BUS_AND_STATUS_REG ,BASR_ACK ,BASR_ACK ,HZ /64 ) <0 ) -scmd_printk (KERN_ERR , hostdata->connected, +BUS_AND_STATUS_REG ,BASR_ACK , +BASR_ACK ,HZ /64 ) <0 ) +scmd_printk (KERN_DEBUG , hostdata->connected,"%s: !REQ and !ACK\n" , __func__);if (!(NCR5380_read (BUS_AND_STATUS_REG ) &BASR_PHASE_MATCH ))return 0 ; +if (bytes ==0 ) +udelay (MAC_PDMA_DELAY ); + +if (bytes >=0 ) +continue ; +dsprintk (NDEBUG_PSEUDO_DMA , hostdata->host, -"%s: bus error (%d/%d)\n" , __func__, transferred, len); +"%s: bus error (%d/%d)\n" , __func__, d - dst, len);NCR5380_dprint (NDEBUG_PSEUDO_DMA , hostdata->host); - d = dst + transferred; - n = len - transferred; +return -1 ; } scmd_printk(KERN_ERR, hostdata->connected,
@@ -192,93 +311,27 @@ static inline int macscsi_pread(struct Nreturn -1 ; } - -#define CP_MEM_TO_IO (s,d,n) \ -__asm__ __volatile__ \ - (" cmp.w #4,%2\n" \ - " bls 8f\n" \ - " move.w %0,%%d0\n" \ - " neg.b %%d0\n" \ - " and.w #3,%%d0\n" \ - " sub.w %%d0,%2\n" \ - " bra 2f\n" \ - " 1: move.b (%0)+,(%1)\n" \ - " 2: dbf %%d0,1b\n" \ - " move.w %2,%%d0\n" \ - " lsr.w #5,%%d0\n" \ - " bra 4f\n" \ - " 3: move.l (%0)+,(%1)\n" \ - "31: move.l (%0)+,(%1)\n" \ - "32: move.l (%0)+,(%1)\n" \ - "33: move.l (%0)+,(%1)\n" \ - "34: move.l (%0)+,(%1)\n" \ - "35: move.l (%0)+,(%1)\n" \ - "36: move.l (%0)+,(%1)\n" \ - "37: move.l (%0)+,(%1)\n" \ - " 4: dbf %%d0,3b\n" \ - " move.w %2,%%d0\n" \ - " lsr.w #2,%%d0\n" \ - " and.w #7,%%d0\n" \ - " bra 6f\n" \ - " 5: move.l (%0)+,(%1)\n" \ - " 6: dbf %%d0,5b\n" \ - " and.w #3,%2\n" \ - " bra 8f\n" \ - " 7: move.b (%0)+,(%1)\n" \ - " 8: dbf %2,7b\n" \ - " moveq.l #0, %2\n" \ - " 9: \n" \ - ".section .fixup,\"ax\"\n" \ - " .even\n" \ - "91: moveq.l #1, %2\n" \ - " jra 9b\n" \ - "94: moveq.l #4, %2\n" \ - " jra 9b\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .align 4\n" \ - " .long 1b,91b\n" \ - " .long 3b,94b\n" \ - " .long 31b,94b\n" \ - " .long 32b,94b\n" \ - " .long 33b,94b\n" \ - " .long 34b,94b\n" \ - " .long 35b,94b\n" \ - " .long 36b,94b\n" \ - " .long 37b,94b\n" \ - " .long 5b,94b\n" \ - " .long 7b,91b\n" \ - ".previous" \ - : "=a"(s), "=a"(d), "=d"(n) \ - : "0"(s), "1"(d), "2"(n) \ - : "d0") -static inline int macscsi_pwrite (struct NCR5380_hostdata *hostdata,unsigned char *src,int len) {unsigned char *s = src;u8 __iomem *d = hostdata->pdma_io + (OUTPUT_DATA_REG <<4 ); -int n = len; -int transferred; + + hostdata->pdma_residual = len;while (!NCR5380_poll_politely (hostdata,BUS_AND_STATUS_REG ,BASR_DRQ |BASR_PHASE_MATCH ,BASR_DRQ |BASR_PHASE_MATCH ,HZ /64 )) { -CP_MEM_TO_IO (s, d, n); +int bytes; - transferred = s - src - n; - hostdata->pdma_residual = len - transferred; + bytes =mac_pdma_send (s, d,min (hostdata->pdma_residual,512 )); -/* Target changed phase early? */ -if (NCR5380_poll_politely2 (hostdata,STATUS_REG ,SR_REQ ,SR_REQ , -BUS_AND_STATUS_REG ,BASR_ACK ,BASR_ACK ,HZ /64 ) <0 ) -scmd_printk (KERN_ERR , hostdata->connected, -"%s: !REQ and !ACK\n" , __func__); -if (!(NCR5380_read (BUS_AND_STATUS_REG ) &BASR_PHASE_MATCH )) -return 0 ; +if (bytes >0 ) { + s += bytes; + hostdata->pdma_residual -= bytes; + } -/* No bus error. */ -if (n ==0 ) { +if (hostdata->pdma_residual ==0 ) {if (NCR5380_poll_politely (hostdata,TARGET_COMMAND_REG ,TCR_LAST_BYTE_SENT ,TCR_LAST_BYTE_SENT ,HZ /64 ) <0 )
@@ -287,17 +340,29 @@ static inline int macscsi_pwrite(structreturn 0 ; } +if (NCR5380_poll_politely2 (hostdata,STATUS_REG ,SR_REQ ,SR_REQ , +BUS_AND_STATUS_REG ,BASR_ACK , +BASR_ACK ,HZ /64 ) <0 ) +scmd_printk (KERN_DEBUG , hostdata->connected, +"%s: !REQ and !ACK\n" , __func__); +if (!(NCR5380_read (BUS_AND_STATUS_REG ) &BASR_PHASE_MATCH )) +return 0 ; + +if (bytes ==0 ) +udelay (MAC_PDMA_DELAY ); + +if (bytes >=0 ) +continue ; +dsprintk (NDEBUG_PSEUDO_DMA , hostdata->host, -"%s: bus error (%d/%d)\n" , __func__, transferred, len); +"%s: bus error (%d/%d)\n" , __func__, s - src, len);NCR5380_dprint (NDEBUG_PSEUDO_DMA , hostdata->host); - s = src + transferred; - n = len - transferred; +return -1 ; }scmd_printk (KERN_ERR , hostdata->connected,"%s: phase mismatch or !DRQ\n" , __func__);NCR5380_dprint (NDEBUG_PSEUDO_DMA , hostdata->host); -return -1 ; }
Greg Kroah-Hartman
maintainerPATCH 101/293 gtp: fix suspicious RCU usage
In reply to Greg Kroah-Hartman[ Upstream commit e198987e7dd7d3645a53875151cd6f8fc425b706 ]
gtp_encap_enable_socket() and gtp_encap_destroy() are not protected by rcu_read_lock(). and it's not safe to write sk->sk_user_data. This patch make these functions to use lock_sock() instead of rcu_dereference_sk_user_data().
Test commands:
gtp-link add gtp1
Splat looks like:
[ 83.238315] =============================
[ 83.239127] WARNING: suspicious RCU usage
[ 83.239702] 5.2.0-rc6+ #49 Not tainted
[ 83.240268] -----------------------------
[ 83.241205] drivers/net/gtp.c:799 suspicious rcu_dereference_check() usage!
[ 83.243828]
[ 83.243828] other info that might help us debug this:
[ 83.243828]
[ 83.246325]
[ 83.246325] rcu_scheduler_active = 2, debug_locks = 1
[ 83.247314] 1 lock held by gtp-link/1008:
[ 83.248523] #0: 0000000017772c7f (rtnl_mutex){+.+.}, at: __rtnl_newlink+0x5f5/0x11b0
[ 83.251503]
[ 83.251503] stack backtrace:
[ 83.252173] CPU: 0 PID: 1008 Comm: gtp-link Not tainted 5.2.0-rc6+ #49
[ 83.253271] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[ 83.254562] Call Trace:
[ 83.254995] dump_stack+0x7c/0xbb
[ 83.255567] gtp_encap_enable_socket+0x2df/0x360 [gtp]
[ 83.256415] ? gtp_find_dev+0x1a0/0x1a0 [gtp]
[ 83.257161] ? memset+0x1f/0x40
[ 83.257843] gtp_newlink+0x90/0xa21 [gtp]
[ 83.258497] ? __netlink_ns_capable+0xc3/0xf0
[ 83.259260] __rtnl_newlink+0xb9f/0x11b0
[ 83.260022] ? rtnl_link_unregister+0x230/0x230[ ... ]
--- drivers/net/gtp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/gtp.c +6 -2
@@ -293,12 +293,14 @@ static void gtp_encap_destroy(struct sock *sk) {struct gtp_dev *gtp; - gtp =rcu_dereference_sk_user_data (sk); +lock_sock (sk); + gtp = sk->sk_user_data;if (gtp) {udp_sk (sk)->encap_type =0 ;rcu_assign_sk_user_data (sk,NULL );sock_put (sk); } +release_sock (sk); }static void gtp_encap_disable_sock (struct sock *sk)
@@ -798,7 +800,8 @@ static struct sock *gtp_encap_enable_socket(int fd, int type, goto out_sock; } -if (rcu_dereference_sk_user_data (sock->sk)) { +lock_sock (sock->sk); +if (sock->sk->sk_user_data) { sk =ERR_PTR (-EBUSY ); goto out_sock; }
@@ -814,6 +817,7 @@ static struct sock *gtp_encap_enable_socket(int fd, int type,setup_udp_tunnel_sock (sock_net (sock->sk), sock, &tuncfg); out_sock: +release_sock (sock->sk);sockfd_put (sock);return sk; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 120/293 crypto: ccp - Validate the the error value used to index error messages
In reply to Greg Kroah-HartmanFrom: Hook, Gary <[email protected]>
commit 52393d617af7b554f03531e6756facf2ea687d2e upstream.
The error code read from the queue status register is only 6 bits wide, but we need to verify its value is within range before indexing the error messages.
--- drivers/crypto/ccp/ccp-dev.c | 96 ++++++++++++++++++++++--------------------- drivers/crypto/ccp/ccp-dev.h | 2 2 files changed, 52 insertions(+), 46 deletions(-)
drivers/crypto/ccp/ccp-dev.c +51 -45
@@ -35,56 +35,62 @@ struct ccp_tasklet_data { };/* Human-readable error strings */ +#define CCP_MAX_ERROR_CODE 64static char *ccp_error_codes[] = {"" , -"ERR 01: ILLEGAL_ENGINE" , -"ERR 02: ILLEGAL_KEY_ID" , -"ERR 03: ILLEGAL_FUNCTION_TYPE" , -"ERR 04: ILLEGAL_FUNCTION_MODE" , -"ERR 05: ILLEGAL_FUNCTION_ENCRYPT" , -"ERR 06: ILLEGAL_FUNCTION_SIZE" , -"ERR 07: Zlib_MISSING_INIT_EOM" , -"ERR 08: ILLEGAL_FUNCTION_RSVD" , -"ERR 09: ILLEGAL_BUFFER_LENGTH" , -"ERR 10: VLSB_FAULT" , -"ERR 11: ILLEGAL_MEM_ADDR" , -"ERR 12: ILLEGAL_MEM_SEL" , -"ERR 13: ILLEGAL_CONTEXT_ID" , -"ERR 14: ILLEGAL_KEY_ADDR" , -"ERR 15: 0xF Reserved" , -"ERR 16: Zlib_ILLEGAL_MULTI_QUEUE" , -"ERR 17: Zlib_ILLEGAL_JOBID_CHANGE" , -"ERR 18: CMD_TIMEOUT" , -"ERR 19: IDMA0_AXI_SLVERR" , -"ERR 20: IDMA0_AXI_DECERR" , -"ERR 21: 0x15 Reserved" , -"ERR 22: IDMA1_AXI_SLAVE_FAULT" , -"ERR 23: IDMA1_AIXI_DECERR" , -"ERR 24: 0x18 Reserved" , -"ERR 25: ZLIBVHB_AXI_SLVERR" , -"ERR 26: ZLIBVHB_AXI_DECERR" , -"ERR 27: 0x1B Reserved" , -"ERR 27: ZLIB_UNEXPECTED_EOM" , -"ERR 27: ZLIB_EXTRA_DATA" , -"ERR 30: ZLIB_BTYPE" , -"ERR 31: ZLIB_UNDEFINED_SYMBOL" , -"ERR 32: ZLIB_UNDEFINED_DISTANCE_S" , -"ERR 33: ZLIB_CODE_LENGTH_SYMBOL" , -"ERR 34: ZLIB _VHB_ILLEGAL_FETCH" , -"ERR 35: ZLIB_UNCOMPRESSED_LEN" , -"ERR 36: ZLIB_LIMIT_REACHED" , -"ERR 37: ZLIB_CHECKSUM_MISMATCH0" , -"ERR 38: ODMA0_AXI_SLVERR" , -"ERR 39: ODMA0_AXI_DECERR" , -"ERR 40: 0x28 Reserved" , -"ERR 41: ODMA1_AXI_SLVERR" , -"ERR 42: ODMA1_AXI_DECERR" , -"ERR 43: LSB_PARITY_ERR" , +"ILLEGAL_ENGINE" , +"ILLEGAL_KEY_ID" , +"ILLEGAL_FUNCTION_TYPE" , +"ILLEGAL_FUNCTION_MODE" , +"ILLEGAL_FUNCTION_ENCRYPT" , +"ILLEGAL_FUNCTION_SIZE" , +"Zlib_MISSING_INIT_EOM" , +"ILLEGAL_FUNCTION_RSVD" , +"ILLEGAL_BUFFER_LENGTH" , +"VLSB_FAULT" , +"ILLEGAL_MEM_ADDR" , +"ILLEGAL_MEM_SEL" , +"ILLEGAL_CONTEXT_ID" , +"ILLEGAL_KEY_ADDR" , +"0xF Reserved" , +"Zlib_ILLEGAL_MULTI_QUEUE" , +"Zlib_ILLEGAL_JOBID_CHANGE" , +"CMD_TIMEOUT" , +"IDMA0_AXI_SLVERR" , +"IDMA0_AXI_DECERR" , +"0x15 Reserved" , +"IDMA1_AXI_SLAVE_FAULT" , +"IDMA1_AIXI_DECERR" , +"0x18 Reserved" , +"ZLIBVHB_AXI_SLVERR" , +"ZLIBVHB_AXI_DECERR" , +"0x1B Reserved" , +"ZLIB_UNEXPECTED_EOM" , +"ZLIB_EXTRA_DATA" , +"ZLIB_BTYPE" , +"ZLIB_UNDEFINED_SYMBOL" , +"ZLIB_UNDEFINED_DISTANCE_S" , +"ZLIB_CODE_LENGTH_SYMBOL" , +"ZLIB _VHB_ILLEGAL_FETCH" , +"ZLIB_UNCOMPRESSED_LEN" , +"ZLIB_LIMIT_REACHED" , +"ZLIB_CHECKSUM_MISMATCH0" , +"ODMA0_AXI_SLVERR" , +"ODMA0_AXI_DECERR" , +"0x28 Reserved" , +"ODMA1_AXI_SLVERR" , +"ODMA1_AXI_DECERR" , }; -void ccp_log_error (struct ccp_device *d,int e) +void ccp_log_error (struct ccp_device *d,unsigned int e) { -dev_err (d->dev,"CCP error: %s (0x%x)\n" , ccp_error_codes[e], e); +if (WARN_ON (e >=CCP_MAX_ERROR_CODE )) +return ; + +if (e <ARRAY_SIZE (ccp_error_codes)) +dev_err (d->dev,"CCP error %d: %s\n" , e, ccp_error_codes[e]); +else +dev_err (d->dev,"CCP error %d: Unknown Error\n" , e); }/* List of CCPs, CCP count, read-write access lock, and access functions
drivers/crypto/ccp/ccp-dev.h +1 -1
@@ -632,7 +632,7 @@ struct ccp5_desc {void ccp_add_device (struct ccp_device *ccp);void ccp_del_device (struct ccp_device *ccp); -extern void ccp_log_error (struct ccp_device *,int ); +extern void ccp_log_error (struct ccp_device *,unsigned int );struct ccp_device *ccp_alloc_struct (struct sp_device *sp);bool ccp_queues_suspended (struct ccp_device *ccp);
Greg Kroah-Hartman
maintainerPATCH 121/293 crypto: arm64/sha1-ce - correct digest for empty data in finup
In reply to Greg Kroah-HartmanFrom: Elena Petrova <[email protected]>
commit 1d4aaf16defa86d2665ae7db0259d6cb07e2091f upstream.
The sha1-ce finup implementation for ARM64 produces wrong digest for empty input (len=0). Expected: da39a3ee..., result: 67452301... (initial value of SHA internal state). The error is in sha1_ce_finup:
for empty data finalize will be 1, so the code is relying on sha1_ce_transform to make the final round. However, in sha1_base_do_update, the block function will not be called when len == 0.
Fix it by setting finalize to 0 if data is empty.
--- arch/arm64/crypto/sha1-ce-glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/crypto/sha1-ce-glue.c +1 -1
@@ -54,7 +54,7 @@ static int sha1_ce_finup(struct shash_de unsigned int len, u8 *out) { struct sha1_ce_state *sctx = shash_desc_ctx(desc); -bool finalize = !sctx->sst.count && !(len %SHA1_BLOCK_SIZE ); +bool finalize = !sctx->sst.count && !(len %SHA1_BLOCK_SIZE ) && len;if (!may_use_simd ())return crypto_sha1_finup (desc, data, len, out);
Greg Kroah-Hartman
maintainerPATCH 122/293 crypto: arm64/sha2-ce - correct digest for empty data in finup
In reply to Greg Kroah-HartmanFrom: Elena Petrova <[email protected]>
commit 6bd934de1e393466b319d29c4427598fda096c57 upstream.
The sha256-ce finup implementation for ARM64 produces wrong digest for empty input (len=0). Expected: the actual digest, result: initial value of SHA internal state. The error is in sha256_ce_finup:
for empty data finalize will be 1, so the code is relying on sha2_ce_transform to make the final round. However, in sha256_base_do_update, the block function will not be called when len == 0.
Fix it by setting finalize to 0 if data is empty.
--- arch/arm64/crypto/sha2-ce-glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/crypto/sha2-ce-glue.c +1 -1
@@ -59,7 +59,7 @@ static int sha256_ce_finup(struct shash_ unsigned int len, u8 *out) { struct sha256_ce_state *sctx = shash_desc_ctx(desc); -bool finalize = !sctx->sst.count && !(len %SHA256_BLOCK_SIZE ); +bool finalize = !sctx->sst.count && !(len %SHA256_BLOCK_SIZE ) && len;if (!may_use_simd ()) {if (len)
Greg Kroah-Hartman
maintainerPATCH 124/293 crypto: ccp - memset structure fields to zero before reuse
In reply to Greg Kroah-HartmanFrom: Hook, Gary <[email protected]>
commit 20e833dc36355ed642d00067641a679c618303fa upstream.
The AES GCM function reuses an 'op' data structure, which members contain values that must be cleared for each (re)use.
This fix resolves a crypto self-test failure:
alg: aead: gcm-aes-ccp encryption test failed (wrong result) on test vector 2, cfg="two even aligned splits"
--- drivers/crypto/ccp/ccp-ops.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/crypto/ccp/ccp-ops.c +11 -1
@@ -612,6 +612,7 @@ static int ccp_run_aes_gcm_cmd(struct ccunsigned long long *final;unsigned int dm_offset; +unsigned int jobid;unsigned int ilen;bool in_place = true;/* Default value */ int ret;
@@ -650,9 +651,11 @@ static int ccp_run_aes_gcm_cmd(struct cc p_tag =scatterwalk_ffwd (sg_tag, p_inp, ilen); } + jobid =CCP_NEW_JOBID (cmd_q->ccp); +memset (&op,0 ,sizeof (op)); op.cmd_q = cmd_q; - op.jobid =CCP_NEW_JOBID (cmd_q->ccp); + op.jobid = jobid; op.sb_key = cmd_q->sb_key;/* Pre-allocated */ op.sb_ctx = cmd_q->sb_ctx;/* Pre-allocated */ op.init =1 ;
@@ -797,6 +800,13 @@ static int ccp_run_aes_gcm_cmd(struct cc final[0 ] =cpu_to_be64 (aes->aad_len *8 ); final[1 ] =cpu_to_be64 (ilen *8 ); +memset (&op,0 ,sizeof (op)); + op.cmd_q = cmd_q; + op.jobid = jobid; + op.sb_key = cmd_q->sb_key;/* Pre-allocated */ + op.sb_ctx = cmd_q->sb_ctx;/* Pre-allocated */ + op.init =1 ; + op.u.aes.type = aes->type; op.u.aes.mode =CCP_AES_MODE_GHASH ; op.u.aes.action =CCP_AES_GHASHFINAL ; op.src.type =CCP_MEMTYPE_SYSTEM ;
Greg Kroah-Hartman
maintainerPATCH 125/293 crypto: ccp/gcm - use const time tag comparison.
In reply to Greg Kroah-HartmanFrom: Cfir Cohen <[email protected]>
commit 538a5a072e6ef04377b180ee9b3ce5bae0a85da4 upstream.
Avoid leaking GCM tag through timing side channel.
--- drivers/crypto/ccp/ccp-ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/ccp/ccp-ops.c +2 -1
@@ -832,7 +832,8 @@ static int ccp_run_aes_gcm_cmd(struct cc goto e_tag;ccp_set_dm_area (&tag,0 , p_tag,0 ,AES_BLOCK_SIZE ); - ret =memcmp (tag.address, final_wa.address,AES_BLOCK_SIZE ); + ret =crypto_memneq (tag.address, final_wa.address, +AES_BLOCK_SIZE ) ? -EBADMSG :0 ;ccp_dm_free (&tag); }
Greg Kroah-Hartman
maintainerPATCH 126/293 crypto: crypto4xx - fix a potential double free in ppc4xx_trng_probe
In reply to Greg Kroah-HartmanFrom: Wen Yang <[email protected]>
commit 95566aa75cd6b3b404502c06f66956b5481194b3 upstream.
There is a possible double free issue in ppc4xx_trng_probe():
85: dev->trng_base = of_iomap(trng, 0);
86: of_node_put(trng); ---> released here
87: if (!dev->trng_base)
88: goto err_out;
...
110: ierr_out:
111: of_node_put(trng); ---> double released here
...
This issue was detected by using the Coccinelle software. We fix it by removing the unnecessary of_node_put().
--- drivers/crypto/amcc/crypto4xx_trng.c | 1 - 1 file changed, 1 deletion(-)
drivers/crypto/amcc/crypto4xx_trng.c +0 -1
@@ -111,7 +111,6 @@ void ppc4xx_trng_probe(struct crypto4xx_return ; err_out: -of_node_put (trng);iounmap (dev->trng_base);kfree (rng); dev->trng_base =NULL ;
Greg Kroah-Hartman
maintainerPATCH 127/293 Input: gtco - bounds check collection indent level
In reply to Greg Kroah-HartmanFrom: Grant Hernandez <[email protected]>
commit 2a017fd82c5402b3c8df5e3d6e5165d9e6147dc1 upstream.
The GTCO tablet input driver configures itself from an HID report sent via USB during the initial enumeration process. Some debugging messages are generated during the parsing. A debugging message indentation counter is not bounds checked, leading to the ability for a specially crafted HID report to cause '-' and null bytes be written past the end of the indentation array. As long as the kernel has CONFIG_DYNAMIC_DEBUG enabled, this code will not be optimized out. This was discovered during code review after a previous syzkaller bug was found in this driver.
--- drivers/input/tablet/gtco.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/input/tablet/gtco.c +17 -3
@@ -78,6 +78,7 @@ Scott Hill [email protected]/* Max size of a single report */ #define REPORT_MAX_SIZE 10 +#define MAX_COLLECTION_LEVELS 10/* Bitmask whether pen is in range */
@@ -223,8 +224,7 @@ static void parse_hid_report_descriptor(char maintype ='x' ;char globtype[12 ];int indent =0 ; -char indentstr[10 ] ="" ; - +char indentstr[MAX_COLLECTION_LEVELS +1 ] = {0 };dev_dbg (ddev,"======>>>>>>PARSE<<<<<<======\n" );
@@ -350,6 +350,13 @@ static void parse_hid_report_descriptor(case TAG_MAIN_COL_START : maintype ='S' ; +if (indent ==MAX_COLLECTION_LEVELS ) { +dev_err (ddev,"Collection level %d would exceed limit of %d\n" , + indent +1 , +MAX_COLLECTION_LEVELS ); +break ; + } +if (data ==0 ) {dev_dbg (ddev,"======>>>>>> Physical\n" );strcpy (globtype,"Physical" );
@@ -369,8 +376,15 @@ static void parse_hid_report_descriptor(break ;case TAG_MAIN_COL_END : -dev_dbg (ddev,"<<<<<<======\n" ); maintype ='E' ; + +if (indent ==0 ) { +dev_err (ddev,"Collection level already at zero\n" ); +break ; + } + +dev_dbg (ddev,"<<<<<<======\n" ); + indent--;for (x =0 ; x < indent; x++) indentstr[x] ='-' ;
Greg Kroah-Hartman
maintainerPATCH 128/293 Input: alps - dont handle ALPS cs19 trackpoint-only device
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
commit 7e4935ccc3236751e5fe4bd6846f86e46bb2e427 upstream.
On a latest Lenovo laptop, the trackpoint and 3 buttons below it don't work at all, when we move the trackpoint or press those 3 buttons, the kernel will print out:
"Rejected trackstick packet from non DualPoint device"
This device is identified as an alps touchpad but the packet has trackpoint format, so the alps.c drops the packet and prints out the message above.
According to XiaoXiao's explanation, this device is named cs19 and is trackpoint-only device, its firmware is only for trackpoint, it is independent of touchpad and is a device completely different from DualPoint ones.
To drive this device with mininal changes to the existing driver, we just let the alps driver not handle this device, then the trackpoint.c will be the driver of this device if the trackpoint driver is enabled. (if not, this device will fallback to a bare PS/2 device)
With the trackpoint.c, this trackpoint and 3 buttons all work well, they have all features that the trackpoint should have, like scrolling-screen, drag-and-drop and frame-selection.
--- drivers/input/mouse/alps.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/input/mouse/alps.c +32 -0
@@ -24,6 +24,7 @@#include "psmouse.h" #include "alps.h" +#include "trackpoint.h" /* * Definitions for ALPS version 3 and 4 command mode protocol
@@ -2860,6 +2861,23 @@ static const struct alps_protocol_info *return NULL ; } +static bool alps_is_cs19_trackpoint (struct psmouse *psmouse) +{ +u8 param[2 ] = {0 }; + +if (ps2_command (&psmouse->ps2dev, + param,MAKE_PS2_CMD (0 ,2 ,TP_READ_ID ))) +return false; + +/* +* param[0] contains the trackpoint device variant_id while +* param[1] contains the firmware_id. So far all alps +* trackpoint-only devices have their variant_ids equal +* TP_VARIANT_ALPS and their firmware_ids are in 0x20~0x2f range. +*/ +return param[0 ] ==TP_VARIANT_ALPS && (param[1 ] &0x20 ); +} +static int alps_identify (struct psmouse *psmouse,struct alps_data *priv) {const struct alps_protocol_info *protocol;
@@ -3161,6 +3179,20 @@ int alps_detect(struct psmouse *psmouse,return error;/* +* ALPS cs19 is a trackpoint-only device, and uses different +* protocol than DualPoint ones, so we return -EINVAL here and let +* trackpoint.c drive this device. If the trackpoint driver is not +* enabled, the device will fall back to a bare PS/2 mouse. +* If ps2_command() fails here, we depend on the immediately +* followed psmouse_reset() to reset the device to normal state. +*/ +if (alps_is_cs19_trackpoint (psmouse)) { +psmouse_dbg (psmouse, +"ALPS CS19 trackpoint-only device detected, ignoring\n" ); +return -EINVAL ; + } + +/* * Reset the device to make sure it is fully operational: * on some laptops, like certain Dell Latitudes, we may * fail to properly detect presence of trackstick if device
Greg Kroah-Hartman
maintainerPATCH 102/293 gtp: fix Illegal context switch in RCU read-side critical section.
In reply to Greg Kroah-Hartman[ Upstream commit 3f167e1921865b379a9becf03828e7202c7b4917 ]
ipv4_pdp_add() is called in RCU read-side critical section. So GFP_KERNEL should not be used in the function.
This patch make ipv4_pdp_add() to use GFP_ATOMIC instead of GFP_KERNEL.
Test commands:
gtp-link add gtp1 &
gtp-tunnel add gtp1 v1 100 200 1.1.1.1 2.2.2.2
Splat looks like:
[ 130.618881] =============================
[ 130.626382] WARNING: suspicious RCU usage
[ 130.626994] 5.2.0-rc6+ #50 Not tainted
[ 130.627622] -----------------------------
[ 130.628223] ./include/linux/rcupdate.h:266 Illegal context switch in RCU read-side critical section!
[ 130.629684]
[ 130.629684] other info that might help us debug this:
[ 130.629684]
[ 130.631022]
[ 130.631022] rcu_scheduler_active = 2, debug_locks = 1
[ 130.632136] 4 locks held by gtp-tunnel/1025:
[ 130.632925] #0: 000000002b93c8b7 (cb_lock){++++}, at: genl_rcv+0x15/0x40
[ 130.634159] #1: 00000000f17bc999 (genl_mutex){+.+.}, at: genl_rcv_msg+0xfb/0x130
[ 130.635487] #2: 00000000c644ed8e (rtnl_mutex){+.+.}, at: gtp_genl_new_pdp+0x18c/0x1150 [gtp]
[ 130.636936] #3: 0000000007a1cde7 (rcu_read_lock){....}, at: gtp_genl_new_pdp+0x187/0x1150 [gtp]
[ 130.638348]
[ 130.638348] stack backtrace:
[ 130.639062] CPU: 1 PID: 1025 Comm: gtp-tunnel Not tainted 5.2.0-rc6+ #50
[ 130.641318] Call Trace:
[ 130.641707] dump_stack+0x7c/0xbb
[ 130.642252] ___might_sleep+0x2c0/0x3b0
[ 130.642862] kmem_cache_alloc_trace+0x1cd/0x2b0
[ 130.643591] gtp_genl_new_pdp+0x6c5/0x1150 [gtp]
[ 130.644371] genl_family_rcv_msg+0x63a/0x1030
[ 130.645074] ? mutex_lock_io_nested+0x1090/0x1090
[ 130.645845] ? genl_unregister_family+0x630/0x630
[ 130.646592] ? debug_show_all_locks+0x2d0/0x2d0
[ 130.647293] ? check_flags.part.40+0x440/0x440
[ 130.648099] genl_rcv_msg+0xa3/0x130[ ... ]
--- drivers/net/gtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/gtp.c +1 -1
@@ -956,7 +956,7 @@ static int ipv4_pdp_add(struct gtp_dev *gtp, struct sock *sk, } - pctx =kmalloc (sizeof (struct pdp_ctx ),GFP_KERNEL ); + pctx =kmalloc (sizeof (*pctx),GFP_ATOMIC );if (pctx ==NULL )return -ENOMEM ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 129/293 Input: synaptics - whitelist Lenovo T580 SMBus intertouch
In reply to Greg Kroah-HartmanFrom: Nick Black <[email protected]>
commit 1976d7d200c5a32e72293a2ada36b7b7c9d6dd6e upstream.
Adds the Lenovo T580 to the SMBus intertouch list for Synaptics touchpads. I've tested with this for a week now, and it seems a great improvement. It's also nice to have the complaint gone from dmesg.
--- drivers/input/mouse/synaptics.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/mouse/synaptics.c +1 -0
@@ -179,6 +179,7 @@ static const char * const smbus_pnp_ids["LEN0093" ,/* T480 */ "LEN0096" ,/* X280 */ "LEN0097" ,/* X280 -> ALPS trackpoint */ +"LEN009b" ,/* T580 */ "LEN200f" ,/* T450s */ "LEN2054" ,/* E480 */ "LEN2055", /* E580 */
Greg Kroah-Hartman
maintainerPATCH 130/293 Input: alps - fix a mismatch between a condition check and its comment
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
commit 771a081e44a9baa1991ef011cc453ef425591740 upstream.
In the function alps_is_cs19_trackpoint(), we check if the param[1] is in the 0x20~0x2f range, but the code we wrote for this checking is not correct:
(param[1] & 0x20) does not mean param[1] is in the range of 0x20~0x2f, it also means the param[1] is in the range of 0x30~0x3f, 0x60~0x6f...
Now fix it with a new condition checking ((param[1] & 0xf0) == 0x20).
--- drivers/input/mouse/alps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/mouse/alps.c +1 -1
@@ -2875,7 +2875,7 @@ static bool alps_is_cs19_trackpoint(stru* trackpoint-only devices have their variant_ids equal * TP_VARIANT_ALPS and their firmware_ids are in 0x20~0x2f range. */ -return param[0 ] ==TP_VARIANT_ALPS && (param[1 ] &0x20 ); +return param[0 ] ==TP_VARIANT_ALPS && ((param[1 ] &0xf0 ) ==0x20 ); }static int alps_identify (struct psmouse *psmouse,struct alps_data *priv)
Greg Kroah-Hartman
maintainerPATCH 131/293 regulator: s2mps11: Fix buck7 and buck8 wrong voltages
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit 16da0eb5ab6ef2dd1d33431199126e63db9997cc upstream.
On S2MPS11 device, the buck7 and buck8 regulator voltages start at 750 mV, not 600 mV. Using wrong minimal value caused shifting of these regulator values by 150 mV (e.g. buck7 usually configured to v1.35 V was reported as 1.2 V).
On most of the boards these regulators are left in default state so this was only affecting reported voltage. However if any driver wanted to change them, then effectively it would set voltage 150 mV higher than intended.
--- drivers/regulator/s2mps11.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/s2mps11.c +2 -2
@@ -386,8 +386,8 @@ static const struct regulator_desc s2mpsregulator_desc_s2mps11_buck1_4 (4 ), regulator_desc_s2mps11_buck5,regulator_desc_s2mps11_buck67810 (6 ,MIN_600_MV ,STEP_6_25_MV ), -regulator_desc_s2mps11_buck67810 (7 ,MIN_600_MV ,STEP_12_5_MV ), -regulator_desc_s2mps11_buck67810 (8 ,MIN_600_MV ,STEP_12_5_MV ), +regulator_desc_s2mps11_buck67810 (7 ,MIN_750_MV ,STEP_12_5_MV ), +regulator_desc_s2mps11_buck67810 (8 ,MIN_750_MV ,STEP_12_5_MV ), regulator_desc_s2mps11_buck9, regulator_desc_s2mps11_buck67810(10, MIN_750_MV, STEP_12_5_MV), };
Greg Kroah-Hartman
maintainerPATCH 132/293 arm64: tegra: Update Jetson TX1 GPU regulator timings
In reply to Greg Kroah-HartmanFrom: Jon Hunter <[email protected]>
commit ece6031ece2dd64d63708cfe1088016cee5b10c0 upstream.
The GPU regulator enable ramp delay for Jetson TX1 is set to 1ms which not sufficient because the enable ramp delay has been measured to be greater than 1ms. Furthermore, the downstream kernels released by NVIDIA for Jetson TX1 are using a enable ramp delay 2ms and a settling delay of 160us. Update the GPU regulator enable ramp delay for Jetson TX1 to be 2ms and add a settling delay of 160us.
--- arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi +2 -1
@@ -307,7 +307,8 @@ regulator-max-microvolt = <1320000>; enable-gpios = <&pmic 6 GPIO_ACTIVE_HIGH>; regulator-ramp-delay = <80>; - regulator-enable-ramp-delay = <1000>; + regulator-enable-ramp-delay = <2000>; + regulator-settling-time-us = <160>; }; }; };
Greg Kroah-Hartman
maintainerPATCH 133/293 iwlwifi: pcie: dont service an interrupt that was masked
In reply to Greg Kroah-HartmanFrom: Emmanuel Grumbach <[email protected]>
commit 3b57a10ca14c619707398dc58fe5ece18c95b20b upstream.
Sometimes the register status can include interrupts that were masked. We can, for example, get the RF-Kill bit set in the interrupt status register although this interrupt was masked. Then if we get the ALIVE interrupt (for example) that was not masked, we need to *not* service the RF-Kill interrupt.
Fix this in the MSI-X interrupt handler.
--- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/rx.c +21 -6
@@ -1956,10 +1956,18 @@ irqreturn_t iwl_pcie_irq_msix_handler(inreturn IRQ_NONE ; } -if (iwl_have_debug_level (IWL_DL_ISR )) -IWL_DEBUG_ISR (trans,"ISR inta_fh 0x%08x, enabled 0x%08x\n" , - inta_fh, +if (iwl_have_debug_level (IWL_DL_ISR )) { +IWL_DEBUG_ISR (trans, +"ISR inta_fh 0x%08x, enabled (sw) 0x%08x (hw) 0x%08x\n" , + inta_fh, trans_pcie->fh_mask,iwl_read32 (trans,CSR_MSIX_FH_INT_MASK_AD )); +if (inta_fh & ~trans_pcie->fh_mask) +IWL_DEBUG_ISR (trans, +"We got a masked interrupt (0x%08x)\n" , + inta_fh & ~trans_pcie->fh_mask); + } + + inta_fh &= trans_pcie->fh_mask;if ((trans_pcie->shared_vec_mask &IWL_SHARED_IRQ_NON_RX ) && inta_fh &MSIX_FH_INT_CAUSES_Q0 ) {
@@ -1998,11 +2006,18 @@ irqreturn_t iwl_pcie_irq_msix_handler(in }/* After checking FH register check HW register */ -if (iwl_have_debug_level (IWL_DL_ISR )) +if (iwl_have_debug_level (IWL_DL_ISR )) {IWL_DEBUG_ISR (trans, -"ISR inta_hw 0x%08x, enabled 0x%08x\n" , - inta_hw, +"ISR inta_hw 0x%08x, enabled (sw) 0x%08x (hw) 0x%08x\n" , + inta_hw, trans_pcie->hw_mask,iwl_read32 (trans,CSR_MSIX_HW_INT_MASK_AD )); +if (inta_hw & ~trans_pcie->hw_mask) +IWL_DEBUG_ISR (trans, +"We got a masked interrupt 0x%08x\n" , + inta_hw & ~trans_pcie->hw_mask); + } + + inta_hw &= trans_pcie->hw_mask;/* Alive notification via Rx interrupt will do the real work */ if (inta_hw &MSIX_HW_INT_CAUSES_REG_ALIVE ) {
Greg Kroah-Hartman
maintainerPATCH 134/293 iwlwifi: pcie: fix ALIVE interrupt handling for gen2 devices w/o MSI-X
In reply to Greg Kroah-HartmanFrom: Emmanuel Grumbach <[email protected]>
commit ec46ae30245ecb41d73f8254613db07c653fb498 upstream.
We added code to restock the buffer upon ALIVE interrupt when MSI-X is disabled. This was added as part of the context info code. This code was added only if the ISR debug level is set which is very unlikely to be related.
Move this code to run even when the ISR debug level is not set.
Note that gen2 devices work with MSI-X in most cases so that this path is seldom used.
--- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 34 ++++++++++++--------------- 1 file changed, 16 insertions(+), 18 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/rx.c +16 -18
@@ -1674,25 +1674,23 @@ irqreturn_t iwl_pcie_irq_handler(int irq goto out; } -if (iwl_have_debug_level (IWL_DL_ISR )) { -/* NIC fires this, but we don't use it, redundant with WAKEUP */ -if (inta &CSR_INT_BIT_SCD ) { -IWL_DEBUG_ISR (trans, -"Scheduler finished to transmit the frame/frames.\n" ); - isr_stats->sch++; - } +/* NIC fires this, but we don't use it, redundant with WAKEUP */ +if (inta &CSR_INT_BIT_SCD ) { +IWL_DEBUG_ISR (trans, +"Scheduler finished to transmit the frame/frames.\n" ); + isr_stats->sch++; + } -/* Alive notification via Rx interrupt will do the real work */ -if (inta &CSR_INT_BIT_ALIVE ) { -IWL_DEBUG_ISR (trans,"Alive interrupt\n" ); - isr_stats->alive++; -if (trans->cfg->gen2) { -/* -* We can restock, since firmware configured -* the RFH -*/ -iwl_pcie_rxmq_restock (trans, trans_pcie->rxq); - } +/* Alive notification via Rx interrupt will do the real work */ +if (inta &CSR_INT_BIT_ALIVE ) { +IWL_DEBUG_ISR (trans,"Alive interrupt\n" ); + isr_stats->alive++; +if (trans->cfg->gen2) { +/* +* We can restock, since firmware configured +* the RFH +*/ +iwl_pcie_rxmq_restock (trans, trans_pcie->rxq); } }
Greg Kroah-Hartman
maintainerPATCH 135/293 NFSv4: Handle the special Linux file open access mode
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit 44942b4e457beda00981f616402a1a791e8c616e upstream.
According to the open() manpage, Linux reserves the access mode 3 to mean "check for read and write permission on the file and return a file descriptor that can't be used for reading or writing."
Currently, the NFSv4 code will ask the server to open the file, and will use an incorrect share access mode of 0. Since it has an incorrect share access mode, the client later forgets to send a corresponding close, meaning it can leak stateids on the server.
--- fs/nfs/inode.c | 1 + fs/nfs/nfs4file.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
fs/nfs/inode.c +1 -0
@@ -1034,6 +1034,7 @@ int nfs_open(struct inode *inode, structnfs_fscache_open_file (inode, filp);return 0 ; } +EXPORT_SYMBOL_GPL (nfs_open);/* * This function is called whenever some part of NFS notices that
fs/nfs/nfs4file.c +1 -1
@@ -50,7 +50,7 @@ nfs4_file_open(struct inode *inode, strureturn err;if ((openflags &O_ACCMODE ) ==3 ) - openflags--; +return nfs_open (inode, filp);/* We can't create new files here */ openflags &= ~(O_CREAT |O_EXCL );
Greg Kroah-Hartman
maintainerPATCH 136/293 pnfs/flexfiles: Fix PTR_ERR() dereferences in ff_layout_track_ds_error
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit 8e04fdfadda75a849c649f7e50fe7d97772e1fcb upstream.
mirror->mirror_ds can be NULL if uninitialised, but can contain a PTR_ERR() if call to GETDEVICEINFO failed.
--- fs/nfs/flexfilelayout/flexfilelayoutdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/flexfilelayout/flexfilelayoutdev.c +1 -1
@@ -306,7 +306,7 @@ int ff_layout_track_ds_error(struct nfs4if (status ==0 )return 0 ; -if (mirror->mirror_ds ==NULL ) +if (IS_ERR_OR_NULL (mirror->mirror_ds))return -EINVAL ; dserr =kmalloc (sizeof (*dserr), gfp_flags);
Greg Kroah-Hartman
maintainerPATCH 137/293 lib/scatterlist: Fix mapping iterator when sg->offset is greater than PAGE_SIZE
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit aeb87246537a83c2aff482f3f34a2e0991e02cbc upstream.
All mapping iterator logic is based on the assumption that sg->offset is always lower than PAGE_SIZE.
But there are situations where sg->offset is such that the SG item is on the second page. In that case sg_copy_to_buffer() fails properly copying the data into the buffer. One of the reason is that the data will be outside the kmapped area used to access that data.
This patch fixes the issue by adjusting the mapping iterator offset and pgoffset fields such that offset is always lower than PAGE_SIZE.
--- lib/scatterlist.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
lib/scatterlist.c +5 -4
@@ -496,17 +496,18 @@ static bool sg_miter_get_next_page(struc {if (!miter->__remaining) {struct scatterlist *sg; -unsigned long pgoffset;if (!__sg_page_iter_next (&miter->piter))return false; sg = miter->piter.sg; - pgoffset = miter->piter.sg_pgoffset; - miter->__offset = pgoffset ?0 : sg->offset; + miter->__offset = miter->piter.sg_pgoffset ?0 : sg->offset; + miter->piter.sg_pgoffset += miter->__offset >>PAGE_SHIFT ; + miter->__offset &=PAGE_SIZE -1 ; miter->__remaining = sg->offset + sg->length - - (pgoffset <<PAGE_SHIFT ) - miter->__offset; + (miter->piter.sg_pgoffset <<PAGE_SHIFT ) - + miter->__offset; miter->__remaining = min_t(unsigned long, miter->__remaining,PAGE_SIZE - miter->__offset); }
Greg Kroah-Hartman
maintainerPATCH 138/293 ASoC: dapm: Adapt for debugfs API change
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
commit ceaea851b9ea75f9ea2bbefb53ff0d4b27cd5a6e upstream.
Back in ff9fb72bc07705c (debugfs: return error values, not NULL) the debugfs APIs were changed to return error pointers rather than NULL pointers on error, breaking the error checking in ASoC. Update the code to use IS_ERR() and log the codes that are returned as part of the error messages.
--- sound/soc/soc-dapm.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
sound/soc/soc-dapm.c +10 -8
@@ -2120,23 +2120,25 @@ void snd_soc_dapm_debugfs_init(struct sn {struct dentry *d; -if (!parent) +if (!parent ||IS_ERR (parent))return ; dapm->debugfs_dapm =debugfs_create_dir ("dapm" , parent); -if (!dapm->debugfs_dapm) { +if (IS_ERR (dapm->debugfs_dapm)) {dev_warn (dapm->dev, -"ASoC: Failed to create DAPM debugfs directory\n" ); +"ASoC: Failed to create DAPM debugfs directory %ld\n" , +PTR_ERR (dapm->debugfs_dapm));return ; } d =debugfs_create_file ("bias_level" ,0444 , dapm->debugfs_dapm, dapm, &dapm_bias_fops); -if (!d) +if (IS_ERR (d))dev_warn (dapm->dev, -"ASoC: Failed to create bias level debugfs file\n" ); +"ASoC: Failed to create bias level debugfs file: %ld\n" , +PTR_ERR (d)); }static void dapm_debugfs_add_widget (struct snd_soc_dapm_widget *w)
@@ -2150,10 +2152,10 @@ static void dapm_debugfs_add_widget(stru d =debugfs_create_file (w->name,0444 , dapm->debugfs_dapm, w, &dapm_widget_power_fops); -if (!d) +if (IS_ERR (d))dev_warn (w->dapm->dev, -"ASoC: Failed to create %s debugfs file\n" , - w->name); +"ASoC: Failed to create %s debugfs file: %ld\n" , + w->name,PTR_ERR (d)); }static void dapm_debugfs_cleanup (struct snd_soc_dapm_context *dapm)
Greg Kroah-Hartman
maintainerPATCH 139/293 ALSA: seq: Break too long mutex context in the write loop
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit ede34f397ddb063b145b9e7d79c6026f819ded13 upstream.
The fix for the racy writes and ioctls to sequencer widened the application of client->ioctl_mutex to the whole write loop. Although it does unlock/relock for the lengthy operation like the event dup, the loop keeps the ioctl_mutex for the whole time in other situations. This may take quite long time if the user-space would give a huge buffer, and this is a likely cause of some weird behavior spotted by syzcaller fuzzer.
This patch puts a simple workaround, just adding a mutex break in the loop when a large number of events have been processed. This shouldn't hit any performance drop because the threshold is set high enough for usual operations.
--- sound/core/seq/seq_clientmgr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
sound/core/seq/seq_clientmgr.c +10 -1
@@ -1001,7 +1001,7 @@ static ssize_t snd_seq_write(struct file {struct snd_seq_client *client = file->private_data;int written =0 , len; -int err; +int err, handled;struct snd_seq_event event;if (!(snd_seq_file_flags (file) &SNDRV_SEQ_LFLG_OUTPUT ))
@@ -1014,6 +1014,8 @@ static ssize_t snd_seq_write(struct fileif (!client->accept_output || client->pool ==NULL )return -ENXIO ; + repeat: + handled =0 ;/* allocate the pool now if the pool is not allocated yet */ mutex_lock (&client->ioctl_mutex);if (client->pool->size >0 && !snd_seq_write_pool_allocated (client)) {
@@ -1073,12 +1075,19 @@ static ssize_t snd_seq_write(struct file 0, 0, &client->ioctl_mutex);if (err <0 )break ; + handled++; __skip_event:/* Update pointers and counts */ count -= len; buf += len; written += len; + +/* let's have a coffee break if too many events are queued */ +if (++handled >=200 ) { +mutex_unlock (&client->ioctl_mutex); + goto repeat; + } } out:
Greg Kroah-Hartman
maintainerPATCH 141/293 media: v4l2: Test type instead of cfg->type in v4l2_ctrl_new_custom()
In reply to Greg Kroah-HartmanFrom: Boris Brezillon <[email protected]>
commit 07d89227a983df957a6a7c56f7c040cde9ac571f upstream.
cfg->type can be overridden by v4l2_ctrl_fill() and the new value is stored in the local type var. Fix the tests to use this local var.
--- drivers/media/v4l2-core/v4l2-ctrls.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/media/v4l2-core/v4l2-ctrls.c +4 -5
@@ -2113,16 +2113,15 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(sv4l2_ctrl_fill (cfg->id, &name, &type, &min, &max, &step, &def, &flags); - is_menu = (cfg->type ==V4L2_CTRL_TYPE_MENU || - cfg->type ==V4L2_CTRL_TYPE_INTEGER_MENU ); + is_menu = (type ==V4L2_CTRL_TYPE_MENU || + type ==V4L2_CTRL_TYPE_INTEGER_MENU );if (is_menu)WARN_ON (step);else WARN_ON (cfg->menu_skip_mask); -if (cfg->type ==V4L2_CTRL_TYPE_MENU && qmenu ==NULL ) +if (type ==V4L2_CTRL_TYPE_MENU && !qmenu) { qmenu =v4l2_ctrl_get_menu (cfg->id); -else if (cfg->type ==V4L2_CTRL_TYPE_INTEGER_MENU && - qmenu_int ==NULL ) { + }else if (type ==V4L2_CTRL_TYPE_INTEGER_MENU && !qmenu_int) {handler_set_err (hdl, -EINVAL );return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 106/293 iavf: fix dereference of null rx_buffer pointer
In reply to Greg Kroah-Hartman[ Upstream commit 9fe06a51287b2d41baef7ece94df34b5abf19b90 ]
A recent commit efa14c3985828d ("iavf: allow null RX descriptors") added a null pointer sanity check on rx_buffer, however, rx_buffer is being dereferenced before that check, which implies a null pointer dereference bug can potentially occur. Fix this by only dereferencing rx_buffer until after the null pointer check.
Addresses-Coverity: ("Dereference before null check")
--- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +4 -2
@@ -1117,7 +1117,7 @@ static struct sk_buff *i40e_construct_skb(struct i40e_ring *rx_ring,struct i40e_rx_buffer *rx_buffer, unsigned int size) { - void *va = page_address(rx_buffer->page) + rx_buffer->page_offset; + void *va;#if (PAGE_SIZE <8192 )unsigned int truesize =i40e_rx_pg_size (rx_ring) /2 ;#else
@@ -1127,6 +1127,7 @@ static struct sk_buff *i40e_construct_skb(struct i40e_ring *rx_ring,struct sk_buff *skb;/* prefetch first cache line of first page */ + va =page_address (rx_buffer->page) + rx_buffer->page_offset;prefetch (va);#if L1_CACHE_BYTES <128 prefetch (va +L1_CACHE_BYTES );
@@ -1181,7 +1182,7 @@ static struct sk_buff *i40e_build_skb(struct i40e_ring *rx_ring,struct i40e_rx_buffer *rx_buffer, unsigned int size) { - void *va = page_address(rx_buffer->page) + rx_buffer->page_offset; + void *va;#if (PAGE_SIZE <8192 )unsigned int truesize =i40e_rx_pg_size (rx_ring) /2 ;#else
@@ -1191,6 +1192,7 @@ static struct sk_buff *i40e_build_skb(struct i40e_ring *rx_ring,struct sk_buff *skb;/* prefetch first cache line of first page */ + va =page_address (rx_buffer->page) + rx_buffer->page_offset;prefetch (va);#if L1_CACHE_BYTES <128 prefetch (va +L1_CACHE_BYTES );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 140/293 ALSA: hda/realtek: apply ALC891 headset fixup to one Dell machine
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
commit 4b4e0e32e4b09274dbc9d173016c1a026f44608c upstream.
Without this patch, the headset-mic and headphone-mic don't work.
--- sound/pci/hda/patch_realtek.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/pci/hda/patch_realtek.c +5 -0
@@ -8149,6 +8149,11 @@ static const struct snd_hda_pin_quirk al {0x18, 0x01a19030}, {0x1a, 0x01813040}, {0x21, 0x01014020}), + SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE, + {0x16, 0x01813030}, + {0x17, 0x02211010}, + {0x18, 0x01a19040}, + {0x21, 0x01014020}), SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE, {0x14, 0x01014010}, {0x18, 0x01a19020},
Greg Kroah-Hartman
maintainerPATCH 104/293 gtp: fix use-after-free in gtp_newlink()
In reply to Greg Kroah-Hartman[ Upstream commit a2bed90704c68d3763bf24decb1b781a45395de8 ]
Current gtp_newlink() could be called after unregister_pernet_subsys(). gtp_newlink() uses gtp_net but it can be destroyed by unregister_pernet_subsys().
So unregister_pernet_subsys() should be called after rtnl_link_unregister().
Test commands:
#SHELL 1
while :
do
for i in {1..5}
do
./gtp-link add gtp$i &
done
killall gtp-linkdone
#SHELL 2
while :
do
modprobe -rv gtp
done
Splat looks like:
[ 753.176631] BUG: KASAN: use-after-free in gtp_newlink+0x9b4/0xa5c [gtp] [ 753.177722] Read of size 8 at addr ffff8880d48f2458 by task gtp-link/7126 [ 753.179082] CPU: 0 PID: 7126 Comm: gtp-link Tainted: G W 5.2.0-rc6+ #50 [ 753.185801] Call Trace: [ 753.186264] dump_stack+0x7c/0xbb [ 753.186863] ? gtp_newlink+0x9b4/0xa5c [gtp] [ 753.187583] print_address_description+0xc7/0x240 [ 753.188382] ? gtp_newlink+0x9b4/0xa5c [gtp] [ 753.189097] ? gtp_newlink+0x9b4/0xa5c [gtp] [ 753.189846] __kasan_report+0x12a/0x16f [ 753.190542] ? gtp_newlink+0x9b4/0xa5c [gtp] [ 753.191298] kasan_report+0xe/0x20 [ 753.191893] gtp_newlink+0x9b4/0xa5c [gtp] [ 753.192580] ? __netlink_ns_capable+0xc3/0xf0 [ 753.193370] __rtnl_newlink+0xb9f/0x11b0 [ ... ] [ 753.241201] Allocated by task 7186: [ 753.241844] save_stack+0x19/0x80 [ 753.242399] __kasan_kmalloc.constprop.3+0xa0/0xd0 [ 753.243192] __kmalloc+0x13e/0x300 [ 753.243764] ops_init+0xd6/0x350 [ 753.244314] register_pernet_operations+0x249/0x6f0 [ ... ] [ 753.251770] Freed by task 7178: [ 753.252288] save_stack+0x19/0x80 [ 753.252833] __kasan_slab_free+0x111/0x150 [ 753.253962] kfree+0xc7/0x280 [ 753.254509] ops_free_list.part.11+0x1c4/0x2d0 [ 753.255241] unregister_pernet_operations+0x262/0x390 [ ... ] [ 753.285883] list_add corruption. next->prev should be prev (ffff8880d48f2458), but was ffff8880d497d878. (next. [ 753.287241] ------------[ cut here ]------------ [ 753.287794] kernel BUG at lib/list_debug.c:25! [ 753.288364] invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI [ 753.289099] CPU: 0 PID: 7126 Comm: gtp-link Tainted: G B W 5.2.0-rc6+ #50 [ 753.291036] RIP: 0010:__list_add_valid+0x74/0xd0 [ 753.291589] Code: 48 39 da 75 27 48 39 f5 74 36 48 39 dd 74 31 48 83 c4 08 b8 01 00 00 00 5b 5d c3 48 89 d9 48b [ 753.293779] RSP: 0018:ffff8880cae8f398 EFLAGS: 00010286 [ 753.294401] RAX: 0000000000000075 RBX: ffff8880d497d878 RCX: 0000000000000000 [ 753.296260] RDX: 0000000000000075 RSI: 0000000000000008 RDI: ffffed10195d1e69 [ 753.297070] RBP: ffff8880cd250ae0 R08: ffffed101b4bff21 R09: ffffed101b4bff21 [ 753.297899] R10: 0000000000000001 R11: ffffed101b4bff20 R12: ffff8880d497d878 [ 753.298703] R13: 0000000000000000 R14: ffff8880cd250ae0 R15: ffff8880d48f2458 [ 753.299564] FS: 00007f5f79805740(0000) GS:ffff8880da400000(0000) knlGS:0000000000000000 [ 753.300533] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 753.301231] CR2: 00007fe8c7ef4f10 CR3: 00000000b71a6006 CR4: 00000000000606f0 [ 753.302183] Call Trace: [ 753.302530] gtp_newlink+0x5f6/0xa5c [gtp] [ 753.303037] ? __netlink_ns_capable+0xc3/0xf0 [ 753.303576] __rtnl_newlink+0xb9f/0x11b0 [ 753.304092] ? rtnl_link_unregister+0x230/0x230
--- drivers/net/gtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/gtp.c +1 -1
@@ -1383,9 +1383,9 @@ late_initcall(gtp_init); static void __exit gtp_fini(void) { -unregister_pernet_subsys (>p_net_ops);genl_unregister_family (>p_genl_family);rtnl_link_unregister (>p_link_ops); +unregister_pernet_subsys (>p_net_ops);pr_info ("GTP module unloaded\n" ); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 108/293 floppy: fix out-of-bounds read in next_valid_format
In reply to Greg Kroah-Hartman[ Upstream commit 5635f897ed83fd539df78e98ba69ee91592f9bb8 ]
This fixes a global out-of-bounds read access in the next_valid_format function of the floppy driver.
The values from autodetect field of the struct floppy_drive_params are used as indices for the floppy_type array in the next_valid_format function 'floppy_type[DP->autodetect[probed_format]].sect'.
To trigger the bug, one could use a value out of range and set the drive parameters with the FDSETDRVPRM ioctl. A floppy disk is not required to be inserted.
CAP_SYS_ADMIN is required to call FDSETDRVPRM.
The patch adds the check for values of the autodetect field to be in the '0 <= x < ARRAY_SIZE(floppy_type)' range of the floppy_type array indices.
The bug was found by syzkaller.
--- drivers/block/floppy.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/block/floppy.c +18 -0
@@ -3386,6 +3386,20 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo)return 0 ; } +static bool valid_floppy_drive_params (const short autodetect[8 ]) +{ +size_t floppy_type_size =ARRAY_SIZE (floppy_type); +size_t i =0 ; + +for (i =0 ; i <8 ; ++i) { +if (autodetect[i] <0 || + autodetect[i] >= floppy_type_size) +return false; + } + +return true; +} +static int fd_locked_ioctl (struct block_device *bdev,fmode_t mode,unsigned int cmd,unsigned long param) {
@@ -3512,6 +3526,8 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned intSUPBOUND (size,strlen ((const char *)outparam) +1 );break ;case FDSETDRVPRM : +if (!valid_floppy_drive_params (inparam.dp.autodetect)) +return -EINVAL ; *UDP = inparam.dp;break ;case FDGETDRVPRM :
@@ -3709,6 +3725,8 @@ static int compat_setdrvprm(int drive,return -EPERM ;if (copy_from_user (&v, arg,sizeof (struct compat_floppy_drive_params )))return -EFAULT ; +if (!valid_floppy_drive_params (v.autodetect)) +return -EINVAL ;mutex_lock (&floppy_mutex);UDP ->cmos = v.cmos;UDP ->max_dtr = v.max_dtr;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 105/293 net: mvmdio: defer probe of orion-mdio if a clock is not ready
In reply to Greg Kroah-Hartman[ Upstream commit 433a06d7d74e677c40b1148c70c48677ff62fb6b ]
Defer probing of the orion-mdio interface when getting a clock returns EPROBE_DEFER. This avoids locking up the Armada 8k SoC when mdio is used before all clocks have been enabled.
--- drivers/net/ethernet/marvell/mvmdio.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/marvell/mvmdio.c +5 -0
@@ -321,6 +321,10 @@ static int orion_mdio_probe(struct platform_device *pdev)for (i =0 ; i <ARRAY_SIZE (dev->clk); i++) { dev->clk[i] =of_clk_get (pdev->dev.of_node, i); +if (PTR_ERR (dev->clk[i]) == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; + goto out_clk; + }if (IS_ERR (dev->clk[i]))break ;clk_prepare_enable (dev->clk[i]);
@@ -365,6 +369,7 @@ static int orion_mdio_probe(struct platform_device *pdev)if (dev->err_interrupt >0 )writel (0 , dev->regs +MVMDIO_ERR_INT_MASK ); +out_clk:for (i =0 ; i <ARRAY_SIZE (dev->clk); i++) {if (IS_ERR (dev->clk[i]))break ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 143/293 KVM: x86/vPMU: refine kvm_pmu err msg when event creation failed
In reply to Greg Kroah-HartmanFrom: Like Xu <[email protected]>
commit 6fc3977ccc5d3c22e851f2dce2d3ce2a0a843842 upstream.
If a perf_event creation fails due to any reason of the host perf subsystem, it has no chance to log the corresponding event for guest which may cause abnormal sampling data in guest result. In debug mode, this message helps to understand the state of vPMC and we may not limit the number of occurrences but not in a spamming style.
--- arch/x86/kvm/pmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/pmu.c +2 -2
@@ -131,8 +131,8 @@ static void pmc_reprogram_counter(struct intr ? kvm_perf_overflow_intr : kvm_perf_overflow, pmc);if (IS_ERR (event)) { -printk_once ("kvm_pmu: event creation failed %ld\n" , -PTR_ERR (event)); +pr_debug_ratelimited ("kvm_pmu: event creation failed %ld for pmc->idx = %d\n" , +PTR_ERR (event), pmc->idx);return ; }
Greg Kroah-Hartman
maintainerPATCH 153/293 perf/x86/amd/uncore: Do not set ThreadMask and SliceMask for non-L3 PMCs
In reply to Greg Kroah-HartmanFrom: Kim Phillips <[email protected]>
commit 16f4641166b10e199f0d7b68c2c5f004fef0bda3 upstream.
The following commit:
d7cbbe49a930 ("perf/x86/amd/uncore: Set ThreadMask and SliceMask for L3 Cache perf events")
enables L3 PMC events for all threads and slices by writing 1's in 'ChL3PmcCfg' (L3 PMC PERF_CTL) register fields.
Those bitfields overlap with high order event select bits in the Data Fabric PMC control register, however.
So when a user requests raw Data Fabric events (-e amd_df/event=0xYYY/), the two highest order bits get inadvertently set, changing the counter select to events that don't exist, and for which no counts are read.
This patch changes the logic to write the L3 masks only when dealing with L3 PMC counters.
AMD Family 16h and below Northbridge (NB) counters were not affected.
--- arch/x86/events/amd/uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/amd/uncore.c +1 -1
@@ -213,7 +213,7 @@ static int amd_uncore_event_init(struct* SliceMask and ThreadMask need to be set for certain L3 events in * Family 17h. For other events, the two fields do not affect the count. */ -if (l3_mask) +if (l3_mask &&is_llc_event (event)) hwc->config |= (AMD64_L3_SLICE_MASK |AMD64_L3_THREAD_MASK );if (event->cpu <0 )
Greg Kroah-Hartman
maintainerPATCH 154/293 perf/x86/amd/uncore: Set the thread mask for F17h L3 PMCs
In reply to Greg Kroah-HartmanFrom: Kim Phillips <[email protected]>
commit 2f217d58a8a086d3399fecce39fb358848e799c4 upstream.
Fill in the L3 performance event select register ThreadMask bitfield, to enable per hardware thread accounting.
--- arch/x86/events/amd/uncore.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
arch/x86/events/amd/uncore.c +11 -4
@@ -209,15 +209,22 @@ static int amd_uncore_event_init(struct hwc->config = event->attr.config &AMD64_RAW_EVENT_MASK_NB ; hwc->idx =-1 ; +if (event->cpu <0 ) +return -EINVAL ; +/* * SliceMask and ThreadMask need to be set for certain L3 events in * Family 17h. For other events, the two fields do not affect the count. */ -if (l3_mask &&is_llc_event (event)) - hwc->config |= (AMD64_L3_SLICE_MASK |AMD64_L3_THREAD_MASK ); +if (l3_mask &&is_llc_event (event)) { +int thread =2 * (cpu_data (event->cpu).cpu_core_id %4 ); -if (event->cpu <0 ) -return -EINVAL ; +if (smp_num_siblings >1 ) + thread +=cpu_data (event->cpu).apicid &1 ; + + hwc->config |= (1ULL << (AMD64_L3_THREAD_SHIFT + thread) & +AMD64_L3_THREAD_MASK ) |AMD64_L3_SLICE_MASK ; + } uncore =event_to_amd_uncore (event);if (!uncore)
Greg Kroah-Hartman
maintainerPATCH 155/293 intel_th: pci: Add Ice Lake NNPI support
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
commit 4aa5aed2b6f267592705a526f57518a5d715b769 upstream.
This adds Ice Lake NNPI support to the Intel(R) Trace Hub.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -178,6 +178,11 @@ static const struct pci_device_id intel_ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x02a6), .driver_data = (kernel_ulong_t)&intel_th_2x, }, + { +/* Ice Lake NNPI */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, { 0 }, };
Greg Kroah-Hartman
maintainerPATCH 156/293 PCI: Do not poll for PME if the device is in D3cold
In reply to Greg Kroah-HartmanFrom: Mika Westerberg <[email protected]>
commit 000dd5316e1c756a1c028f22e01d06a38249dd4d upstream.
PME polling does not take into account that a device that is directly connected to the host bridge may go into D3cold as well. This leads to a situation where the PME poll thread reads from a config space of a device that is in D3cold and gets incorrect information because the config space is not accessible.
Here is an example from Intel Ice Lake system where two PCIe root ports are in D3cold (I've instrumented the kernel to log the PMCSR register contents):
[ 62.971442] pcieport 0000:00:07.1: Check PME status, PMCSR=0xffff [ 62.971504] pcieport 0000:00:07.0: Check PME status, PMCSR=0xffff
Since 0xffff is interpreted so that PME is pending, the root ports will be runtime resumed. This repeats over and over again essentially blocking all runtime power management.
Prevent this from happening by checking whether the device is in D3cold before its PME status is read.
--- drivers/pci/pci.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/pci/pci.c +7 -0
@@ -1786,6 +1786,13 @@ static void pci_pme_list_scan(struct wor*/ if (bridge && bridge->current_state !=PCI_D0 )continue ; +/* +* If the device is in D3cold it should not be +* polled either. +*/ +if (pme_dev->dev->current_state == PCI_D3cold) +continue ; +pci_pme_wakeup (pme_dev->dev,NULL ); }else {list_del (&pme_dev->list);
Greg Kroah-Hartman
maintainerPATCH 157/293 Btrfs: fix data loss after inode eviction, renaming it, and fsync it
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit d1d832a0b51dd9570429bb4b81b2a6c1759e681a upstream.
When we log an inode, regardless of logging it completely or only that it exists, we always update it as logged (logged_trans and last_log_commit fields of the inode are updated). This is generally fine and avoids future attempts to log it from having to do repeated work that brings no value.
However, if we write data to a file, then evict its inode after all the dealloc was flushed (and ordered extents completed), rename the file and fsync it, we end up not logging the new extents, since the rename may result in logging that the inode exists in case the parent directory was logged before. The following reproducer shows and explains how this can happen:
$ mkfs.btrfs -f /dev/sdb $ mount /dev/sdb /mnt
$ mkdir /mnt/dir $ touch /mnt/dir/foo $ touch /mnt/dir/bar
# Do a direct IO write instead of a buffered write because with a
# buffered write we would need to make sure dealloc gets flushed and # complete before we do the inode eviction later, and we can not do that # from user space with call to things such as sync(2) since that results # in a transaction commit as well. $ xfs_io -d -c "pwrite -S 0xd3 0 4K" /mnt/dir/bar
# Keep the directory dir in use while we evict inodes. We want our file # bar's inode to be evicted but we don't want our directory's inode to
# be evicted (if it were evicted too, we would not be able to reproduce # the issue since the first fsync below, of file foo, would result in a # transaction commit. $ ( cd /mnt/dir; while true; do :; done ) & $ pid=$!
# Wait a bit to give time for the background process to chdir.
$ sleep 0.1
# Evict all inodes, except the inode for the directory dir because it is
# currently in use by our background process. $ echo 2 > /proc/sys/vm/drop_caches
# fsync file foo, which ends up persisting information about the parent # directory because it is a new inode. $ xfs_io -c fsync /mnt/dir/foo
# Rename bar, this results in logging that this inode exists (inode item, # names, xattrs) because the parent directory is in the log.
$ mv /mnt/dir/bar /mnt/dir/baz
# Now fsync baz, which ends up doing absolutely nothing because of the
# rename operation which logged that the inode exists only. $ xfs_io -c fsync /mnt/dir/baz
<power failure>
$ mount /dev/sdb /mnt $ od -t x1 -A d /mnt/dir/baz 0000000
--> Empty file, data we wrote is missing.
Fix this by not updating last_sub_trans of an inode when we are logging only that it exists and the inode was not yet logged since it was loaded from disk (full_sync bit set), this is enough to make btrfs_inode_in_log() return false for this scenario and make us log the inode. The logged_trans of the inode is still always setsince that alone is used to track if names need to be deleted as part of unlink operations.
--- fs/btrfs/tree-log.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/btrfs/tree-log.c +11 -1
@@ -5266,9 +5266,19 @@ log_extents: } } +/* +* Don't update last_log_commit if we logged that an inode exists after +* it was loaded to memory (full_sync bit set). +* This is to prevent data loss when we do a write to the inode, then +* the inode gets evicted after all delalloc was flushed, then we log +* it exists (due to a rename for example) and then fsync it. This last +* fsync would do nothing (not logging the extents previously written). +*/ spin_lock (&inode->lock); inode->logged_trans = trans->transid; - inode->last_log_commit = inode->last_sub_trans; +if (inode_only !=LOG_INODE_EXISTS || + !test_bit (BTRFS_INODE_NEEDS_FULL_SYNC , &inode->runtime_flags)) + inode->last_log_commit = inode->last_sub_trans;spin_unlock (&inode->lock); out_unlock:if (unlikely (err))
Greg Kroah-Hartman
maintainerPATCH 158/293 Btrfs: fix fsync not persisting dentry deletions due to inode evictions
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 803f0f64d17769071d7287d9e3e3b79a3e1ae937 upstream.
In order to avoid searches on a log tree when unlinking an inode, we check if the inode being unlinked was logged in the current transaction, as well as the inode of its parent directory. When any of the inodes are logged, we proceed to delete directory items and inode reference items from the log, to ensure that if a subsequent fsync of only the inode being unlinked or only of the parent directory when the other is not fsync'ed as well, does not result in the entry still existing after a power failure.
That check however is not reliable when one of the inodes involved (the one being unlinked or its parent directory's inode) is evicted, since the logged_trans field is transient, that is, it is not stored on disk, so it is lost when the inode is evicted and loaded into memory again (which is set to zero on load). As a consequence the checks currently being done by btrfs_del_dir_entries_in_log() and btrfs_del_inode_ref_in_log() always return true if the inode was evicted before, regardless of the inode having been logged or not before (and in the current transaction), this results in the dentry being unlinked still existing after a log replay if after the unlink operation only one of the inodes involved is fsync'ed.
Example:
$ mkfs.btrfs -f /dev/sdb $ mount /dev/sdb /mnt
$ mkdir /mnt/dir $ touch /mnt/dir/foo $ xfs_io -c fsync /mnt/dir/foo
# Keep an open file descriptor on our directory while we evict inodes. # We just want to evict the file's inode, the directory's inode must not
# be evicted. $ ( cd /mnt/dir; while true; do :; done ) & $ pid=$!
# Wait a bit to give time to background process to chdir to our test
# directory. $ sleep 0.5
# Trigger eviction of the file's inode.
$ echo 2 > /proc/sys/vm/drop_caches
# Unlink our file and fsync the parent directory. After a power failure
# we don't expect to see the file anymore, since we fsync'ed the parent # directory. $ rm -f $SCRATCH_MNT/dir/foo $ xfs_io -c fsync /mnt/dir
<power failure>
$ mount /dev/sdb /mnt $ ls /mnt/dir foo $ --> file still there, unlink not persisted despite explicit fsync on dir
Fix this by checking if the inode has the full_sync bit set in its runtime flags as well, since that bit is set everytime an inode is loaded from disk, or for other less common cases such as after a shrinking truncate or failure to allocate extent maps for holes, and gets cleared after the first fsync. Also consider the inode as possibly logged only if it was last modified in the current transaction (besides having the full_fsync flag set).
--- fs/btrfs/tree-log.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
fs/btrfs/tree-log.c +26 -2
@@ -3153,6 +3153,30 @@ int btrfs_free_log_root_tree(struct btrf }/* +* Check if an inode was logged in the current transaction. We can't always rely +* on an inode's logged_trans value, because it's an in-memory only field and +* therefore not persisted. This means that its value is lost if the inode gets +* evicted and loaded again from disk (in which case it has a value of 0, and +* certainly it is smaller then any possible transaction ID), when that happens +* the full_sync flag is set in the inode's runtime flags, so on that case we +* assume eviction happened and ignore the logged_trans value, assuming the +* worst case, that the inode was logged before in the current transaction. +*/ +static bool inode_logged (struct btrfs_trans_handle *trans, +struct btrfs_inode *inode) +{ +if (inode->logged_trans == trans->transid) +return true; + +if (inode->last_trans == trans->transid && +test_bit (BTRFS_INODE_NEEDS_FULL_SYNC , &inode->runtime_flags) && + !test_bit (BTRFS_FS_LOG_RECOVERING , &trans->fs_info->flags)) +return true; + +return false; +} + +/* * If both a file and directory are logged, and unlinks or renames are * mixed in, we have a few interesting corners: *
@@ -3186,7 +3210,7 @@ int btrfs_del_dir_entries_in_log(structint bytes_del =0 ;u64 dir_ino =btrfs_ino (dir); -if (dir->logged_trans < trans->transid) +if (!inode_logged (trans, dir))return 0 ; ret =join_running_log_trans (root);
@@ -3291,7 +3315,7 @@ int btrfs_del_inode_ref_in_log(struct btu64 index;int ret; -if (inode->logged_trans < trans->transid) +if (!inode_logged (trans, inode))return 0 ; ret =join_running_log_trans (root);
Greg Kroah-Hartman
maintainerPATCH 159/293 Btrfs: add missing inode version, ctime and mtime updates when punching hole
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 179006688a7e888cbff39577189f2e034786d06a upstream.
If the range for which we are punching a hole covers only part of a page, we end up updating the inode item but we skip the update of the inode's iversion, mtime and ctime. Fix that by ensuring we update those properties of the inode.
A patch for fstests test case generic/059 that tests this as been sent along with this fix.
--- fs/btrfs/file.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/btrfs/file.c +5 -0
@@ -2784,6 +2784,11 @@ out_only_mutex:* for detecting, at fsync time, if the inode isn't yet in the * log tree or it's there but not up to date. */ +struct timespec now =current_time (inode); + +inode_inc_iversion (inode); + inode->i_mtime = now; + inode->i_ctime = now; trans =btrfs_start_transaction (root,1 );if (IS_ERR (trans)) { err =PTR_ERR (trans);
Greg Kroah-Hartman
maintainerPATCH 161/293 HID: wacom: correct touch resolution x/y typo
In reply to Greg Kroah-HartmanFrom: Aaron Armstrong Skomra <[email protected]>
commit 68c20cc2164cc5c7c73f8012ae6491afdb1f7f72 upstream.
This affects the 2nd-gen Intuos Pro Medium and Large when using their Bluetooth connection.
--- drivers/hid/wacom_wac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/wacom_wac.c +1 -1
@@ -3550,7 +3550,7 @@ int wacom_setup_touch_input_capabilities 0, 5920, 4, 0); }input_abs_set_res (input_dev,ABS_MT_POSITION_X ,40 ); -input_abs_set_res (input_dev,ABS_MT_POSITION_X ,40 ); +input_abs_set_res (input_dev,ABS_MT_POSITION_Y ,40 );/* fall through */
Greg Kroah-Hartman
maintainerPATCH 162/293 libnvdimm/pfn: fix fsdax-mode namespace info-block zero-fields
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
commit 7e3e888dfc138089f4c15a81b418e88f0978f744 upstream.
At namespace creation time there is the potential for the "expected to be zero" fields of a 'pfn' info-block to be filled with indeterminate data. While the kernel buffer is zeroed on allocation it is immediately overwritten by nd_pfn_validate() filling it with the current contents of the on-media info-block location. For fields like, 'flags' and the 'padding' it potentially means that future implementations can not rely on those fields being zero.
In preparation to stop using the 'start_pad' and 'end_trunc' fields for section alignment, arrange for fields that are not explicitly initialized to be guaranteed zero. Bump the minor version to indicate it is safe to assume the 'padding' and 'flags' are zero. Otherwise, this corruption is expected to benign since all other critical fields are explicitly initialized.
Note The cc: stable is about spreading this new policy to as many kernels as possible not fixing an issue in those kernels. It is not until the change titled "libnvdimm/pfn: Stop padding pmem namespaces to section alignment" where this improper initialization becomes a problem. So if someone decides to backport "libnvdimm/pfn: Stop padding pmem namespaces to section alignment" (which is not tagged for stable), make sure this pre-requisite is flagged.
--- drivers/nvdimm/dax_devs.c | 2 +- drivers/nvdimm/pfn.h | 1 + drivers/nvdimm/pfn_devs.c | 18 +++++++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-)
drivers/nvdimm/dax_devs.c +1 -1
@@ -126,7 +126,7 @@ int nd_dax_probe(struct device *dev, strnvdimm_bus_unlock (&ndns->dev);if (!dax_dev)return -ENOMEM ; - pfn_sb =devm_kzalloc (dev,sizeof (*pfn_sb),GFP_KERNEL ); + pfn_sb =devm_kmalloc (dev,sizeof (*pfn_sb),GFP_KERNEL ); nd_pfn->pfn_sb = pfn_sb; rc =nd_pfn_validate (nd_pfn,DAX_SIG ); dev_dbg(dev, "%s: dax: %s\n", __func__,
drivers/nvdimm/pfn.h +1 -0
@@ -36,6 +36,7 @@ struct nd_pfn_sb {__le32 end_trunc;/* minor-version-2 record the base alignment of the mapping */ __le32 align; +/* minor-version-3 guarantee the padding and flags are zero */ u8 padding[4000 ];__le64 checksum; };
drivers/nvdimm/pfn_devs.c +15 -3
@@ -361,6 +361,15 @@ struct device *nd_pfn_create(struct nd_rreturn dev; } +/** +* nd_pfn_validate - read and validate info-block +* @nd_pfn: fsdax namespace runtime state / properties +* @sig: 'devdax' or 'fsdax' signature +* +* Upon return the info-block buffer contents (->pfn_sb) are +* indeterminate when validation fails, and a coherent info-block +* otherwise. +*/ int nd_pfn_validate (struct nd_pfn *nd_pfn,const char *sig) {u64 checksum, offset;
@@ -506,7 +515,7 @@ int nd_pfn_probe(struct device *dev, strnvdimm_bus_unlock (&ndns->dev);if (!pfn_dev)return -ENOMEM ; - pfn_sb =devm_kzalloc (dev,sizeof (*pfn_sb),GFP_KERNEL ); + pfn_sb =devm_kmalloc (dev,sizeof (*pfn_sb),GFP_KERNEL ); nd_pfn =to_nd_pfn (pfn_dev); nd_pfn->pfn_sb = pfn_sb; rc =nd_pfn_validate (nd_pfn,PFN_SIG );
@@ -637,7 +646,7 @@ static int nd_pfn_init(struct nd_pfn *ndu64 checksum;int rc; - pfn_sb =devm_kzalloc (&nd_pfn->dev,sizeof (*pfn_sb),GFP_KERNEL ); + pfn_sb =devm_kmalloc (&nd_pfn->dev,sizeof (*pfn_sb),GFP_KERNEL );if (!pfn_sb)return -ENOMEM ;
@@ -646,11 +655,14 @@ static int nd_pfn_init(struct nd_pfn *nd sig =DAX_SIG ; else sig =PFN_SIG ; + rc =nd_pfn_validate (nd_pfn, sig);if (rc != -ENODEV )return rc;/* no info block, do init */ ; +memset (pfn_sb,0 ,sizeof (*pfn_sb)); + nd_region =to_nd_region (nd_pfn->dev.parent);if (nd_region->ro) { dev_info(&nd_pfn->dev,
@@ -704,7 +716,7 @@ static int nd_pfn_init(struct nd_pfn *ndmemcpy (pfn_sb->uuid, nd_pfn->uuid,16 );memcpy (pfn_sb->parent_uuid,nd_dev_to_uuid (&ndns->dev),16 ); pfn_sb->version_major =cpu_to_le16 (1 ); - pfn_sb->version_minor =cpu_to_le16 (2 ); + pfn_sb->version_minor =cpu_to_le16 (3 ); pfn_sb->start_pad =cpu_to_le32 (start_pad); pfn_sb->end_trunc =cpu_to_le32 (end_trunc); pfn_sb->align =cpu_to_le32 (nd_pfn->align);
Greg Kroah-Hartman
maintainerPATCH 163/293 coda: pass the host file in vma->vm_file on mmap
In reply to Greg Kroah-HartmanFrom: Jan Harkes <[email protected]>
commit 7fa0a1da3dadfd9216df7745a1331fdaa0940d1c upstream.
Patch series "Coda updates".
The following patch series is a collection of various fixes for Coda, most of which were collected from linux-fsdevel or linux-kernel but which have as yet not found their way upstream.
This patch (of 22):
Various file systems expect that vma->vm_file points at their own file handle, several use file_inode(vma->vm_file) to get at their inode or use vma->vm_file->private_data. However the way Coda wrapped mmap on a host file broke this assumption, vm_file was still pointing at the Coda file and the host file systems would scribble over Coda's inode and private file data.
This patch fixes the incorrect expectation and wraps vm_ops->open and vm_ops->close to allow Coda to track when the vm_area_struct is destroyed so we still release the reference on the Coda file handle at the right time.
--- fs/coda/file.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-)
fs/coda/file.c +68 -2
@@ -27,6 +27,13 @@#include "coda_linux.h" #include "coda_int.h" +struct coda_vm_ops { +atomic_t refcnt; +struct file *coda_file; +const struct vm_operations_struct *host_vm_ops; +struct vm_operations_struct vm_ops; +}; +static ssize_t coda_file_read_iter (struct kiocb *iocb,struct iov_iter *to) {
@@ -61,6 +68,34 @@ coda_file_write_iter(struct kiocb *iocb,return ret; } +static void +coda_vm_open (struct vm_area_struct *vma) +{ +struct coda_vm_ops *cvm_ops = + container_of(vma->vm_ops, struct coda_vm_ops, vm_ops); + +atomic_inc (&cvm_ops->refcnt); + +if (cvm_ops->host_vm_ops && cvm_ops->host_vm_ops->open) + cvm_ops->host_vm_ops->open (vma); +} + +static void +coda_vm_close (struct vm_area_struct *vma) +{ +struct coda_vm_ops *cvm_ops = + container_of(vma->vm_ops, struct coda_vm_ops, vm_ops); + +if (cvm_ops->host_vm_ops && cvm_ops->host_vm_ops->close) + cvm_ops->host_vm_ops->close (vma); + +if (atomic_dec_and_test (&cvm_ops->refcnt)) { + vma->vm_ops = cvm_ops->host_vm_ops; +fput (cvm_ops->coda_file); +kfree (cvm_ops); + } +} +static int coda_file_mmap (struct file *coda_file,struct vm_area_struct *vma) {
@@ -68,6 +103,8 @@ coda_file_mmap(struct file *coda_file, sstruct coda_inode_info *cii;struct file *host_file;struct inode *coda_inode, *host_inode; +struct coda_vm_ops *cvm_ops; +int ret; cfi =CODA_FTOC (coda_file);BUG_ON (!cfi || cfi->cfi_magic !=CODA_MAGIC );
@@ -76,6 +113,13 @@ coda_file_mmap(struct file *coda_file, sif (!host_file->f_op->mmap)return -ENODEV ; +if (WARN_ON (coda_file != vma->vm_file)) +return -EIO ; + + cvm_ops =kmalloc (sizeof (struct coda_vm_ops ),GFP_KERNEL ); +if (!cvm_ops) +return -ENOMEM ; + coda_inode =file_inode (coda_file); host_inode =file_inode (host_file);
@@ -89,6 +133,7 @@ coda_file_mmap(struct file *coda_file, s* the container file on us! */ else if (coda_inode->i_mapping != host_inode->i_mapping) {spin_unlock (&cii->c_lock); +kfree (cvm_ops);return -EBUSY ; }
@@ -97,7 +142,29 @@ coda_file_mmap(struct file *coda_file, s cfi->cfi_mapcount++;spin_unlock (&cii->c_lock); -return call_mmap (host_file, vma); + vma->vm_file =get_file (host_file); + ret =call_mmap (vma->vm_file, vma); + +if (ret) { +/* if call_mmap fails, our caller will put coda_file so we +* should drop the reference to the host_file that we got. +*/ +fput (host_file); +kfree (cvm_ops); + }else { +/* here we add redirects for the open/close vm_operations */ + cvm_ops->host_vm_ops = vma->vm_ops; +if (vma->vm_ops) + cvm_ops->vm_ops = *vma->vm_ops; + + cvm_ops->vm_ops.open = coda_vm_open; + cvm_ops->vm_ops.close = coda_vm_close; + cvm_ops->coda_file = coda_file; +atomic_set (&cvm_ops->refcnt,1 ); + + vma->vm_ops = &cvm_ops->vm_ops; + } +return ret; }int coda_open (struct inode *coda_inode,struct file *coda_file)
@@ -207,4 +274,3 @@ const struct file_operations coda_file_o .fsync = coda_fsync, .splice_read = generic_file_splice_read, }; -
Greg Kroah-Hartman
maintainerPATCH 164/293 gpu: ipu-v3: ipu-ic: Fix saturation bit offset in TPMEM
In reply to Greg Kroah-HartmanFrom: Steve Longerbeam <[email protected]>
commit 3d1f62c686acdedf5ed9642b763f3808d6a47d1e upstream.
The saturation bit was being set at bit 9 in the second 32-bit word of the TPMEM CSC. This isn't correct, the saturation bit is bit 42, which is bit 10 of the second word.
--- drivers/gpu/ipu-v3/ipu-ic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/ipu-v3/ipu-ic.c +1 -1
@@ -256,7 +256,7 @@ static int init_csc(struct ipu_ic *ic,writel (param, base++); param = ((a[0 ] &0x1fe0 ) >>5 ) | (params->scale <<8 ) | - (params->sat <<9 ); + (params->sat <<10 );writel (param, base++); param = ((a[1] & 0x1f) << 27) | ((c[0][1] & 0x1ff) << 18) |
Greg Kroah-Hartman
maintainerPATCH 166/293 crypto: caam - limit output IV to CBC to work around CTR mode DMA issue
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
commit ed527b13d800dd515a9e6c582f0a73eca65b2e1b upstream.
The CAAM driver currently violates an undocumented and slightly controversial requirement imposed by the crypto stack that a buffer referred to by the request structure via its virtual address may not be modified while any scatterlists passed via the same request structure are mapped for inbound DMA.
This may result in errors like
alg: aead: decryption failed on test 1 for gcm_base(ctr-aes-caam,ghash-generic): ret=74
alg: aead: Failed to load transform for gcm(aes): -2
on non-cache coherent systems, due to the fact that the GCM driver passes an IV buffer by virtual address which shares a cacheline with the auth_tag buffer passed via a scatterlist, resulting in corruption of the auth_tag when the IV is updated while the DMA mapping is live.
Since the IV that is returned to the caller is only valid for CBC mode, and given that the in-kernel users of CBC (such as CTS) don't trigger the same issue as the GCM driver, let's just disable the output IV generation for all modes except CBC for the time being.
--- drivers/crypto/caam/caamalg.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/crypto/caam/caamalg.c +9 -6
@@ -853,6 +853,7 @@ static void ablkcipher_encrypt_done(strustruct ablkcipher_request *req = context;struct ablkcipher_edesc *edesc;struct crypto_ablkcipher *ablkcipher =crypto_ablkcipher_reqtfm (req); +struct caam_ctx *ctx =crypto_ablkcipher_ctx (ablkcipher);int ivsize =crypto_ablkcipher_ivsize (ablkcipher);#ifdef DEBUG
@@ -877,10 +878,11 @@ static void ablkcipher_encrypt_done(stru/* * The crypto API expects us to set the IV (req->info) to the last -* ciphertext block. This is used e.g. by the CTS mode. +* ciphertext block when running in CBC mode. */ -scatterwalk_map_and_copy (req->info, req->dst, req->nbytes - ivsize, - ivsize,0 ); +if ((ctx->cdata.algtype &OP_ALG_AAI_MASK ) ==OP_ALG_AAI_CBC ) +scatterwalk_map_and_copy (req->info, req->dst, req->nbytes - + ivsize, ivsize,0 );/* In case initial IV was generated, copy it in GIVCIPHER request */ if (edesc->iv_dir ==DMA_FROM_DEVICE ) {
@@ -1609,10 +1611,11 @@ static int ablkcipher_decrypt(struct abl/* * The crypto API expects us to set the IV (req->info) to the last -* ciphertext block. +* ciphertext block when running in CBC mode. */ -scatterwalk_map_and_copy (req->info, req->src, req->nbytes - ivsize, - ivsize,0 ); +if ((ctx->cdata.algtype &OP_ALG_AAI_MASK ) ==OP_ALG_AAI_CBC ) +scatterwalk_map_and_copy (req->info, req->src, req->nbytes - + ivsize, ivsize,0 );/* Create and submit job descriptor*/ init_ablkcipher_job (ctx->sh_desc_dec, ctx->sh_desc_dec_dma, edesc, req);
Greg Kroah-Hartman
maintainerPATCH 167/293 parisc: Ensure userspace privilege for ptraced processes in regset functions
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 34c32fc603311a72cb558e5e337555434f64c27b upstream.
On parisc the privilege level of a process is stored in the lowest two bits of the instruction pointers (IAOQ0 and IAOQ1). On Linux we use privilege level 0 for the kernel and privilege level 3 for user-space. So userspace should not be allowed to modify IAOQ0 or IAOQ1 of a ptraced process to change it's privilege level to e.g. 0 to try to gain kernel privileges.
This patch prevents such modifications in the regset support functions by always setting the two lowest bits to one (which relates to privilege level 3 for user-space) if IAOQ0 or IAOQ1 are modified via ptrace regset calls.
--- arch/parisc/kernel/ptrace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/parisc/kernel/ptrace.c +2 -1
@@ -500,7 +500,8 @@ static void set_reg(struct pt_regs *regsreturn ;case RI (iaoq[0 ]):case RI (iaoq[1 ]): - regs->iaoq[num -RI (iaoq[0 ])] = val; +/* set 2 lowest bits to ensure userspace privilege: */ + regs->iaoq[num -RI (iaoq[0 ])] = val |3 ;return ;case RI (sar): regs->sar = val;return ;
Greg Kroah-Hartman
maintainerPATCH 168/293 parisc: Fix kernel panic due invalid values in IAOQ0 or IAOQ1
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 10835c854685393a921b68f529bf740fa7c9984d upstream.
On parisc the privilege level of a process is stored in the lowest two bits of the instruction pointers (IAOQ0 and IAOQ1). On Linux we use privilege level 0 for the kernel and privilege level 3 for user-space. So userspace should not be allowed to modify IAOQ0 or IAOQ1 of a ptraced process to change it's privilege level to e.g. 0 to try to gain kernel privileges.
This patch prevents such modifications by always setting the two lowest bits to one (which relates to privilege level 3 for user-space) if IAOQ0 or IAOQ1 are modified via ptrace calls in the native and compat ptrace paths.
--- arch/parisc/kernel/ptrace.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)
arch/parisc/kernel/ptrace.c +18 -10
@@ -171,6 +171,9 @@ long arch_ptrace(struct task_struct *chiif ((addr & (sizeof (unsigned long )-1 )) || addr >=sizeof (struct pt_regs ))break ; +if (addr ==PT_IAOQ0 || addr ==PT_IAOQ1 ) { + data |=3 ;/* ensure userspace privilege */ + } if ((addr >= PT_GR1 && addr <= PT_GR31) || addr == PT_IAOQ0 || addr == PT_IAOQ1 || (addr >= PT_FR0 && addr <= PT_FR31 + 4) ||
@@ -232,16 +235,18 @@ long arch_ptrace(struct task_struct *chistatic compat_ulong_t translate_usr_offset (compat_ulong_t offset) { -if (offset <0 ) -return sizeof (struct pt_regs ); -else if (offset <=32 *4 )/* gr[0..31] */ -return offset *2 +4 ; -else if (offset <=32 *4 +32 *8 )/* gr[0..31] + fr[0..31] */ -return offset +32 *4 ; -else if (offset <sizeof (struct pt_regs )/2 +32 *4 ) -return offset *2 +4 -32 *8 ; +compat_ulong_t pos; + +if (offset <32 *4 )/* gr[0..31] */ + pos = offset *2 +4 ; +else if (offset <32 *4 +32 *8 )/* fr[0] ... fr[31] */ + pos = (offset -32 *4 ) +PT_FR0 ; +else if (offset <sizeof (struct pt_regs )/2 +32 *4 )/* sr[0] ... ipsw */ + pos = (offset -32 *4 -32 *8 ) *2 +PT_SR0 +4 ;else -return sizeof (struct pt_regs ); + pos =sizeof (struct pt_regs ); + +return pos; } long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
@@ -285,9 +290,12 @@ long compat_arch_ptrace(struct task_stru addr =translate_usr_offset (addr);if (addr >=sizeof (struct pt_regs ))break ; +if (addr ==PT_IAOQ0 +4 || addr ==PT_IAOQ1 +4 ) { + data |=3 ;/* ensure userspace privilege */ + }if (addr >=PT_FR0 && addr <=PT_FR31 +4 ) {/* Special case, fp regs are 64 bits anyway */ - *(__u64 *) ((char *)task_regs (child) + addr) = data; + *(__u32 *) ((char *)task_regs (child) + addr) = data; ret =0 ; } else if ((addr >= PT_GR1+4 && addr <= PT_GR31+4) ||
Greg Kroah-Hartman
maintainerPATCH 169/293 powerpc/32s: fix suspend/resume when IBATs 4-7 are used
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 6ecb78ef56e08d2119d337ae23cb951a640dc52d upstream.
Previously, only IBAT1 and IBAT2 were used to map kernel linear mem. Since commit 63b2bc619565 ("powerpc/mm/32s: Use BATs for STRICT_KERNEL_RWX"), we may have all 8 BATs used for mapping kernel text. But the suspend/restore functions only save/restore BATs 0 to 3, and clears BATs 4 to 7.
Make suspend and restore functions respectively save and reload the 8 BATs on CPUs having MMU_FTR_USE_HIGH_BATS feature.
--- arch/powerpc/kernel/swsusp_32.S | 73 ++++++++++++++++++++++++++++---- arch/powerpc/platforms/powermac/sleep.S | 68 +++++++++++++++++++++++++++-- 2 files changed, 128 insertions(+), 13 deletions(-)
arch/powerpc/kernel/swsusp_32.S +65 -8
@@ -24,11 +24,19 @@ #define SL_IBAT2 0x48 #define SL_DBAT3 0x50 #define SL_IBAT3 0x58 -#define SL_TB 0x60 -#define SL_R2 0x68 -#define SL_CR 0x6c -#define SL_LR 0x70 -#define SL_R12 0x74 /* r12 to r31 */ +#define SL_DBAT4 0x60 +#define SL_IBAT4 0x68 +#define SL_DBAT5 0x70 +#define SL_IBAT5 0x78 +#define SL_DBAT6 0x80 +#define SL_IBAT6 0x88 +#define SL_DBAT7 0x90 +#define SL_IBAT7 0x98 +#define SL_TB 0xa0 +#define SL_R2 0xa8 +#define SL_CR 0xac +#define SL_LR 0xb0 +#define SL_R12 0xb4 /* r12 to r31 */ #define SL_SIZE (SL_R12 + 80) .section .data
@@ -113,6 +121,41 @@ _GLOBAL(swsusp_arch_suspend) mfibatl r4,3 stw r4,SL_IBAT3+4(r11) +BEGIN_MMU_FTR_SECTION + mfspr r4,SPRN_DBAT4U + stw r4,SL_DBAT4(r11) + mfspr r4,SPRN_DBAT4L + stw r4,SL_DBAT4+4(r11) + mfspr r4,SPRN_DBAT5U + stw r4,SL_DBAT5(r11) + mfspr r4,SPRN_DBAT5L + stw r4,SL_DBAT5+4(r11) + mfspr r4,SPRN_DBAT6U + stw r4,SL_DBAT6(r11) + mfspr r4,SPRN_DBAT6L + stw r4,SL_DBAT6+4(r11) + mfspr r4,SPRN_DBAT7U + stw r4,SL_DBAT7(r11) + mfspr r4,SPRN_DBAT7L + stw r4,SL_DBAT7+4(r11) + mfspr r4,SPRN_IBAT4U + stw r4,SL_IBAT4(r11) + mfspr r4,SPRN_IBAT4L + stw r4,SL_IBAT4+4(r11) + mfspr r4,SPRN_IBAT5U + stw r4,SL_IBAT5(r11) + mfspr r4,SPRN_IBAT5L + stw r4,SL_IBAT5+4(r11) + mfspr r4,SPRN_IBAT6U + stw r4,SL_IBAT6(r11) + mfspr r4,SPRN_IBAT6L + stw r4,SL_IBAT6+4(r11) + mfspr r4,SPRN_IBAT7U + stw r4,SL_IBAT7(r11) + mfspr r4,SPRN_IBAT7L + stw r4,SL_IBAT7+4(r11) +END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS) + #if 0 /* Backup various CPU config stuffs */ bl __save_cpu_setup
@@ -278,27 +321,41 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) mtibatu 3,r4 lwz r4,SL_IBAT3+4(r11) mtibatl 3,r4 -#endif - BEGIN_MMU_FTR_SECTION - li r4,0 + lwz r4,SL_DBAT4(r11) mtspr SPRN_DBAT4U,r4 + lwz r4,SL_DBAT4+4(r11) mtspr SPRN_DBAT4L,r4 + lwz r4,SL_DBAT5(r11) mtspr SPRN_DBAT5U,r4 + lwz r4,SL_DBAT5+4(r11) mtspr SPRN_DBAT5L,r4 + lwz r4,SL_DBAT6(r11) mtspr SPRN_DBAT6U,r4 + lwz r4,SL_DBAT6+4(r11) mtspr SPRN_DBAT6L,r4 + lwz r4,SL_DBAT7(r11) mtspr SPRN_DBAT7U,r4 + lwz r4,SL_DBAT7+4(r11) mtspr SPRN_DBAT7L,r4 + lwz r4,SL_IBAT4(r11) mtspr SPRN_IBAT4U,r4 + lwz r4,SL_IBAT4+4(r11) mtspr SPRN_IBAT4L,r4 + lwz r4,SL_IBAT5(r11) mtspr SPRN_IBAT5U,r4 + lwz r4,SL_IBAT5+4(r11) mtspr SPRN_IBAT5L,r4 + lwz r4,SL_IBAT6(r11) mtspr SPRN_IBAT6U,r4 + lwz r4,SL_IBAT6+4(r11) mtspr SPRN_IBAT6L,r4 + lwz r4,SL_IBAT7(r11) mtspr SPRN_IBAT7U,r4 + lwz r4,SL_IBAT7+4(r11) mtspr SPRN_IBAT7L,r4 END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS) +#endif /* Flush all TLBs */ lis r4,0x1000
arch/powerpc/platforms/powermac/sleep.S +63 -5
101 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 170/293 powerpc/watchpoint: Restore NV GPRs while returning from exception
In reply to Greg Kroah-HartmanFrom: Ravi Bangoria <[email protected]>
commit f474c28fbcbe42faca4eb415172c07d76adcb819 upstream.
powerpc hardware triggers watchpoint before executing the instruction. To make trigger-after-execute behavior, kernel emulates the instruction. If the instruction is 'load something into non-volatile register', exception handler should restore emulated register state while returning back, otherwise there will be register state corruption. eg, adding a watchpoint on a list can corrput the list:
# cat /proc/kallsyms | grep kthread_create_list c00000000121c8b8 d kthread_create_list
Add watchpoint on kthread_create_list->prev:
# perf record -e mem:0xc00000000121c8c0
Run some workload such that new kthread gets invoked. eg, I just logged out from console:
list_add corruption. next->prev should be prev (c000000001214e00), \ but was c00000000121c8b8. (next=c00000000121c8b8). WARNING: CPU: 59 PID: 309 at lib/list_debug.c:25 __list_add_valid+0xb4/0xc0 CPU: 59 PID: 309 Comm: kworker/59:0 Kdump: loaded Not tainted 5.1.0-rc7+ #69 ... NIP __list_add_valid+0xb4/0xc0 LR __list_add_valid+0xb0/0xc0 Call Trace: __list_add_valid+0xb0/0xc0 (unreliable) __kthread_create_on_node+0xe0/0x260 kthread_create_on_node+0x34/0x50 create_worker+0xe8/0x260 worker_thread+0x444/0x560 kthread+0x160/0x1a0 ret_from_kernel_thread+0x5c/0x70
List corruption happened because it uses 'load into non-volatile register' instruction:
Snippet from __kthread_create_on_node:
c000000000136be8: addis r29,r2,-19
c000000000136bec: ld r29,31424(r29)
if (!__list_add_valid(new, prev, next))
c000000000136bf0: mr r3,r30
c000000000136bf4: mr r5,r28
c000000000136bf8: mr r4,r29
c000000000136bfc: bl c00000000059a2f8 <__list_add_valid+0x8>Register state from WARN_ON():
GPR00: c00000000059a3a0 c000007ff23afb50 c000000001344e00 0000000000000075
GPR04: 0000000000000000 0000000000000000 0000001852af8bc1 0000000000000000
GPR08: 0000000000000001 0000000000000007 0000000000000006 00000000000004aa
GPR12: 0000000000000000 c000007ffffeb080 c000000000137038 c000005ff62aaa00
GPR16: 0000000000000000 0000000000000000 c000007fffbe7600 c000007fffbe7370
GPR20: c000007fffbe7320 c000007fffbe7300 c000000001373a00 0000000000000000
GPR24: fffffffffffffef7 c00000000012e320 c000007ff23afcb0 c000000000cb8628
GPR28: c00000000121c8b8 c000000001214e00 c000007fef5b17e8 c000007fef5b17c0
Watchpoint hit at 0xc000000000136bec.
addis r29,r2,-19
=> r29 = 0xc000000001344e00 + (-19 << 16)
=> r29 = 0xc000000001214e00
ld r29,31424(r29)
=> r29 = *(0xc000000001214e00 + 31424)
=> r29 = *(0xc00000000121c8c0)
0xc00000000121c8c0 is where we placed a watchpoint and thus this instruction was emulated by emulate_step. But because handle_dabr_fault did not restore emulated register state, r29 still contains stale value in above register state.
--- arch/powerpc/kernel/exceptions-64s.S | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/powerpc/kernel/exceptions-64s.S +7 -2
@@ -1675,7 +1675,7 @@ handle_page_fault: addi r3,r1,STACK_FRAME_OVERHEAD bl do_page_fault cmpdi r3,0 - beq+ 12f + beq+ ret_from_except_lite bl save_nvgprs mr r5,r3 addi r3,r1,STACK_FRAME_OVERHEAD
@@ -1690,7 +1690,12 @@ handle_dabr_fault: ld r5,_DSISR(r1) addi r3,r1,STACK_FRAME_OVERHEAD bl do_break -12: b ret_from_except_lite + /* + * do_break() may have changed the NV GPRS while handling a breakpoint. + * If so, we need to restore them with their updated values. Don't use + * ret_from_except_lite here. + */ + b ret_from_except #ifdef CONFIG_PPC_STD_MMU_64
Greg Kroah-Hartman
maintainerPATCH 171/293 eCryptfs: fix a couple type promotion bugs
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 0bdf8a8245fdea6f075a5fede833a5fcf1b3466c upstream.
ECRYPTFS_SIZE_AND_MARKER_BYTES is type size_t, so if "rc" is negative that gets type promoted to a high positive value and treated as success.
--- fs/ecryptfs/crypto.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
fs/ecryptfs/crypto.c +8 -4
@@ -1034,8 +1034,10 @@ int ecryptfs_read_and_validate_header_re rc =ecryptfs_read_lower (file_size,0 ,ECRYPTFS_SIZE_AND_MARKER_BYTES , inode); -if (rc <ECRYPTFS_SIZE_AND_MARKER_BYTES ) -return rc >=0 ? -EINVAL : rc; +if (rc <0 ) +return rc; +else if (rc <ECRYPTFS_SIZE_AND_MARKER_BYTES ) +return -EINVAL ; rc =ecryptfs_validate_marker (marker);if (!rc)ecryptfs_i_size_init (file_size, inode);
@@ -1397,8 +1399,10 @@ int ecryptfs_read_and_validate_xattr_regecryptfs_inode_to_lower (inode),ECRYPTFS_XATTR_NAME , file_size, ECRYPTFS_SIZE_AND_MARKER_BYTES); -if (rc <ECRYPTFS_SIZE_AND_MARKER_BYTES ) -return rc >=0 ? -EINVAL : rc; +if (rc <0 ) +return rc; +else if (rc <ECRYPTFS_SIZE_AND_MARKER_BYTES ) +return -EINVAL ; rc =ecryptfs_validate_marker (marker);if (!rc)ecryptfs_i_size_init (file_size, inode);
Greg Kroah-Hartman
maintainerPATCH 172/293 intel_th: msu: Fix single mode with disabled IOMMU
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
commit 918b8646497b5dba6ae82d4a7325f01b258972b9 upstream.
Commit 4e0eaf239fb3 ("intel_th: msu: Fix single mode with IOMMU") switched the single mode code to use dma mapping pages obtained from the page allocator, but with IOMMU disabled, that may lead to using SWIOTLB bounce buffers and without additional sync'ing, produces empty trace buffers.
Fix this by using a DMA32 GFP flag to the page allocation in single mode, as the device supports full 32-bit DMA addressing.
--- drivers/hwtracing/intel_th/msu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/intel_th/msu.c +1 -1
@@ -640,7 +640,7 @@ static int msc_buffer_contig_alloc(struc goto err_out; ret = -ENOMEM ; - page =alloc_pages (GFP_KERNEL | __GFP_ZERO, order); + page =alloc_pages (GFP_KERNEL | __GFP_ZERO |GFP_DMA32 , order);if (!page) goto err_free_sgt;
Greg Kroah-Hartman
maintainerPATCH 173/293 Bluetooth: Add SMP workaround Microsoft Surface Precision Mouse bug
In reply to Greg Kroah-HartmanFrom: Szymon Janc <[email protected]>
commit 1d87b88ba26eabd4745e158ecfd87c93a9b51dc2 upstream.
Microsoft Surface Precision Mouse provides bogus identity address when pairing. It connects with Static Random address but provides Public Address in SMP Identity Address Information PDU. Address has same value but type is different. Workaround this by dropping IRK if ID address discrepancy is detected.
Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 19
LE Connection Complete (0x01)
Status: Success (0x00)
Handle: 75
Role: Master (0x00)
Peer address type: Random (0x01)
Peer address: E0:52:33:93:3B:21 (Static)
Connection interval: 50.00 msec (0x0028)
Connection latency: 0 (0x0000)
Supervision timeout: 420 msec (0x002a)
Master clock accuracy: 0x00....
Quoted 1 line
ACL Data RX: Handle 75 flags
0x02dlen 12
SMP: Identity Address Information (0x09) len 7
Address type: Public (0x00)
Address: E0:52:33:93:3B:21Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199461
--- net/bluetooth/smp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/bluetooth/smp.c +13 -0
@@ -2571,6 +2571,19 @@ static int smp_cmd_ident_addr_info(struc goto distribute; } +/* Drop IRK if peer is using identity address during pairing but is +* providing different address as identity information. +* +* Microsoft Surface Precision Mouse is known to have this bug. +*/ +if (hci_is_identity_address (&hcon->dst, hcon->dst_type) && + (bacmp (&info->bdaddr, &hcon->dst) || + info->addr_type != hcon->dst_type)) { +bt_dev_err (hcon->hdev, +"ignoring IRK with invalid identity address" ); + goto distribute; + } +bacpy (&smp->id_addr, &info->bdaddr); smp->id_addr_type = info->addr_type;
Greg Kroah-Hartman
maintainerPATCH 175/293 net: mvmdio: allow up to four clocks to be specified for orion-mdio
In reply to Greg Kroah-HartmanFrom: Josua Mayer <[email protected]>
commit 4aabed699c400810981d3dda170f05fa4d782905 upstream.
Allow up to four clocks to be specified and enabled for the orion-mdio interface, which are required by the Armada 8k and defined in armada-cp110.dtsi.
Fixes a hang in probing the mvmdio driver that was encountered on the Clearfog GT 8K with all drivers built as modules, but also affects other boards such as the MacchiatoBIN.
--- drivers/net/ethernet/marvell/mvmdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvmdio.c +1 -1
@@ -64,7 +64,7 @@struct orion_mdio_dev {void __iomem *regs; -struct clk *clk[3 ]; +struct clk *clk[4 ];/* * If we have access to the error interrupt pin (which is * somewhat misnamed as it not only reflects internal errors
Greg Kroah-Hartman
maintainerPATCH 176/293 dt-bindings: allow up to four clocks for orion-mdio
In reply to Greg Kroah-HartmanFrom: Josua Mayer <[email protected]>
commit 80785f5a22e9073e2ded5958feb7f220e066d17b upstream.
Armada 8040 needs four clocks to be enabled for MDIO accesses to work. Update the binding to allow the extra clock to be specified.
--- Documentation/devicetree/bindings/net/marvell-orion-mdio.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/net/marvell-orion-mdio.txt +1 -1
@@ -16,7 +16,7 @@ Required properties: Optional properties: - interrupts: interrupt line number for the SMI error/done interrupt -- clocks: phandle for up to three required clocks for the MDIO instance +- clocks: phandle for up to four required clocks for the MDIO instance The child nodes of the MDIO driver are the individual PHY devices connected to this MDIO bus. They must have a "reg" property given the
Greg Kroah-Hartman
maintainerPATCH 177/293 dm bufio: fix deadlock with loop device
In reply to Greg Kroah-HartmanFrom: Junxiao Bi <[email protected]>
commit bd293d071ffe65e645b4d8104f9d8fe15ea13862 upstream.
When thin-volume is built on loop device, if available memory is low, the following deadlock can be triggered:
One process P1 allocates memory with GFP_FS flag, direct alloc fails, memory reclaim invokes memory shrinker in dm_bufio, dm_bufio_shrink_scan() runs, mutex dm_bufio_client->lock is acquired, then P1 waits for dm_buffer IO to complete in __try_evict_buffer().
But this IO may never complete if issued to an underlying loop device that forwards it using direct-IO, which allocates memory using GFP_KERNEL (see: do_blockdev_direct_IO()). If allocation fails, memory reclaim will invoke memory shrinker in dm_bufio, dm_bufio_shrink_scan() will be invoked, and since the mutex is already held by P1 the loop thread will hang, and IO will never complete. Resulting in ABBA deadlock.
--- drivers/md/dm-bufio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/md/dm-bufio.c +1 -3
@@ -1630,9 +1630,7 @@ dm_bufio_shrink_scan(struct shrinker *shunsigned long freed; c = container_of(shrink, struct dm_bufio_client, shrinker); -if (sc->gfp_mask & __GFP_FS) -dm_bufio_lock (c); -else if (!dm_bufio_trylock (c)) +if (!dm_bufio_trylock (c))return SHRINK_STOP ; freed =__scan (c, sc->nr_to_scan, sc->gfp_mask);
Greg Kroah-Hartman
maintainerPATCH 178/293 compiler.h, kasan: Avoid duplicating __read_once_size_nocheck()
In reply to Greg Kroah-Hartman[ Upstream commit bdb5ac801af3d81d36732c2f640d6a1d3df83826 ]
Instead of having two identical __read_once_size_nocheck() functions with different attributes, consolidate all the difference in new macro __no_kasan_or_inline and use it. No functional changes.
--- include/linux/compiler.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
include/linux/compiler.h +6 -8
@@ -185,23 +185,21 @@ void __read_once_size(const volatile void *p, void *res, int size)#ifdef CONFIG_KASAN /* -* This function is not 'inline' because __no_sanitize_address confilcts +* We can't declare function 'inline' because __no_sanitize_address confilcts * with inlining. Attempt to inline it may cause a build failure. * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 * '__maybe_unused' allows us to avoid defined-but-not-used warnings. */ -static __no_sanitize_address __maybe_unused -void __read_once_size_nocheck(const volatile void *p, void *res, int size) -{ - __READ_ONCE_SIZE; -} +# define __no_kasan_or_inline __no_sanitize_address __maybe_unused#else -static __always_inline +# define __no_kasan_or_inline __always_inline +#endif + +static __no_kasan_or_inline void __read_once_size_nocheck(const volatile void *p, void *res, int size) { __READ_ONCE_SIZE; } -#endif static __always_inline void __write_once_size(volatile void *p, void *res, int size) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 180/293 lib/strscpy: Shut up KASAN false-positives in strscpy()
In reply to Greg Kroah-Hartman[ Upstream commit 1a3241ff10d038ecd096d03380327f2a0b5840a6 ]
strscpy() performs the word-at-a-time optimistic reads. So it may may access the memory past the end of the object, which is perfectly fine since strscpy() doesn't use that (past-the-end) data and makes sure the optimistic read won't cross a page boundary.
Use new read_word_at_a_time() to shut up the KASAN.
Note that this potentially could hide some bugs. In example bellow, stscpy() will copy more than we should (1-3 extra uninitialized bytes):
char dst[8];
char *src;
src = kmalloc(5, GFP_KERNEL);
memset(src, 0xff, 5);
strscpy(dst, src, 8);--- lib/string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/string.c +1 -1
@@ -203,7 +203,7 @@ ssize_t strscpy(char *dest, const char *src, size_t count)while (max >=sizeof (unsigned long )) {unsigned long c, data; - c = *(unsigned long *)(src+res); + c =read_word_at_a_time (src+res);if (has_zero (c, &data, &constants)) { data =prep_zero_mask (c, data, &constants); data =create_zero_mask (data);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 179/293 compiler.h: Add read_word_at_a_time() function.
In reply to Greg Kroah-Hartman[ Upstream commit 7f1e541fc8d57a143dd5df1d0a1276046e08c083 ]
Sometimes we know that it's safe to do potentially out-of-bounds access because we know it won't cross a page boundary. Still, KASAN will report this as a bug.
Add read_word_at_a_time() function which is supposed to be used in such cases. In read_word_at_a_time() KASAN performs relaxed check - only the first byte of access is validated.
--- include/linux/compiler.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/linux/compiler.h +8 -0
@@ -238,6 +238,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s* required ordering. */ #include <asm/barrier.h> +#include <linux/kasan-checks.h> #define __READ_ONCE (x, check) \ ({ \
@@ -257,6 +258,13 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s*/ #define READ_ONCE_NOCHECK (x) __READ_ONCE(x, 0) +static __no_kasan_or_inline +unsigned long read_word_at_a_time (const void *addr) +{ +kasan_check_read (addr,1 ); +return *(unsigned long *)addr; +} +#define WRITE_ONCE (x, val) \ ({ \ union { typeof(x) __val; char __c[1]; } __u = \
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 146/293 drm/nouveau/i2c: Enable i2c pads & busses during preinit
In reply to Greg Kroah-HartmanFrom: Lyude Paul <[email protected]>
commit 7cb95eeea6706c790571042a06782e378b2561ea upstream.
It turns out that while disabling i2c bus access from software when the GPU is suspended was a step in the right direction with:
commit 342406e4fbba ("drm/nouveau/i2c: Disable i2c bus access after ->fini()")
We also ended up accidentally breaking the vbios init scripts on some older Tesla GPUs, as apparently said scripts can actually use the i2c bus. Since these scripts are executed before initializing any subdevices, we end up failing to acquire access to the i2c bus which has left a number of cards with their fan controllers uninitialized. Luckily this doesn't break hardware - it just means the fan gets stuck at 100%.
This also means that we've always been using our i2c busses before initializing them during the init scripts for older GPUs, we just didn't notice it until we started preventing them from being used until init. It's pretty impressive this never caused us any issues before!
So, fix this by initializing our i2c pad and busses during subdev pre-init. We skip initializing aux busses during pre-init, as those are guaranteed to only ever be used by nouveau for DP aux transactions.
--- drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c +20 -0
@@ -185,6 +185,25 @@ nvkm_i2c_fini(struct nvkm_subdev *subdev }static int +nvkm_i2c_preinit (struct nvkm_subdev *subdev) +{ +struct nvkm_i2c *i2c =nvkm_i2c (subdev); +struct nvkm_i2c_bus *bus; +struct nvkm_i2c_pad *pad; + +/* +* We init our i2c busses as early as possible, since they may be +* needed by the vbios init scripts on some cards +*/ +list_for_each_entry (pad, &i2c->pad, head) +nvkm_i2c_pad_init (pad); +list_for_each_entry (bus, &i2c->bus, head) +nvkm_i2c_bus_init (bus); + +return 0 ; +} + +static int nvkm_i2c_init (struct nvkm_subdev *subdev) {struct nvkm_i2c *i2c =nvkm_i2c (subdev);
@@ -238,6 +257,7 @@ nvkm_i2c_dtor(struct nvkm_subdev *subdevstatic const struct nvkm_subdev_func nvkm_i2c = { .dtor = nvkm_i2c_dtor, + .preinit = nvkm_i2c_preinit, .init = nvkm_i2c_init, .fini = nvkm_i2c_fini, .intr = nvkm_i2c_intr,
Greg Kroah-Hartman
maintainerPATCH 182/293 bnx2x: Prevent ptp_task to be rescheduled indefinitely
In reply to Greg Kroah-HartmanFrom: "Guilherme G. Piccoli" <[email protected]>
[ Upstream commit 3c91f25c2f72ba6001775a5932857c1d2131c531 ]
Currently bnx2x ptp worker tries to read a register with timestamp information in case of TX packet timestamping and in case it fails, the routine reschedules itself indefinitely. This was reported as a kworker always at 100% of CPU usage, which was narrowed down to be bnx2x ptp_task.
By following the ioctl handler, we could narrow down the problem to an NTP tool (chrony) requesting HW timestamping from bnx2x NIC with RX filter zeroed; this isn't reproducible for example with ptp4l (from linuxptp) since this tool requests a supported RX filter. It seems NIC FW timestamp mechanism cannot work well with RX_FILTER_NONE - driver's PTP filter init routine skips a register write to the adapter if there's not a supported filter request.
This patch addresses the problem of bnx2x ptp thread's everlasting reschedule by retrying the register read 10 times; between the read attempts the thread sleeps for an increasing amount of time starting in 1ms to give FW some time to perform the timestamping. If it still fails after all retries, we bail out in order to prevent an unbound resource consumption from bnx2x.
The patch also adds an ethtool statistic for accounting the skipped TX timestamp packets and it reduces the priority of timestamping error messages to prevent log flooding. The code was tested using both linuxptp and chrony.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 5 ++- drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 4 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 33 ++++++++++++++------ drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h | 3 + 4 files changed, 34 insertions(+), 11 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +4 -1
@@ -3859,9 +3859,12 @@ netdev_tx_t bnx2x_start_xmit(struct sk_bif (unlikely (skb_shinfo (skb)->tx_flags &SKBTX_HW_TSTAMP )) {if (!(bp->flags &TX_TIMESTAMPING_EN )) { + bp->eth_stats.ptp_skip_tx_ts++;BNX2X_ERR ("Tx timestamping was not enabled, this packet will not be timestamped\n" ); }else if (bp->ptp_tx_skb) { -BNX2X_ERR ("The device supports only a single outstanding packet to timestamp, this packet will not be timestamped\n" ); + bp->eth_stats.ptp_skip_tx_ts++; +dev_err_once (&bp->dev->dev, +"Device supports only a single outstanding packet to timestamp, this packet won't be timestamped\n" ); }else {skb_shinfo (skb)->tx_flags |=SKBTX_IN_PROGRESS ;/* schedule check for Tx timestamp */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +3 -1
@@ -182,7 +182,9 @@ static const struct { {STATS_OFFSET32 (driver_filtered_tx_pkt), 4, false, "driver_filtered_tx_pkt" }, { STATS_OFFSET32(eee_tx_lpi), - 4, true, "Tx LPI entry count"} + 4, true, "Tx LPI entry count"}, + { STATS_OFFSET32(ptp_skip_tx_ts), + 4, false, "ptp_skipped_tx_tstamp" }, };#define BNX2X_NUM_STATS ARRAY_SIZE(bnx2x_stats_arr)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +24 -9
@@ -15264,11 +15264,24 @@ static void bnx2x_ptp_task(struct work_su32 val_seq;u64 timestamp, ns;struct skb_shared_hwtstamps shhwtstamps; +bool bail = true; +int i; -/* Read Tx timestamp registers */ - val_seq =REG_RD (bp, port ?NIG_REG_P1_TLLH_PTP_BUF_SEQID : -NIG_REG_P0_TLLH_PTP_BUF_SEQID ); -if (val_seq &0x10000 ) { +/* FW may take a while to complete timestamping; try a bit and if it's +* still not complete, may indicate an error state - bail out then. +*/ +for (i =0 ; i <10 ; i++) { +/* Read Tx timestamp registers */ + val_seq =REG_RD (bp, port ?NIG_REG_P1_TLLH_PTP_BUF_SEQID : +NIG_REG_P0_TLLH_PTP_BUF_SEQID ); +if (val_seq &0x10000 ) { + bail = false; +break ; + } +msleep (1 << i); + } + +if (!bail) {/* There is a valid timestamp value */ timestamp =REG_RD (bp, port ?NIG_REG_P1_TLLH_PTP_BUF_TS_MSB :NIG_REG_P0_TLLH_PTP_BUF_TS_MSB );
@@ -15283,16 +15296,18 @@ static void bnx2x_ptp_task(struct work_smemset (&shhwtstamps,0 ,sizeof (shhwtstamps)); shhwtstamps.hwtstamp =ns_to_ktime (ns);skb_tstamp_tx (bp->ptp_tx_skb, &shhwtstamps); -dev_kfree_skb_any (bp->ptp_tx_skb); - bp->ptp_tx_skb =NULL ;DP (BNX2X_MSG_PTP ,"Tx timestamp, timestamp cycles = %llu, ns = %llu\n" , timestamp, ns); }else { -DP (BNX2X_MSG_PTP ,"There is no valid Tx timestamp yet\n" ); -/* Reschedule to keep checking for a valid timestamp value */ -schedule_work (&bp->ptp_task); +DP (BNX2X_MSG_PTP , +"Tx timestamp is not recorded (register read=%u)\n" , + val_seq); + bp->eth_stats.ptp_skip_tx_ts++; } + +dev_kfree_skb_any (bp->ptp_tx_skb); + bp->ptp_tx_skb =NULL ; }void bnx2x_set_rx_ts (struct bnx2x *bp,struct sk_buff *skb)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h +3 -0
@@ -207,6 +207,9 @@ struct bnx2x_eth_stats {u32 driver_filtered_tx_pkt;/* src: Clear-on-Read register; Will not survive PMF Migration */ u32 eee_tx_lpi; + +/* PTP */ +u32 ptp_skip_tx_ts; };struct bnx2x_eth_q_stats {
Greg Kroah-Hartman
maintainerPATCH 183/293 caif-hsi: fix possible deadlock in cfhsi_exit_module()
In reply to Greg Kroah-HartmanFrom: Taehee Yoo <[email protected]>
[ Upstream commit fdd258d49e88a9e0b49ef04a506a796f1c768a8e ]
cfhsi_exit_module() calls unregister_netdev() under rtnl_lock(). but unregister_netdev() internally calls rtnl_lock(). So deadlock would occur.
--- drivers/net/caif/caif_hsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/caif/caif_hsi.c +1 -1
@@ -1462,7 +1462,7 @@ static void __exit cfhsi_exit_module(voirtnl_lock ();list_for_each_safe (list_node, n, &cfhsi_list) { cfhsi = list_entry(list_node, struct cfhsi, list); -unregister_netdev (cfhsi->ndev); +unregister_netdevice (cfhsi->ndev); }rtnl_unlock (); }
Greg Kroah-Hartman
maintainerPATCH 148/293 dm zoned: fix zone state management race
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
commit 3b8cafdd5436f9298b3bf6eb831df5eef5ee82b6 upstream.
dm-zoned uses the zone flag DMZ_ACTIVE to indicate that a zone of the backend device is being actively read or written and so cannot be reclaimed. This flag is set as long as the zone atomic reference counter is not 0. When this atomic is decremented and reaches 0 (e.g. on BIO completion), the active flag is cleared and set again whenever the zone is reused and BIO issued with the atomic counter incremented. These 2 operations (atomic inc/dec and flag set/clear) are however not always executed atomically under the target metadata mutex lock and this causes the warning:
WARN_ON(!test_bit(DMZ_ACTIVE, &zone->flags));
in dmz_deactivate_zone() to be displayed. This problem is regularly triggered with xfstests generic/209, generic/300, generic/451 and xfs/077 with XFS being used as the file system on the dm-zoned target device. Similarly, xfstests ext4/303, ext4/304, generic/209 and generic/300 trigger the warning with ext4 use.
This problem can be easily fixed by simply removing the DMZ_ACTIVE flag and managing the "ACTIVE" state by directly looking at the reference counter value. To do so, the functions dmz_activate_zone() and dmz_deactivate_zone() are changed to inline functions respectively calling atomic_inc() and atomic_dec(), while the dmz_is_active() macro is changed to an inline function calling atomic_read().
--- drivers/md/dm-zoned-metadata.c | 24 ------------------------ drivers/md/dm-zoned.h | 28 ++++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 28 deletions(-)
drivers/md/dm-zoned-metadata.c +0 -24
@@ -1594,30 +1594,6 @@ struct dm_zone *dmz_get_zone_for_reclaim }/* -* Activate a zone (increment its reference count). -*/ -void dmz_activate_zone (struct dm_zone *zone) -{ -set_bit (DMZ_ACTIVE , &zone->flags); -atomic_inc (&zone->refcount); -} - -/* -* Deactivate a zone. This decrement the zone reference counter -* and clears the active state of the zone once the count reaches 0, -* indicating that all BIOs to the zone have completed. Returns -* true if the zone was deactivated. -*/ -void dmz_deactivate_zone (struct dm_zone *zone) -{ -if (atomic_dec_and_test (&zone->refcount)) { -WARN_ON (!test_bit (DMZ_ACTIVE , &zone->flags)); -clear_bit_unlock (DMZ_ACTIVE , &zone->flags); -smp_mb__after_atomic (); - } -} - -/* * Get the zone mapping a chunk, if the chunk is mapped already. * If no mapping exist and the operation is WRITE, a zone is * allocated and used to map the chunk.
drivers/md/dm-zoned.h +24 -4
@@ -115,7 +115,6 @@ enum {DMZ_BUF ,/* Zone internal state */ -DMZ_ACTIVE ,DMZ_RECLAIM , DMZ_SEQ_WRITE_ERR, };
@@ -128,7 +127,6 @@ enum {#define dmz_is_empty (z) ((z)->wp_block == 0)#define dmz_is_offline (z) test_bit(DMZ_OFFLINE, &(z)->flags)#define dmz_is_readonly (z) test_bit(DMZ_READ_ONLY, &(z)->flags) -#define dmz_is_active (z) test_bit(DMZ_ACTIVE, &(z)->flags)#define dmz_in_reclaim (z) test_bit(DMZ_RECLAIM, &(z)->flags)#define dmz_seq_write_err (z) test_bit(DMZ_SEQ_WRITE_ERR, &(z)->flags)
@@ -188,8 +186,30 @@ void dmz_unmap_zone(struct dmz_metadataunsigned int dmz_nr_rnd_zones (struct dmz_metadata *zmd);unsigned int dmz_nr_unmap_rnd_zones (struct dmz_metadata *zmd); -void dmz_activate_zone (struct dm_zone *zone); -void dmz_deactivate_zone (struct dm_zone *zone); +/* +* Activate a zone (increment its reference count). +*/ +static inline void dmz_activate_zone (struct dm_zone *zone) +{ +atomic_inc (&zone->refcount); +} + +/* +* Deactivate a zone. This decrement the zone reference counter +* indicating that all BIOs to the zone have completed when the count is 0. +*/ +static inline void dmz_deactivate_zone (struct dm_zone *zone) +{ +atomic_dec (&zone->refcount); +} + +/* +* Test if a zone is active, that is, has a refcount > 0. +*/ +static inline bool dmz_is_active (struct dm_zone *zone) +{ +return atomic_read (&zone->refcount); +}int dmz_lock_zone_reclaim (struct dm_zone *zone);void dmz_unlock_zone_reclaim (struct dm_zone *zone);
Greg Kroah-Hartman
maintainerPATCH 149/293 xen/events: fix binding user event channels to cpus
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit bce5963bcb4f9934faa52be323994511d59fd13c upstream.
When binding an interdomain event channel to a vcpu via IOCTL_EVTCHN_BIND_INTERDOMAIN not only the event channel needs to be bound, but the affinity of the associated IRQi must be changed, too. Otherwise the IRQ and the event channel won't be moved to another vcpu in case the original vcpu they were bound to is going offline.
--- drivers/xen/events/events_base.c | 12 ++++++++++-- drivers/xen/evtchn.c | 2 +- include/xen/events.h | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-)
drivers/xen/events/events_base.c +10 -2
@@ -1293,7 +1293,7 @@ void rebind_evtchn_irq(int evtchn, int i }/* Rebind an evtchn so that it gets delivered to a specific cpu */ -int xen_rebind_evtchn_to_cpu (int evtchn,unsigned tcpu) +static int xen_rebind_evtchn_to_cpu (int evtchn,unsigned int tcpu) {struct evtchn_bind_vcpu bind_vcpu;int masked;
@@ -1327,7 +1327,6 @@ int xen_rebind_evtchn_to_cpu(int evtchn,return 0 ; } -EXPORT_SYMBOL_GPL (xen_rebind_evtchn_to_cpu);static int set_affinity_irq (struct irq_data *data,const struct cpumask *dest,bool force)
@@ -1341,6 +1340,15 @@ static int set_affinity_irq(struct irq_dreturn ret; } +/* To be called with desc->lock held. */ +int xen_set_affinity_evtchn (struct irq_desc *desc,unsigned int tcpu) +{ +struct irq_data *d =irq_desc_get_irq_data (desc); + +return set_affinity_irq (d,cpumask_of (tcpu), false); +} +EXPORT_SYMBOL_GPL (xen_set_affinity_evtchn); +static void enable_dynirq (struct irq_data *data) {int evtchn =evtchn_from_irq (data->irq);
drivers/xen/evtchn.c +1 -1
@@ -447,7 +447,7 @@ static void evtchn_bind_interdom_next_vcthis_cpu_write (bind_last_selected_cpu, selected_cpu);/* unmask expects irqs to be disabled */ -xen_rebind_evtchn_to_cpu (evtchn, selected_cpu); +xen_set_affinity_evtchn (desc, selected_cpu);raw_spin_unlock_irqrestore (&desc->lock, flags); }
include/xen/events.h +2 -1
@@ -3,6 +3,7 @@#define _XEN_EVENTS_H#include <linux/interrupt.h> +#include <linux/irq.h> #ifdef CONFIG_PCI_MSI #include <linux/msi.h> #endif
@@ -59,7 +60,7 @@ void evtchn_put(unsigned int evtchn);void xen_send_IPI_one (unsigned int cpu,enum ipi_vector vector);void rebind_evtchn_irq (int evtchn,int irq); -int xen_rebind_evtchn_to_cpu (int evtchn,unsigned tcpu); +int xen_set_affinity_evtchn (struct irq_desc *desc,unsigned int tcpu);static inline void notify_remote_via_evtchn (int port) {
Greg Kroah-Hartman
maintainerPATCH 150/293 9p/xen: Add cleanup path in p9_trans_xen_init
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
commit 80a316ff16276b36d0392a8f8b2f63259857ae98 upstream.
If xenbus_register_frontend() fails in p9_trans_xen_init, we should call v9fs_unregister_trans() to do cleanup.
--- net/9p/trans_xen.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/9p/trans_xen.c +7 -1
@@ -530,13 +530,19 @@ static struct xenbus_driver xen_9pfs_frostatic int p9_trans_xen_init (void ) { +int rc; +if (!xen_domain ())return -ENODEV ;pr_info ("Initialising Xen transport for 9pfs\n" );v9fs_register_trans (&p9_xen_trans); -return xenbus_register_frontend (&xen_9pfs_front_driver); + rc =xenbus_register_frontend (&xen_9pfs_front_driver); +if (rc) +v9fs_unregister_trans (&p9_xen_trans); + +return rc; }module_init (p9_trans_xen_init);
Greg Kroah-Hartman
maintainerPATCH 151/293 9p/virtio: Add cleanup path in p9_virtio_init
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
commit d4548543fc4ece56c6f04b8586f435fb4fd84c20 upstream.
KASAN report this:
BUG: unable to handle kernel paging request at ffffffffa0097000 PGD 3870067 P4D 3870067 PUD 3871063 PMD 2326e2067 PTE 0 Oops: 0000 [#1 CPU: 0 PID: 5340 Comm: modprobe Not tainted 5.1.0-rc7+ #25 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014 RIP: 0010:__list_add_valid+0x10/0x70 Code: c3 48 8b 06 55 48 89 e5 5d 48 39 07 0f 94 c0 0f b6 c0 c3 90 90 90 90 90 90 90 55 48 89 d0 48 8b 52 08 48 89 e5 48 39 f2 75 19 <48> 8b 32 48 39 f0 75 3a
RSP: 0018:ffffc90000e23c68 EFLAGS: 00010246 RAX: ffffffffa00ad000 RBX: ffffffffa009d000 RCX: 0000000000000000 RDX: ffffffffa0097000 RSI: ffffffffa0097000 RDI: ffffffffa009d000 RBP: ffffc90000e23c68 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffa0097000 R13: ffff888231797180 R14: 0000000000000000 R15: ffffc90000e23e78 FS: 00007fb215285540(0000) GS:ffff888237a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffa0097000 CR3: 000000022f144000 CR4: 00000000000006f0 Call Trace: v9fs_register_trans+0x2f/0x60 [9pnet ? 0xffffffffa0087000 p9_virtio_init+0x25/0x1000 [9pnet_virtio do_one_initcall+0x6c/0x3cc ? kmem_cache_alloc_trace+0x248/0x3b0 do_init_module+0x5b/0x1f1 load_module+0x1db1/0x2690 ? m_show+0x1d0/0x1d0 __do_sys_finit_module+0xc5/0xd0 __x64_sys_finit_module+0x15/0x20 do_syscall_64+0x6b/0x1d0 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7fb214d8e839 Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01
RSP: 002b:00007ffc96554278 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
RAX: ffffffffffffffda RBX: 000055e67eed2aa0 RCX: 00007fb214d8e839
RDX: 0000000000000000 RSI: 000055e67ce95c2e RDI: 0000000000000003
RBP: 000055e67ce95c2e R08: 0000000000000000 R09: 000055e67eed2aa0
R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000
R13: 000055e67eeda500 R14: 0000000000040000 R15: 000055e67eed2aa0
Modules linked in: 9pnet_virtio(+) 9pnet gre rfkill vmw_vsock_virtio_transport_common vsock [last unloaded: 9pnet_virtio CR2: ffffffffa0097000 ---[ end trace 4a52bb13ff07b761
If register_virtio_driver() fails in p9_virtio_init, we should call v9fs_unregister_trans() to do cleanup.
--- net/9p/trans_virtio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/9p/trans_virtio.c +7 -1
@@ -764,10 +764,16 @@ static struct p9_trans_module p9_virtio_/* The standard init function */ static int __init p9_virtio_init (void ) { +int rc; +INIT_LIST_HEAD (&virtio_chan_list);v9fs_register_trans (&p9_virtio_trans); -return register_virtio_driver (&p9_virtio_drv); + rc =register_virtio_driver (&p9_virtio_drv); +if (rc) +v9fs_unregister_trans (&p9_virtio_trans); + +return rc; } static void __exit p9_virtio_cleanup(void)
Greg Kroah-Hartman
maintainerPATCH 142/293 media: coda: Remove unbalanced and unneeded mutex unlock
In reply to Greg Kroah-HartmanFrom: Ezequiel Garcia <[email protected]>
commit 766b9b168f6c75c350dd87c3e0bc6a9b322f0013 upstream.
The mutex unlock in the threaded interrupt handler is not paired with any mutex lock. Remove it.
This bug has been here for a really long time, so it applies to any stable repo.
--- drivers/media/platform/coda/coda-bit.c | 1 - 1 file changed, 1 deletion(-)
drivers/media/platform/coda/coda-bit.c +0 -1
@@ -2257,7 +2257,6 @@ irqreturn_t coda_irq_handler(int irq, voif (ctx ==NULL ) {v4l2_err (&dev->v4l2_dev,"Instance released before the end of transaction\n" ); -mutex_unlock (&dev->coda_mutex);return IRQ_HANDLED ; }
Greg Kroah-Hartman
maintainerPATCH 196/293 netrom: fix a memory leak in nr_rx_frame()
In reply to Greg Kroah-HartmanFrom: Cong Wang <[email protected]>
[ Upstream commit c8c8218ec5af5d2598381883acbefbf604e56b5e ]
When the skb is associated with a new sock, just assigning it to skb->sk is not sufficient, we have to set its destructor to free the sock properly too.
--- net/netrom/af_netrom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netrom/af_netrom.c +2 -1
@@ -871,7 +871,7 @@ int nr_rx_frame(struct sk_buff *skb, strunsigned short frametype, flags, window, timeout;int ret; - skb->sk =NULL ;/* Initially we don't know who it's for */ +skb_orphan (skb);/* * skb->data points to the netrom frame start
@@ -970,6 +970,7 @@ int nr_rx_frame(struct sk_buff *skb, str window = skb->data[20 ]; skb->sk = make; + skb->destructor = sock_efree; make->sk_state =TCP_ESTABLISHED ;/* Fill in his circuit details */
Greg Kroah-Hartman
maintainerPATCH 185/293 ipv4: dont set IPv6 only flags to IPv4 addresses
In reply to Greg Kroah-HartmanFrom: Matteo Croce <[email protected]>
[ Upstream commit 2e60546368165c2449564d71f6005dda9205b5fb ]
Avoid the situation where an IPV6 only flag is applied to an IPv4 address:
# ip addr add 192.0.2.1/24 dev dummy0 nodad home mngtmpaddr noprefixroute
# ip -4 addr show dev dummy0
2: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
inet 192.0.2.1/24 scope global noprefixroute dummy0
valid_lft forever preferred_lft foreverOr worse, by sending a malicious netlink command:
# ip -4 addr show dev dummy0
2: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
inet 192.0.2.1/24 scope global nodad optimistic dadfailed home tentative mngtmpaddr noprefixroute stable-privacy dummy0
valid_lft forever preferred_lft forever--- net/ipv4/devinet.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/ipv4/devinet.c +8 -0
@@ -66,6 +66,11 @@#include <net/net_namespace.h> #include <net/addrconf.h> +#define IPV6ONLY_FLAGS \ + (IFA_F_NODAD | IFA_F_OPTIMISTIC | IFA_F_DADFAILED | \ + IFA_F_HOMEADDRESS | IFA_F_TENTATIVE | \ + IFA_F_MANAGETEMPADDR | IFA_F_STABLE_PRIVACY) +static struct ipv4_devconf ipv4_devconf = { .data = { [IPV4_DEVCONF_ACCEPT_REDIRECTS -1 ] =1 ,
@@ -455,6 +460,9 @@ static int __inet_insert_ifa(struct in_i ifa->ifa_flags &= ~IFA_F_SECONDARY ; last_primary = &in_dev->ifa_list; +/* Don't set IPv6 only flags to IPv4 addresses */ + ifa->ifa_flags &= ~IPV6ONLY_FLAGS ; +for (ifap = &in_dev->ifa_list; (ifa1 = *ifap) !=NULL ; ifap = &ifa1->ifa_next) { if (!(ifa1->ifa_flags & IFA_F_SECONDARY) &&
Greg Kroah-Hartman
maintainerPATCH 198/293 bonding: validate ip header before check IPPROTO_IGMP
In reply to Greg Kroah-HartmanFrom: Cong Wang <[email protected]>
[ Upstream commit 9d1bc24b52fb8c5d859f9a47084bf1179470e04c ]
bond_xmit_roundrobin() checks for IGMP packets but it parses the IP header even before checking skb->protocol.
We should validate the IP header with pskb_may_pull() before using iph->protocol.
--- drivers/net/bonding/bond_main.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-)
drivers/net/bonding/bond_main.c +23 -14
@@ -3817,8 +3817,8 @@ static u32 bond_rr_gen_slave_id(struct bstatic int bond_xmit_roundrobin (struct sk_buff *skb,struct net_device *bond_dev) {struct bonding *bond =netdev_priv (bond_dev); -struct iphdr *iph =ip_hdr (skb);struct slave *slave; +int slave_cnt;u32 slave_id;/* Start with the curr_active_slave that joined the bond as the
@@ -3827,23 +3827,32 @@ static int bond_xmit_roundrobin(struct s* send the join/membership reports. The curr_active_slave found * will send all of this type of traffic. */ -if (iph->protocol ==IPPROTO_IGMP && skb->protocol ==htons (ETH_P_IP )) { - slave =rcu_dereference (bond->curr_active_slave); -if (slave) -bond_dev_queue_xmit (bond, skb, slave->dev); -else -bond_xmit_slave_id (bond, skb,0 ); - }else { -int slave_cnt =ACCESS_ONCE (bond->slave_cnt); +if (skb->protocol ==htons (ETH_P_IP )) { +int noff =skb_network_offset (skb); +struct iphdr *iph; + +if (unlikely (!pskb_may_pull (skb, noff +sizeof (*iph)))) + goto non_igmp; -if (likely (slave_cnt)) { - slave_id =bond_rr_gen_slave_id (bond); -bond_xmit_slave_id (bond, skb, slave_id % slave_cnt); - }else { -bond_tx_drop (bond_dev, skb); + iph =ip_hdr (skb); +if (iph->protocol ==IPPROTO_IGMP ) { + slave =rcu_dereference (bond->curr_active_slave); +if (slave) +bond_dev_queue_xmit (bond, skb, slave->dev); +else +bond_xmit_slave_id (bond, skb,0 ); +return NETDEV_TX_OK ; } } +non_igmp: + slave_cnt =ACCESS_ONCE (bond->slave_cnt); +if (likely (slave_cnt)) { + slave_id =bond_rr_gen_slave_id (bond); +bond_xmit_slave_id (bond, skb, slave_id % slave_cnt); + }else { +bond_tx_drop (bond_dev, skb); + }return NETDEV_TX_OK ; }