4.19.307-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 161/202 USB: serial: cp210x: add ID for IMST iM871A-USB
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leonard Dallmayr <[email protected]>
commit 12b17b4eb82a41977eb848048137b5908d52845c upstream.
The device IMST USB-Stick for Smart Meter is a rebranded IMST iM871A-USB Wireless M-Bus USB-adapter. It is used to read wireless water, gas and electricity meters.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -147,6 +147,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ + { USB_DEVICE(0x10C4, 0x87ED) }, /* IMST USB-Stick for Smart Meter */ { USB_DEVICE(0x10C4, 0x8856) }, /* CEL EM357 ZigBee USB Stick - LR */ { USB_DEVICE(0x10C4, 0x8857) }, /* CEL EM357 ZigBee USB Stick */ { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */
Greg Kroah-Hartman
maintainerPATCH 162/202 Input: atkbd - skip ATKBD_CMD_SETLEDS when skipping ATKBD_CMD_GETID
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 683cd8259a9b883a51973511f860976db2550a6e upstream.
After commit 936e4d49ecbc ("Input: atkbd - skip ATKBD_CMD_GETID in translated mode") the keyboard on Dell XPS 13 9350 / 9360 / 9370 models has stopped working after a suspend/resume.
The problem appears to be that atkbd_probe() fails when called from atkbd_reconnect() on resume, which on systems where ATKBD_CMD_GETID is skipped can only happen by ATKBD_CMD_SETLEDS failing. ATKBD_CMD_SETLEDS failing because ATKBD_CMD_GETID was skipped is weird, but apparently that is what is happening.
Fix this by also skipping ATKBD_CMD_SETLEDS when skipping ATKBD_CMD_GETID.
--- drivers/input/keyboard/atkbd.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/input/keyboard/atkbd.c +8 -5
@@ -763,7 +763,6 @@ static int atkbd_probe(struct atkbd *atk {struct ps2dev *ps2dev = &atkbd->ps2dev;unsigned char param[2 ]; -bool skip_getid;/* * Some systems, where the bit-twiddling when testing the io-lines of the
@@ -777,6 +776,11 @@ static int atkbd_probe(struct atkbd *atk"keyboard reset failed on %s\n" , ps2dev->serio->phys); +if (atkbd_skip_getid (atkbd)) { + atkbd->id =0xab83 ; +return 0 ; + } +/* * Then we check the keyboard ID. We should get 0xab83 under normal conditions. * Some keyboards report different values, but the first byte is always 0xab or
@@ -785,18 +789,17 @@ static int atkbd_probe(struct atkbd *atk*/ param[0 ] = param[1 ] =0xa5 ;/* initialize with invalid values */ - skip_getid =atkbd_skip_getid (atkbd); -if (skip_getid ||ps2_command (ps2dev, param,ATKBD_CMD_GETID )) { +if (ps2_command (ps2dev, param,ATKBD_CMD_GETID )) {/* -* If the get ID command was skipped or failed, we check if we can at least set +* If the get ID command failed, we check if we can at least set * the LEDs on the keyboard. This should work on every keyboard out there. * It also turns the LEDs off, which we want anyway. */ param[0 ] =0 ;if (ps2_command (ps2dev, param,ATKBD_CMD_SETLEDS ))return -1 ; - atkbd->id = skip_getid ?0xab83 :0xabba ; + atkbd->id =0xabba ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 163/202 vhost: use kzalloc() instead of kmalloc() followed by memset()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prathu Baronia <[email protected]>
commit 4d8df0f5f79f747d75a7d356d9b9ea40a4e4c8a9 upstream.
Use kzalloc() to allocate new zeroed out msg node instead of memsetting a node allocated with kmalloc().
Message-Id: <[email protected]>
--- drivers/vhost/vhost.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/vhost/vhost.c +2 -3
@@ -2490,12 +2490,11 @@ EXPORT_SYMBOL_GPL(vhost_disable_notify);/* Create a new message. */ struct vhost_msg_node *vhost_new_msg (struct vhost_virtqueue *vq,int type) { -struct vhost_msg_node *node =kmalloc (sizeof *node,GFP_KERNEL ); +/* Make sure all padding within the structure is initialized. */ +struct vhost_msg_node *node =kzalloc (sizeof (*node),GFP_KERNEL );if (!node)return NULL ; -/* Make sure all padding within the structure is initialized. */ -memset (&node->msg,0 ,sizeof node->msg); node->vq = vq; node->msg.type = type;return node;
Greg Kroah-Hartman
maintainerPATCH 164/202 hrtimer: Report offline hrtimer enqueue
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
commit dad6a09f3148257ac1773cd90934d721d68ab595 upstream.
The hrtimers migration on CPU-down hotplug process has been moved earlier, before the CPU actually goes to die. This leaves a small window of opportunity to queue an hrtimer in a blind spot, leaving it ignored.
For example a practical case has been reported with RCU waking up a SCHED_FIFO task right before the CPUHP_AP_IDLE_DEAD stage, queuing that way a sched/rt timer to the local offline CPU.
Make sure such situations never go unnoticed and warn when that happens.
--- include/linux/hrtimer.h | 4 +++- kernel/time/hrtimer.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-)
include/linux/hrtimer.h +3 -1
@@ -182,6 +182,7 @@ enum hrtimer_base_type {* @hang_detected: The last hrtimer interrupt detected a hang * @softirq_activated: displays, if the softirq is raised - update of softirq * related settings is not required then. +* @online: CPU is online from an hrtimers point of view * @nr_events: Total number of hrtimer interrupt events * @nr_retries: Total number of hrtimer interrupt retries * @nr_hangs: Total number of hrtimer interrupt hangs
@@ -206,7 +207,8 @@ struct hrtimer_cpu_base { unsigned int hres_active : 1, in_hrtirq : 1, hang_detected : 1, - softirq_activated : 1; + softirq_activated : 1, + online : 1;#ifdef CONFIG_HIGH_RES_TIMERS unsigned int nr_events;unsigned short nr_retries;
kernel/time/hrtimer.c +3 -0
@@ -970,6 +970,7 @@ static int enqueue_hrtimer(struct hrtime enum hrtimer_mode mode) {debug_activate (timer, mode); +WARN_ON_ONCE (!base->cpu_base->online); base->cpu_base->active_bases |=1 << base->index;
@@ -1887,6 +1888,7 @@ int hrtimers_prepare_cpu(unsigned int cp cpu_base->softirq_next_timer =NULL ; cpu_base->expires_next =KTIME_MAX ; cpu_base->softirq_expires_next =KTIME_MAX ; + cpu_base->online =1 ;return 0 ; }
@@ -1953,6 +1955,7 @@ int hrtimers_cpu_dying(unsigned int dyinsmp_call_function_single (ncpu, retrigger_next_event,NULL ,0 );raw_spin_unlock (&new_base->lock); + old_base->online =0 ;raw_spin_unlock (&old_base->lock);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 165/202 btrfs: forbid creating subvol qgroups
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Burkov <[email protected]>
commit 0c309d66dacddf8ce939b891d9ead4a8e21ad6f0 upstream.
Creating a qgroup 0/subvolid leads to various races and it isn't helpful, because you can't specify a subvol id when creating a subvol, so you can't be sure it will be the right one. Any requirements on the automatic subvol can be gratified by using a higher level qgroup and the inheritance parameters of subvol creation.
--- fs/btrfs/ioctl.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/btrfs/ioctl.c +5 -0
@@ -5343,6 +5343,11 @@ static long btrfs_ioctl_qgroup_create(st goto out; } +if (sa->create &&is_fstree (sa->qgroupid)) { + ret = -EINVAL ; + goto out; + } + trans =btrfs_join_transaction (root);if (IS_ERR (trans)) { ret =PTR_ERR (trans);
Greg Kroah-Hartman
maintainerPATCH 166/202 btrfs: send: return EOPNOTSUPP on unknown flags
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
commit f884a9f9e59206a2d41f265e7e403f080d10b493 upstream.
When some ioctl flags are checked we return EOPNOTSUPP, like for BTRFS_SCRUB_SUPPORTED_FLAGS, BTRFS_SUBVOL_CREATE_ARGS_MASK or fallocate modes. The EINVAL is supposed to be for a supported but invalid values or combination of options. Fix that when checking send flags so it's consistent with the rest.
--- fs/btrfs/send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/send.c +1 -1
@@ -6842,7 +6842,7 @@ long btrfs_ioctl_send(struct file *mnt_f }if (arg->flags & ~BTRFS_SEND_FLAG_MASK ) { - ret = -EINVAL ; + ret = -EOPNOTSUPP ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 167/202 spi: ppc4xx: Drop write-only variable
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit b3aa619a8b4706f35cb62f780c14e68796b37f3f ]
Since commit 24778be20f87 ("spi: convert drivers to use bits_per_word_mask") the bits_per_word variable is only written to. The check that was there before isn't needed any more as the spi core ensures that only 8 bit transfers are used, so the variable can go away together with all assignments to it.
--- drivers/spi/spi-ppc4xx.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/spi/spi-ppc4xx.c +0 -5
@@ -173,10 +173,8 @@ static int spi_ppc4xx_setupxfer(struct spi_device *spi, struct spi_transfer *t)int scr;u8 cdm =0 ;u32 speed; -u8 bits_per_word;/* Start with the generic configuration for this device. */ - bits_per_word = spi->bits_per_word; speed = spi->max_speed_hz;/*
@@ -184,9 +182,6 @@ static int spi_ppc4xx_setupxfer(struct spi_device *spi, struct spi_transfer *t)* the transfer to overwrite the generic configuration with zeros. */ if (t) { -if (t->bits_per_word) - bits_per_word = t->bits_per_word; -if (t->speed_hz) speed =min (t->speed_hz, spi->max_speed_hz); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 141/202 net: sysfs: Fix /sys/class/net/<iface> path
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit ae3f4b44641dfff969604735a0dcbf931f383285 ]
The documentation is pointing to the wrong path for the interface. Documentation is pointing to /sys/class/<iface>, instead of /sys/class/net/<iface>.
Fix it by adding the net/ directory before the interface.
--- .../ABI/testing/sysfs-class-net-queues | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-)
Documentation/ABI/testing/sysfs-class-net-queues +11 -11
@@ -1,4 +1,4 @@ -What: /sys/class/<iface>/queues/rx-<queue>/rps_cpus +What: /sys/class/net/<iface>/queues/rx-<queue>/rps_cpus Date: March 2010 KernelVersion: 2.6.35 Contact: [email protected]
@@ -8,7 +8,7 @@ Description: network device queue. Possible values depend on the number of available CPU(s) in the system. -What: /sys/class/<iface>/queues/rx-<queue>/rps_flow_cnt +What: /sys/class/net/<iface>/queues/rx-<queue>/rps_flow_cnt Date: April 2010 KernelVersion: 2.6.35 Contact: [email protected]
@@ -16,7 +16,7 @@ Description: Number of Receive Packet Steering flows being currently processed by this particular network device receive queue. -What: /sys/class/<iface>/queues/tx-<queue>/tx_timeout +What: /sys/class/net/<iface>/queues/tx-<queue>/tx_timeout Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -24,7 +24,7 @@ Description: Indicates the number of transmit timeout events seen by this network interface transmit queue. -What: /sys/class/<iface>/queues/tx-<queue>/tx_maxrate +What: /sys/class/net/<iface>/queues/tx-<queue>/tx_maxrate Date: March 2015 KernelVersion: 4.1 Contact: [email protected]
@@ -32,7 +32,7 @@ Description: A Mbps max-rate set for the queue, a value of zero means disabled, default is disabled. -What: /sys/class/<iface>/queues/tx-<queue>/xps_cpus +What: /sys/class/net/<iface>/queues/tx-<queue>/xps_cpus Date: November 2010 KernelVersion: 2.6.38 Contact: [email protected]
@@ -42,7 +42,7 @@ Description: network device transmit queue. Possible vaules depend on the number of available CPU(s) in the system. -What: /sys/class/<iface>/queues/tx-<queue>/xps_rxqs +What: /sys/class/net/<iface>/queues/tx-<queue>/xps_rxqs Date: June 2018 KernelVersion: 4.18.0 Contact: [email protected]
@@ -53,7 +53,7 @@ Description: number of available receive queue(s) in the network device. Default is disabled. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/hold_time +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/hold_time Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -62,7 +62,7 @@ Description: of this particular network device transmit queue. Default value is 1000. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/inflight +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/inflight Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -70,7 +70,7 @@ Description: Indicates the number of bytes (objects) in flight on this network device transmit queue. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -79,7 +79,7 @@ Description: on this network device transmit queue. This value is clamped to be within the bounds defined by limit_max and limit_min. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit_max +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit_max Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -88,7 +88,7 @@ Description: queued on this network device transmit queue. See include/linux/dynamic_queue_limits.h for the default value. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit_min +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit_min Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 168/202 ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Khoroshilov <[email protected]>
[ Upstream commit 6ef5d5b92f7117b324efaac72b3db27ae8bb3082 ]
There is a path in rt5645_jack_detect_work(), where rt5645->jd_mutex is left locked forever. That may lead to deadlock
when rt5645_jack_detect_work() is called for the second time.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- sound/soc/codecs/rt5645.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/rt5645.c +1 -0
@@ -3313,6 +3313,7 @@ static void rt5645_jack_detect_work(struct work_struct *work) report, SND_JACK_HEADPHONE);snd_soc_jack_report (rt5645->mic_jack, report,SND_JACK_MICROPHONE ); +mutex_unlock (&rt5645->jd_mutex);return ;case 4 : val =snd_soc_component_read32 (rt5645->component,RT5645_A_JD_CTRL1 ) &0x0020 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 169/202 Documentation: net-sysfs: describe missing statistics
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Wiedmann <[email protected]>
[ Upstream commit e528afb72a481977456bb18345d4e7f6b85fa7b1 ]
Sync the ABI description with the interface statistics that are currently available through sysfs.
Stable-dep-of: 5b3fbd61b9d1 ("net: sysfs: Fix /sys/class/net/<iface> path for statistics")
--- .../ABI/testing/sysfs-class-net-statistics | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
Documentation/ABI/testing/sysfs-class-net-statistics +16 -0
@@ -51,6 +51,14 @@ Description: packet processing. See the network driver for the exact meaning of this value. +What: /sys/class/<iface>/statistics/rx_errors +Date: April 2005 +KernelVersion: 2.6.12 +Contact: [email protected] +Description: + Indicates the number of receive errors on this network device. + See the network driver for the exact meaning of this value. + What: /sys/class/<iface>/statistics/rx_fifo_errors Date: April 2005 KernelVersion: 2.6.12
@@ -88,6 +96,14 @@ Description: due to lack of capacity in the receive side. See the network driver for the exact meaning of this value. +What: /sys/class/<iface>/statistics/rx_nohandler +Date: February 2016 +KernelVersion: 4.6 +Contact: [email protected] +Description: + Indicates the number of received packets that were dropped on + an inactive device by the network core. + What: /sys/class/<iface>/statistics/rx_over_errors Date: April 2005 KernelVersion: 2.6.12
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 142/202 HID: apple: Add support for the 2021 Magic Keyboard
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Henrie <[email protected]>
commit 0cd3be51733febb4f8acb92bcf55b75fe824dd05 upstream.
--- drivers/hid/hid-apple.c | 4 ++++ drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 1 + 3 files changed, 6 insertions(+)
drivers/hid/hid-apple.c +4 -0
@@ -599,6 +599,10 @@ static const struct hid_device_id apple_ .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021), + .driver_data = APPLE_HAS_FN }, + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021), + .driver_data = APPLE_HAS_FN }, { } };
drivers/hid/hid-ids.h +1 -0
@@ -176,6 +176,7 @@#define USB_DEVICE_ID_APPLE_IRCONTROL3 0x8241#define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242#define USB_DEVICE_ID_APPLE_IRCONTROL5 0x8243 +#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 0x029c#define USB_VENDOR_ID_ASUS 0x0486#define USB_DEVICE_ID_ASUS_T91MT 0x0185
drivers/hid/hid-quirks.c +1 -0
@@ -301,6 +301,7 @@ static const struct hid_device_id hid_ha { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021) }, #endif #if IS_ENABLED(CONFIG_HID_APPLEIR) { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) },
Greg Kroah-Hartman
maintainerPATCH 143/202 HID: apple: Swap the Fn and Left Control keys on Apple keyboards
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: free5lot <[email protected]>
commit 346338ef00d35bf8338ded171f9abeb9b10b43df upstream.
This patch allows users to swap the Fn and left Control keys on all Apple
keyboards: internal (e.g. Macbooks) and external (both wired and wireless). The patch adds a new hid-apple module param: swap_fn_leftctrl (off by default).
--- drivers/hid/hid-apple.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-)
drivers/hid/hid-apple.c +28 -2
@@ -54,6 +54,12 @@ MODULE_PARM_DESC(swap_opt_cmd, "Swap the"(For people who want to keep Windows PC keyboard muscle memory. " "[0] = as-is, Mac layout. 1 = swapped, Windows layout.)"); +static unsigned int swap_fn_leftctrl; +module_param (swap_fn_leftctrl, uint,0644 ); +MODULE_PARM_DESC (swap_fn_leftctrl,"Swap the Fn and left Control keys. " +"(For people who want to keep PC keyboard muscle memory. " +"[0] = as-is, Mac layout, 1 = swapped, PC layout)" ); +struct apple_sc {unsigned long quirks;unsigned int fn_on;
@@ -166,6 +172,11 @@ static const struct apple_key_translatio { } }; +static const struct apple_key_translation swapped_fn_leftctrl_keys[] = { + {KEY_FN ,KEY_LEFTCTRL }, + { } +}; +static const struct apple_key_translation *apple_find_translation (const struct apple_key_translation *table,u16 from) {
@@ -187,9 +198,11 @@ static int hidinput_apple_event(struct hbool do_translate;u16 code =0 ; -if (usage->code ==KEY_FN ) { +u16 fn_keycode = (swap_fn_leftctrl) ? (KEY_LEFTCTRL ) : (KEY_FN ); + +if (usage->code == fn_keycode) { asc->fn_on = !!value; -input_event (input, usage->type, usage->code, value); +input_event (input, usage->type,KEY_FN , value);return 1 ; }
@@ -274,6 +287,14 @@ static int hidinput_apple_event(struct h } } +if (swap_fn_leftctrl) { + trans =apple_find_translation (swapped_fn_leftctrl_keys, usage->code); +if (trans) { +input_event (input, usage->type, trans->to, value); +return 1 ; + } + } +return 0 ; }
@@ -344,6 +365,11 @@ static void apple_setup_input(struct inpfor (trans = apple_iso_keyboard; trans->from; trans++)set_bit (trans->to, input->keybit); + +if (swap_fn_leftctrl) { +for (trans = swapped_fn_leftctrl_keys; trans->from; trans++) +set_bit (trans->to, input->keybit); + } } static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi,
Greg Kroah-Hartman
maintainerPATCH 144/202 HID: apple: Add 2021 magic keyboard FN key mapping
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Berg <[email protected]>
commit 531cb56972f2773c941499fcfb639cd5128dfb27 upstream.
The new 2021 apple models have a different FN key assignment. Add a new translation table and use that for the 2021 magic keyboard.
--- drivers/hid/hid-apple.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/hid/hid-apple.c +28 -1
@@ -73,6 +73,28 @@ struct apple_key_translation {u8 flags; }; +static const struct apple_key_translation apple2021_fn_keys[] = { + {KEY_BACKSPACE ,KEY_DELETE }, + {KEY_ENTER ,KEY_INSERT }, + {KEY_F1 ,KEY_BRIGHTNESSDOWN ,APPLE_FLAG_FKEY }, + {KEY_F2 ,KEY_BRIGHTNESSUP ,APPLE_FLAG_FKEY }, + {KEY_F3 ,KEY_SCALE ,APPLE_FLAG_FKEY }, + {KEY_F4 ,KEY_SEARCH ,APPLE_FLAG_FKEY }, + {KEY_F5 ,KEY_MICMUTE ,APPLE_FLAG_FKEY }, + {KEY_F6 ,KEY_SLEEP ,APPLE_FLAG_FKEY }, + {KEY_F7 ,KEY_PREVIOUSSONG ,APPLE_FLAG_FKEY }, + {KEY_F8 ,KEY_PLAYPAUSE ,APPLE_FLAG_FKEY }, + {KEY_F9 ,KEY_NEXTSONG ,APPLE_FLAG_FKEY }, + {KEY_F10 ,KEY_MUTE ,APPLE_FLAG_FKEY }, + {KEY_F11 ,KEY_VOLUMEDOWN ,APPLE_FLAG_FKEY }, + {KEY_F12 ,KEY_VOLUMEUP ,APPLE_FLAG_FKEY }, + {KEY_UP ,KEY_PAGEUP }, + {KEY_DOWN ,KEY_PAGEDOWN }, + {KEY_LEFT ,KEY_HOME }, + {KEY_RIGHT ,KEY_END }, + { } +}; +static const struct apple_key_translation macbookair_fn_keys[] = { {KEY_BACKSPACE ,KEY_DELETE }, {KEY_ENTER ,KEY_INSERT },
@@ -207,7 +229,9 @@ static int hidinput_apple_event(struct h }if (fnmode) { -if (hid->product >=USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && +if (hid->product ==USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 ) + table = apple2021_fn_keys; +else if (hid->product >=USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && hid->product <=USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS ) table = macbookair_fn_keys;else if (hid->product <0x21d || hid->product >=0x300 )
@@ -366,6 +390,9 @@ static void apple_setup_input(struct inpfor (trans = apple_iso_keyboard; trans->from; trans++)set_bit (trans->to, input->keybit); +for (trans = apple2021_fn_keys; trans->from; trans++) +set_bit (trans->to, input->keybit); +if (swap_fn_leftctrl) {for (trans = swapped_fn_leftctrl_keys; trans->from; trans++)set_bit (trans->to, input->keybit);
Greg Kroah-Hartman
maintainerPATCH 145/202 bonding: remove print in bond_verify_device_path
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchao Shao <[email protected]>
commit 486058f42a4728053ae69ebbf78e9731d8ce6f8b upstream.
As suggested by Paolo in link[1], if the memory allocation fails, the mm layer will emit a lot warning comprising the backtrace, so remove the print.
[1] https://lore.kernel.org/all/[email protected]/
--- drivers/net/bonding/bond_main.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/bonding/bond_main.c +1 -4
@@ -2460,11 +2460,8 @@ struct bond_vlan_tag *bond_verify_deviceif (start_dev == end_dev) { tags =kcalloc (level +1 ,sizeof (*tags),GFP_ATOMIC ); -if (!tags) { -net_err_ratelimited ("%s: %s: Failed to allocate tags\n" , - __func__, start_dev->name); +if (!tags)return ERR_PTR (-ENOMEM ); - } tags[level].vlan_proto =VLAN_N_VID ;return tags; }
Greg Kroah-Hartman
maintainerPATCH 146/202 dmaengine: fix is_slave_direction() return false when DMA_DEV_TO_DEV
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit a22fe1d6dec7e98535b97249fdc95c2be79120bb ]
is_slave_direction() should return true when direction is DMA_DEV_TO_DEV.
--- include/linux/dmaengine.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/dmaengine.h +2 -1
@@ -827,7 +827,8 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,static inline bool is_slave_direction (enum dma_transfer_direction direction) { -return (direction ==DMA_MEM_TO_DEV ) || (direction ==DMA_DEV_TO_MEM ); +return (direction ==DMA_MEM_TO_DEV ) || (direction ==DMA_DEV_TO_MEM ) || + (direction ==DMA_DEV_TO_DEV ); } static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 147/202 phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
[ Upstream commit 7104ba0f1958adb250319e68a15eff89ec4fd36d ]
If the external phy working together with phy-omap-usb2 does not implement send_srp(), we may still attempt to call it. This can happen on an idle Ethernet gadget triggering a wakeup for example:
configfs-gadget.g1 gadget.0: ECM Suspend configfs-gadget.g1 gadget.0: Port suspended. Triggering wakeup
...
Unable to handle kernel NULL pointer dereference at virtual address
00000000 when execute
...
PC is at 0x0
LR is at musb_gadget_wakeup+0x1d4/0x254 [musb_hdrc]
...musb_gadget_wakeup [musb_hdrc] from usb_gadget_wakeup+0x1c/0x3c [udc_core] usb_gadget_wakeup [udc_core] from eth_start_xmit+0x3b0/0x3d4 [u_ether] eth_start_xmit [u_ether] from dev_hard_start_xmit+0x94/0x24c dev_hard_start_xmit from sch_direct_xmit+0x104/0x2e4 sch_direct_xmit from __dev_queue_xmit+0x334/0xd88 __dev_queue_xmit from arp_solicit+0xf0/0x268arp_solicit from neigh_probe+0x54/0x7cneigh_probe from __neigh_event_send+0x22c/0x47c __neigh_event_send from neigh_resolve_output+0x14c/0x1c0 neigh_resolve_output from ip_finish_output2+0x1c8/0x628 ip_finish_output2 from ip_send_skb+0x40/0xd8ip_send_skb from udp_send_skb+0x124/0x340udp_send_skb from udp_sendmsg+0x780/0x984udp_sendmsg from __sys_sendto+0xd8/0x158__sys_sendto from ret_fast_syscall+0x0/0x58
Let's fix the issue by checking for send_srp() and set_vbus() before calling them. For USB peripheral only cases these both could be NULL.
--- drivers/phy/ti/phy-omap-usb2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/ti/phy-omap-usb2.c +2 -2
@@ -64,7 +64,7 @@ static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) {struct omap_usb *phy =phy_to_omapusb (otg->usb_phy); -if (!phy->comparator) +if (!phy->comparator || !phy->comparator->set_vbus)return -ENODEV ;return phy->comparator->set_vbus (phy->comparator, enabled);
@@ -74,7 +74,7 @@ static int omap_usb_start_srp(struct usb_otg *otg) {struct omap_usb *phy =phy_to_omapusb (otg->usb_phy); -if (!phy->comparator) +if (!phy->comparator || !phy->comparator->start_srp)return -ENODEV ;return phy->comparator->start_srp (phy->comparator);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 138/202 netfilter: nf_log: replace BUG_ON by WARN_ON_ONCE when putting logger
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 259eb32971e9eb24d1777a28d82730659f50fdcb ]
Module reference is bumped for each user, this should not ever happen.
But BUG_ON check should use rcu_access_pointer() instead.
If this ever happens, do WARN_ON_ONCE() instead of BUG_ON() and consolidate pointer check under the rcu read side lock section.
--- net/netfilter/nf_log.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/netfilter/nf_log.c +4 -3
@@ -202,11 +202,12 @@ void nf_logger_put(int pf, enum nf_log_type type)return ; } -BUG_ON (loggers[pf][type] ==NULL ); -rcu_read_lock (); logger =rcu_dereference (loggers[pf][type]); -module_put (logger->me); +if (!logger) +WARN_ON_ONCE (1 ); +else +module_put (logger->me);rcu_read_unlock (); }EXPORT_SYMBOL_GPL (nf_logger_put);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 171/202 MIPS: Add memory clobber to csum_ipv6_magic() inline assembler
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit d55347bfe4e66dce2e1e7501e5492f4af3e315f8 ]
After 'lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests' was applied, the test_csum_ipv6_magic unit test started failing for all mips platforms, both little and bit endian. Oddly enough, adding debug code into test_csum_ipv6_magic() made the problem disappear.
The gcc manual says:
"The "memory" clobber tells the compiler that the assembly code performs
memory reads or writes to items other than those listed in the input and output operands (for example, accessing the memory pointed to by one of the input parameters)
"
This is definitely the case for csum_ipv6_magic(). Indeed, adding the 'memory' clobber fixes the problem.
--- arch/mips/include/asm/checksum.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/mips/include/asm/checksum.h +2 -1
@@ -276,7 +276,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, " .set pop" : "=&r" (sum), "=&r" (tmp) : "r" (saddr), "r" (daddr), - "0" (htonl(len)), "r" (htonl(proto)), "r" (sum)); + "0" (htonl(len)), "r" (htonl(proto)), "r" (sum) + : "memory");return csum_fold (sum); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 180/202 firewire: core: correct documentation of fw_csr_string() kernel API
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
commit 5f9ab17394f831cb7986ec50900fa37507a127f1 upstream.
Against its current description, the kernel API can accepts all types of directory entries.
This commit corrects the documentation.
--- drivers/firewire/core-device.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/firewire/core-device.c +3 -4
@@ -113,10 +113,9 @@ static int textual_leaf_to_string(const* @buf: where to put the string * @size: size of @buf, in bytes * -* The string is taken from a minimal ASCII text descriptor leaf after -* the immediate entry with @key. The string is zero-terminated. -* An overlong string is silently truncated such that it and the -* zero byte fit into @size. +* The string is taken from a minimal ASCII text descriptor leaf just after the entry with the +* @key. The string is zero-terminated. An overlong string is silently truncated such that it +* and the zero byte fit into @size. * * Returns strlen(buf) or a negative error code. */
Greg Kroah-Hartman
maintainerPATCH 181/202 nfc: nci: free rx_data_reassembly skb on NCI device cleanup
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit bfb007aebe6bff451f7f3a4be19f4f286d0d5d9c upstream.
rx_data_reassembly skb is stored during NCI data exchange for processing fragmented packets. It is dropped only when the last fragment is processed or when an NTF packet with NCI_OP_RF_DEACTIVATE_NTF opcode is received. However, the NCI device may be deallocated before that which leads to skb leak.
As by design the rx_data_reassembly skb is bound to the NCI device and nothing prevents the device to be freed before the skb is processed in some way and cleaned, free it on the NCI device cleanup.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- net/nfc/nci/core.c | 4 ++++ 1 file changed, 4 insertions(+)
net/nfc/nci/core.c +4 -0
@@ -1209,6 +1209,10 @@ void nci_free_device(struct nci_dev *nde {nfc_free_device (ndev->nfc_dev);nci_hci_deallocate (ndev); + +/* drop partial rx data packet if present */ +if (ndev->rx_data_reassembly) +kfree_skb (ndev->rx_data_reassembly);kfree (ndev); }EXPORT_SYMBOL (nci_free_device);
Greg Kroah-Hartman
maintainerPATCH 182/202 xen-netback: properly sync TX responses
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Beulich <[email protected]>
commit 7b55984c96ffe9e236eb9c82a2196e0b1f84990d upstream.
Invoking the make_tx_response() / push_tx_responses() pair with no lock held would be acceptable only if all such invocations happened from the same context (NAPI instance or dealloc thread). Since this isn't the case, and since the interface "spec" also doesn't demand that multicast operations may only be performed with no in-flight transmits, MCAST_{ADD,DEL} processing also needs to acquire the response lock around the invocations.
To prevent similar mistakes going forward, "downgrade" the present functions to private helpers of just the two remaining ones using them directly, with no forward declarations anymore. This involves renaming what so far was make_tx_response(), for the new function of that name to serve the new (wrapper) purpose.
While there,
- constify the txp parameters,
- correct xenvif_idx_release()'s status parameter's type,
- rename {,_}make_tx_response()'s status parameters for consistency with xenvif_idx_release()'s.
--- drivers/net/xen-netback/netback.c | 84 ++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 44 deletions(-)
drivers/net/xen-netback/netback.c +40 -44
@@ -97,13 +97,12 @@ module_param_named(hash_cache_size, xenvMODULE_PARM_DESC (hash_cache_size,"Number of flows in the hash cache" );static void xenvif_idx_release (struct xenvif_queue *queue,u16 pending_idx, -u8 status); +s8 status);static void make_tx_response (struct xenvif_queue *queue, -struct xen_netif_tx_request *txp, +const struct xen_netif_tx_request *txp,unsigned int extra_count, -s8 st); -static void push_tx_responses (struct xenvif_queue *queue); +s8 status);static void xenvif_idx_unmap (struct xenvif_queue *queue,u16 pending_idx);
@@ -201,13 +200,9 @@ static void xenvif_tx_err(struct xenvif_ unsigned int extra_count, RING_IDX end) {RING_IDX cons = queue->tx.req_cons; -unsigned long flags; do { - spin_lock_irqsave(&queue->response_lock, flags); make_tx_response(queue, txp, extra_count, XEN_NETIF_RSP_ERROR); - push_tx_responses(queue); - spin_unlock_irqrestore(&queue->response_lock, flags); if (cons == end) break; RING_COPY_REQUEST(&queue->tx, cons++, txp);
@@ -458,12 +453,7 @@ static void xenvif_get_requests(struct xfor (shinfo->nr_frags =0 ; nr_slots >0 && shinfo->nr_frags <MAX_SKB_FRAGS ; nr_slots--) {if (unlikely (!txp->size)) { -unsigned long flags; - -spin_lock_irqsave (&queue->response_lock, flags);make_tx_response (queue, txp,0 ,XEN_NETIF_RSP_OKAY ); -push_tx_responses (queue); -spin_unlock_irqrestore (&queue->response_lock, flags); ++txp;continue ; }
@@ -489,14 +479,8 @@ static void xenvif_get_requests(struct xfor (shinfo->nr_frags =0 ; shinfo->nr_frags < nr_slots; ++txp) {if (unlikely (!txp->size)) { -unsigned long flags; - -spin_lock_irqsave (&queue->response_lock, flags);make_tx_response (queue, txp,0 ,XEN_NETIF_RSP_OKAY ); -push_tx_responses (queue); -spin_unlock_irqrestore (&queue->response_lock, - flags);continue ; }
@@ -990,7 +974,6 @@ static void xenvif_tx_build_gops(struct (ret ==0 ) ?XEN_NETIF_RSP_OKAY : XEN_NETIF_RSP_ERROR); -push_tx_responses (queue);continue ; }
@@ -1002,7 +985,6 @@ static void xenvif_tx_build_gops(structmake_tx_response (queue, &txreq, extra_count,XEN_NETIF_RSP_OKAY ); -push_tx_responses (queue);continue ; }
@@ -1428,8 +1410,35 @@ int xenvif_tx_action(struct xenvif_queuereturn work_done; } +static void _make_tx_response (struct xenvif_queue *queue, +const struct xen_netif_tx_request *txp, +unsigned int extra_count, +s8 status) +{ +RING_IDX i = queue->tx.rsp_prod_pvt; +struct xen_netif_tx_response *resp; + + resp =RING_GET_RESPONSE (&queue->tx, i); + resp->id = txp->id; + resp->status = status; + +while (extra_count-- !=0 ) +RING_GET_RESPONSE (&queue->tx, ++i)->status =XEN_NETIF_RSP_NULL ; + + queue->tx.rsp_prod_pvt = ++i; +} + +static void push_tx_responses (struct xenvif_queue *queue) +{ +int notify; + +RING_PUSH_RESPONSES_AND_CHECK_NOTIFY (&queue->tx, notify); +if (notify) +notify_remote_via_irq (queue->tx_irq); +} +static void xenvif_idx_release (struct xenvif_queue *queue,u16 pending_idx, -u8 status) +s8 status) {struct pending_tx_info *pending_tx_info;pending_ring_idx_t index;
@@ -1439,8 +1448,8 @@ static void xenvif_idx_release(struct xespin_lock_irqsave (&queue->response_lock, flags); -make_tx_response (queue, &pending_tx_info->req, - pending_tx_info->extra_count, status); +_make_tx_response (queue, &pending_tx_info->req, + pending_tx_info->extra_count, status);/* Release the pending index before pusing the Tx response so * its available before a new Tx request is pushed by the
@@ -1454,32 +1463,19 @@ static void xenvif_idx_release(struct xespin_unlock_irqrestore (&queue->response_lock, flags); } -static void make_tx_response (struct xenvif_queue *queue, -struct xen_netif_tx_request *txp, +const struct xen_netif_tx_request *txp,unsigned int extra_count, -s8 st) +s8 status) { -RING_IDX i = queue->tx.rsp_prod_pvt; -struct xen_netif_tx_response *resp; - - resp =RING_GET_RESPONSE (&queue->tx, i); - resp->id = txp->id; - resp->status = st; - -while (extra_count-- !=0 ) -RING_GET_RESPONSE (&queue->tx, ++i)->status =XEN_NETIF_RSP_NULL ; +unsigned long flags; - queue->tx.rsp_prod_pvt = ++i; -} +spin_lock_irqsave (&queue->response_lock, flags); -static void push_tx_responses (struct xenvif_queue *queue) -{ -int notify; +_make_tx_response (queue, txp, extra_count, status); +push_tx_responses (queue); -RING_PUSH_RESPONSES_AND_CHECK_NOTIFY (&queue->tx, notify); -if (notify) -notify_remote_via_irq (queue->tx_irq); +spin_unlock_irqrestore (&queue->response_lock, flags); }static void xenvif_idx_unmap (struct xenvif_queue *queue,u16 pending_idx)
Greg Kroah-Hartman
maintainerPATCH 183/202 binder: signal epoll threads of self-work
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carlos Llamas <[email protected]>
commit 97830f3c3088638ff90b20dfba2eb4d487bf14d7 upstream.
In (e)poll mode, threads often depend on I/O events to determine when data is ready for consumption. Within binder, a thread may initiate a command via BINDER_WRITE_READ without a read buffer and then make use of epoll_wait() or similar to consume any responses afterwards.
It is then crucial that epoll threads are signaled via wakeup when they queue their own work. Otherwise, they risk waiting indefinitely for an event leaving their work unhandled. What is worse, subsequent commands won't trigger a wakeup either as the thread has pending work.
--- drivers/android/binder.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/android/binder.c +10 -0
@@ -846,6 +846,16 @@ binder_enqueue_thread_work_ilocked(struc {WARN_ON (!list_empty (&thread->waiting_thread_node));binder_enqueue_work_ilocked (work, &thread->todo); + +/* (e)poll-based threads require an explicit wakeup signal when +* queuing their own work; they rely on these events to consume +* messages without I/O block. Without it, threads risk waiting +* indefinitely without handling the work. +*/ +if (thread->looper &BINDER_LOOPER_STATE_POLL && + thread->pid == current->pid && !thread->process_todo) +wake_up_interruptible_sync (&thread->wait); + thread->process_todo = true; }
Greg Kroah-Hartman
maintainerPATCH 184/202 ext4: fix double-free of blocks due to wrong extents moved_len
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
commit 55583e899a5357308274601364741a83e78d6ac4 upstream.
In ext4_move_extents(), moved_len is only updated when all moves are successfully executed, and only discards orig_inode and donor_inode preallocations when moved_len is not zero. When the loop fails to exit after successfully moving some extents, moved_len is not updated and remains at 0, so it does not discard the preallocations.
If the moved extents overlap with the preallocated extents, the overlapped extents are freed twice in ext4_mb_release_inode_pa() and ext4_process_freed_data() (as described in commit 94d7c16cbbbd ("ext4:
Fix double-free of blocks with EXT4_IOC_MOVE_EXT")), and bb_free is incremented twice. Hence when trim is executed, a zero-division bug is triggered in mb_update_avg_fragment_size() because bb_free is not zero and bb_fragments is zero.
Therefore, update move_len after each extent move to avoid the issue.
--- fs/ext4/move_extent.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/ext4/move_extent.c +2 -4
@@ -616,6 +616,7 @@ ext4_move_extents(struct file *o_filp, s goto out; o_end = o_start + len; + *moved_len =0 ;while (o_start < o_end) {struct ext4_extent *ex;ext4_lblk_t cur_blk, next_blk;
@@ -671,7 +672,7 @@ ext4_move_extents(struct file *o_filp, s*/ ext4_double_up_write_data_sem (orig_inode, donor_inode);/* Swap original branches with new branches */ -move_extent_per_page (o_filp, donor_inode, + *moved_len +=move_extent_per_page (o_filp, donor_inode, orig_page_index, donor_page_index, offset_in_page, cur_len, unwritten, &ret);
@@ -681,9 +682,6 @@ ext4_move_extents(struct file *o_filp, s o_start += cur_len; d_start += cur_len; } - *moved_len = o_start - orig_blk; -if (*moved_len > len) - *moved_len = len; out:if (*moved_len) {
Greg Kroah-Hartman
maintainerPATCH 185/202 staging: iio: ad5933: fix type mismatch regression
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Schiller <[email protected]>
commit 6db053cd949fcd6254cea9f2cd5d39f7bd64379c upstream.
Commit 4c3577db3e4f ("Staging: iio: impedance-analyzer: Fix sparse warning") fixed a compiler warning, but introduced a bug that resulted in one of the two 16 bit IIO channels always being zero (when both are enabled).
This is because int is 32 bits wide on most architectures and in the case of a little-endian machine the two most significant bytes would occupy the buffer for the second channel as 'val' is being passed as a void pointer to 'iio_push_to_buffers()'.
Fix by defining 'val' as u16. Tested working on ARM64.
--- drivers/staging/iio/impedance-analyzer/ad5933.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/impedance-analyzer/ad5933.c +1 -1
@@ -638,7 +638,7 @@ static void ad5933_work(struct work_stru struct ad5933_state, work.work);struct iio_dev *indio_dev =i2c_get_clientdata (st->client);__be16 buf[2 ]; -int val[2 ]; +u16 val[2 ];unsigned char status;int ret;
Greg Kroah-Hartman
maintainerPATCH 186/202 ring-buffer: Clean ring_buffer_poll_wait() error return
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vincent Donnefort <[email protected]>
commit 66bbea9ed6446b8471d365a22734dc00556c4785 upstream.
The return type for ring_buffer_poll_wait() is __poll_t. This is behind the scenes an unsigned where we can set event bits. In case of a non-allocated CPU, we do return instead -EINVAL (0xffffffea). Lucky us, this ends up setting few error bits (EPOLLERR | EPOLLHUP | EPOLLNVAL), so user-space at least is aware something went wrong.
Nonetheless, this is an incorrect code. Replace that -EINVAL with a proper EPOLLERR to clean that output. As this doesn't change the behaviour, there's no need to treat this change as a bug fix.
--- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ring_buffer.c +1 -1
@@ -676,7 +676,7 @@ __poll_t ring_buffer_poll_wait(struct ri work = &buffer->irq_work; else {if (!cpumask_test_cpu (cpu, buffer->cpumask)) -return -EINVAL ; +return EPOLLERR ; cpu_buffer = buffer->buffers[cpu]; work = &cpu_buffer->irq_work;
Greg Kroah-Hartman
maintainerPATCH 187/202 serial: max310x: set default value when reading clock ready bit
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
commit 0419373333c2f2024966d36261fd82a453281e80 upstream.
If regmap_read() returns a non-zero value, the 'val' variable can be left uninitialized.
Clear it before calling regmap_read() to make sure we properly detect the clock ready bit.
--- drivers/tty/serial/max310x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/max310x.c +1 -1
@@ -600,7 +600,7 @@ static int max310x_set_ref_clk(struct de/* Wait for crystal */ if (xtal) { -unsigned int val; +unsigned int val =0 ;msleep (10 );regmap_read (s->regmap,MAX310X_STS_IRQSTS_REG , &val);if (!(val &MAX310X_STS_CLKREADY_BIT )) {
Greg Kroah-Hartman
maintainerPATCH 188/202 serial: max310x: improve crystal stable clock detection
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
commit 93cd256ab224c2519e7c4e5f58bb4f1ac2bf0965 upstream.
Some people are seeing a warning similar to this when using a crystal:
max310x 11-006c: clock is not stable yet
The datasheet doesn't mention the maximum time to wait for the clock to be stable when using a crystal, and it seems that the 10ms delay in the driver is not always sufficient.
Jan Kundrát reported that it took three tries (each separated by 10ms) to get a stable clock.
Modify behavior to check stable clock ready bit multiple times (20), and waiting 10ms between each try.
Note: the first draft of the driver originally used a 50ms delay, without checking the clock stable bit.
Then a loop with 1000 retries was implemented, each time reading the clock stable bit.
--- drivers/tty/serial/max310x.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/tty/serial/max310x.c +16 -5
@@ -235,6 +235,10 @@#define MAX310x_REV_MASK (0xf8)#define MAX310X_WRITE_BIT 0x80 +/* Crystal-related definitions */ +#define MAX310X_XTAL_WAIT_RETRIES 20/* Number of retries */ +#define MAX310X_XTAL_WAIT_DELAY_MS 10/* Delay between retries */ +/* MAX3107 specific */ #define MAX3107_REV_ID (0xa0)
@@ -600,12 +604,19 @@ static int max310x_set_ref_clk(struct de/* Wait for crystal */ if (xtal) { -unsigned int val =0 ; -msleep (10 ); -regmap_read (s->regmap,MAX310X_STS_IRQSTS_REG , &val); -if (!(val &MAX310X_STS_CLKREADY_BIT )) { +bool stable = false; +unsigned int try =0 , val =0 ; + +do { +msleep (MAX310X_XTAL_WAIT_DELAY_MS ); +regmap_read (s->regmap,MAX310X_STS_IRQSTS_REG , &val); + +if (val &MAX310X_STS_CLKREADY_BIT ) + stable = true; + }while (!stable && (++try <MAX310X_XTAL_WAIT_RETRIES )); + +if (!stable)dev_warn (dev,"clock is not stable yet\n" ); - } }return (int )bestfreq;
Greg Kroah-Hartman
maintainerPATCH 189/202 x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksander Mazur <[email protected]>
commit f6a1892585cd19e63c4ef2334e26cd536d5b678d upstream.
The kernel built with MCRUSOE is unbootable on Transmeta Crusoe. It shows the following error message:
This kernel requires an i686 CPU, but only detected an i586 CPU. Unable to boot - please use a kernel appropriate for your CPU.
Remove MCRUSOE from the condition introduced in commit in Fixes, effectively changing X86_MINIMUM_CPU_FAMILY back to 5 on that machine, which matches the CPU family given by CPUID.
[ bp: Massage commit message. ]
--- arch/x86/Kconfig.cpu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig.cpu +1 -1
@@ -372,7 +372,7 @@ config X86_CMOV config X86_MINIMUM_CPU_FAMILY int default "64" if X86_64 - default "6" if X86_32 && (MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MATOM || MCRUSOE || MCORE2 || MK7 || MK8) + default "6" if X86_32 && (MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MATOM || MCORE2 || MK7 || MK8) default "5" if X86_32 && X86_CMPXCHG64 default "4"
Greg Kroah-Hartman
maintainerPATCH 172/202 i40e: Fix waiting for queues of all VSIs to be disabled
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Vecera <[email protected]>
[ Upstream commit c73729b64bb692186da080602cd13612783f52ac ]
The function i40e_pf_wait_queues_disabled() iterates all PF's VSIs up to 'pf->hw.func_caps.num_vsis' but this is incorrect because the real number of VSIs can be up to 'pf->num_alloc_vsi' that can be higher. Fix this loop.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
@@ -4966,7 +4966,7 @@ static int i40e_pf_wait_queues_disabled(struct i40e_pf *pf) {int v, ret =0 ; -for (v =0 ; v < pf->hw.func_caps.num_vsis; v++) { +for (v =0 ; v < pf->num_alloc_vsi; v++) {if (pf->vsi[v]) { ret =i40e_vsi_wait_queues_disabled (pf->vsi[v]);if (ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 190/202 x86/mm/ident_map: Use gbpages only where full GB page should be mapped.
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Wahl <[email protected]>
commit d794734c9bbfe22f86686dc2909c25f5ffe1a572 upstream.
When ident_pud_init() uses only gbpages to create identity maps, large ranges of addresses not actually requested can be included in the resulting table; a 4K request will map a full GB. On UV systems, this ends up including regions that will cause hardware to halt the system if accessed (these are marked "reserved" by BIOS). Even processor speculation into these regions is enough to trigger the system halt.
Only use gbpages when map creation requests include the full GB page of space. Fall back to using smaller 2M pages when only portions of a GB page are included in the request.
No attempt is made to coalesce mapping requests. If a request requires a map entry at the 2M (pmd) level, subsequent mapping requests within the same 1G region will also be at the pmd level, even if adjacent or overlapping such requests could have been combined to map a full gbpage. Existing usage starts with larger regions and then adds smaller regions, so this should not have any great consequence.
[ dhansen: fix up comment formatting, simplifty changelog ]
--- arch/x86/mm/ident_map.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
arch/x86/mm/ident_map.c +18 -5
@@ -26,18 +26,31 @@ static int ident_pud_init(struct x86_mapfor (; addr < end; addr = next) {pud_t *pud = pud_page +pud_index (addr);pmd_t *pmd; +bool use_gbpage; next = (addr &PUD_MASK ) +PUD_SIZE ;if (next > end) next = end; -if (info->direct_gbpages) { -pud_t pudval; +/* if this is already a gbpage, this portion is already mapped */ +if (pud_large (*pud)) +continue ; + +/* Is using a gbpage allowed? */ + use_gbpage = info->direct_gbpages; -if (pud_present (*pud)) -continue ; +/* Don't use gbpage if it maps more than the requested region. */ +/* at the begining: */ + use_gbpage &= ((addr & ~PUD_MASK ) ==0 ); +/* ... or at the end: */ + use_gbpage &= ((next & ~PUD_MASK ) ==0 ); + +/* Never overwrite existing mappings */ + use_gbpage &= !pud_present (*pud); + +if (use_gbpage) { +pud_t pudval; - addr &=PUD_MASK ; pudval =__pud ((addr - info->offset) | info->page_flag);set_pud (pud, pudval);continue ;
Greg Kroah-Hartman
maintainerPATCH 191/202 ALSA: hda/conexant: Add quirk for SWS JS201D
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: bo liu <[email protected]>
commit 4639c5021029d49fd2f97fa8d74731f167f98919 upstream.
The SWS JS201D need a different pinconfig from windows driver. Add a quirk to use a specific pinconfig to SWS JS201D.
--- sound/pci/hda/patch_conexant.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
sound/pci/hda/patch_conexant.c +18 -0
@@ -229,6 +229,7 @@ enum {CXT_FIXUP_MUTE_LED_GPIO ,CXT_FIXUP_HEADSET_MIC ,CXT_FIXUP_HP_MIC_NO_PRESENCE , + CXT_PINCFG_SWS_JS201D, };/* for hda_fixup_thinkpad_acpi() */
@@ -717,6 +718,17 @@ static const struct hda_pintbl cxt_pincf {} }; +/* SuoWoSi/South-holding JS201D with sn6140 */ +static const struct hda_pintbl cxt_pincfg_sws_js201d[] = { + {0x16 ,0x03211040 },/* hp out */ + {0x17 ,0x91170110 },/* SPK/Class_D */ + {0x18 ,0x95a70130 },/* Internal mic */ + {0x19 ,0x03a11020 },/* Headset Mic */ + {0x1a ,0x40f001f0 },/* Not used */ + {0x21 ,0x40f001f0 },/* Not used */ + {} +}; +static const struct hda_fixup cxt_fixups[] = { [CXT_PINCFG_LENOVO_X200 ] = { .type =HDA_FIXUP_PINS ,
@@ -868,6 +880,10 @@ static const struct hda_fixup cxt_fixups .chained = true, .chain_id = CXT_FIXUP_HEADSET_MIC, }, + [CXT_PINCFG_SWS_JS201D] = { + .type = HDA_FIXUP_PINS, + .v.pins = cxt_pincfg_sws_js201d, + }, }; static const struct snd_pci_quirk cxt5045_fixups[] = {
@@ -939,6 +955,7 @@ static const struct snd_pci_quirk cxt506SND_PCI_QUIRK (0x103c ,0x8457 ,"HP Z2 G4 mini" ,CXT_FIXUP_HP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x103c ,0x8458 ,"HP Z2 G4 mini premium" ,CXT_FIXUP_HP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x138d ,"Asus" ,CXT_FIXUP_HEADPHONE_MIC_PIN ), +SND_PCI_QUIRK (0x14f1 ,0x0265 ,"SWS JS201D" ,CXT_PINCFG_SWS_JS201D ),SND_PCI_QUIRK (0x152d ,0x0833 ,"OLPC XO-1.5" ,CXT_FIXUP_OLPC_XO ),SND_PCI_QUIRK (0x17aa ,0x20f2 ,"Lenovo T400" ,CXT_PINCFG_LENOVO_TP410 ), SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410),
@@ -978,6 +995,7 @@ static const struct hda_model_fixup cxt5 { .id = CXT_FIXUP_MUTE_LED_GPIO, .name = "mute-led-gpio" }, { .id = CXT_FIXUP_HP_MIC_NO_PRESENCE, .name = "hp-mic-fix" }, { .id = CXT_PINCFG_LENOVO_NOTEBOOK, .name = "lenovo-20149" }, + { .id = CXT_PINCFG_SWS_JS201D, .name = "sws-js201d" }, {} };
Greg Kroah-Hartman
maintainerPATCH 192/202 nilfs2: fix data corruption in dsync block recovery for small block sizes
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 67b8bcbaed4777871bb0dcc888fb02a614a98ab1 upstream.
The helper function nilfs_recovery_copy_block() of nilfs_recovery_dsync_blocks(), which recovers data from logs created by data sync writes during a mount after an unclean shutdown, incorrectly calculates the on-page offset when copying repair data to the file's page cache. In environments where the block size is smaller than the page size, this flaw can cause data corruption and leak uninitialized memory bytes during the recovery process.
Fix these issues by correcting this byte offset calculation on the page.
--- fs/nilfs2/recovery.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/nilfs2/recovery.c +4 -3
@@ -472,9 +472,10 @@ static int nilfs_prepare_segment_for_recstatic int nilfs_recovery_copy_block (struct the_nilfs *nilfs,struct nilfs_recovery_block *rb, -struct page *page) +loff_t pos,struct page *page) {struct buffer_head *bh_org; +size_t from = pos & ~PAGE_MASK ;void *kaddr; bh_org =__bread (nilfs->ns_bdev, rb->blocknr, nilfs->ns_blocksize);
@@ -482,7 +483,7 @@ static int nilfs_recovery_copy_block(strreturn -EIO ; kaddr =kmap_atomic (page); -memcpy (kaddr +bh_offset (bh_org), bh_org->b_data, bh_org->b_size); +memcpy (kaddr + from, bh_org->b_data, bh_org->b_size);kunmap_atomic (kaddr);brelse (bh_org);return 0 ;
@@ -521,7 +522,7 @@ static int nilfs_recover_dsync_blocks(st goto failed_inode; } - err =nilfs_recovery_copy_block (nilfs, rb, page); + err =nilfs_recovery_copy_block (nilfs, rb, pos, page);if (unlikely (err)) goto failed_page;
Greg Kroah-Hartman
maintainerPATCH 193/202 nilfs2: fix hang in nilfs_lookup_dirty_data_buffers()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 38296afe3c6ee07319e01bb249aa4bb47c07b534 upstream.
Syzbot reported a hang issue in migrate_pages_batch() called by mbind() and nilfs_lookup_dirty_data_buffers() called in the log writer of nilfs2.
While migrate_pages_batch() locks a folio and waits for the writeback to complete, the log writer thread that should bring the writeback to completion picks up the folio being written back in nilfs_lookup_dirty_data_buffers() that it calls for subsequent log creation and was trying to lock the folio. Thus causing a deadlock.
In the first place, it is unexpected that folios/pages in the middle of writeback will be updated and become dirty. Nilfs2 adds a checksum to verify the validity of the log being written and uses it for recovery at mount, so data changes during writeback are suppressed. Since this is broken, an unclean shutdown could potentially cause recovery to fail.
Investigation revealed that the root cause is that the wait for writeback completion in nilfs_page_mkwrite() is conditional, and if the backing device does not require stable writes, data may be modified without waiting.
Fix these issues by making nilfs_page_mkwrite() wait for writeback to finish regardless of the stable write requirement of the backing device.
--- fs/nilfs2/file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/nilfs2/file.c +7 -1
@@ -105,7 +105,13 @@ static vm_fault_t nilfs_page_mkwrite(strnilfs_transaction_commit (inode->i_sb); mapped: -wait_for_stable_page (page); +/* +* Since checksumming including data blocks is performed to determine +* the validity of the log to be written and used for recovery, it is +* necessary to wait for writeback to finish here, regardless of the +* stable write requirement of the backing device. +*/ +wait_on_page_writeback (page); out:sb_end_pagefault (inode->i_sb);return block_page_mkwrite_return (ret);
Greg Kroah-Hartman
maintainerPATCH 194/202 nfp: use correct macro for LengthSelect in BAR config
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Basilio <[email protected]>
commit b3d4f7f2288901ed2392695919b3c0e24c1b4084 upstream.
The 1st and 2nd expansion BAR configuration registers are configured, when the driver starts up, in variables 'barcfg_msix_general' and 'barcfg_msix_xpb', respectively. The 'LengthSelect' field is ORed in from bit 0, which is incorrect. The 'LengthSelect' field should start from bit 27.
This has largely gone un-noticed because NFP_PCIE_BAR_PCIE2CPP_LengthSelect_32BIT happens to be 0.
--- drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c +4 -2
@@ -571,11 +571,13 @@ static int enable_bars(struct nfp6000_pcconst u32 barcfg_msix_general =NFP_PCIE_BAR_PCIE2CPP_MapType ( NFP_PCIE_BAR_PCIE2CPP_MapType_GENERAL) | - NFP_PCIE_BAR_PCIE2CPP_LengthSelect_32BIT; +NFP_PCIE_BAR_PCIE2CPP_LengthSelect ( + NFP_PCIE_BAR_PCIE2CPP_LengthSelect_32BIT);const u32 barcfg_msix_xpb =NFP_PCIE_BAR_PCIE2CPP_MapType ( NFP_PCIE_BAR_PCIE2CPP_MapType_BULK) | - NFP_PCIE_BAR_PCIE2CPP_LengthSelect_32BIT | +NFP_PCIE_BAR_PCIE2CPP_LengthSelect ( + NFP_PCIE_BAR_PCIE2CPP_LengthSelect_32BIT) |NFP_PCIE_BAR_PCIE2CPP_Target_BaseAddress (NFP_CPP_TARGET_ISLAND_XPB );const u32 barcfg_explicit[4 ] = {
Greg Kroah-Hartman
maintainerPATCH 195/202 irqchip/irq-brcmstb-l2: Add write memory barrier before exit
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Doug Berger <[email protected]>
commit b0344d6854d25a8b3b901c778b1728885dd99007 upstream.
It was observed on Broadcom devices that use GIC v3 architecture L1 interrupt controllers as the parent of brcmstb-l2 interrupt controllers that the deactivation of the parent interrupt could happen before the brcmstb-l2 deasserted its output. This would lead the GIC to reactivate the interrupt only to find that no L2 interrupt was pending. The result was a spurious interrupt invoking handle_bad_irq() with its associated messaging. While this did not create a functional problem it is a waste of cycles.
The hazard exists because the memory mapped bus writes to the brcmstb-l2 registers are buffered and the GIC v3 architecture uses a very efficient system register write to deactivate the interrupt.
Add a write memory barrier prior to invoking chained_irq_exit() to introduce a dsb(st) on those systems to ensure the system register write cannot be executed until the memory mapped writes are visible to the system.
[ florian: Added Fixes tag ]
--- drivers/irqchip/irq-brcmstb-l2.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/irqchip/irq-brcmstb-l2.c +3 -0
@@ -121,6 +121,9 @@ static void brcmstb_l2_intc_irq_handle(sgeneric_handle_irq (irq_linear_revmap (b->domain, irq)); }while (status); out: +/* Don't ack parent before all device writes are done */ +wmb (); +chained_irq_exit (chip, desc); }
Greg Kroah-Hartman
maintainerPATCH 196/202 pmdomain: core: Move the unused cleanup to a _sync initcall
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
commit 741ba0134fa7822fcf4e4a0a537a5c4cfd706b20 upstream.
The unused clock cleanup uses the _sync initcall to give all users at earlier initcalls time to probe. Do the same to avoid leaving some PDs dangling at "on" (which actually happened on qcom!).
--- drivers/base/power/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/domain.c +1 -1
@@ -847,7 +847,7 @@ static int __init genpd_power_off_unusedreturn 0 ; } -late_initcall (genpd_power_off_unused); +late_initcall_sync (genpd_power_off_unused);#if defined(CONFIG_PM_SLEEP ) || defined(CONFIG_PM_GENERIC_DOMAINS_OF )
Greg Kroah-Hartman
maintainerPATCH 197/202 Revert "md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d"
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxiao Bi <[email protected]>
[ Upstream commit bed9e27baf52a09b7ba2a3714f1e24e17ced386d ]
This reverts commit 5e2cf333b7bd5d3e62595a44d598a254c697cd74.
That commit introduced the following race and can cause system hung.
md_write_start: raid5d:
// mddev->in_sync == 1
set "MD_SB_CHANGE_PENDING"
// running before md_write_start wakeup it
waiting "MD_SB_CHANGE_PENDING" cleared
>>>>>>>>> hung wakeup mddev->thread
...
waiting "MD_SB_CHANGE_PENDING" cleared
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
hung, raid5d should clear this flag
but get hung by same flag.
The issue reverted commit fixing is fixed by last patch in a new way.
--- drivers/md/raid5.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/md/raid5.c +0 -12
@@ -44,7 +44,6 @@*/ #include <linux/blkdev.h> -#include <linux/delay.h> #include <linux/kthread.h> #include <linux/raid/pq.h> #include <linux/async_tx.h>
@@ -6330,18 +6329,7 @@ static void raid5d(struct md_thread *thread)spin_unlock_irq (&conf->device_lock);md_check_recovery (mddev);spin_lock_irq (&conf->device_lock); - -/* -* Waiting on MD_SB_CHANGE_PENDING below may deadlock -* seeing md_check_recovery() is needed to clear -* the flag when using mdmon. -*/ -continue ; } - -wait_event_lock_irq (mddev->sb_wait, - !test_bit (MD_SB_CHANGE_PENDING , &mddev->sb_flags), - conf->device_lock); }pr_debug ("%d stripes handled\n" , handled);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 198/202 sched/membarrier: reduce the ability to hammer on sys_membarrier
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 944d5fe50f3f03daacfea16300e656a1691c4a23 upstream.
On some systems, sys_membarrier can be very expensive, causing overall slowdowns for everything. So put a lock on the path in order to serialize the accesses to prevent the ability for this to be called at too high of a frequency and saturate the machine.
[ converted to explicit mutex_*() calls - cleanup.h is not in this stable
branch - gregkh ]
--- kernel/sched/membarrier.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/sched/membarrier.c +6 -0
@@ -34,6 +34,8 @@ | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED \ | MEMBARRIER_PRIVATE_EXPEDITED_SYNC_CORE_BITMASK) +static DEFINE_MUTEX (membarrier_ipi_mutex); +static void ipi_mb (void *info) {smp_mb ();/* IPIs should be serializing but paranoid. */
@@ -64,6 +66,7 @@ static int membarrier_global_expedited(v fallback = true; } +mutex_lock (&membarrier_ipi_mutex);cpus_read_lock ();for_each_online_cpu (cpu) {struct task_struct *p;
@@ -104,6 +107,7 @@ static int membarrier_global_expedited(v* rq->curr modification in scheduler. */ smp_mb ();/* exit from system call is not a mb */ +mutex_unlock (&membarrier_ipi_mutex);return 0 ; }
@@ -144,6 +148,7 @@ static int membarrier_private_expedited( fallback = true; } +mutex_lock (&membarrier_ipi_mutex);cpus_read_lock ();for_each_online_cpu (cpu) {struct task_struct *p;
@@ -182,6 +187,7 @@ static int membarrier_private_expedited(* rq->curr modification in scheduler. */ smp_mb ();/* exit from system call is not a mb */ +mutex_unlock (&membarrier_ipi_mutex);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 199/202 nilfs2: fix potential bug in end_buffer_async_write
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 5bc09b397cbf1221f8a8aacb1152650c9195b02b upstream.
According to a syzbot report, end_buffer_async_write(), which handles the completion of block device writes, may detect abnormal condition of the buffer async_write flag and cause a BUG_ON failure when using nilfs2.
Nilfs2 itself does not use end_buffer_async_write(). But, the async_write flag is now used as a marker by commit 7f42ec394156 ("nilfs2: fix issue with race condition of competition between segments for dirty blocks") as a means of resolving double list insertion of dirty blocks in nilfs_lookup_dirty_data_buffers() and nilfs_lookup_node_buffers() and the resulting crash.
This modification is safe as long as it is used for file data and b-tree node blocks where the page caches are independent. However, it was irrelevant and redundant to also introduce async_write for segment summary and super root blocks that share buffers with the backing device. This led to the possibility that the BUG_ON check in end_buffer_async_write would fail as described above, if independent writebacks of the backing device occurred in parallel.
The use of async_write for segment summary buffers has already been removed in a previous change.
Fix this issue by removing the manipulation of the async_write flag for the remaining super root block buffer.
--- fs/nilfs2/segment.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/nilfs2/segment.c +5 -3
@@ -1702,7 +1702,6 @@ static void nilfs_segctor_prepare_write(list_for_each_entry (bh, &segbuf->sb_payload_buffers, b_assoc_buffers) { -set_buffer_async_write (bh);if (bh == segbuf->sb_super_root) {if (bh->b_page != bd_page) {lock_page (bd_page);
@@ -1713,6 +1712,7 @@ static void nilfs_segctor_prepare_write( }break ; } +set_buffer_async_write (bh);if (bh->b_page != fs_page) {nilfs_begin_page_io (fs_page); fs_page = bh->b_page;
@@ -1798,7 +1798,6 @@ static void nilfs_abort_logs(struct listlist_for_each_entry (bh, &segbuf->sb_payload_buffers, b_assoc_buffers) { -clear_buffer_async_write (bh);if (bh == segbuf->sb_super_root) {clear_buffer_uptodate (bh);if (bh->b_page != bd_page) {
@@ -1807,6 +1806,7 @@ static void nilfs_abort_logs(struct list }break ; } +clear_buffer_async_write (bh);if (bh->b_page != fs_page) {nilfs_end_page_io (fs_page, err); fs_page = bh->b_page;
@@ -1894,8 +1894,9 @@ static void nilfs_segctor_complete_writeBIT (BH_Delay) |BIT (BH_NILFS_Volatile) | BIT(BH_NILFS_Redirected)); -set_mask_bits (&bh->b_state, clear_bits, set_bits);if (bh == segbuf->sb_super_root) { +set_buffer_uptodate (bh); +clear_buffer_dirty (bh);if (bh->b_page != bd_page) {end_page_writeback (bd_page); bd_page = bh->b_page;
@@ -1903,6 +1904,7 @@ static void nilfs_segctor_complete_write update_sr = true;break ; } +set_mask_bits (&bh->b_state, clear_bits, set_bits);if (bh->b_page != fs_page) {nilfs_end_page_io (fs_page,0 ); fs_page = bh->b_page;
Greg Kroah-Hartman
maintainerPATCH 173/202 tracing/trigger: Fix to return error if failed to alloc snapshot
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
commit 0958b33ef5a04ed91f61cef4760ac412080c4e08 upstream.
Fix register_snapshot_trigger() to return error code if it failed to allocate a snapshot instead of 0 (success). Unless that, it will register snapshot trigger without an error.
--- kernel/trace/trace_events_trigger.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/trace/trace_events_trigger.c +4 -2
@@ -1133,8 +1133,10 @@ register_snapshot_trigger(char *glob, ststruct event_trigger_data *data, struct trace_event_file *file) { - if (tracing_alloc_snapshot_instance(file->tr) != 0) - return 0; + int ret = tracing_alloc_snapshot_instance(file->tr); + +if (ret <0 ) +return ret;return register_trigger (glob, ops, data, file); }
Greg Kroah-Hartman
maintainerPATCH 174/202 mm/writeback: fix possible divide-by-zero in wb_dirty_limits(), again
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zach O'Keefe <[email protected]>
commit 9319b647902cbd5cc884ac08a8a6d54ce111fc78 upstream.
(struct dirty_throttle_control *)->thresh is an unsigned long, but is passed as the u32 divisor argument to div_u64(). On architectures where unsigned long is 64 bytes, the argument will be implicitly truncated.
Use div64_u64() instead of div_u64() so that the value used in the "is this a safe division" check is the same as the divisor.
Also, remove redundant cast of the numerator to u64, as that should happen implicitly.
This would be difficult to exploit in memcg domain, given the ratio-based arithmetic domain_drity_limits() uses, but is much easier in global writeback domain with a BDI_CAP_STRICTLIMIT-backing device, using e.g. vm.dirty_bytes=(1<<32)*PAGE_SIZE so that dtc->thresh == (1<<32)
--- mm/page-writeback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page-writeback.c +1 -1
@@ -1529,7 +1529,7 @@ static inline void wb_dirty_limits(struc*/ dtc->wb_thresh =__wb_calc_thresh (dtc); dtc->wb_bg_thresh = dtc->thresh ? -div_u64 ((u64 )dtc->wb_thresh * dtc->bg_thresh, dtc->thresh) :0 ; +div64_u64 (dtc->wb_thresh * dtc->bg_thresh, dtc->thresh) :0 ;/* * In order to avoid the stacked BDI deadlock we need
Greg Kroah-Hartman
maintainerPATCH 175/202 HID: wacom: generic: Avoid reporting a serial of 0 to userspace
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tatsunosuke Tobita <[email protected]>
commit ab41a31dd5e2681803642b6d08590b61867840ec upstream.
The xf86-input-wacom driver does not treat '0' as a valid serial number and will drop any input report which contains an MSC_SERIAL = 0 event. The kernel driver already takes care to avoid sending any MSC_SERIAL event if the value of serial[0] == 0 (which is the case for devices that don't actually report a serial number), but this is not quite sufficient.
Only the lower 32 bits of the serial get reported to userspace, so if this portion of the serial is zero then there can still be problems.
This commit allows the driver to report either the lower 32 bits if they are non-zero or the upper 32 bits otherwise.
--- drivers/hid/wacom_wac.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/hid/wacom_wac.c +8 -1
@@ -2461,7 +2461,14 @@ static void wacom_wac_pen_report(struct wacom_wac->hid_data.tipswitch);input_report_key (input, wacom_wac->tool[0 ], sense);if (wacom_wac->serial[0 ]) { -input_event (input,EV_MSC ,MSC_SERIAL , wacom_wac->serial[0 ]); +/* +* xf86-input-wacom does not accept a serial number +* of '0'. Report the low 32 bits if possible, but +* if they are zero, report the upper ones instead. +*/ +__u32 serial_lo = wacom_wac->serial[0 ] &0xFFFFFFFFu ; +__u32 serial_hi = wacom_wac->serial[0 ] >>32 ; +input_event (input,EV_MSC ,MSC_SERIAL , (int )(serial_lo ? serial_lo : serial_hi));input_report_abs (input,ABS_MISC , sense ? id :0 ); }
Greg Kroah-Hartman
maintainerPATCH 176/202 HID: wacom: Do not register input devices until after hid_hw_start
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gerecke <[email protected]>
commit c1d6708bf0d3dd976460d435373cf5abf21ce258 upstream.
If a input device is opened before hid_hw_start is called, events may not be received from the hardware. In the case of USB-backed devices, for example, the hid_hw_start function is responsible for filling in the URB which is submitted when the input device is opened. If a device is opened prematurely, polling will never start because the device will not have been in the correct state to send the URB.
Because the wacom driver registers its input devices before calling hid_hw_start, there is a window of time where a device can be opened and end up in an inoperable state. Some ARM-based Chromebooks in particular reliably trigger this bug.
This commit splits the wacom_register_inputs function into two pieces. One which is responsible for setting up the allocated inputs (and runs prior to hid_hw_start so that devices are ready for any input events they may end up receiving) and another which only registers the devices (and runs after hid_hw_start to ensure devices can be immediately opened without issue). Note that the functions to initialize the LEDs and remotes are also moved after hid_hw_start to maintain their own dependency chains.
--- drivers/hid/wacom_sys.c | 63 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 20 deletions(-)
drivers/hid/wacom_sys.c +43 -20
@@ -2059,7 +2059,7 @@ static int wacom_allocate_inputs(structreturn 0 ; } -static int wacom_register_inputs (struct wacom *wacom) +static int wacom_setup_inputs (struct wacom *wacom) {struct input_dev *pen_input_dev, *touch_input_dev, *pad_input_dev;struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
@@ -2078,10 +2078,6 @@ static int wacom_register_inputs(structinput_free_device (pen_input_dev); wacom_wac->pen_input =NULL ; pen_input_dev =NULL ; - }else { - error =input_register_device (pen_input_dev); -if (error) - goto fail; } error =wacom_setup_touch_input_capabilities (touch_input_dev, wacom_wac);
@@ -2090,10 +2086,6 @@ static int wacom_register_inputs(structinput_free_device (touch_input_dev); wacom_wac->touch_input =NULL ; touch_input_dev =NULL ; - }else { - error =input_register_device (touch_input_dev); -if (error) - goto fail; } error =wacom_setup_pad_input_capabilities (pad_input_dev, wacom_wac);
@@ -2102,7 +2094,34 @@ static int wacom_register_inputs(structinput_free_device (pad_input_dev); wacom_wac->pad_input =NULL ; pad_input_dev =NULL ; - }else { + } + +return 0 ; +} + +static int wacom_register_inputs (struct wacom *wacom) +{ +struct input_dev *pen_input_dev, *touch_input_dev, *pad_input_dev; +struct wacom_wac *wacom_wac = &(wacom->wacom_wac); +int error =0 ; + + pen_input_dev = wacom_wac->pen_input; + touch_input_dev = wacom_wac->touch_input; + pad_input_dev = wacom_wac->pad_input; + +if (pen_input_dev) { + error =input_register_device (pen_input_dev); +if (error) + goto fail; + } + +if (touch_input_dev) { + error =input_register_device (touch_input_dev); +if (error) + goto fail; + } + +if (pad_input_dev) { error =input_register_device (pad_input_dev);if (error) goto fail;
@@ -2352,6 +2371,20 @@ static int wacom_parse_and_register(stru goto fail; } + error =wacom_setup_inputs (wacom); +if (error) + goto fail; + +if (features->type ==HID_GENERIC ) + connect_mask |=HID_CONNECT_DRIVER ; + +/* Regular HID work starts now */ + error =hid_hw_start (hdev, connect_mask); +if (error) { +hid_err (hdev,"hw start failed\n" ); + goto fail; + } + error =wacom_register_inputs (wacom);if (error) goto fail;
@@ -2366,16 +2399,6 @@ static int wacom_parse_and_register(stru goto fail; } -if (features->type ==HID_GENERIC ) - connect_mask |=HID_CONNECT_DRIVER ; - -/* Regular HID work starts now */ - error =hid_hw_start (hdev, connect_mask); -if (error) { -hid_err (hdev,"hw start failed\n" ); - goto fail; - } -if (!wireless) {/* Note that if query fails it is not a hard failure */ wacom_query_tablet_data (wacom);
Greg Kroah-Hartman
maintainerPATCH 177/202 USB: hub: check for alternate port before enabling A_ALT_HNP_SUPPORT
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit f17c34ffc792bbb520e4b61baa16b6cfc7d44b13 upstream.
The OTG 1.3 spec has the feature A_ALT_HNP_SUPPORT, which tells a device that it is connected to the wrong port. Some devices refuse to operate if you enable that feature, because it indicates to them that they ought to request to be connected to another port.
According to the spec this feature may be used based only the following three conditions:
6.5.3 a_alt_hnp_support
Setting this feature indicates to the B-device that it is connected to an A-device port that is not capable of HNP, but that the A-device does have an alternate port that is capable of HNP.
The A-device is required to set this feature under the following conditions:
• the A-device has multiple receptacles
• the A-device port that connects to the B-device does not support HNP
• the A-device has another port that does support HNP
A check for the third and first condition is missing. Add it.
--- drivers/usb/core/hub.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/usb/core/hub.c +19 -11
@@ -2331,17 +2331,25 @@ static int usb_enumerate_device_otg(stru } }else if (desc->bLength ==sizeof (struct usb_otg_descriptor )) { -/* Set a_alt_hnp_support for legacy otg device */ - err =usb_control_msg (udev, -usb_sndctrlpipe (udev,0 ), -USB_REQ_SET_FEATURE ,0 , -USB_DEVICE_A_ALT_HNP_SUPPORT , -0 ,NULL ,0 , -USB_CTRL_SET_TIMEOUT ); -if (err <0 ) -dev_err (&udev->dev, -"set a_alt_hnp_support failed: %d\n" , - err); +/* +* We are operating on a legacy OTP device +* These should be told that they are operating +* on the wrong port if we have another port that does +* support HNP +*/ +if (bus->otg_port !=0 ) { +/* Set a_alt_hnp_support for legacy otg device */ + err =usb_control_msg (udev, +usb_sndctrlpipe (udev,0 ), +USB_REQ_SET_FEATURE ,0 , +USB_DEVICE_A_ALT_HNP_SUPPORT , +0 ,NULL ,0 , +USB_CTRL_SET_TIMEOUT ); +if (err <0 ) +dev_err (&udev->dev, +"set a_alt_hnp_support failed: %d\n" , + err); + } } }#endif
Greg Kroah-Hartman
maintainerPATCH 178/202 usb: f_mass_storage: forbid async queue when shutdown happen
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: yuan linyu <[email protected]>
commit b2d2d7ea0dd09802cf5a0545bf54d8ad8987d20c upstream.
When write UDC to empty and unbind gadget driver from gadget device, it is possible that there are many queue failures for mass storage function.
The root cause is mass storage main thread alaways try to queue request to receive a command from host if running flag is on, on platform like dwc3, if pull down called, it will not queue request again and return -ESHUTDOWN, but it not affect running flag of mass storage function.
Check return code from mass storage function and clear running flag if it is -ESHUTDOWN, also indicate start in/out transfer failure to break loops.
--- drivers/usb/gadget/function/f_mass_storage.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_mass_storage.c +18 -2
@@ -574,21 +574,37 @@ static int start_transfer(struct fsg_devstatic bool start_in_transfer (struct fsg_common *common,struct fsg_buffhd *bh) { +int rc; +if (!fsg_is_set (common))return false; bh->state =BUF_STATE_SENDING ; -if (start_transfer (common->fsg, common->fsg->bulk_in, bh->inreq)) + rc =start_transfer (common->fsg, common->fsg->bulk_in, bh->inreq); +if (rc) { bh->state =BUF_STATE_EMPTY ; +if (rc == -ESHUTDOWN ) { + common->running =0 ; +return false; + } + }return true; }static bool start_out_transfer (struct fsg_common *common,struct fsg_buffhd *bh) { +int rc; +if (!fsg_is_set (common))return false; bh->state =BUF_STATE_RECEIVING ; -if (start_transfer (common->fsg, common->fsg->bulk_out, bh->outreq)) + rc =start_transfer (common->fsg, common->fsg->bulk_out, bh->outreq); +if (rc) { bh->state =BUF_STATE_FULL ; +if (rc == -ESHUTDOWN ) { + common->running =0 ; +return false; + } + }return true; }
Greg Kroah-Hartman
maintainerPATCH 179/202 scsi: Revert "scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock"
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lee Duncan <[email protected]>
commit 977fe773dcc7098d8eaf4ee6382cb51e13e784cb upstream.
This reverts commit 1a1975551943f681772720f639ff42fbaa746212.
This commit causes interrupts to be lost for FCoE devices, since it changed sping locks from "bh" to "irqsave".
Instead, a work queue should be used, and will be addressed in a separate commit.
--- drivers/scsi/fcoe/fcoe_ctlr.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/scsi/fcoe/fcoe_ctlr.c +8 -12
@@ -330,17 +330,16 @@ static void fcoe_ctlr_announce(struct fc {struct fcoe_fcf *sel;struct fcoe_fcf *fcf; -unsigned long flags;mutex_lock (&fip->ctlr_mutex); -spin_lock_irqsave (&fip->ctlr_lock, flags); +spin_lock_bh (&fip->ctlr_lock);kfree_skb (fip->flogi_req); fip->flogi_req =NULL ;list_for_each_entry (fcf, &fip->fcfs, list) fcf->flogi_sent =0 ; -spin_unlock_irqrestore (&fip->ctlr_lock, flags); +spin_unlock_bh (&fip->ctlr_lock); sel = fip->sel_fcf;if (sel &ðer_addr_equal (sel->fcf_mac, fip->dest_addr))
@@ -710,7 +709,6 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr {struct fc_frame *fp;struct fc_frame_header *fh; -unsigned long flags;u16 old_xid;u8 op;u8 mac[ETH_ALEN ];
@@ -744,11 +742,11 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr op =FIP_DT_FLOGI ;if (fip->mode ==FIP_MODE_VN2VN )break ; -spin_lock_irqsave (&fip->ctlr_lock, flags); +spin_lock_bh (&fip->ctlr_lock);kfree_skb (fip->flogi_req); fip->flogi_req = skb; fip->flogi_req_send =1 ; -spin_unlock_irqrestore (&fip->ctlr_lock, flags); +spin_unlock_bh (&fip->ctlr_lock);schedule_work (&fip->timer_work);return -EINPROGRESS ;case ELS_FDISC :
@@ -1725,11 +1723,10 @@ static int fcoe_ctlr_flogi_send_locked(sstatic int fcoe_ctlr_flogi_retry (struct fcoe_ctlr *fip) {struct fcoe_fcf *fcf; -unsigned long flags;int error;mutex_lock (&fip->ctlr_mutex); -spin_lock_irqsave (&fip->ctlr_lock, flags); +spin_lock_bh (&fip->ctlr_lock);LIBFCOE_FIP_DBG (fip,"re-sending FLOGI - reselect\n" ); fcf =fcoe_ctlr_select (fip);if (!fcf || fcf->flogi_sent) {
@@ -1740,7 +1737,7 @@ static int fcoe_ctlr_flogi_retry(structfcoe_ctlr_solicit (fip,NULL ); error =fcoe_ctlr_flogi_send_locked (fip); } -spin_unlock_irqrestore (&fip->ctlr_lock, flags); +spin_unlock_bh (&fip->ctlr_lock);mutex_unlock (&fip->ctlr_mutex);return error; }
@@ -1757,9 +1754,8 @@ static int fcoe_ctlr_flogi_retry(structstatic void fcoe_ctlr_flogi_send (struct fcoe_ctlr *fip) {struct fcoe_fcf *fcf; -unsigned long flags; -spin_lock_irqsave (&fip->ctlr_lock, flags); +spin_lock_bh (&fip->ctlr_lock); fcf = fip->sel_fcf;if (!fcf || !fip->flogi_req_send) goto unlock;
@@ -1786,7 +1782,7 @@ static void fcoe_ctlr_flogi_send(struct }else /* XXX */ LIBFCOE_FIP_DBG (fip,"No FCF selected - defer send\n" ); unlock: -spin_unlock_irqrestore (&fip->ctlr_lock, flags); +spin_unlock_bh (&fip->ctlr_lock); }/**
Greg Kroah-Hartman
maintainerPATCH 170/202 net: sysfs: Fix /sys/class/net/<iface> path for statistics
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 5b3fbd61b9d1f4ed2db95aaf03f9adae0373784d ]
The Documentation/ABI/testing/sysfs-class-net-statistics documentation is pointing to the wrong path for the interface. Documentation is pointing to /sys/class/<iface>, instead of /sys/class/net/<iface>.
Fix it by adding the net/ directory before the interface.
--- .../ABI/testing/sysfs-class-net-statistics | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-)
Documentation/ABI/testing/sysfs-class-net-statistics +24 -24
@@ -1,4 +1,4 @@ -What: /sys/class/<iface>/statistics/collisions +What: /sys/class/net/<iface>/statistics/collisions Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -6,7 +6,7 @@ Description: Indicates the number of collisions seen by this network device. This value might not be relevant with all MAC layers. -What: /sys/class/<iface>/statistics/multicast +What: /sys/class/net/<iface>/statistics/multicast Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -14,7 +14,7 @@ Description: Indicates the number of multicast packets received by this network device. -What: /sys/class/<iface>/statistics/rx_bytes +What: /sys/class/net/<iface>/statistics/rx_bytes Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -23,7 +23,7 @@ Description: See the network driver for the exact meaning of when this value is incremented. -What: /sys/class/<iface>/statistics/rx_compressed +What: /sys/class/net/<iface>/statistics/rx_compressed Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -32,7 +32,7 @@ Description: network device. This value might only be relevant for interfaces that support packet compression (e.g: PPP). -What: /sys/class/<iface>/statistics/rx_crc_errors +What: /sys/class/net/<iface>/statistics/rx_crc_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -41,7 +41,7 @@ Description: by this network device. Note that the specific meaning might depend on the MAC layer used by the interface. -What: /sys/class/<iface>/statistics/rx_dropped +What: /sys/class/net/<iface>/statistics/rx_dropped Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -51,7 +51,7 @@ Description: packet processing. See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_errors +What: /sys/class/net/<iface>/statistics/rx_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -59,7 +59,7 @@ Description: Indicates the number of receive errors on this network device. See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_fifo_errors +What: /sys/class/net/<iface>/statistics/rx_fifo_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -68,7 +68,7 @@ Description: network device. See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_frame_errors +What: /sys/class/net/<iface>/statistics/rx_frame_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -78,7 +78,7 @@ Description: on the MAC layer protocol used. See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_length_errors +What: /sys/class/net/<iface>/statistics/rx_length_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -87,7 +87,7 @@ Description: error, oversized or undersized. See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_missed_errors +What: /sys/class/net/<iface>/statistics/rx_missed_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -96,7 +96,7 @@ Description: due to lack of capacity in the receive side. See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_nohandler +What: /sys/class/net/<iface>/statistics/rx_nohandler Date: February 2016 KernelVersion: 4.6 Contact: [email protected]
@@ -104,7 +104,7 @@ Description: Indicates the number of received packets that were dropped on an inactive device by the network core. -What: /sys/class/<iface>/statistics/rx_over_errors +What: /sys/class/net/<iface>/statistics/rx_over_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -114,7 +114,7 @@ Description: (e.g: larger than MTU). See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_packets +What: /sys/class/net/<iface>/statistics/rx_packets Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -122,7 +122,7 @@ Description: Indicates the total number of good packets received by this network device. -What: /sys/class/<iface>/statistics/tx_aborted_errors +What: /sys/class/net/<iface>/statistics/tx_aborted_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -132,7 +132,7 @@ Description: a medium collision). See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/tx_bytes +What: /sys/class/net/<iface>/statistics/tx_bytes Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -143,7 +143,7 @@ Description: transmitted packets or all packets that have been queued for transmission. -What: /sys/class/<iface>/statistics/tx_carrier_errors +What: /sys/class/net/<iface>/statistics/tx_carrier_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -152,7 +152,7 @@ Description: because of carrier errors (e.g: physical link down). See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/tx_compressed +What: /sys/class/net/<iface>/statistics/tx_compressed Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -161,7 +161,7 @@ Description: this might only be relevant for devices that support compression (e.g: PPP). -What: /sys/class/<iface>/statistics/tx_dropped +What: /sys/class/net/<iface>/statistics/tx_dropped Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -170,7 +170,7 @@ Description: See the driver for the exact reasons as to why the packets were dropped. -What: /sys/class/<iface>/statistics/tx_errors +What: /sys/class/net/<iface>/statistics/tx_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -179,7 +179,7 @@ Description: a network device. See the driver for the exact reasons as to why the packets were dropped. -What: /sys/class/<iface>/statistics/tx_fifo_errors +What: /sys/class/net/<iface>/statistics/tx_fifo_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -188,7 +188,7 @@ Description: FIFO error. See the driver for the exact reasons as to why the packets were dropped. -What: /sys/class/<iface>/statistics/tx_heartbeat_errors +What: /sys/class/net/<iface>/statistics/tx_heartbeat_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -197,7 +197,7 @@ Description: reported as heartbeat errors. See the driver for the exact reasons as to why the packets were dropped. -What: /sys/class/<iface>/statistics/tx_packets +What: /sys/class/net/<iface>/statistics/tx_packets Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -206,7 +206,7 @@ Description: device. See the driver for whether this reports the number of all attempted or successful transmissions. -What: /sys/class/<iface>/statistics/tx_window_errors +What: /sys/class/net/<iface>/statistics/tx_window_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 201/202 lsm: new security_file_ioctl_compat() hook
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alfred Piccioni <[email protected]>
commit f1bb47a31dff6d4b34fb14e99850860ee74bb003 upstream.
Some ioctl commands do not require ioctl permission, but are routed to other permissions such as FILE_GETATTR or FILE_SETATTR. This routing is done by comparing the ioctl cmd to a set of 64-bit flags (FS_IOC_*).
However, if a 32-bit process is running on a 64-bit kernel, it emits 32-bit flags (FS_IOC32_*) for certain ioctl operations. These flags are being checked erroneously, which leads to these ioctl operations being routed to the ioctl permission, rather than the correct file permissions.
This was also noted in a RED-PEN finding from a while back - "/* RED-PEN how should LSM module know it's handling 32bit? */".
This patch introduces a new hook, security_file_ioctl_compat(), that is called from the compat ioctl syscall. All current LSMs have been changed to support this hook.
Reviewing the three places where we are currently using security_file_ioctl(), it appears that only SELinux needs a dedicated compat change; TOMOYO and SMACK appear to be functional without any change.
--- fs/compat_ioctl.c | 3 +-- include/linux/lsm_hooks.h | 9 +++++++++ include/linux/security.h | 9 +++++++++ security/security.c | 17 +++++++++++++++++ security/selinux/hooks.c | 28 ++++++++++++++++++++++++++++ security/smack/smack_lsm.c | 1 + security/tomoyo/tomoyo.c | 1 + 7 files changed, 66 insertions(+), 2 deletions(-)
fs/compat_ioctl.c +1 -2
@@ -1370,8 +1370,7 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned iif (!f.file) goto out; -/* RED-PEN how should LSM module know it's handling 32bit? */ - error =security_file_ioctl (f.file, cmd, arg); + error =security_file_ioctl_compat (f.file, cmd, arg);if (error) goto out_fput;
include/linux/lsm_hooks.h +9 -0
@@ -466,6 +466,12 @@* simple integer value. When @arg represents a user space pointer, it * should never be used by the security module. * Return 0 if permission is granted. +* @file_ioctl_compat: +* @file contains the file structure. +* @cmd contains the operation to perform. +* @arg contains the operational arguments. +* Check permission for a compat ioctl operation on @file. +* Return 0 if permission is granted. * @mmap_addr : * Check permissions for a mmap operation at @addr. * @addr contains virtual address that will be used for the operation.
@@ -1563,6 +1569,8 @@ union security_list_options {void (*file_free_security)(struct file *file);int (*file_ioctl)(struct file *file,unsigned int cmd,unsigned long arg); +int (*file_ioctl_compat)(struct file *file,unsigned int cmd, +unsigned long arg);int (*mmap_addr)(unsigned long addr);int (*mmap_file)(struct file *file,unsigned long reqprot,unsigned long prot,unsigned long flags);
@@ -1861,6 +1869,7 @@ struct security_hook_heads {struct hlist_head file_alloc_security;struct hlist_head file_free_security;struct hlist_head file_ioctl; +struct hlist_head file_ioctl_compat;struct hlist_head mmap_addr;struct hlist_head mmap_file;struct hlist_head file_mprotect;
include/linux/security.h +9 -0
@@ -322,6 +322,8 @@ int security_file_permission(struct fileint security_file_alloc (struct file *file);void security_file_free (struct file *file);int security_file_ioctl (struct file *file,unsigned int cmd,unsigned long arg); +int security_file_ioctl_compat (struct file *file,unsigned int cmd, +unsigned long arg);int security_mmap_file (struct file *file,unsigned long prot,unsigned long flags);int security_mmap_addr (unsigned long addr);
@@ -833,6 +835,13 @@ static inline int security_file_ioctl(st {return 0 ; } + +static inline int security_file_ioctl_compat (struct file *file, +unsigned int cmd, +unsigned long arg) +{ +return 0 ; +}static inline int security_mmap_file (struct file *file,unsigned long prot,unsigned long flags)
security/security.c +17 -0
@@ -890,6 +890,23 @@ int security_file_ioctl(struct file *filreturn call_int_hook (file_ioctl,0 , file, cmd, arg); } +/** +* security_file_ioctl_compat() - Check if an ioctl is allowed in compat mode +* @file: associated file +* @cmd: ioctl cmd +* @arg: ioctl arguments +* +* Compat version of security_file_ioctl() that correctly handles 32-bit +* processes running on 64-bit kernels. +* +* Return: Returns 0 if permission is granted. +*/ +int security_file_ioctl_compat (struct file *file,unsigned int cmd, +unsigned long arg) +{ +return call_int_hook (file_ioctl_compat,0 , file, cmd, arg); +} +static inline unsigned long mmap_prot (struct file *file,unsigned long prot) {/*
security/selinux/hooks.c +28 -0
@@ -3709,6 +3709,33 @@ static int selinux_file_ioctl(struct filreturn error; } +static int selinux_file_ioctl_compat (struct file *file,unsigned int cmd, +unsigned long arg) +{ +/* +* If we are in a 64-bit kernel running 32-bit userspace, we need to +* make sure we don't compare 32-bit flags to 64-bit flags. +*/ +switch (cmd) { +case FS_IOC32_GETFLAGS : + cmd =FS_IOC_GETFLAGS ; +break ; +case FS_IOC32_SETFLAGS : + cmd =FS_IOC_SETFLAGS ; +break ; +case FS_IOC32_GETVERSION : + cmd =FS_IOC_GETVERSION ; +break ; +case FS_IOC32_SETVERSION : + cmd =FS_IOC_SETVERSION ; +break ; +default : +break ; + } + +return selinux_file_ioctl (file, cmd, arg); +} +static int default_noexec;static int file_map_prot_check (struct file *file,unsigned long prot,int shared)
@@ -7054,6 +7081,7 @@ static struct security_hook_list selinuxLSM_HOOK_INIT (file_alloc_security, selinux_file_alloc_security),LSM_HOOK_INIT (file_free_security, selinux_file_free_security),LSM_HOOK_INIT (file_ioctl, selinux_file_ioctl), +LSM_HOOK_INIT (file_ioctl_compat, selinux_file_ioctl_compat),LSM_HOOK_INIT (mmap_file, selinux_mmap_file),LSM_HOOK_INIT (mmap_addr, selinux_mmap_addr), LSM_HOOK_INIT(file_mprotect, selinux_file_mprotect),
security/smack/smack_lsm.c +1 -0
@@ -4737,6 +4737,7 @@ static struct security_hook_list smack_hLSM_HOOK_INIT (file_alloc_security, smack_file_alloc_security),LSM_HOOK_INIT (file_free_security, smack_file_free_security),LSM_HOOK_INIT (file_ioctl, smack_file_ioctl), +LSM_HOOK_INIT (file_ioctl_compat, smack_file_ioctl),LSM_HOOK_INIT (file_lock, smack_file_lock),LSM_HOOK_INIT (file_fcntl, smack_file_fcntl), LSM_HOOK_INIT(mmap_file, smack_mmap_file),
security/tomoyo/tomoyo.c +1 -0
@@ -516,6 +516,7 @@ static struct security_hook_list tomoyo_LSM_HOOK_INIT (path_rename, tomoyo_path_rename),LSM_HOOK_INIT (inode_getattr, tomoyo_inode_getattr),LSM_HOOK_INIT (file_ioctl, tomoyo_file_ioctl), +LSM_HOOK_INIT (file_ioctl_compat, tomoyo_file_ioctl),LSM_HOOK_INIT (path_chmod, tomoyo_path_chmod),LSM_HOOK_INIT (path_chown, tomoyo_path_chown), LSM_HOOK_INIT(path_chroot, tomoyo_path_chroot),
Greg Kroah-Hartman
maintainerPATCH 202/202 netfilter: nf_tables: fix pointer math issue in nft_byteorder_eval()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit c301f0981fdd3fd1ffac6836b423c4d7a8e0eb63 upstream.
The problem is in nft_byteorder_eval() where we are iterating through a loop and writing to dst[0], dst[1], dst[2] and so on... On each iteration we are writing 8 bytes. But dst[] is an array of u32 so each element only has space for 4 bytes. That means that every iteration overwrites part of the previous element.
I spotted this bug while reviewing commit caf3ef7468f7 ("netfilter:nf_tables: prevent OOB access in nft_byteorder_eval") which is a related issue. I think that the reason we have not detected this bug in testing is that most of time we only write one element.
--- net/netfilter/nft_byteorder.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/netfilter/nft_byteorder.c +3 -2
@@ -41,19 +41,20 @@ static void nft_byteorder_eval(const strswitch (priv->size) {case 8 : { +u64 *dst64 = (void *)dst;u64 src64;switch (priv->op) {case NFT_BYTEORDER_NTOH :for (i =0 ; i < priv->len /8 ; i++) { src64 =get_unaligned ((u64 *)&src[i]); -put_unaligned_be64 (src64, &dst[i]); +put_unaligned_be64 (src64, &dst64[i]); }break ;case NFT_BYTEORDER_HTON :for (i =0 ; i < priv->len /8 ; i++) { src64 =get_unaligned_be64 (&src[i]); -put_unaligned (src64, (u64 *)&dst[i]); +put_unaligned (src64, &dst64[i]); }break ; }
Greg Kroah-Hartman
maintainerPATCH 200/202 nilfs2: replace WARN_ONs for invalid DAT metadata block requests
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 5124a0a549857c4b87173280e192eea24dea72ad upstream.
If DAT metadata file block access fails due to corruption of the DAT file or abnormal virtual block numbers held by b-trees or inodes, a kernel warning is generated.
This replaces the WARN_ONs by error output, so that a kernel, booted with panic_on_warn, does not panic. This patch also replaces the detected return code -ENOENT with another internal code -EINVAL to notify the bmap layer of metadata corruption. When the bmap layer sees -EINVAL, it handles the abnormal situation with nilfs_bmap_convert_error() and finally returns code -EIO as it should.
--- fs/nilfs2/dat.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
fs/nilfs2/dat.c +17 -10
@@ -40,8 +40,21 @@ static inline struct nilfs_dat_info *NILstatic int nilfs_dat_prepare_entry (struct inode *dat,struct nilfs_palloc_req *req,int create) { -return nilfs_palloc_get_entry_block (dat, req->pr_entry_nr, - create, &req->pr_entry_bh); +int ret; + + ret =nilfs_palloc_get_entry_block (dat, req->pr_entry_nr, + create, &req->pr_entry_bh); +if (unlikely (ret == -ENOENT )) { +nilfs_error (dat->i_sb, +"DAT doesn't have a block to manage vblocknr = %llu" , + (unsigned long long )req->pr_entry_nr); +/* +* Return internal code -EINVAL to notify bmap layer of +* metadata corruption. +*/ + ret = -EINVAL ; + } +return ret; } static void nilfs_dat_commit_entry(struct inode *dat,
@@ -123,11 +136,7 @@ static void nilfs_dat_commit_free(structint nilfs_dat_prepare_start (struct inode *dat,struct nilfs_palloc_req *req) { -int ret; - - ret =nilfs_dat_prepare_entry (dat, req,0 ); -WARN_ON (ret == -ENOENT ); -return ret; +return nilfs_dat_prepare_entry (dat, req,0 ); } void nilfs_dat_commit_start(struct inode *dat, struct nilfs_palloc_req *req,
@@ -154,10 +163,8 @@ int nilfs_dat_prepare_end(struct inode *int ret; ret =nilfs_dat_prepare_entry (dat, req,0 ); -if (ret <0 ) { -WARN_ON (ret == -ENOENT ); +if (ret <0 )return ret; - } kaddr =kmap_atomic (req->pr_entry_bh->b_page); entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
Re: [PATCH 4.19 200/202] nilfs2: replace WARN_ONs for invalid DAT metadata block requests
Quoted 74 lines · Greg Kroah-Hartman
4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit
5124a0a549857c4b87173280e192eea24dea72adupstream.If DAT metadata file block access fails due to corruption of the DAT file or abnormal virtual block numbers held by b-trees or inodes, a kernel warning is generated.
This replaces the
WARN_ONsby error output, so that a kernel, booted withpanic_on_warn, does not panic. This patch also replaces the detected return code-ENOENTwith another internal code-EINVALto notify the bmap layer of metadata corruption. When the bmap layer sees-EINVAL, it handles the abnormal situation withnilfs_bmap_convert_error()and finally returns code-EIOas it should.Signed-off-by Ryusuke Konishi <[email protected]>Reported-by <[email protected]>Tested-by Ryusuke Konishi <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- fs/nilfs2/dat.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)fs/nilfs2/dat.c +16
-7@@ -40,8 +40,21 @@ static inline struct nilfs_dat_info *NILstatic int nilfs_dat_prepare_entry (struct inode *dat,struct nilfs_palloc_req *req,int create) { -return nilfs_palloc_get_entry_block (dat, req->pr_entry_nr, - create, &req->pr_entry_bh); +int ret; + + ret =nilfs_palloc_get_entry_block (dat, req->pr_entry_nr, + create, &req->pr_entry_bh); +if (unlikely (ret == -ENOENT )) { +nilfs_error (dat->i_sb, +"DAT doesn't have a block to manage vblocknr = %llu" , + (unsigned long long )req->pr_entry_nr); +/* +* Return internal code -EINVAL to notify bmap layer of +* metadata corruption. +*/ + ret = -EINVAL ; + } +return ret; } static void nilfs_dat_commit_entry(struct inode *dat,@@ -123,11 +136,7 @@ static void nilfs_dat_commit_free(structint nilfs_dat_prepare_start (struct inode *dat,struct nilfs_palloc_req *req) { -int ret; - - ret =nilfs_dat_prepare_entry (dat, req,0 ); -WARN_ON (ret == -ENOENT ); -return ret; +return nilfs_dat_prepare_entry (dat, req,0 ); } void nilfs_dat_commit_start(struct inode *dat, struct nilfs_palloc_req *req,@@ -154,10 +163,8 @@ int nilfs_dat_prepare_end(struct inode *int ret;
fs/nilfs2/dat.c int nilfs_dat_prepare_end(struct inode * · line 170
Quoted 10 lines
fs/nilfs2/dat.c +1
-3ret =nilfs_dat_prepare_entry (dat, req,0 ); -if (ret <0 ) { -WARN_ON (ret == -ENOENT ); +if (ret <0 )return ret; - } kaddr =kmap_atomic (req->pr_entry_bh->b_page); entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
Hi Greg,
Could you please drop this patch for 4.19?
This uses nilfs_error() instead of nilfs_err(), but they are different functions.
I will separately send an equivalent replacement patch for 4.19 (and 5.4).
Ryusuke Konishi
Re: [PATCH 4.19 123/202] misc: lis3lv02d_i2c: Add missing setting of the reg_ctrl callback
In reply to Greg Kroah-HartmanHi Greg,
Quoted 1 line · Greg Kroah-Hartman
4.19-stable review patch. If anyone has any objections, please let me know.
This is known to cause a regression (WARN triggering on suspend, possible panic if panic-on-warn is set).
A fix for the regression is pending:
https://lore.kernel.org/regressions/[email protected]/T/#u
but it has not been merged yet, so please hold of on merging this patch until you can apply both at once.
I see that you are also planning to apply this to other stable branches. I'm not sure if this is necessary but to be safe I'll copy and paste this reply to the emails for the other stable branches.
Regards,
Hans
Quoted 55 lines
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit
b1b9f7a494400c0c39f8cd83de3aaa6111c55087]The
lis3lv02d_i2cdriver was missing a line to set the lis3_dev'sreg_ctrlcallback.
lis3_reg_ctrl(on)is called from the init callback, but due to the missingreg_ctrlcallback the regulators where never turned off again leading to the following oops/backtrace when detaching the driver:[ 82.313527] ------------[ cut here ]------------ [ 82.313546] WARNING: CPU: 1 PID: 1724 at drivers/regulator/core.c:2396 _regulator_put+0x219/0x230 ... [ 82.313695] RIP: 0010:_regulator_put+0x219/0x230 ... [ 82.314767] Call Trace: [ 82.314770] <TASK> [ 82.314772] ? _regulator_put+0x219/0x230 [ 82.314777] ? __warn+0x81/0x170 [ 82.314784] ? _regulator_put+0x219/0x230 [ 82.314791] ? report_bug+0x18d/0x1c0 [ 82.314801] ? handle_bug+0x3c/0x80 [ 82.314806] ? exc_invalid_op+0x13/0x60 [ 82.314812] ? asm_exc_invalid_op+0x16/0x20 [ 82.314845] ? _regulator_put+0x219/0x230 [ 82.314857] regulator_bulk_free+0x39/0x60 [ 82.314865] i2c_device_remove+0x22/0xb0Add the missing setting of the callback so that the regulators properly get turned off again when not used.
Signed-off-by Hans de Goede <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 1 + 1 file changed, 1 insertion(+)drivers/misc/lis3lv02d/lis3lv02d_i2c.c +1
-0@@ -164,6 +164,7 @@ static int lis3lv02d_i2c_probe(struct i2c_client *client, lis3_dev.init = lis3_i2c_init; lis3_dev.read = lis3_i2c_read; lis3_dev.write = lis3_i2c_write; + lis3_dev.reg_ctrl = lis3_reg_ctrl; lis3_dev.irq = client->irq; lis3_dev.ac = lis3lv02d_axis_map; lis3_dev.pm_dev = &client->dev;
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.307 release. There are 202 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 Fri, 23 Feb 2024 12:59:02 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.307-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.19:
10 builds: 10 pass, 0 fail
20 boots: 20 pass, 0 fail
37 tests: 37 pass, 0 failLinux version: 4.19.307-rc1-g05a45288956c
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Jon
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.307 release. There are 202 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 Fri, 23 Feb 2024 12:59:02 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.307-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.307 release. There are 202 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 Fri, 23 Feb 2024 12:59:02 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.307-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 4.19.307-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-4.19.y
* git commit: 05a45288956cb4f8bd2d47d10050520cddfa9063
* git describe: v4.19.306-203-g05a45288956c
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.19.y/build/v4.19.306-203-g05a45288956c
## Test Regressions (compared to v4.19.306-165-g6d7461510b51)
## Metric Regressions (compared to v4.19.306-165-g6d7461510b51)
## Test Fixes (compared to v4.19.306-165-g6d7461510b51)
## Metric Fixes (compared to v4.19.306-165-g6d7461510b51)
## Test result summary
total: 58627, pass: 50543, fail: 940, skip: 7095, xfail: 49
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 111 total, 105 passed, 6 failed
* arm64: 36 total, 31 passed, 5 failed
* i386: 21 total, 18 passed, 3 failed
* mips: 20 total, 20 passed, 0 failed
* parisc: 3 total, 0 passed, 3 failed
* powerpc: 24 total, 24 passed, 0 failed
* s390: 6 total, 6 passed, 0 failed
* sh: 10 total, 10 passed, 0 failed
* sparc: 6 total, 6 passed, 0 failed
* x86_64: 31 total, 26 passed, 5 failed
## Test suites summary
* boot
* kselftest-android
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-lib
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mm
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-user
* kselftest-zram
* kunit
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-smoketest
* ltp-syscalls
* ltp-tracing
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org
Hi Greg,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.307 release. There are 202 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 Fri, 23 Feb 2024 12:59:02 +0000. Anything received after that time might be too late.
Built and boot tested on x86_64 and aarch64.
Thanks,
Harshit
Quoted 10 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.307-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h