5.4.244-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 143/161 USB: sisusbvga: Add endpoint checks
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
commit df05a9b05e466a46725564528b277d0c570d0104 upstream.
The syzbot fuzzer was able to provoke a WARNING from the sisusbvga driver:
------------[ cut here ]------------ usb 1-1: BOGUS urb xfer, pipe 3 != type 1 WARNING: CPU: 1 PID: 26 at drivers/usb/core/urb.c:504 usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504 Modules linked in: CPU: 1 PID: 26 Comm: kworker/1:1 Not tainted 6.2.0-rc5-syzkaller-00199-g5af6ce704936 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Workqueue: usb_hub_wq hub_event RIP: 0010:usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504 Code: 7c 24 18 e8 6c 50 80 fb 48 8b 7c 24 18 e8 62 1a 01 ff 41 89 d8 44 89 e1 4c 89 ea 48 89 c6 48 c7 c7 60 b1 fa 8a e8 84 b0 be 03 <0f> 0b e9 58 f8 ff ff e8 3e 50 80 fb 48 81 c5 c0 05 00 00 e9 84 f7 RSP: 0018:ffffc90000a1ed18 EFLAGS: 00010282 RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000 RDX: ffff888012783a80 RSI: ffffffff816680ec RDI: fffff52000143d95 RBP: ffff888079020000 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000080000000 R11: 0000000000000000 R12: 0000000000000003 R13: ffff888017d33370 R14: 0000000000000003 R15: ffff888021213600 FS: 0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00005592753a60b0 CR3: 0000000022899000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> sisusb_bulkout_msg drivers/usb/misc/sisusbvga/sisusbvga.c:224 [inline] sisusb_send_bulk_msg.constprop.0+0x904/0x1230 drivers/usb/misc/sisusbvga/sisusbvga.c:379 sisusb_send_bridge_packet drivers/usb/misc/sisusbvga/sisusbvga.c:567 [inline] sisusb_do_init_gfxdevice drivers/usb/misc/sisusbvga/sisusbvga.c:2077 [inline] sisusb_init_gfxdevice+0x87b/0x4000 drivers/usb/misc/sisusbvga/sisusbvga.c:2177 sisusb_probe+0x9cd/0xbe2 drivers/usb/misc/sisusbvga/sisusbvga.c:2869
...
The problem was caused by the fact that the driver does not check whether the endpoints it uses are actually present and have the appropriate types. This can be fixed by adding a simple check of the endpoints.
--- drivers/usb/misc/sisusbvga/sisusb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/usb/misc/sisusbvga/sisusb.c +14 -0
@@ -3014,6 +3014,20 @@ static int sisusb_probe(struct usb_interstruct usb_device *dev =interface_to_usbdev (intf);struct sisusb_usb_data *sisusb;int retval =0 , i; +static const u8 ep_addresses[] = { +SISUSB_EP_GFX_IN |USB_DIR_IN , +SISUSB_EP_GFX_OUT |USB_DIR_OUT , +SISUSB_EP_GFX_BULK_OUT |USB_DIR_OUT , +SISUSB_EP_GFX_LBULK_OUT |USB_DIR_OUT , +SISUSB_EP_BRIDGE_IN |USB_DIR_IN , +SISUSB_EP_BRIDGE_OUT |USB_DIR_OUT , +0 }; + +/* Are the expected endpoints present? */ +if (!usb_check_bulk_endpoints (intf, ep_addresses)) { +dev_err (&intf->dev,"Invalid USB2VGA device\n" ); +return -EINVAL ; + }dev_info (&dev->dev,"USB2VGA dongle found at address %d\n" , dev->devnum);
Greg Kroah-Hartman
maintainerPATCH 144/161 media: radio-shark: Add endpoint checks
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
commit 76e31045ba030e94e72105c01b2e98f543d175ac upstream.
The syzbot fuzzer was able to provoke a WARNING from the radio-shark2 driver:
------------[ cut here ]------------ usb 1-1: BOGUS urb xfer, pipe 1 != type 3 WARNING: CPU: 0 PID: 3271 at drivers/usb/core/urb.c:504 usb_submit_urb+0xed2/0x1880 drivers/usb/core/urb.c:504 Modules linked in: CPU: 0 PID: 3271 Comm: kworker/0:3 Not tainted 6.1.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Workqueue: usb_hub_wq hub_event RIP: 0010:usb_submit_urb+0xed2/0x1880 drivers/usb/core/urb.c:504 Code: 7c 24 18 e8 00 36 ea fb 48 8b 7c 24 18 e8 36 1c 02 ff 41 89 d8 44 89 e1 4c 89 ea 48 89 c6 48 c7 c7 a0 b6 90 8a e8 9a 29 b8 03 <0f> 0b e9 58 f8 ff ff e8 d2 35 ea fb 48 81 c5 c0 05 00 00 e9 84 f7 RSP: 0018:ffffc90003876dd0 EFLAGS: 00010282 RAX: 0000000000000000 RBX: 0000000000000003 RCX: 0000000000000000 RDX: ffff8880750b0040 RSI: ffffffff816152b8 RDI: fffff5200070edac RBP: ffff8880172d81e0 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000080000000 R11: 0000000000000000 R12: 0000000000000001 R13: ffff8880285c5040 R14: 0000000000000002 R15: ffff888017158200 FS: 0000000000000000(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffe03235b90 CR3: 000000000bc8e000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> usb_start_wait_urb+0x101/0x4b0 drivers/usb/core/message.c:58 usb_bulk_msg+0x226/0x550 drivers/usb/core/message.c:387 shark_write_reg+0x1ff/0x2e0 drivers/media/radio/radio-shark2.c:88
...
The problem was caused by the fact that the driver does not check whether the endpoints it uses are actually present and have the appropriate types. This can be fixed by adding a simple check of these endpoints (and similarly for the radio-shark driver).
--- drivers/media/radio/radio-shark.c | 10 ++++++++++ drivers/media/radio/radio-shark2.c | 10 ++++++++++ 2 files changed, 20 insertions(+)
drivers/media/radio/radio-shark.c +10 -0
@@ -316,6 +316,16 @@ static int usb_shark_probe(struct usb_in {struct shark_device *shark;int retval = -ENOMEM ; +static const u8 ep_addresses[] = { +SHARK_IN_EP |USB_DIR_IN , +SHARK_OUT_EP |USB_DIR_OUT , +0 }; + +/* Are the expected endpoints present? */ +if (!usb_check_int_endpoints (intf, ep_addresses)) { +dev_err (&intf->dev,"Invalid radioSHARK device\n" ); +return -EINVAL ; + } shark =kzalloc (sizeof (struct shark_device ),GFP_KERNEL );if (!shark)
drivers/media/radio/radio-shark2.c +10 -0
@@ -282,6 +282,16 @@ static int usb_shark_probe(struct usb_in {struct shark_device *shark;int retval = -ENOMEM ; +static const u8 ep_addresses[] = { +SHARK_IN_EP |USB_DIR_IN , +SHARK_OUT_EP |USB_DIR_OUT , +0 }; + +/* Are the expected endpoints present? */ +if (!usb_check_int_endpoints (intf, ep_addresses)) { +dev_err (&intf->dev,"Invalid radioSHARK2 device\n" ); +return -EINVAL ; + } shark =kzalloc (sizeof (struct shark_device ),GFP_KERNEL );if (!shark)
Greg Kroah-Hartman
maintainerPATCH 145/161 net: fix skb leak in __skb_tstamp_tx()
In reply to Greg Kroah-HartmanFrom: Pratyush Yadav <[email protected]>
commit 8a02fb71d7192ff1a9a47c9d937624966c6e09af upstream.
Commit 50749f2dd685 ("tcp/udp: Fix memleaks of sk and zerocopy skbs with TX timestamp.") added a call to skb_orphan_frags_rx() to fix leaks with zerocopy skbs. But it ended up adding a leak of its own. When skb_orphan_frags_rx() fails, the function just returns, leaking the skb it just cloned. Free it before returning.
This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc.
--- net/core/skbuff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/skbuff.c +3 -1
@@ -4633,8 +4633,10 @@ void __skb_tstamp_tx(struct sk_buff *ori }else { skb =skb_clone (orig_skb,GFP_ATOMIC ); -if (skb_orphan_frags_rx (skb,GFP_ATOMIC )) +if (skb_orphan_frags_rx (skb,GFP_ATOMIC )) { +kfree_skb (skb);return ; + } }if (!skb)return ;
Greg Kroah-Hartman
maintainerPATCH 146/161 selftests: fib_tests: mute cleanup error message
In reply to Greg Kroah-HartmanFrom: Po-Hsu Lin <[email protected]>
commit d226b1df361988f885c298737d6019c863a25f26 upstream.
In the end of the test, there will be an error message induced by the ip netns del ns1 command in cleanup()
Tests passed: 201
Tests failed: 0
Cannot remove namespace file "/run/netns/ns1": No such file or directory
This can even be reproduced with just ./fib_tests.sh -h as we're calling cleanup() on exit.
Redirect the error message to /dev/null to mute it.
V2: Update commit message and fixes tag.
V3: resubmit due to missing netdev ML in V2
--- tools/testing/selftests/net/fib_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/fib_tests.sh +1 -1
@@ -68,7 +68,7 @@ setup() cleanup() { $IP link del dev dummy0 &> /dev/null - ip netns del ns1 + ip netns del ns1 &> /dev/null ip netns del ns2 &> /dev/null }
Greg Kroah-Hartman
maintainerPATCH 147/161 bpf: Fix mask generation for 32-bit narrow loads of 64-bit fields
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
commit 0613d8ca9ab382caabe9ed2dceb429e9781e443f upstream.
A narrow load from a 64-bit context field results in a 64-bit load followed potentially by a 64-bit right-shift and then a bitwise AND operation to extract the relevant data.
In the case of a 32-bit access, an immediate mask of 0xffffffff is used to construct a 64-bit BPP_AND operation which then sign-extends the mask value and effectively acts as a glorified no-op. For example:
0: 61 10 00 00 00 00 00 00 r0 = *(u32 *)(r1 + 0)
results in the following code generation for a 64-bit field:
ldr x7, [x7] // 64-bit load mov x10, #0xffffffffffffffff and x7, x7, x10
Fix the mask generation so that narrow loads always perform a 32-bit AND operation:
ldr x7, [x7] // 64-bit load mov w10, #0xffffffff and w7, w7, w10
--- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/verifier.c +1 -1
@@ -8966,7 +8966,7 @@ static int convert_ctx_accesses(struct b insn_buf[cnt++] =BPF_ALU64_IMM (BPF_RSH , insn->dst_reg, shift); - insn_buf[cnt++] =BPF_ALU64_IMM (BPF_AND , insn->dst_reg, + insn_buf[cnt++] =BPF_ALU32_IMM (BPF_AND , insn->dst_reg, (1ULL << size *8 ) -1 ); } }
Greg Kroah-Hartman
maintainerPATCH 148/161 ipv6: Fix out-of-bounds access in ipv6_find_tlv()
In reply to Greg Kroah-HartmanFrom: Gavrilov Ilia <[email protected]>
commit 878ecb0897f4737a4c9401f3523fd49589025671 upstream.
optlen is fetched without checking whether there is more than one byte to parse. It can lead to out-of-bounds access.
Found by InfoTeCS on behalf of Linux Verification Center (linuxtesting.org) with SVACE.
--- net/ipv6/exthdrs_core.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/exthdrs_core.c +2 -0
@@ -143,6 +143,8 @@ int ipv6_find_tlv(const struct sk_buff * optlen =1 ;break ;default : +if (len <2 ) + goto bad; optlen = nh[offset +1 ] +2 ;if (optlen > len) goto bad;
Greg Kroah-Hartman
maintainerPATCH 149/161 power: supply: leds: Fix blink to LED on transition
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit e4484643991e0f6b89060092563f0dbab9450cbb upstream.
When a battery's status changes from charging to full then the charging-blink-full-solid trigger tries to change the LED from blinking to solid/on.
As is documented in include/linux/leds.h to deactivate blinking / to make the LED solid a LED_OFF must be send:
"""
* Deactivate blinking again when the brightness is set to LED_OFF
* via the brightness_set() callback.
"""
led_set_brighness() calls with a brightness value other then 0 / LED_OFF merely change the brightness of the LED in its on state while it is blinking.
So power_supply_update_bat_leds() must first send a LED_OFF event before the LED_FULL to disable blinking.
--- drivers/power/supply/power_supply_leds.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/power/supply/power_supply_leds.c +3 -2
@@ -34,8 +34,9 @@ static void power_supply_update_bat_ledsled_trigger_event (psy->charging_full_trig,LED_FULL );led_trigger_event (psy->charging_trig,LED_OFF );led_trigger_event (psy->full_trig,LED_FULL ); -led_trigger_event (psy->charging_blink_full_solid_trig, -LED_FULL ); +/* Going from blink to LED on requires a LED_OFF event to stop blink */ +led_trigger_event (psy->charging_blink_full_solid_trig,LED_OFF ); +led_trigger_event (psy->charging_blink_full_solid_trig,LED_FULL );break ;case POWER_SUPPLY_STATUS_CHARGING :led_trigger_event (psy->charging_full_trig,LED_FULL );
Greg Kroah-Hartman
maintainerPATCH 150/161 power: supply: bq27xxx: Fix bq27xxx_battery_update() race condition
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 5c34c0aef185dcd10881847b9ebf20046aa77cb4 upstream.
bq27xxx_battery_update() assumes / requires that it is only run once, not multiple times at the same time. But there are 3 possible callers:
1. bq27xxx_battery_poll() delayed_work item handler
2. bq27xxx_battery_irq_handler_thread() I2C IRQ handler
3. bq27xxx_battery_setup()
And there is no protection against these racing with each other, fix this race condition by making all callers take di->lock:
- Rename bq27xxx_battery_update() to bq27xxx_battery_update_unlocked()
- Add new bq27xxx_battery_update() which takes di->lock and then calls bq27xxx_battery_update_unlocked()
- Make stale cache check code in bq27xxx_battery_get_property(), which already takes di->lock directly to check the jiffies, call bq27xxx_battery_update_unlocked() instead of messing with the delayed_work item
- Make bq27xxx_battery_update_unlocked() mod the delayed-work item so that the next poll is delayed to poll_interval milliseconds after the last update independent of the source of the update
--- drivers/power/supply/bq27xxx_battery.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
drivers/power/supply/bq27xxx_battery.c +13 -8
@@ -1547,7 +1547,7 @@ static int bq27xxx_battery_read_health(sreturn POWER_SUPPLY_HEALTH_GOOD ; } -void bq27xxx_battery_update (struct bq27xxx_device_info *di) +static void bq27xxx_battery_update_unlocked (struct bq27xxx_device_info *di) {struct bq27xxx_reg_cache cache = {0 , };bool has_ci_flag = di->opts &BQ27XXX_O_ZERO ;
@@ -1597,6 +1597,16 @@ void bq27xxx_battery_update(struct bq27x di->cache = cache; di->last_update = jiffies; + +if (poll_interval >0 ) +mod_delayed_work (system_wq, &di->work, poll_interval *HZ ); +} + +void bq27xxx_battery_update (struct bq27xxx_device_info *di) +{ +mutex_lock (&di->lock); +bq27xxx_battery_update_unlocked (di); +mutex_unlock (&di->lock); }EXPORT_SYMBOL_GPL (bq27xxx_battery_update);
@@ -1607,9 +1617,6 @@ static void bq27xxx_battery_poll(struct work.work);bq27xxx_battery_update (di); - -if (poll_interval >0 ) -schedule_delayed_work (&di->work, poll_interval *HZ ); }/*
@@ -1770,10 +1777,8 @@ static int bq27xxx_battery_get_property(struct bq27xxx_device_info *di =power_supply_get_drvdata (psy);mutex_lock (&di->lock); -if (time_is_before_jiffies (di->last_update +5 *HZ )) { -cancel_delayed_work_sync (&di->work); -bq27xxx_battery_poll (&di->work.work); - } +if (time_is_before_jiffies (di->last_update +5 *HZ )) +bq27xxx_battery_update_unlocked (di);mutex_unlock (&di->lock);if (psp !=POWER_SUPPLY_PROP_PRESENT && di->cache.flags <0 )
Greg Kroah-Hartman
maintainerPATCH 151/161 power: supply: bq27xxx: Fix I2C IRQ race on remove
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 444ff00734f3878cd54ddd1ed5e2e6dbea9326d5 upstream.
devm_request_threaded_irq() requested IRQs are only free-ed after the driver's remove function has ran. So the IRQ could trigger and call bq27xxx_battery_update() after bq27xxx_battery_teardown() has already run.
Switch to explicitly free-ing the IRQ in bq27xxx_battery_i2c_remove() to fix this.
--- drivers/power/supply/bq27xxx_battery_i2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/supply/bq27xxx_battery_i2c.c +2 -1
@@ -187,7 +187,7 @@ static int bq27xxx_battery_i2c_probe(stri2c_set_clientdata (client, di);if (client->irq) { - ret =devm_request_threaded_irq (&client->dev, client->irq, + ret =request_threaded_irq (client->irq,NULL , bq27xxx_battery_irq_handler_thread,IRQF_ONESHOT , di->name, di);
@@ -217,6 +217,7 @@ static int bq27xxx_battery_i2c_remove(st {struct bq27xxx_device_info *di =i2c_get_clientdata (client); +free_irq (client->irq, di);bq27xxx_battery_teardown (di);mutex_lock (&battery_mutex);
Greg Kroah-Hartman
maintainerPATCH 152/161 power: supply: bq27xxx: Fix poll_interval handling and races on remove
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit c00bc80462afc7963f449d7f21d896d2f629cacc upstream.
Before this patch bq27xxx_battery_teardown() was setting poll_interval = 0 to avoid bq27xxx_battery_update() requeuing the delayed_work item.
There are 2 problems with this:
1. If the driver is unbound through sysfs, rather then the module being rmmod-ed, this changes poll_interval unexpectedly
2. This is racy, after it being set poll_interval could be changed before bq27xxx_battery_update() checks it through /sys/module/bq27xxx_battery/parameters/poll_interval
Fix this by added a removed attribute to struct bq27xxx_device_info and using that instead of setting poll_interval to 0.
There also is another poll_interval related race on remove(), writing /sys/module/bq27xxx_battery/parameters/poll_interval will requeue the delayed_work item for all devices on the bq27xxx_battery_devices list and the device being removed was only removed from that list after cancelling the delayed_work item.
Fix this by moving the removal from the bq27xxx_battery_devices list to before cancelling the delayed_work item.
--- drivers/power/supply/bq27xxx_battery.c | 22 +++++++++------------- include/linux/power/bq27xxx_battery.h | 1 + 2 files changed, 10 insertions(+), 13 deletions(-)
drivers/power/supply/bq27xxx_battery.c +9 -13
@@ -1598,7 +1598,7 @@ static void bq27xxx_battery_update_unloc di->last_update = jiffies; -if (poll_interval >0 ) +if (!di->removed && poll_interval >0 )mod_delayed_work (system_wq, &di->work, poll_interval *HZ ); }
@@ -1915,22 +1915,18 @@ EXPORT_SYMBOL_GPL(bq27xxx_battery_setup)void bq27xxx_battery_teardown (struct bq27xxx_device_info *di) { -/* -* power_supply_unregister call bq27xxx_battery_get_property which -* call bq27xxx_battery_poll. -* Make sure that bq27xxx_battery_poll will not call -* schedule_delayed_work again after unregister (which cause OOPS). -*/ - poll_interval =0 ; - -cancel_delayed_work_sync (&di->work); - -power_supply_unregister (di->bat); -mutex_lock (&bq27xxx_list_lock);list_del (&di->list);mutex_unlock (&bq27xxx_list_lock); +/* Set removed to avoid bq27xxx_battery_update() re-queuing the work */ +mutex_lock (&di->lock); + di->removed = true; +mutex_unlock (&di->lock); + +cancel_delayed_work_sync (&di->work); + +power_supply_unregister (di->bat);mutex_destroy (&di->lock); }EXPORT_SYMBOL_GPL (bq27xxx_battery_teardown);
include/linux/power/bq27xxx_battery.h +1 -0
@@ -64,6 +64,7 @@ struct bq27xxx_device_info {struct bq27xxx_access_methods bus;struct bq27xxx_reg_cache cache;int charge_design_full; +bool removed;unsigned long last_update;struct delayed_work work;struct power_supply *bat;
Greg Kroah-Hartman
maintainerPATCH 153/161 power: supply: sbs-charger: Fix INHIBITED bit for Status reg
In reply to Greg Kroah-HartmanFrom: Daisuke Nojiri <[email protected]>
commit b2f2a3c9800208b0db2c2e34b05323757117faa2 upstream.
CHARGE_INHIBITED bit position of the ChargerStatus register is actually 0 not 1. This patch corrects it.
--- drivers/power/supply/sbs-charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/sbs-charger.c +1 -1
@@ -25,7 +25,7 @@#define SBS_CHARGER_REG_STATUS 0x13#define SBS_CHARGER_REG_ALARM_WARNING 0x16 -#define SBS_CHARGER_STATUS_CHARGE_INHIBITED BIT(1) +#define SBS_CHARGER_STATUS_CHARGE_INHIBITED BIT(0)#define SBS_CHARGER_STATUS_RES_COLD BIT(9)#define SBS_CHARGER_STATUS_RES_HOT BIT(10)#define SBS_CHARGER_STATUS_BATTERY_PRESENT BIT(14)
Greg Kroah-Hartman
maintainerPATCH 154/161 coresight: Fix signedness bug in tmc_etr_buf_insert_barrier_packet()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit f67bc15e526bb9920683ad6c1891ff9e08981335 upstream.
This code generates a Smatch warning:
drivers/hwtracing/coresight/coresight-tmc-etr.c:947 tmc_etr_buf_insert_barrier_packet()
error: uninitialized symbol 'bufp'.
The problem is that if tmc_sg_table_get_data() returns -EINVAL, then when we test if "len < CORESIGHT_BARRIER_PKT_SIZE", the negative "len" value is type promoted to a high unsigned long value which is greater than CORESIGHT_BARRIER_PKT_SIZE. Fix this bug by adding an explicit check for error codes.
--- drivers/hwtracing/coresight/coresight-tmc-etr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-tmc-etr.c +1 -1
@@ -909,7 +909,7 @@ tmc_etr_buf_insert_barrier_packet(struct len =tmc_etr_buf_get_data (etr_buf, offset,CORESIGHT_BARRIER_PKT_SIZE , &bufp); -if (WARN_ON (len <CORESIGHT_BARRIER_PKT_SIZE )) +if (WARN_ON (len <0 || len <CORESIGHT_BARRIER_PKT_SIZE ))return -EINVAL ;coresight_insert_barrier_packet (bufp);return offset +CORESIGHT_BARRIER_PKT_SIZE ;
Greg Kroah-Hartman
maintainerPATCH 155/161 xen/pvcalls-back: fix double frees with pvcalls_new_active_socket()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 8fafac202d18230bb9926bda48e563fd2cce2a4f upstream.
In the pvcalls_new_active_socket() function, most error paths call pvcalls_back_release_active(fedata->dev, fedata, map) which calls sock_release() on "sock". The bug is that the caller also frees sock.
Fix this by making every error path in pvcalls_new_active_socket() release the sock, and don't free it in the caller.
--- drivers/xen/pvcalls-back.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/xen/pvcalls-back.c +4 -5
@@ -321,8 +321,10 @@ static struct sock_mapping *pvcalls_new_void *page; map =kzalloc (sizeof (*map),GFP_KERNEL ); -if (map ==NULL ) +if (map ==NULL ) { +sock_release (sock);return NULL ; + } map->fedata = fedata; map->sock = sock;
@@ -414,10 +416,8 @@ static int pvcalls_back_connect(struct x req->u.connect.ref, req->u.connect.evtchn, sock); -if (!map) { +if (!map) ret = -EFAULT ; -sock_release (sock); - } out: rsp =RING_GET_RESPONSE (&fedata->ring, fedata->ring.rsp_prod_pvt++);
@@ -558,7 +558,6 @@ static void __pvcalls_back_accept(struct sock);if (!map) { ret = -EFAULT ; -sock_release (sock); goto out_error; }
Greg Kroah-Hartman
maintainerPATCH 156/161 x86/show_trace_log_lvl: Ensure stack pointer is aligned, again
In reply to Greg Kroah-HartmanFrom: Vernon Lovejoy <[email protected]>
commit 2e4be0d011f21593c6b316806779ba1eba2cd7e0 upstream.
The commit e335bb51cc15 ("x86/unwind: Ensure stack pointer is aligned") tried to align the stack pointer in show_trace_log_lvl(), otherwise the "stack < stack_info.end" check can't guarantee that the last read does not go past the end of the stack.
However, we have the same problem with the initial value of the stack pointer, it can also be unaligned. So without this patch this trivial kernel module
#include <linux/module.h>
static int init(void)
{
asm volatile("sub $0x4,%rsp");
dump_stack();
asm volatile("add $0x4,%rsp");
return -EAGAIN;
}
module_init(init);
MODULE_LICENSE("GPL");crashes the kernel.
--- arch/x86/kernel/dumpstack.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/x86/kernel/dumpstack.c +5 -2
@@ -171,7 +171,6 @@ void show_trace_log_lvl(struct task_struprintk ("%sCall Trace:\n" , log_lvl);unwind_start (&state, task, regs, stack); - stack = stack ? :get_stack_pointer (task, regs); regs =unwind_get_entry_regs (&state, &partial);/*
@@ -190,9 +189,13 @@ void show_trace_log_lvl(struct task_stru* - hardirq stack * - entry stack */ -for ( ; stack; stack =PTR_ALIGN (stack_info.next_sp,sizeof (long ))) { +for (stack = stack ?:get_stack_pointer (task, regs); + stack; + stack = stack_info.next_sp) {const char *stack_name; + stack =PTR_ALIGN (stack,sizeof (long )); +if (get_stack_info (stack, task, &stack_info, &visit_mask)) {/* * We weren't on a valid stack. It's possible that
Greg Kroah-Hartman
maintainerPATCH 157/161 ASoC: Intel: Skylake: Fix declaration of enum skl_ch_cfg
In reply to Greg Kroah-HartmanFrom: Cezary Rojewski <[email protected]>
commit 95109657471311601b98e71f03d0244f48dc61bb upstream.
Constant 'C4_CHANNEL' does not exist on the firmware side. Value 0xC is reserved for 'C7_1' instead.
--- include/uapi/sound/skl-tplg-interface.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/uapi/sound/skl-tplg-interface.h +2 -1
@@ -66,7 +66,8 @@ enum skl_ch_cfg {SKL_CH_CFG_DUAL_MONO =9 ,SKL_CH_CFG_I2S_DUAL_STEREO_0 =10 ,SKL_CH_CFG_I2S_DUAL_STEREO_1 =11 , -SKL_CH_CFG_4_CHANNEL =12 , +SKL_CH_CFG_7_1 =12 , +SKL_CH_CFG_4_CHANNEL =SKL_CH_CFG_7_1 , SKL_CH_CFG_INVALID };
Greg Kroah-Hartman
maintainerPATCH 158/161 forcedeth: Fix an error handling path in nv_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit 5b17a4971d3b2a073f4078dd65331efbe35baa2d upstream.
If an error occures after calling nv_mgmt_acquire_sema(), it should be undone with a corresponding nv_mgmt_release_sema() call.
Add it in the error handling path of the probe as already done in the remove function.
--- drivers/net/ethernet/nvidia/forcedeth.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/nvidia/forcedeth.c +1 -0
@@ -6099,6 +6099,7 @@ static int nv_probe(struct pci_dev *pci_return 0 ; out_error: +nv_mgmt_release_sema (dev);if (phystate_orig)writel (phystate|NVREG_ADAPTCTL_RUNNING , base + NvRegAdapterControl); out_freering:
Greg Kroah-Hartman
maintainerPATCH 159/161 net/mlx5: Fix error message when failing to allocate device memory
In reply to Greg Kroah-HartmanFrom: Roi Dayan <[email protected]>
commit a65735148e0328f80c0f72f9f8d2f609bfcf4aff upstream.
Fix spacing for the error and also the correct error code pointer.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -1
@@ -887,7 +887,7 @@ static int mlx5_init_once(struct mlx5_co dev->dm =mlx5_dm_create (dev);if (IS_ERR (dev->dm)) -mlx5_core_warn (dev,"Failed to init device memory%d\n" , err); +mlx5_core_warn (dev,"Failed to init device memory %ld\n" ,PTR_ERR (dev->dm)); dev->tracer =mlx5_fw_tracer_create (dev); dev->hv_vhca =mlx5_hv_vhca_create (dev);
Greg Kroah-Hartman
maintainerPATCH 160/161 net/mlx5: Devcom, fix error flow in mlx5_devcom_register_device
In reply to Greg Kroah-HartmanFrom: Shay Drory <[email protected]>
commit af87194352cad882d787d06fb7efa714acd95427 upstream.
In case devcom allocation is failed, mlx5 is always freeing the priv. However, this priv might have been allocated by a different thread, and freeing it might lead to use-after-free bugs.
Fix it by freeing the priv only in case it was allocated by the running thread.
--- drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c +2 -1
@@ -110,7 +110,8 @@ struct mlx5_devcom *mlx5_devcom_register priv->devs[idx] = dev; devcom =mlx5_devcom_alloc (priv, idx);if (!devcom) { -kfree (priv); +if (new_priv) +kfree (priv);return ERR_PTR (-ENOMEM ); }
Greg Kroah-Hartman
maintainerPATCH 161/161 3c589_cs: Fix an error handling path in tc589_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit 640bf95b2c7c2981fb471acdafbd3e0458f8390d upstream.
Should tc589_config() fail, some resources need to be released as already done in the remove function.
--- drivers/net/ethernet/3com/3c589_cs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ethernet/3com/3c589_cs.c +10 -1
@@ -196,6 +196,7 @@ static int tc589_probe(struct pcmcia_dev {struct el3_private *lp;struct net_device *dev; +int ret;dev_dbg (&link->dev,"3c589_attach()\n" );
@@ -219,7 +220,15 @@ static int tc589_probe(struct pcmcia_dev dev->ethtool_ops = &netdev_ethtool_ops; -return tc589_config (link); + ret =tc589_config (link); +if (ret) + goto err_free_netdev; + +return 0 ; + +err_free_netdev: +free_netdev (dev); +return ret; }static void tc589_detach (struct pcmcia_device *link)
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.244 release. There are 161 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 Tue, 30 May 2023 19:08:13 +0000. Anything received after that time might be too late.
Build results:
total: 159 pass: 159 fail: 0 Qemu test results: total: 455 pass: 455 fail: 0
Guenter
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.244 release. There are 161 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 Tue, 30 May 2023 19:08:13 +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/v5.x/stable-review/patch-5.4.244-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.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: 5.4.244-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.4.y
* git commit: 99ecfa2a4afcb3256e9102eb5cc0525d97aec466
* git describe: v5.4.243-162-g99ecfa2a4afc
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.4.y/build/v5.4.243-162-g99ecfa2a4afc
## Test Regressions (compared to v5.4.243)
## Metric Regressions (compared to v5.4.243)
## Test Fixes (compared to v5.4.243)
## Metric Fixes (compared to v5.4.243)
## Test result summary
total: 134703, pass: 113495, fail: 3730, skip: 17279, xfail: 199
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 145 total, 144 passed, 1 failed
* arm64: 45 total, 39 passed, 6 failed
* i386: 28 total, 20 passed, 8 failed
* mips: 27 total, 27 passed, 0 failed
* parisc: 6 total, 6 passed, 0 failed
* powerpc: 30 total, 30 passed, 0 failed
* riscv: 12 total, 11 passed, 1 failed
* s390: 6 total, 6 passed, 0 failed
* sh: 12 total, 12 passed, 0 failed
* sparc: 6 total, 6 passed, 0 failed
* x86_64: 38 total, 36 passed, 2 failed
## Test suites summary
* boot
* fwts
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-sigaltstack
* kselftest-size
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-user_events
* kselftest-vDSO
* kselftest-watchdog
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libhugetlbfs
* 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-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* perf
* rcutorture
* v4l2-compliance
* vdso
--
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 5.4.244 release. There are 161 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 Tue, 30 May 2023 19:08:13 +0000. Anything received after that time might be too late.
No problems seen 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/v5.x/stable-review/patch-5.4.244-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.244 release. There are 161 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 Tue, 30 May 2023 19:08:13 +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/v5.x/stable-review/patch-5.4.244-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.4:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
59 tests: 59 pass, 0 failLinux version: 5.4.244-rc1-g99ecfa2a4afc
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Jon
Hello Greg,
Quoted 10 lines
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, May 28, 2023 8:09 PMThis is the start of the stable review cycle for the 5.4.244 release. There are 161 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 Tue, 30 May 2023 19:08:13 +0000. Anything received after that time might be too late.
CIP configurations built and booted with Linux 5.4.244-rc1 (99ecfa2a4afc):
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/pipelines/881425010
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/commits/linux-5.4.y
Kind regards, Chris
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.244 release. There are 161 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 Tue, 30 May 2023 19:08:13 +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/v5.x/stable-review/patch-5.4.244-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian