4.9.274-rc1 review
Subsystems (3)
Sasha Levin
maintainercover 4.9.274-rc1 review
This is the start of the stable review cycle for the 4.9.274 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:39:51 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-4.9.y&id2=v4.9.273
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
Thanks,
Sasha
-------------
Pseudo-Shortlog of commits:
Alexander Duyck (1):
i40e: Be much more verbose about what we can and cannot offload
Anirudh Rayabharam (1):
HID: usbhid: fix info leak in hid_submit_ctrl
Antti Järvinen (1):
PCI: Mark TI C667X to avoid bus reset
Arnd Bergmann (1):
ARM: 9081/1: fix gcc-10 thumb2-kernel regression
Bixuan Cui (1):
HID: gt683r: add missing MODULE_DEVICE_TABLE
Bumyong Lee (1):
dmaengine: pl330: fix wrong usage of spinlock flags in dma_cyclc
Chen Li (1):
radeon: use memcpy_to/fromio for UVD fw upload
Chengyang Fan (1):
net: ipv4: fix memory leak in ip_mc_add1_src
Christophe JAILLET (4):
alx: Fix an error handling path in 'alx_probe()'
qlcnic: Fix an error handling path in 'qlcnic_probe()'
netxen_nic: Fix an error handling path in 'netxen_nic_probe()'
be2net: Fix an error handling path in 'be_probe()'
Dan Robertson (1):
net: ieee802154: fix null deref in parse dev addr
Dongliang Mu (1):
net: usb: fix possible use-after-free in smsc75xx_bind
Du Cheng (1):
cfg80211: call cfg80211_leave_ocb when switching away from OCB
Eric Dumazet (5):
net/af_unix: fix a data-race in unix_dgram_sendmsg / unix_release_sock
inet: use bigger hash table for IP ID generation
inet: annotate date races around sk->sk_txhash
net/packet: annotate accesses to po->bind
net/packet: annotate accesses to po->ifindex
Esben Haabendal (1):
net: ll_temac: Avoid ndo_start_xmit returning NETDEV_TX_BUSY
Fugang Duan (1):
net: fec_ptp: add clock rate zero check
Hillf Danton (1):
gfs2: Fix use-after-free in gfs2_glock_shrink_scan
Ido Schimmel (1):
rtnetlink: Fix regression in bridge VLAN configuration
Jiapeng Chong (2):
ethernet: myri10ge: Fix missing error code in myri10ge_probe()
rtnetlink: Fix missing error code in rtnl_bridge_notify()
Jisheng Zhang (1):
net: stmmac: dwmac1000: Fix extended MAC address registers definition
Johan Hovold (1):
i2c: robotfuzz-osif: fix control-request directions
Johannes Berg (2):
mac80211: remove warning in ieee80211_get_sband()
mac80211: drop multicast fragments
Josh Triplett (1):
net: ipconfig: Don't override command-line hostnames or domains
Kees Cook (4):
r8152: Avoid memcpy() over-reading of ETH_SS_STATS
sh_eth: Avoid memcpy() over-reading of ETH_SS_STATS
r8169: Avoid memcpy() over-reading of ETH_SS_STATS
net: qed: Fix memcpy() overflow of qed_dcbx_params()
Linyu Yuan (1):
net: cdc_eem: fix tx fixup skb leak
Maciej Żenczykowski (1):
net: cdc_ncm: switch to eth%d interface naming
Mark Bolhuis (1):
HID: Add BUS_VIRTUAL to hid_connect logging
Maurizio Lombardi (1):
scsi: target: core: Fix warning on realtime kernels
Maxim Mikityanskiy (1):
netfilter: synproxy: Fix out of bounds when parsing TCP options
Ming Lei (1):
scsi: core: Put .shost_dev in failure path if host state changes to
RUNNING
Nanyong Sun (1):
net: ipv4: fix memory leak in netlbl_cipsov4_add_std
Naoya Horiguchi (1):
mm: hwpoison: change PageHWPoison behavior on hugetlb pages
Nathan Chancellor (1):
Makefile: Move -Wno-unused-but-set-variable out of GCC only block
Norbert Slusarek (1):
can: bcm: fix infoleak in struct bcm_msg_head
Paolo Abeni (1):
udp: fix race between close() and udp_abort()
Pavel Skripkin (5):
net: rds: fix memory leak in rds_recvmsg
net: hamradio: fix memory leak in mkiss_close
net: ethernet: fix potential use-after-free in ec_bhf_remove
net: caif: fix memory leak in ldisc_open
nilfs2: fix memory leak in nilfs_sysfs_delete_device_group
Peter Chen (1):
usb: dwc3: core: fix kernel panic when do reboot
Rafael J. Wysocki (1):
Revert "PCI: PM: Do not read power state in pci_enable_device_flags()"
Randy Dunlap (1):
dmaengine: QCOM_HIDMA_MGMT depends on HAS_IOMEM
Sasha Levin (1):
Linux 4.9.274-rc1
Shanker Donthineni (1):
PCI: Mark some NVIDIA GPUs to avoid bus reset
Srinivas Pandruvada (1):
HID: hid-sensor-hub: Return error for hid_set_field() failure
Steven Rostedt (VMware) (3):
tracing: Do no increment trace_clock_global() by one
tracing: Do not stop recording cmdlines when tracing is off
tracing: Do not stop recording comms if the trace file is being read
Suzuki K Poulose (1):
arm64: perf: Disable PMU while processing counter overflows
Sven Eckelmann (1):
batman-adv: Avoid WARN_ON timing related checks
Tetsuo Handa (1):
can: bcm/raw/isotp: use per module netdevice notifier
Thomas Gleixner (1):
x86/fpu: Reset state for all signal restore failures
Vineet Gupta (1):
ARCv2: save ABI registers across signal handling
Yang Yingliang (1):
dmaengine: stedma40: add missing iounmap() on error in d40_probe()
Yongqiang Liu (1):
ARM: OMAP2+: Fix build warning when mmc_omap is not built
Zheng Yongjun (4):
net/x25: Return the correct errno code
net: Return the correct errno code
fib: Return the correct errno code
ping: Check return value of function 'ping_queue_rcv_skb'
Makefile | 7 +- arch/arc/include/uapi/asm/sigcontext.h | 1 + arch/arc/kernel/signal.c | 43 +++++++++ arch/arm/kernel/setup.c | 16 ++-- arch/arm/mach-omap2/board-n8x0.c | 2 +- arch/arm64/kernel/perf_event.c | 50 ++++++----- arch/x86/kernel/fpu/signal.c | 18 ++-- drivers/dma/pl330.c | 6 +- drivers/dma/qcom/Kconfig | 1 + drivers/dma/ste_dma40.c | 3 + drivers/gpu/drm/radeon/radeon_uvd.c | 4 +- drivers/hid/hid-core.c | 3 + drivers/hid/hid-gt683r.c | 1 + drivers/hid/hid-sensor-hub.c | 13 ++- drivers/hid/usbhid/hid-core.c | 2 +- drivers/i2c/busses/i2c-robotfuzz-osif.c | 4 +- drivers/net/caif/caif_serial.c | 1 + drivers/net/ethernet/atheros/alx/main.c | 1 + drivers/net/ethernet/ec_bhf.c | 4 +- drivers/net/ethernet/emulex/benet/be_main.c | 1 + drivers/net/ethernet/freescale/fec_ptp.c | 4 + drivers/net/ethernet/intel/i40e/i40e_main.c | 52 +++++++++-- .../net/ethernet/myricom/myri10ge/myri10ge.c | 1 + .../ethernet/qlogic/netxen/netxen_nic_main.c | 2 + drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 4 +- .../net/ethernet/qlogic/qlcnic/qlcnic_main.c | 1 + drivers/net/ethernet/realtek/r8169.c | 2 +- drivers/net/ethernet/renesas/sh_eth.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac1000.h | 8 +- drivers/net/ethernet/xilinx/ll_temac_main.c | 5 ++ drivers/net/hamradio/mkiss.c | 1 + drivers/net/usb/cdc_eem.c | 2 +- drivers/net/usb/cdc_ncm.c | 2 +- drivers/net/usb/r8152.c | 2 +- drivers/net/usb/smsc75xx.c | 10 ++- drivers/pci/pci.c | 16 +++- drivers/pci/quirks.c | 22 +++++ drivers/scsi/hosts.c | 8 +- drivers/target/target_core_transport.c | 4 +- drivers/usb/dwc3/core.c | 2 +- fs/gfs2/glock.c | 2 +- fs/nilfs2/sysfs.c | 1 + include/linux/hid.h | 3 +- include/linux/swapops.h | 9 -- include/net/sock.h | 10 ++- kernel/trace/trace.c | 12 --- kernel/trace/trace_clock.c | 6 +- mm/memory-failure.c | 87 +++++-------------- net/batman-adv/bat_iv_ogm.c | 4 +- net/can/bcm.c | 64 +++++++++++--- net/can/raw.c | 62 ++++++++++--- net/compat.c | 2 +- net/core/fib_rules.c | 2 +- net/core/rtnetlink.c | 4 + net/ieee802154/nl802154.c | 9 +- net/ipv4/cipso_ipv4.c | 1 + net/ipv4/igmp.c | 1 + net/ipv4/ipconfig.c | 13 +-- net/ipv4/ping.c | 12 +-- net/ipv4/route.c | 42 ++++++--- net/ipv4/udp.c | 10 +++ net/ipv6/udp.c | 3 + net/mac80211/ieee80211_i.h | 2 +- net/mac80211/rx.c | 9 +- net/netfilter/nf_synproxy_core.c | 5 ++ net/packet/af_packet.c | 32 +++---- net/rds/recv.c | 2 +- net/unix/af_unix.c | 7 +- net/wireless/util.c | 3 + net/x25/af_x25.c | 2 +- 70 files changed, 493 insertions(+), 259 deletions(-)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 1/71 net: ieee802154: fix null deref in parse dev addr
From: Dan Robertson <[email protected]>
[ Upstream commit 9fdd04918a452980631ecc499317881c1d120b70 ]
Fix a logic error that could result in a null deref if the user sets the mode incorrectly for the given addr type.
--- net/ieee802154/nl802154.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
net/ieee802154/nl802154.c +5 -4
@@ -1330,19 +1330,20 @@ ieee802154_llsec_parse_dev_addr(struct nlattr *nla, nl802154_dev_addr_policy))return -EINVAL ; -if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID ] || - !attrs[NL802154_DEV_ADDR_ATTR_MODE ] || - !(attrs[NL802154_DEV_ADDR_ATTR_SHORT ] || - attrs[NL802154_DEV_ADDR_ATTR_EXTENDED ])) +if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID ] || !attrs[NL802154_DEV_ADDR_ATTR_MODE ])return -EINVAL ; addr->pan_id =nla_get_le16 (attrs[NL802154_DEV_ADDR_ATTR_PAN_ID ]); addr->mode =nla_get_u32 (attrs[NL802154_DEV_ADDR_ATTR_MODE ]);switch (addr->mode) {case NL802154_DEV_ADDR_SHORT : +if (!attrs[NL802154_DEV_ADDR_ATTR_SHORT ]) +return -EINVAL ; addr->short_addr =nla_get_le16 (attrs[NL802154_DEV_ADDR_ATTR_SHORT ]);break ;case NL802154_DEV_ADDR_EXTENDED : +if (!attrs[NL802154_DEV_ADDR_ATTR_EXTENDED ]) +return -EINVAL ; addr->extended_addr =nla_get_le64 (attrs[NL802154_DEV_ADDR_ATTR_EXTENDED ]);break ;default :
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 2/71 HID: hid-sensor-hub: Return error for hid_set_field() failure
In reply to Sasha LevinFrom: Srinivas Pandruvada <[email protected]>
[ Upstream commit edb032033da0dc850f6e7740fa1023c73195bc89 ]
In the function sensor_hub_set_feature(), return error when hid_set_field() fails.
--- drivers/hid/hid-sensor-hub.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/hid/hid-sensor-hub.c +9 -4
@@ -223,16 +223,21 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, buffer_size = buffer_size /sizeof (__s32);if (buffer_size) {for (i =0 ; i < buffer_size; ++i) { -hid_set_field (report->field[field_index], i, - (__force __s32 )cpu_to_le32 (*buf32)); + ret =hid_set_field (report->field[field_index], i, + (__force __s32 )cpu_to_le32 (*buf32)); +if (ret) + goto done_proc; + ++buf32; } }if (remaining_bytes) { value =0 ;memcpy (&value, (u8 *)buf32, remaining_bytes); -hid_set_field (report->field[field_index], i, - (__force __s32 )cpu_to_le32 (value)); + ret =hid_set_field (report->field[field_index], i, + (__force __s32 )cpu_to_le32 (value)); +if (ret) + goto done_proc; }hid_hw_request (hsdev->hdev, report,HID_REQ_SET_REPORT );hid_hw_wait (hsdev->hdev);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 3/71 HID: Add BUS_VIRTUAL to hid_connect logging
In reply to Sasha LevinFrom: Mark Bolhuis <[email protected]>
[ Upstream commit 48e33befe61a7d407753c53d1a06fc8d6b5dab80 ]
Add BUS_VIRTUAL to hid_connect logging since it's a valid hid bus type and it should not print <UNKNOWN>
--- drivers/hid/hid-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hid/hid-core.c +3 -0
@@ -1804,6 +1804,9 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)case BUS_I2C : bus ="I2C" ;break ; +case BUS_VIRTUAL : + bus ="VIRTUAL" ; +break ;default : bus ="<UNKNOWN>" ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 4/71 HID: usbhid: fix info leak in hid_submit_ctrl
In reply to Sasha LevinFrom: Anirudh Rayabharam <[email protected]>
[ Upstream commit 6be388f4a35d2ce5ef7dbf635a8964a5da7f799f ]
In hid_submit_ctrl(), the way of calculating the report length doesn't take into account that report->size can be zero. When running the syzkaller reproducer, a report of size 0 causes hid_submit_ctrl) to calculate transfer_buffer_length as 16384. When this urb is passed to the usb core layer, KMSAN reports an info leak of 16384 bytes.
To fix this, first modify hid_report_len() to account for the zero report size case by using DIV_ROUND_UP for the division. Then, call it from hid_submit_ctrl().
--- drivers/hid/usbhid/hid-core.c | 2 +- include/linux/hid.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/hid/usbhid/hid-core.c +1 -1
@@ -372,7 +372,7 @@ static int hid_submit_ctrl(struct hid_device *hid) raw_report = usbhid->ctrl[usbhid->ctrltail].raw_report; dir = usbhid->ctrl[usbhid->ctrltail].dir; - len = ((report->size -1 ) >>3 ) +1 + (report->id >0 ); + len =hid_report_len (report);if (dir ==USB_DIR_OUT ) { usbhid->urbctrl->pipe =usb_sndctrlpipe (hid_to_usb_dev (hid),0 ); usbhid->urbctrl->transfer_buffer_length = len;
include/linux/hid.h +1 -2
@@ -1127,8 +1127,7 @@ static inline void hid_hw_wait(struct hid_device *hdev)*/ static inline u32 hid_report_len (struct hid_report *report) { -/* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */ -return ((report->size -1 ) >>3 ) +1 + (report->id >0 ); +return DIV_ROUND_UP (report->size,8 ) + (report->id >0 ); } int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 5/71 ARM: OMAP2+: Fix build warning when mmc_omap is not built
In reply to Sasha LevinFrom: Yongqiang Liu <[email protected]>
[ Upstream commit 040ab72ee10ea88e1883ad143b3e2b77596abc31 ]
GCC reports the following warning with W=1:
arch/arm/mach-omap2/board-n8x0.c:325:19: warning:
variable 'index' set but not used [-Wunused-but-set-variable] 325 | int bit, *openp, index;
| ^~~~~
Fix this by moving CONFIG_MMC_OMAP to cover the rest codes in the n8x0_mmc_callback().
--- arch/arm/mach-omap2/board-n8x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/board-n8x0.c +1 -1
@@ -327,6 +327,7 @@ static int n8x0_mmc_get_cover_state(struct device *dev, int slot)static void n8x0_mmc_callback (void *data,u8 card_mask) { +#ifdef CONFIG_MMC_OMAP int bit, *openp, index;if (board_is_n800 ()) {
@@ -344,7 +345,6 @@ static void n8x0_mmc_callback(void *data, u8 card_mask) else *openp =0 ; -#ifdef CONFIG_MMC_OMAP omap_mmc_notify_cover_event (mmc_device, index, *openp);#else pr_warn ("MMC: notify cover event not available\n" );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 6/71 HID: gt683r: add missing MODULE_DEVICE_TABLE
In reply to Sasha LevinFrom: Bixuan Cui <[email protected]>
[ Upstream commit a4b494099ad657f1cb85436d333cf38870ee95bc ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/hid/hid-gt683r.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/hid-gt683r.c +1 -0
@@ -64,6 +64,7 @@ static const struct hid_device_id gt683r_led_id[] = { { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) }, { } }; +MODULE_DEVICE_TABLE (hid, gt683r_led_id);static void gt683r_brightness_set (struct led_classdev *led_cdev,enum led_brightness brightness)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 7/71 gfs2: Fix use-after-free in gfs2_glock_shrink_scan
In reply to Sasha LevinFrom: Hillf Danton <[email protected]>
[ Upstream commit 1ab19c5de4c537ec0d9b21020395a5b5a6c059b2 ]
The GLF_LRU flag is checked under lru_lock in gfs2_glock_remove_from_lru() to remove the glock from the lru list in __gfs2_glock_put().
On the shrink scan path, the same flag is cleared under lru_lock but because of cond_resched_lock(&lru_lock) in gfs2_dispose_glock_lru(), progress on the put side can be made without deleting the glock from the lru list.
Keep GLF_LRU across the race window opened by cond_resched_lock(&lru_lock) to ensure correct behavior on both sides - clear GLF_LRU after list_del under lru_lock.
--- fs/gfs2/glock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/glock.c +1 -1
@@ -1350,6 +1350,7 @@ __acquires(&lru_lock)while (!list_empty (list)) { gl = list_entry(list->next, struct gfs2_glock, gl_lru);list_del_init (&gl->gl_lru); +clear_bit (GLF_LRU , &gl->gl_flags);if (!spin_trylock (&gl->gl_lockref.lock)) { add_back_to_lru:list_add (&gl->gl_lru, &lru_list);
@@ -1396,7 +1397,6 @@ static long gfs2_scan_glock_lru(int nr)if (!test_bit (GLF_LOCK , &gl->gl_flags)) {list_move (&gl->gl_lru, &dispose);atomic_dec (&lru_count); -clear_bit (GLF_LRU , &gl->gl_flags); freed++;continue ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 8/71 scsi: target: core: Fix warning on realtime kernels
In reply to Sasha LevinFrom: Maurizio Lombardi <[email protected]>
[ Upstream commit 515da6f4295c2c42b8c54572cce3d2dd1167c41e ]
On realtime kernels, spin_lock_irq*(spinlock_t) do not disable the interrupts, a call to irqs_disabled() will return false thus firing a warning in __transport_wait_for_tasks().
Remove the warning and also replace assert_spin_locked() with lockdep_assert_held()
--- drivers/target/target_core_transport.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/target/target_core_transport.c +1 -3
@@ -2779,9 +2779,7 @@ __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop, __releases(&cmd->t_state_lock) __acquires(&cmd->t_state_lock) { - -assert_spin_locked (&cmd->t_state_lock); -WARN_ON_ONCE (!irqs_disabled ()); +lockdep_assert_held (&cmd->t_state_lock);if (fabric_stop) cmd->transport_state |=CMD_T_FABRIC_STOP ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 9/71 ethernet: myri10ge: Fix missing error code in myri10ge_probe()
In reply to Sasha LevinFrom: Jiapeng Chong <[email protected]>
[ Upstream commit f336d0b93ae978f12c5e27199f828da89b91e56a ]
The error code is missing in this code scenario, add the error code '-EINVAL' to the return value 'status'.
Eliminate the follow smatch warning:
drivers/net/ethernet/myricom/myri10ge/myri10ge.c:3818 myri10ge_probe()
warn: missing error code 'status'.
--- drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/myricom/myri10ge/myri10ge.c +1 -0
@@ -4050,6 +4050,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)dev_err (&pdev->dev,"invalid sram_size %dB or board span %ldB\n" , mgp->sram_size, mgp->board_span); + status = -EINVAL ; goto abort_with_ioremap; } memcpy_fromio(mgp->eeprom_strings,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 10/71 net: ipconfig: Don't override command-line hostnames or domains
In reply to Sasha LevinFrom: Josh Triplett <[email protected]>
[ Upstream commit b508d5fb69c2211a1b860fc058aafbefc3b3c3cd ]
If the user specifies a hostname or domain name as part of the ip= command-line option, preserve it and don't overwrite it with one supplied by DHCP/BOOTP.
For instance, ip=::::myhostname::dhcp will use "myhostname" rather than ignoring and overwriting it.
Fix the comment on ic_bootp_string that suggests it only copies a string "if not already set"; it doesn't have any such logic.
--- net/ipv4/ipconfig.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
net/ipv4/ipconfig.c +8 -5
@@ -880,7 +880,7 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d/* -* Copy BOOTP-supplied string if not already set. +* Copy BOOTP-supplied string */ static int __init ic_bootp_string (char *dest,char *src,int len,int max) {
@@ -929,12 +929,15 @@ static void __init ic_do_bootp_ext(u8 *ext) }break ;case 12 :/* Host name */ -ic_bootp_string (utsname ()->nodename, ext+1 , *ext, - __NEW_UTS_LEN); - ic_host_name_set =1 ; +if (!ic_host_name_set) { +ic_bootp_string (utsname ()->nodename, ext+1 , *ext, + __NEW_UTS_LEN); + ic_host_name_set =1 ; + }break ;case 15 :/* Domain name (DNS) */ -ic_bootp_string (ic_domain, ext+1 , *ext,sizeof (ic_domain)); +if (!ic_domain[0 ]) +ic_bootp_string (ic_domain, ext+1 , *ext,sizeof (ic_domain));break ;case 17 :/* Root path */ if (!root_server_path[0 ])
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 11/71 rtnetlink: Fix missing error code in rtnl_bridge_notify()
In reply to Sasha LevinFrom: Jiapeng Chong <[email protected]>
[ Upstream commit a8db57c1d285c758adc7fb43d6e2bad2554106e1 ]
The error code is missing in this code scenario, add the error code '-EINVAL' to the return value 'err'.
Eliminate the follow smatch warning:
net/core/rtnetlink.c:4834 rtnl_bridge_notify() warn: missing error code 'err'.
--- net/core/rtnetlink.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/rtnetlink.c +3 -1
@@ -3530,8 +3530,10 @@ static int rtnl_bridge_notify(struct net_device *dev)if (err <0 ) goto errout; -if (!skb->len) +if (!skb->len) { + err = -EINVAL ; goto errout; + }rtnl_notify (skb, net,0 ,RTNLGRP_LINK ,NULL ,GFP_ATOMIC );return 0 ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 12/71 net/x25: Return the correct errno code
In reply to Sasha LevinFrom: Zheng Yongjun <[email protected]>
[ Upstream commit d7736958668c4facc15f421e622ffd718f5be80a ]
When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.
--- net/x25/af_x25.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/x25/af_x25.c +1 -1
@@ -550,7 +550,7 @@ static int x25_create(struct net *net, struct socket *sock, int protocol,if (protocol) goto out; - rc = -ENOBUFS ; + rc = -ENOMEM ;if ((sk =x25_alloc_socket (net, kern)) ==NULL ) goto out;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 13/71 net: Return the correct errno code
In reply to Sasha LevinFrom: Zheng Yongjun <[email protected]>
[ Upstream commit 49251cd00228a3c983651f6bb2f33f6a0b8f152e ]
When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.
--- net/compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/compat.c +1 -1
@@ -159,7 +159,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,if (kcmlen > stackbuf_size) kcmsg_base = kcmsg =sock_kmalloc (sk, kcmlen,GFP_KERNEL );if (kcmsg ==NULL ) -return -ENOBUFS ; +return -ENOMEM ;/* Now copy them over neatly. */ memset (kcmsg,0 , kcmlen);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 14/71 fib: Return the correct errno code
In reply to Sasha LevinFrom: Zheng Yongjun <[email protected]>
[ Upstream commit 59607863c54e9eb3f69afc5257dfe71c38bb751e ]
When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.
--- net/core/fib_rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/fib_rules.c +1 -1
@@ -767,7 +767,7 @@ static void notify_rule_change(int event, struct fib_rule *rule, {struct net *net;struct sk_buff *skb; -int err = -ENOBUFS ; +int err = -ENOMEM ; net = ops->fro_net; skb =nlmsg_new (fib_rule_nlmsg_size (ops, rule),GFP_KERNEL );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 15/71 dmaengine: QCOM_HIDMA_MGMT depends on HAS_IOMEM
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit 0cfbb589d67f16fa55b26ae02b69c31b52e344b1 ]
When CONFIG_HAS_IOMEM is not set/enabled, certain iomap() family functions [including ioremap(), devm_ioremap(), etc.] are not available.
Drivers that use these functions should depend on HAS_IOMEM so that they do not cause build errors.
Rectifies these build errors:
s390-linux-ld: drivers/dma/qcom/hidma_mgmt.o: in function `hidma_mgmt_probe':
hidma_mgmt.c:(.text+0x780): undefined reference to `devm_ioremap_resource'
s390-linux-ld: drivers/dma/qcom/hidma_mgmt.o: in function `hidma_mgmt_init':
hidma_mgmt.c:(.init.text+0x126): undefined reference to `of_address_to_resource'
s390-linux-ld: hidma_mgmt.c:(.init.text+0x16e): undefined reference to `of_address_to_resource'
--- drivers/dma/qcom/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/dma/qcom/Kconfig +1 -0
@@ -9,6 +9,7 @@ config QCOM_BAM_DMA config QCOM_HIDMA_MGMT tristate "Qualcomm Technologies HIDMA Management support" + depends on HAS_IOMEM select DMA_ENGINE help Enable support for the Qualcomm Technologies HIDMA Management.
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 16/71 dmaengine: stedma40: add missing iounmap() on error in d40_probe()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit fffdaba402cea79b8d219355487d342ec23f91c6 ]
Add the missing iounmap() before return from d40_probe() in the error handling case.
--- drivers/dma/ste_dma40.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/dma/ste_dma40.c +3 -0
@@ -3674,6 +3674,9 @@ static int __init d40_probe(struct platform_device *pdev)kfree (base->lcla_pool.base_unaligned); +if (base->lcpa_base) +iounmap (base->lcpa_base); +if (base->phy_lcpa)release_mem_region (base->phy_lcpa, base->lcpa_size);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 17/71 mm: hwpoison: change PageHWPoison behavior on hugetlb pages
In reply to Sasha LevinFrom: Naoya Horiguchi <[email protected]>
[ Upstream commit b37ff71cc626a0c1b5e098ff9a0b723815f6aaeb ]
We'd like to narrow down the error region in memory error on hugetlb pages. However, currently we set PageHWPoison flags on all subpages in the error hugepage and add # of subpages to num_hwpoison_pages, which doesn't fit our purpose.
So this patch changes the behavior and we only set PageHWPoison on the head page then increase num_hwpoison_pages only by 1. This is a preparation for narrow-down part which comes in later patches.
--- include/linux/swapops.h | 9 ----- mm/memory-failure.c | 87 ++++++++++++----------------------------- 2 files changed, 24 insertions(+), 72 deletions(-)
include/linux/swapops.h +0 -9
@@ -196,15 +196,6 @@ static inline void num_poisoned_pages_dec(void) atomic_long_dec(&num_poisoned_pages); } -static inline void num_poisoned_pages_add (long num) -{ -atomic_long_add (num, &num_poisoned_pages); -} - -static inline void num_poisoned_pages_sub (long num) -{ -atomic_long_sub (num, &num_poisoned_pages); -}#else static inline swp_entry_t make_hwpoison_entry (struct page *page)
mm/memory-failure.c +24 -63
178 lines not on this page · raw message
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 18/71 batman-adv: Avoid WARN_ON timing related checks
In reply to Sasha LevinFrom: Sven Eckelmann <[email protected]>
[ Upstream commit 9f460ae31c4435fd022c443a6029352217a16ac1 ]
The soft/batadv interface for a queued OGM can be changed during the time the OGM was queued for transmission and when the OGM is actually transmitted by the worker.
But WARN_ON must be used to denote kernel bugs and not to print simple warnings. A warning can simply be printed using pr_warn.
--- net/batman-adv/bat_iv_ogm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/batman-adv/bat_iv_ogm.c +3 -1
@@ -585,8 +585,10 @@ static void batadv_iv_ogm_emit(struct batadv_forw_packet *forw_packet)if (WARN_ON (!forw_packet->if_outgoing))return ; -if (WARN_ON (forw_packet->if_outgoing->soft_iface != soft_iface)) +if (forw_packet->if_outgoing->soft_iface != soft_iface) { +pr_warn ("%s: soft interface switch for queued OGM\n" , __func__);return ; + }if (forw_packet->if_incoming->if_status !=BATADV_IF_ACTIVE )return ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 19/71 net: ipv4: fix memory leak in netlbl_cipsov4_add_std
In reply to Sasha LevinFrom: Nanyong Sun <[email protected]>
[ Upstream commit d612c3f3fae221e7ea736d196581c2217304bbbc ]
Reported by syzkaller:
BUG: memory leak
unreferenced object 0xffff888105df7000 (size 64):
comm "syz-executor842", pid 360, jiffies 4294824824 (age 22.546s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace:
[<00000000e67ed558>] kmalloc include/linux/slab.h:590 [inline] [<00000000e67ed558>] kzalloc include/linux/slab.h:720 [inline] [<00000000e67ed558>] netlbl_cipsov4_add_std net/netlabel/netlabel_cipso_v4.c:145 [inline] [<00000000e67ed558>] netlbl_cipsov4_add+0x390/0x2340 net/netlabel/netlabel_cipso_v4.c:416 [<0000000006040154>] genl_family_rcv_msg_doit.isra.0+0x20e/0x320 net/netlink/genetlink.c:739 [<00000000204d7a1c>] genl_family_rcv_msg net/netlink/genetlink.c:783 [inline] [<00000000204d7a1c>] genl_rcv_msg+0x2bf/0x4f0 net/netlink/genetlink.c:800 [<00000000c0d6a995>] netlink_rcv_skb+0x134/0x3d0 net/netlink/af_netlink.c:2504 [<00000000d78b9d2c>] genl_rcv+0x24/0x40 net/netlink/genetlink.c:811 [<000000009733081b>] netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] [<000000009733081b>] netlink_unicast+0x4a0/0x6a0 net/netlink/af_netlink.c:1340 [<00000000d5fd43b8>] netlink_sendmsg+0x789/0xc70 net/netlink/af_netlink.c:1929 [<000000000a2d1e40>] sock_sendmsg_nosec net/socket.c:654 [inline] [<000000000a2d1e40>] sock_sendmsg+0x139/0x170 net/socket.c:674 [<00000000321d1969>] ____sys_sendmsg+0x658/0x7d0 net/socket.c:2350 [<00000000964e16bc>] ___sys_sendmsg+0xf8/0x170 net/socket.c:2404 [<000000001615e288>] __sys_sendmsg+0xd3/0x190 net/socket.c:2433 [<000000004ee8b6a5>] do_syscall_64+0x37/0x90 arch/x86/entry/common.c:47 [<00000000171c7cee>] entry_SYSCALL_64_after_hwframe+0x44/0xae
The memory of doi_def->map.std pointing is allocated in netlbl_cipsov4_add_std, but no place has freed it. It should be freed in cipso_v4_doi_free which frees the cipso DOI resource.
--- net/ipv4/cipso_ipv4.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/cipso_ipv4.c +1 -0
@@ -486,6 +486,7 @@ void cipso_v4_doi_free(struct cipso_v4_doi *doi_def)kfree (doi_def->map.std->lvl.local);kfree (doi_def->map.std->cat.cipso);kfree (doi_def->map.std->cat.local); +kfree (doi_def->map.std);break ; }kfree (doi_def);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 20/71 net: rds: fix memory leak in rds_recvmsg
In reply to Sasha LevinFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 49bfcbfd989a8f1f23e705759a6bb099de2cff9f ]
Syzbot reported memory leak in rds. The problem was in unputted refcount in case of error.
int rds_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
int msg_flags)
{
...
if (!rds_next_incoming(rs, &inc)) {
...
}After this "if" inc refcount incremented and
if (rds_cmsg_recv(inc, msg, rs)) {
ret = -EFAULT;
goto out;
}
...
out:
return ret;
}in case of rds_cmsg_recv() fail the refcount won't be decremented. And it's easy to see from ftrace log, that rds_inc_addref() don't have rds_inc_put() pair in rds_recvmsg() after rds_cmsg_recv()
1) | rds_recvmsg() {
1) 3.721 us | rds_inc_addref();
1) 3.853 us | rds_message_inc_copy_to_user();
1) + 10.395 us | rds_cmsg_recv();
1) + 34.260 us | }--- net/rds/recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rds/recv.c +1 -1
@@ -596,7 +596,7 @@ int rds_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,if (rds_cmsg_recv (inc, msg, rs)) { ret = -EFAULT ; - goto out; +break ; }rds_stats_inc (s_recv_delivered);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 21/71 udp: fix race between close() and udp_abort()
In reply to Sasha LevinFrom: Paolo Abeni <[email protected]>
[ Upstream commit a8b897c7bcd47f4147d066e22cc01d1026d7640e ]
Kaustubh reported and diagnosed a panic in udp_lib_lookup(). The root cause is udp_abort() racing with close(). Both racing functions acquire the socket lock, but udp{v6}_destroy_sock() release it before performing destructive actions.
We can't easily extend the socket lock scope to avoid the race, instead use the SOCK_DEAD flag to prevent udp_abort from doing any action when the critical race happens.
--- net/ipv4/udp.c | 10 ++++++++++ net/ipv6/udp.c | 3 +++ 2 files changed, 13 insertions(+)
net/ipv4/udp.c +10 -0
@@ -1998,6 +1998,9 @@ void udp_destroy_sock(struct sock *sk) {struct udp_sock *up =udp_sk (sk);bool slow =lock_sock_fast (sk); + +/* protects from races with udp_abort() */ +sock_set_flag (sk,SOCK_DEAD );udp_flush_pending_frames (sk);unlock_sock_fast (sk, slow);if (static_key_false (&udp_encap_needed) && up->encap_type) {
@@ -2228,10 +2231,17 @@ int udp_abort(struct sock *sk, int err) {lock_sock (sk); +/* udp{v6}_destroy_sock() sets it under the sk lock, avoid racing +* with close() +*/ +if (sock_flag (sk,SOCK_DEAD )) + goto out; + sk->sk_err = err; sk->sk_error_report (sk);__udp_disconnect (sk,0 ); +out:release_sock (sk);return 0 ;
net/ipv6/udp.c +3 -0
@@ -1325,6 +1325,9 @@ void udpv6_destroy_sock(struct sock *sk) {struct udp_sock *up =udp_sk (sk);lock_sock (sk); + +/* protects from races with udp_abort() */ +sock_set_flag (sk,SOCK_DEAD );udp_v6_flush_pending_frames (sk);release_sock (sk);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 22/71 rtnetlink: Fix regression in bridge VLAN configuration
In reply to Sasha LevinFrom: Ido Schimmel <[email protected]>
[ Upstream commit d2e381c4963663bca6f30c3b996fa4dbafe8fcb5 ]
Cited commit started returning errors when notification info is not filled by the bridge driver, resulting in the following regression:
# ip link add name br1 type bridge vlan_filtering 1 # bridge vlan add dev br1 vid 555 self pvid untagged RTNETLINK answers: Invalid argument
As long as the bridge driver does not fill notification info for the bridge device itself, an empty notification should not be considered as an error. This is explained in commit 59ccaaaa49b5 ("bridge: dont send notification when skb->len == 0 in rtnl_bridge_notify").
Fix by removing the error and add a comment to avoid future bugs.
--- net/core/rtnetlink.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/core/rtnetlink.c +5 -3
@@ -3530,10 +3530,12 @@ static int rtnl_bridge_notify(struct net_device *dev)if (err <0 ) goto errout; -if (!skb->len) { - err = -EINVAL ; +/* Notification info is only filled for bridge ports, not the bridge +* device itself. Therefore, a zero notification length is valid and +* should not result in an error. +*/ +if (!skb->len) goto errout; - }rtnl_notify (skb, net,0 ,RTNLGRP_LINK ,NULL ,GFP_ATOMIC );return 0 ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 23/71 netfilter: synproxy: Fix out of bounds when parsing TCP options
In reply to Sasha LevinFrom: Maxim Mikityanskiy <[email protected]>
[ Upstream commit 5fc177ab759418c9537433e63301096e733fb915 ]
The TCP option parser in synproxy (synproxy_parse_options) could read one byte out of bounds. When the length is 1, the execution flow gets into the loop, reads one byte of the opcode, and if the opcode is neither TCPOPT_EOL nor TCPOPT_NOP, it reads one more byte, which exceeds the length of 1.
This fix is inspired by commit 9609dad263f8 ("ipv4: tcp_input: fix stack out of bounds when parsing TCP options.").
v2 changes:
Added an early return when length < 0 to avoid calling skb_header_pointer with negative length.
--- net/netfilter/nf_synproxy_core.c | 5 +++++ 1 file changed, 5 insertions(+)
net/netfilter/nf_synproxy_core.c +5 -0
@@ -34,6 +34,9 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,int length = (th->doff *4 ) -sizeof (*th);u8 buf[40 ], *ptr; +if (unlikely (length <0 )) +return false; + ptr =skb_header_pointer (skb, doff +sizeof (*th), length, buf);if (ptr ==NULL )return false;
@@ -50,6 +53,8 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned int doff, length--;continue ;default : +if (length <2 ) +return true; opsize = *ptr++;if (opsize <2 )return true;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 24/71 alx: Fix an error handling path in 'alx_probe()'
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 33e381448cf7a05d76ac0b47d4a6531ecd0e5c53 ]
If an error occurs after a 'pci_enable_pcie_error_reporting()' call, it must be undone by a corresponding 'pci_disable_pcie_error_reporting()' call, as already done in the remove function.
--- drivers/net/ethernet/atheros/alx/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/atheros/alx/main.c +1 -0
@@ -1653,6 +1653,7 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)free_netdev (netdev); out_pci_release:pci_release_mem_regions (pdev); +pci_disable_pcie_error_reporting (pdev); out_pci_disable:pci_disable_device (pdev);return err;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 25/71 net: stmmac: dwmac1000: Fix extended MAC address registers definition
In reply to Sasha LevinFrom: Jisheng Zhang <[email protected]>
[ Upstream commit 1adb20f0d496b2c61e9aa1f4761b8d71f93d258e ]
The register starts from 0x800 is the 16th MAC address register rather than the first one.
--- drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac1000.h +4 -4
@@ -91,10 +91,10 @@ enum power_event {#define LPI_CTRL_STATUS_TLPIEN 0x00000001/* Transmit LPI Entry */ /* GMAC HW ADDR regs */ -#define GMAC_ADDR_HIGH (reg) (((reg > 15) ? 0x00000800 : 0x00000040) + \ - (reg * 8)) -#define GMAC_ADDR_LOW (reg) (((reg > 15) ? 0x00000804 : 0x00000044) + \ - (reg * 8)) +#define GMAC_ADDR_HIGH (reg) ((reg > 15) ? 0x00000800 + (reg - 16) * 8 : \ + 0x00000040 + (reg * 8)) +#define GMAC_ADDR_LOW (reg) ((reg > 15) ? 0x00000804 + (reg - 16) * 8 : \ + 0x00000044 + (reg * 8))#define GMAC_MAX_PERFECT_ADDRESSES 1#define GMAC_PCS_BASE 0x000000c0/* PCS register base */
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 26/71 qlcnic: Fix an error handling path in 'qlcnic_probe()'
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit cb3376604a676e0302258b01893911bdd7aa5278 ]
If an error occurs after a 'pci_enable_pcie_error_reporting()' call, it must be undone by a corresponding 'pci_disable_pcie_error_reporting()' call, as already done in the remove function.
--- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +1 -0
@@ -2707,6 +2707,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)kfree (ahw); err_out_free_res: +pci_disable_pcie_error_reporting (pdev);pci_release_regions (pdev); err_out_disable_pdev:
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 27/71 netxen_nic: Fix an error handling path in 'netxen_nic_probe()'
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 49a10c7b176295f8fafb338911cf028e97f65f4d ]
If an error occurs after a 'pci_enable_pcie_error_reporting()' call, it must be undone by a corresponding 'pci_disable_pcie_error_reporting()' call, as already done in the remove function.
--- drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +2 -0
@@ -1617,6 +1617,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)free_netdev (netdev); err_out_free_res: +if (NX_IS_REVISION_P3 (pdev->revision)) +pci_disable_pcie_error_reporting (pdev);pci_release_regions (pdev); err_out_disable_pdev:
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 28/71 net: cdc_ncm: switch to eth%d interface naming
In reply to Sasha LevinFrom: Maciej Żenczykowski <[email protected]>
[ Upstream commit c1a3d4067309451e68c33dbd356032549cc0bd8e ]
This is meant to make the host side cdc_ncm interface consistently named just like the older CDC protocols: cdc_ether & cdc_ecm (and even rndis_host), which all use 'FLAG_ETHER | FLAG_POINTTOPOINT'.
include/linux/usb/usbnet.h:
#define FLAG_ETHER 0x0020 /* maybe use "eth%d" names */
#define FLAG_WLAN 0x0080 /* use "wlan%d" names */
#define FLAG_WWAN 0x0400 /* use "wwan%d" names */
#define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */
drivers/net/usb/usbnet.c @ line 1711:
strcpy (net->name, "usb%d");
...
// heuristic: "usb%d" for links we know are two-host, // else "eth%d" when there's reasonable doubt. userspace // can rename the link if it knows better.
if ((dev->driver_info->flags & FLAG_ETHER) != 0 &&
((dev->driver_info->flags & FLAG_POINTTOPOINT) == 0 ||
(net->dev_addr [0] & 0x02) == 0))
strcpy (net->name, "eth%d");
/* WLAN devices should always be named "wlan%d" */
if ((dev->driver_info->flags & FLAG_WLAN) != 0)
strcpy(net->name, "wlan%d");
/* WWAN devices should always be named "wwan%d" */
if ((dev->driver_info->flags & FLAG_WWAN) != 0)
strcpy(net->name, "wwan%d");So by using ETHER | POINTTOPOINT the interface naming is either usb%d or eth%d based on the global uniqueness of the mac address of the device.
Without this 2.5gbps ethernet dongles which all seem to use the cdc_ncm driver end up being called usb%d instead of eth%d even though they're definitely not two-host. (All 1gbps & 5gbps ethernet usb dongles I've tested don't hit this problem due to use of different drivers, primarily r8152 and aqc111)
Fixes tag is based purely on git blame, and is really just here to make sure this hits LTS branches newer than v4.5.
--- drivers/net/usb/cdc_ncm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/cdc_ncm.c +1 -1
@@ -1639,7 +1639,7 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb)static const struct driver_info cdc_ncm_info = { .description ="CDC NCM" , .flags =FLAG_POINTTOPOINT |FLAG_NO_SETINT |FLAG_MULTI_PACKET - |FLAG_LINK_INTR , + |FLAG_LINK_INTR |FLAG_ETHER , .bind = cdc_ncm_bind, .unbind = cdc_ncm_unbind, .manage_power = usbnet_manage_power,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 29/71 net: usb: fix possible use-after-free in smsc75xx_bind
In reply to Sasha LevinFrom: Dongliang Mu <[email protected]>
[ Upstream commit 56b786d86694e079d8aad9b314e015cd4ac02a3d ]
The commit 46a8b29c6306 ("net: usb: fix memory leak in smsc75xx_bind") fails to clean up the work scheduled in smsc75xx_reset-> smsc75xx_set_multicast, which leads to use-after-free if the work is scheduled to start after the deallocation. In addition, this patch also removes a dangling pointer - dev->data[0].
This patch calls cancel_work_sync to cancel the scheduled work and set the dangling pointer to NULL.
--- drivers/net/usb/smsc75xx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/usb/smsc75xx.c +6 -4
@@ -1497,7 +1497,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) ret =smsc75xx_wait_ready (dev,0 );if (ret <0 ) {netdev_warn (dev->net,"device not ready in smsc75xx_bind\n" ); - goto err; + goto free_pdata; }smsc75xx_init_mac_address (dev);
@@ -1506,7 +1506,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) ret =smsc75xx_reset (dev);if (ret <0 ) {netdev_warn (dev->net,"smsc75xx_reset error %d\n" , ret); - goto err; + goto cancel_work; } dev->net->netdev_ops = &smsc75xx_netdev_ops;
@@ -1516,8 +1516,11 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;return 0 ; -err: +cancel_work: +cancel_work_sync (&pdata->set_multicast); +free_pdata:kfree (pdata); + dev->data[0 ] =0 ;return ret; }
@@ -1528,7 +1531,6 @@ static void smsc75xx_unbind(struct usbnet *dev, struct usb_interface *intf)cancel_work_sync (&pdata->set_multicast);netif_dbg (dev, ifdown, dev->net,"free pdata\n" );kfree (pdata); - pdata =NULL ; dev->data[0 ] =0 ; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 30/71 net: ipv4: fix memory leak in ip_mc_add1_src
In reply to Sasha LevinFrom: Chengyang Fan <[email protected]>
[ Upstream commit d8e2973029b8b2ce477b564824431f3385c77083 ]
BUG: memory leak
unreferenced object 0xffff888101bc4c00 (size 32):
comm "syz-executor527", pid 360, jiffies 4294807421 (age 19.329s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
01 00 00 00 00 00 00 00 ac 14 14 bb 00 00 02 00 ................
backtrace:
[<00000000f17c5244>] kmalloc include/linux/slab.h:558 [inline]
[<00000000f17c5244>] kzalloc include/linux/slab.h:688 [inline]
[<00000000f17c5244>] ip_mc_add1_src net/ipv4/igmp.c:1971 [inline]
[<00000000f17c5244>] ip_mc_add_src+0x95f/0xdb0 net/ipv4/igmp.c:2095
[<000000001cb99709>] ip_mc_source+0x84c/0xea0 net/ipv4/igmp.c:2416
[<0000000052cf19ed>] do_ip_setsockopt net/ipv4/ip_sockglue.c:1294 [inline]
[<0000000052cf19ed>] ip_setsockopt+0x114b/0x30c0 net/ipv4/ip_sockglue.c:1423
[<00000000477edfbc>] raw_setsockopt+0x13d/0x170 net/ipv4/raw.c:857
[<00000000e75ca9bb>] __sys_setsockopt+0x158/0x270 net/socket.c:2117
[<00000000bdb993a8>] __do_sys_setsockopt net/socket.c:2128 [inline]
[<00000000bdb993a8>] __se_sys_setsockopt net/socket.c:2125 [inline]
[<00000000bdb993a8>] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2125
[<000000006a1ffdbd>] do_syscall_64+0x40/0x80 arch/x86/entry/common.c:47
[<00000000b11467c4>] entry_SYSCALL_64_after_hwframe+0x44/0xaeIn commit 24803f38a5c0 ("igmp: do not remove igmp souce list info when set link down"), the ip_mc_clear_src() in ip_mc_destroy_dev() was removed, because it was also called in igmpv3_clear_delrec().
Rough callgraph:
inetdev_destroy
-> ip_mc_destroy_dev
-> igmpv3_clear_delrec
-> ip_mc_clear_src-> RCU_INIT_POINTER(dev->ip_ptr, NULL)
However, ip_mc_clear_src() called in igmpv3_clear_delrec() doesn't release in_dev->mc_list->sources. And RCU_INIT_POINTER() assigns the NULL to dev->ip_ptr. As a result, in_dev cannot be obtained through inetdev_by_index() and then in_dev->mc_list->sources cannot be released by ip_mc_del1_src() in the sock_close. Rough call sequence goes like:
sock_close
-> __sock_release
-> inet_release
-> ip_mc_drop_socket
-> inetdev_by_index
-> ip_mc_leave_src
-> ip_mc_del_src
-> ip_mc_del1_srcSo we still need to call ip_mc_clear_src() in ip_mc_destroy_dev() to free in_dev->mc_list->sources.
--- net/ipv4/igmp.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/igmp.c +1 -0
@@ -1782,6 +1782,7 @@ void ip_mc_destroy_dev(struct in_device *in_dev)while ((i =rtnl_dereference (in_dev->mc_list)) !=NULL ) { in_dev->mc_list = i->next_rcu; in_dev->mc_count--; +ip_mc_clear_src (i);ip_ma_put (i); } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 31/71 net/af_unix: fix a data-race in unix_dgram_sendmsg / unix_release_sock
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit a494bd642d9120648b06bb7d28ce6d05f55a7819 ]
While unix_may_send(sk, osk) is called while osk is locked, it appears unix_release_sock() can overwrite unix_peer() after this lock has been released, making KCSAN unhappy.
Changing unix_release_sock() to access/change unix_peer() before lock is released should fix this issue.
BUG: KCSAN: data-race in unix_dgram_sendmsg / unix_release_sock
write to 0xffff88810465a338 of 8 bytes by task 20852 on cpu 1:
unix_release_sock+0x4ed/0x6e0 net/unix/af_unix.c:558 unix_release+0x2f/0x50 net/unix/af_unix.c:859 __sock_release net/socket.c:599 [inline] sock_close+0x6c/0x150 net/socket.c:1258 __fput+0x25b/0x4e0 fs/file_table.c:280 ____fput+0x11/0x20 fs/file_table.c:313 task_work_run+0xae/0x130 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x156/0x190 kernel/entry/common.c:209 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x20/0x40 kernel/entry/common.c:302 do_syscall_64+0x56/0x90 arch/x86/entry/common.c:57 entry_SYSCALL_64_after_hwframe+0x44/0xae
read to 0xffff88810465a338 of 8 bytes by task 20888 on cpu 0:
unix_may_send net/unix/af_unix.c:189 [inline] unix_dgram_sendmsg+0x923/0x1610 net/unix/af_unix.c:1712 sock_sendmsg_nosec net/socket.c:654 [inline] sock_sendmsg net/socket.c:674 [inline] ____sys_sendmsg+0x360/0x4d0 net/socket.c:2350 ___sys_sendmsg net/socket.c:2404 [inline] __sys_sendmmsg+0x315/0x4b0 net/socket.c:2490 __do_sys_sendmmsg net/socket.c:2519 [inline] __se_sys_sendmmsg net/socket.c:2516 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2516 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae
value changed: 0xffff888167905400 -> 0x0000000000000000
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 20888 Comm: syz-executor.0 Not tainted 5.13.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- net/unix/af_unix.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/unix/af_unix.c +4 -3
@@ -534,12 +534,14 @@ static void unix_release_sock(struct sock *sk, int embrion) u->path.mnt =NULL ; state = sk->sk_state; sk->sk_state =TCP_CLOSE ; + + skpair =unix_peer (sk); +unix_peer (sk) =NULL ; +unix_state_unlock (sk);wake_up_interruptible_all (&u->peer_wait); - skpair =unix_peer (sk); -if (skpair !=NULL ) {if (sk->sk_type ==SOCK_STREAM || sk->sk_type ==SOCK_SEQPACKET ) {unix_state_lock (skpair);
@@ -554,7 +556,6 @@ static void unix_release_sock(struct sock *sk, int embrion)unix_dgram_peer_wake_disconnect (sk, skpair);sock_put (skpair);/* It may now die */ -unix_peer (sk) =NULL ; }/* Try to flush out this socket. Throw out buffers at least */
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 32/71 be2net: Fix an error handling path in 'be_probe()'
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit c19c8c0e666f9259e2fc4d2fa4b9ff8e3b40ee5d ]
If an error occurs after a 'pci_enable_pcie_error_reporting()' call, it must be undone by a corresponding 'pci_disable_pcie_error_reporting()' call, as already done in the remove function.
--- drivers/net/ethernet/emulex/benet/be_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/emulex/benet/be_main.c +1 -0
@@ -5998,6 +5998,7 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id) unmap_bars:be_unmap_pci_bars (adapter); free_netdev: +pci_disable_pcie_error_reporting (pdev);free_netdev (netdev); rel_reg:pci_release_regions (pdev);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 33/71 net: hamradio: fix memory leak in mkiss_close
In reply to Sasha LevinFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 7edcc682301492380fbdd604b4516af5ae667a13 ]
My local syzbot instance hit memory leak in mkiss_open()[1]. The problem was in missing free_netdev() in mkiss_close().
In mkiss_open() netdevice is allocated and then registered, but in mkiss_close() netdevice was only unregistered, but not freed.
Fail log:
BUG: memory leak
unreferenced object 0xffff8880281ba000 (size 4096):
comm "syz-executor.1", pid 11443, jiffies 4295046091 (age 17.660s)
hex dump (first 32 bytes):
61 78 30 00 00 00 00 00 00 00 00 00 00 00 00 00 ax0.............
00 27 fa 2a 80 88 ff ff 00 00 00 00 00 00 00 00 .'.*............
backtrace:
[<ffffffff81a27201>] kvmalloc_node+0x61/0xf0
[<ffffffff8706e7e8>] alloc_netdev_mqs+0x98/0xe80
[<ffffffff84e64192>] mkiss_open+0xb2/0x6f0 [1]
[<ffffffff842355db>] tty_ldisc_open+0x9b/0x110
[<ffffffff84236488>] tty_set_ldisc+0x2e8/0x670
[<ffffffff8421f7f3>] tty_ioctl+0xda3/0x1440
[<ffffffff81c9f273>] __x64_sys_ioctl+0x193/0x200
[<ffffffff8911263a>] do_syscall_64+0x3a/0xb0
[<ffffffff89200068>] entry_SYSCALL_64_after_hwframe+0x44/0xae
BUG: memory leak
unreferenced object 0xffff8880141a9a00 (size 96):
comm "syz-executor.1", pid 11443, jiffies 4295046091 (age 17.660s)
hex dump (first 32 bytes):
e8 a2 1b 28 80 88 ff ff e8 a2 1b 28 80 88 ff ff ...(.......(....
98 92 9c aa b0 40 02 00 00 00 00 00 00 00 00 00 .....@..........
backtrace:
[<ffffffff8709f68b>] __hw_addr_create_ex+0x5b/0x310
[<ffffffff8709fb38>] __hw_addr_add_ex+0x1f8/0x2b0
[<ffffffff870a0c7b>] dev_addr_init+0x10b/0x1f0
[<ffffffff8706e88b>] alloc_netdev_mqs+0x13b/0xe80
[<ffffffff84e64192>] mkiss_open+0xb2/0x6f0 [1]
[<ffffffff842355db>] tty_ldisc_open+0x9b/0x110
[<ffffffff84236488>] tty_set_ldisc+0x2e8/0x670
[<ffffffff8421f7f3>] tty_ioctl+0xda3/0x1440
[<ffffffff81c9f273>] __x64_sys_ioctl+0x193/0x200
[<ffffffff8911263a>] do_syscall_64+0x3a/0xb0
[<ffffffff89200068>] entry_SYSCALL_64_after_hwframe+0x44/0xae
BUG: memory leak
unreferenced object 0xffff8880219bfc00 (size 512):
comm "syz-executor.1", pid 11443, jiffies 4295046091 (age 17.660s)
hex dump (first 32 bytes):
00 a0 1b 28 80 88 ff ff 80 8f b1 8d ff ff ff ff ...(............
80 8f b1 8d ff ff ff ff 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff81a27201>] kvmalloc_node+0x61/0xf0
[<ffffffff8706eec7>] alloc_netdev_mqs+0x777/0xe80
[<ffffffff84e64192>] mkiss_open+0xb2/0x6f0 [1]
[<ffffffff842355db>] tty_ldisc_open+0x9b/0x110
[<ffffffff84236488>] tty_set_ldisc+0x2e8/0x670
[<ffffffff8421f7f3>] tty_ioctl+0xda3/0x1440
[<ffffffff81c9f273>] __x64_sys_ioctl+0x193/0x200
[<ffffffff8911263a>] do_syscall_64+0x3a/0xb0
[<ffffffff89200068>] entry_SYSCALL_64_after_hwframe+0x44/0xae
BUG: memory leak
unreferenced object 0xffff888029b2b200 (size 256):
comm "syz-executor.1", pid 11443, jiffies 4295046091 (age 17.660s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff81a27201>] kvmalloc_node+0x61/0xf0
[<ffffffff8706f062>] alloc_netdev_mqs+0x912/0xe80
[<ffffffff84e64192>] mkiss_open+0xb2/0x6f0 [1]
[<ffffffff842355db>] tty_ldisc_open+0x9b/0x110
[<ffffffff84236488>] tty_set_ldisc+0x2e8/0x670
[<ffffffff8421f7f3>] tty_ioctl+0xda3/0x1440
[<ffffffff81c9f273>] __x64_sys_ioctl+0x193/0x200
[<ffffffff8911263a>] do_syscall_64+0x3a/0xb0
[<ffffffff89200068>] entry_SYSCALL_64_after_hwframe+0x44/0xae--- drivers/net/hamradio/mkiss.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/hamradio/mkiss.c +1 -0
@@ -810,6 +810,7 @@ static void mkiss_close(struct tty_struct *tty) ax->tty =NULL ;unregister_netdev (ax->dev); +free_netdev (ax->dev); }/* Perform I/O control on an active ax25 channel. */
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 34/71 net: cdc_eem: fix tx fixup skb leak
In reply to Sasha LevinFrom: Linyu Yuan <[email protected]>
[ Upstream commit c3b26fdf1b32f91c7a3bc743384b4a298ab53ad7 ]
when usbnet transmit a skb, eem fixup it in eem_tx_fixup(), if skb_copy_expand() failed, it return NULL, usbnet_start_xmit() will have no chance to free original skb.
fix it by free orginal skb in eem_tx_fixup() first, then check skb clone status, if failed, return NULL to usbnet.
--- drivers/net/usb/cdc_eem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/cdc_eem.c +1 -1
@@ -138,10 +138,10 @@ static struct sk_buff *eem_tx_fixup(struct usbnet *dev, struct sk_buff *skb, } skb2 =skb_copy_expand (skb,EEM_HEAD ,ETH_FCS_LEN + padlen, flags); +dev_kfree_skb_any (skb);if (!skb2)return NULL ; -dev_kfree_skb_any (skb); skb = skb2; done:
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 35/71 net: ethernet: fix potential use-after-free in ec_bhf_remove
In reply to Sasha LevinFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 9cca0c2d70149160407bda9a9446ce0c29b6e6c6 ]
static void ec_bhf_remove(struct pci_dev *dev)
{
...
struct ec_bhf_priv *priv = netdev_priv(net_dev); unregister_netdev(net_dev); free_netdev(net_dev); pci_iounmap(dev, priv->dma_io); pci_iounmap(dev, priv->io);
...
}
priv is netdev private data, but it is used
after free_netdev(). It can cause use-after-free when accessing priv pointer. So, fix it by moving free_netdev() after pci_iounmap() calls.
--- drivers/net/ethernet/ec_bhf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/ec_bhf.c +3 -1
@@ -589,10 +589,12 @@ static void ec_bhf_remove(struct pci_dev *dev)struct ec_bhf_priv *priv =netdev_priv (net_dev);unregister_netdev (net_dev); -free_netdev (net_dev);pci_iounmap (dev, priv->dma_io);pci_iounmap (dev, priv->io); + +free_netdev (net_dev); +pci_release_regions (dev);pci_clear_master (dev);pci_disable_device (dev);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 36/71 scsi: core: Put .shost_dev in failure path if host state changes to RUNNING
In reply to Sasha LevinFrom: Ming Lei <[email protected]>
[ Upstream commit 11714026c02d613c30a149c3f4c4a15047744529 ]
scsi_host_dev_release() only frees dev_name when host state is SHOST_CREATED. After host state has changed to SHOST_RUNNING, scsi_host_dev_release() no longer cleans up.
Fix this by doing a put_device(&shost->shost_dev) in the failure path when host state is SHOST_RUNNING. Move get_device(&shost->shost_gendev) before device_add(&shost->shost_dev) so that scsi_host_cls_release() can do a put on this reference.
--- drivers/scsi/hosts.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/scsi/hosts.c +6 -2
@@ -265,12 +265,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,device_enable_async_suspend (&shost->shost_dev); +get_device (&shost->shost_gendev); error =device_add (&shost->shost_dev);if (error) goto out_del_gendev; -get_device (&shost->shost_gendev); -if (shost->transportt->host_size) { shost->shost_data =kzalloc (shost->transportt->host_size,GFP_KERNEL );
@@ -307,6 +306,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, out_del_dev:device_del (&shost->shost_dev); out_del_gendev: +/* +* Host state is SHOST_RUNNING so we have to explicitly release +* ->shost_dev. +*/ +put_device (&shost->shost_dev);device_del (&shost->shost_gendev); out_destroy_freelist:device_disable_async_suspend (&shost->shost_gendev);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 37/71 radeon: use memcpy_to/fromio for UVD fw upload
In reply to Sasha LevinFrom: Chen Li <[email protected]>
[ Upstream commit ab8363d3875a83f4901eb1cc00ce8afd24de6c85 ]
I met a gpu addr bug recently and the kernel log tells me the pc is memcpy/memset and link register is radeon_uvd_resume.
As we know, in some architectures, optimized memcpy/memset may not work well on device memory. Trival memcpy_toio/memset_io can fix this problem.
BTW, amdgpu has already done it in:
commit ba0b2275a678 ("drm/amdgpu: use memcpy_to/fromio for UVD fw upload"), that's why it has no this issue on the same gpu and platform.
--- drivers/gpu/drm/radeon/radeon_uvd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_uvd.c +2 -2
@@ -286,7 +286,7 @@ int radeon_uvd_resume(struct radeon_device *rdev)if (rdev->uvd.vcpu_bo ==NULL )return -EINVAL ; -memcpy (rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size); +memcpy_toio ((void __iomem *)rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size); size =radeon_bo_size (rdev->uvd.vcpu_bo); size -= rdev->uvd_fw->size;
@@ -294,7 +294,7 @@ int radeon_uvd_resume(struct radeon_device *rdev) ptr = rdev->uvd.cpu_addr; ptr += rdev->uvd_fw->size; -memset (ptr,0 , size); +memset_io ((void __iomem *)ptr,0 , size);return 0 ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 38/71 can: bcm: fix infoleak in struct bcm_msg_head
In reply to Sasha LevinFrom: Norbert Slusarek <[email protected]>
commit 5e87ddbe3942e27e939bdc02deb8579b0cbd8ecc upstream.
On 64-bit systems, struct bcm_msg_head has an added padding of 4 bytes between struct members count and ival1. Even though all struct members are initialized, the 4-byte hole will contain data from the kernel stack. This patch zeroes out struct bcm_msg_head before usage, preventing infoleaks to userspace.
--- net/can/bcm.c | 3 +++ 1 file changed, 3 insertions(+)
net/can/bcm.c +3 -0
@@ -405,6 +405,7 @@ static void bcm_tx_timeout_tsklet(unsigned long data)if (!op->count && (op->flags &TX_COUNTEVT )) {/* create notification to user */ +memset (&msg_head,0 ,sizeof (msg_head)); msg_head.opcode =TX_EXPIRED ; msg_head.flags = op->flags; msg_head.count = op->count;
@@ -452,6 +453,7 @@ static void bcm_rx_changed(struct bcm_op *op, struct canfd_frame *data)/* this element is not throttled anymore */ data->flags &= (BCM_CAN_FLAGS_MASK |RX_RECV ); +memset (&head,0 ,sizeof (head)); head.opcode =RX_CHANGED ; head.flags = op->flags; head.count = op->count;
@@ -566,6 +568,7 @@ static void bcm_rx_timeout_tsklet(unsigned long data)struct bcm_msg_head msg_head;/* create notification to user */ +memset (&msg_head,0 ,sizeof (msg_head)); msg_head.opcode =RX_TIMEOUT ; msg_head.flags = op->flags; msg_head.count = op->count;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 39/71 tracing: Do no increment trace_clock_global() by one
In reply to Sasha LevinFrom: "Steven Rostedt (VMware)" <[email protected]>
commit 89529d8b8f8daf92d9979382b8d2eb39966846ea upstream.
The trace_clock_global() tries to make sure the events between CPUs is somewhat in order. A global value is used and updated by the latest read of a clock. If one CPU is ahead by a little, and is read by another CPU, a lock is taken, and if the timestamp of the other CPU is behind, it will simply use the other CPUs timestamp.
The lock is also only taken with a "trylock" due to tracing, and strange recursions can happen. The lock is not taken at all in NMI context.
In the case where the lock is not able to be taken, the non synced timestamp is returned. But it will not be less than the saved global timestamp.
The problem arises because when the time goes "backwards" the time returned is the saved timestamp plus 1. If the lock is not taken, and the plus one to the timestamp is returned, there's a small race that can cause the time to go backwards!
CPU0 CPU1
---- ----
trace_clock_global() {
ts = clock() [ 1000 ]
trylock(clock_lock) [ success ]
global_ts = ts; [ 1000 ]
<interrupted by NMI>
trace_clock_global() {
ts = clock() [ 999 ]
if (ts < global_ts)
ts = global_ts + 1 [ 1001 ]
trylock(clock_lock) [ fail ]
return ts [ 1001]
}
unlock(clock_lock);
return ts; [ 1000 ]
} trace_clock_global() {
ts = clock() [ 1000 ]
if (ts < global_ts) [ false 1000 == 1000 ]
trylock(clock_lock) [ success ]
global_ts = ts; [ 1000 ]
unlock(clock_lock)
return ts; [ 1000 ]}
The above case shows to reads of trace_clock_global() on the same CPU, but the second read returns one less than the first read. That is, time when backwards, and this is not what is allowed by trace_clock_global().
This was triggered by heavy tracing and the ring buffer checker that tests for the clock going backwards:
Ring buffer clock went backwards: 20613921464 -> 20613921463
------------[ cut here ]------------ WARNING: CPU: 2 PID: 0 at kernel/trace/ring_buffer.c:3412 check_buffer+0x1b9/0x1c0 Modules linked in: [..] [CPU: 2]TIME DOES NOT MATCH expected:20620711698 actual:20620711697 delta:6790234 before:20613921463 after:20613921463 [20613915818] PAGE TIME STAMP [20613915818] delta:0 [20613915819] delta:1 [20613916035] delta:216 [20613916465] delta:430 [20613916575] delta:110 [20613916749] delta:174 [20613917248] delta:499 [20613917333] delta:85 [20613917775] delta:442 [20613917921] delta:146 [20613918321] delta:400 [20613918568] delta:247 [20613918768] delta:200 [20613919306] delta:538 [20613919353] delta:47 [20613919980] delta:627 [20613920296] delta:316 [20613920571] delta:275 [20613920862] delta:291 [20613921152] delta:290 [20613921464] delta:312 [20613921464] delta:0 TIME EXTEND [20613921464] delta:0
This happened more than once, and always for an off by one result. It also started happening after commit aafe104aa9096 was added.
--- kernel/trace/trace_clock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/trace_clock.c +3 -3
@@ -113,9 +113,9 @@ u64 notrace trace_clock_global(void) prev_time =READ_ONCE (trace_clock_struct.prev_time); now =sched_clock_cpu (this_cpu); -/* Make sure that now is always greater than prev_time */ +/* Make sure that now is always greater than or equal to prev_time */ if ((s64)(now - prev_time) <0 ) - now = prev_time +1 ; + now = prev_time;/* * If in an NMI context then dont risk lockups and simply return
@@ -129,7 +129,7 @@ u64 notrace trace_clock_global(void)/* Reread prev_time in case it was already updated */ prev_time =READ_ONCE (trace_clock_struct.prev_time);if ((s64)(now - prev_time) <0 ) - now = prev_time +1 ; + now = prev_time; trace_clock_struct.prev_time = now;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 40/71 PCI: Mark TI C667X to avoid bus reset
In reply to Sasha LevinFrom: Antti Järvinen <[email protected]>
commit b5cf198e74a91073d12839a3e2db99994a39995d upstream.
Some TI KeyStone C667X devices do not support bus/hot reset. The PCIESS automatically disables LTSSM when Secondary Bus Reset is received and device stops working. Prevent bus reset for these devices. With this change, the device can be assigned to VMs with VFIO, but it will leak state between VMs.
Reference: https://e2e.ti.com/support/processors/f/791/t/954382
--- drivers/pci/quirks.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/pci/quirks.c +10 -0
@@ -3358,6 +3358,16 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0033 , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0034 , quirk_no_bus_reset); +/* +* Some TI KeyStone C667X devices do not support bus/hot reset. The PCIESS +* automatically disables LTSSM when Secondary Bus Reset is received and +* the device stops working. Prevent bus reset for these devices. With +* this change, the device can be assigned to VMs with VFIO, but it will +* leak state between VMs. Reference +* https://e2e.ti.com/support/processors/f/791/t/954382 +*/ +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_TI ,0xb005 , quirk_no_bus_reset); +static void quirk_no_pm_reset (struct pci_dev *dev) {/*
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 41/71 PCI: Mark some NVIDIA GPUs to avoid bus reset
In reply to Sasha LevinFrom: Shanker Donthineni <[email protected]>
commit 4c207e7121fa92b66bf1896bf8ccb9edfb0f9731 upstream.
Some NVIDIA GPU devices do not work with SBR. Triggering SBR leaves the device inoperable for the current system boot. It requires a system hard-reboot to get the GPU device back to normal operating condition post-SBR. For the affected devices, enable NO_BUS_RESET quirk to avoid the issue.
This issue will be fixed in the next generation of hardware.
--- drivers/pci/quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/pci/quirks.c +12 -0
@@ -3345,6 +3345,18 @@ static void quirk_no_bus_reset(struct pci_dev *dev) dev->dev_flags |=PCI_DEV_FLAGS_NO_BUS_RESET ; } +/* +* Some NVIDIA GPU devices do not work with bus reset, SBR needs to be +* prevented for those affected devices. +*/ +static void quirk_nvidia_no_bus_reset (struct pci_dev *dev) +{ +if ((dev->device &0xffc0 ) ==0x2340 ) +quirk_no_bus_reset (dev); +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_NVIDIA ,PCI_ANY_ID , + quirk_nvidia_no_bus_reset); +/* * Some Atheros AR9xxx and QCA988x chips do not behave after a bus reset. * The device will throw a Link Down error on AER-capable systems and
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 42/71 ARCv2: save ABI registers across signal handling
In reply to Sasha LevinFrom: Vineet Gupta <[email protected]>
commit 96f1b00138cb8f04c742c82d0a7c460b2202e887 upstream.
ARCv2 has some configuration dependent registers (r30, r58, r59) which could be targetted by the compiler. To keep the ABI stable, these were unconditionally part of the glibc ABI (sysdeps/unix/sysv/linux/arc/sys/ucontext.h:mcontext_t) however we missed populating them (by saving/restoring them across signal handling).
This patch fixes the issue by
- adding arcv2 ABI regs to kernel struct sigcontext
- populating them during signal handling
Change to struct sigcontext might seem like a glibc ABI change (although it primarily uses ucontext_t:mcontext_t) but the fact is
- it has only been extended (existing fields are not touched)
- the old sigcontext was ABI incomplete to begin with anyways
--- arch/arc/include/uapi/asm/sigcontext.h | 1 + arch/arc/kernel/signal.c | 43 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)
arch/arc/include/uapi/asm/sigcontext.h +1 -0
@@ -17,6 +17,7 @@*/ struct sigcontext {struct user_regs_struct regs; +struct user_regs_arcv2 v2abi; };#endif /* _ASM_ARC_SIGCONTEXT_H */
arch/arc/kernel/signal.c +43 -0
61 lines not on this page · raw message
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 43/71 dmaengine: pl330: fix wrong usage of spinlock flags in dma_cyclc
In reply to Sasha LevinFrom: Bumyong Lee <[email protected]>
commit 4ad5dd2d7876d79507a20f026507d1a93b8fff10 upstream.
flags varible which is the input parameter of pl330_prep_dma_cyclic() should not be used by spinlock_irq[save/restore] function.
--- drivers/dma/pl330.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/dma/pl330.c +4 -2
@@ -2579,13 +2579,15 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(for (i =0 ; i < len / period_len; i++) { desc =pl330_get_desc (pch);if (!desc) { +unsigned long iflags; +dev_err (pch->dmac->ddma.dev,"%s:%d Unable to fetch desc\n" , __func__, __LINE__);if (!first)return NULL ; -spin_lock_irqsave (&pl330->pool_lock, flags); +spin_lock_irqsave (&pl330->pool_lock, iflags);while (!list_empty (&first->node)) { desc = list_entry(first->node.next,
@@ -2595,7 +2597,7 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(list_move_tail (&first->node, &pl330->desc_pool); -spin_unlock_irqrestore (&pl330->pool_lock, flags); +spin_unlock_irqrestore (&pl330->pool_lock, iflags);return NULL ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 44/71 net: fec_ptp: add clock rate zero check
In reply to Sasha LevinFrom: Fugang Duan <[email protected]>
commit cb3cefe3f3f8af27c6076ef7d1f00350f502055d upstream.
Add clock rate zero check to fix coverity issue of "divide by 0".
--- drivers/net/ethernet/freescale/fec_ptp.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/freescale/fec_ptp.c +4 -0
@@ -586,6 +586,10 @@ void fec_ptp_init(struct platform_device *pdev) fep->ptp_caps.enable = fec_ptp_enable; fep->cycle_speed =clk_get_rate (fep->clk_ptp); +if (!fep->cycle_speed) { + fep->cycle_speed =NSEC_PER_SEC ; +dev_err (&fep->pdev->dev,"clk_ptp clock rate is zero\n" ); + } fep->ptp_inc =NSEC_PER_SEC / fep->cycle_speed;spin_lock_init (&fep->tmreg_lock);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 45/71 can: bcm/raw/isotp: use per module netdevice notifier
In reply to Sasha LevinFrom: Tetsuo Handa <[email protected]>
commit 8d0caedb759683041d9db82069937525999ada53 upstream.
syzbot is reporting hung task at register_netdevice_notifier() [1] and unregister_netdevice_notifier() [2], for cleanup_net() might perform time consuming operations while CAN driver's raw/bcm/isotp modules are calling {register,unregister}_netdevice_notifier() on each socket.
Change raw/bcm/isotp modules to call register_netdevice_notifier() from module's __init function and call unregister_netdevice_notifier() from module's __exit function, as with gw/j1939 modules are doing.
--- net/can/bcm.c | 61 +++++++++++++++++++++++++++++++++++++++----------- net/can/raw.c | 62 +++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 96 insertions(+), 27 deletions(-)
net/can/bcm.c +48 -13
@@ -127,7 +127,7 @@ struct bcm_sock {struct sock sk;int bound;int ifindex; -struct notifier_block notifier; +struct list_head notifier;struct list_head rx_ops;struct list_head tx_ops;unsigned long dropped_usr_msgs;
@@ -135,6 +135,10 @@ struct bcm_sock {char procname [32 ];/* inode number in decimal with \0 */ }; +static LIST_HEAD (bcm_notifier_list); +static DEFINE_SPINLOCK (bcm_notifier_lock); +static struct bcm_sock *bcm_busy_notifier; +static inline struct bcm_sock *bcm_sk (const struct sock *sk) {return (struct bcm_sock *)sk;
@@ -1439,20 +1443,15 @@ static int bcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)/* * notification handler for netdevice status changes */ -static int bcm_notifier (struct notifier_block *nb,unsigned long msg, -void *ptr) +static void bcm_notify (struct bcm_sock *bo,unsigned long msg, +struct net_device *dev) { -struct net_device *dev =netdev_notifier_info_to_dev (ptr); - struct bcm_sock *bo = container_of(nb, struct bcm_sock, notifier);struct sock *sk = &bo->sk;struct bcm_op *op;int notify_enodev =0 ;if (!net_eq (dev_net (dev), &init_net)) -return NOTIFY_DONE ; - -if (dev->type !=ARPHRD_CAN ) -return NOTIFY_DONE ; +return ;switch (msg) {
@@ -1487,7 +1486,28 @@ static int bcm_notifier(struct notifier_block *nb, unsigned long msg, sk->sk_error_report (sk); } } +} +static int bcm_notifier (struct notifier_block *nb,unsigned long msg, +void *ptr) +{ +struct net_device *dev =netdev_notifier_info_to_dev (ptr); + +if (dev->type !=ARPHRD_CAN ) +return NOTIFY_DONE ; +if (msg !=NETDEV_UNREGISTER && msg !=NETDEV_DOWN ) +return NOTIFY_DONE ; +if (unlikely (bcm_busy_notifier))/* Check for reentrant bug. */ +return NOTIFY_DONE ; + +spin_lock (&bcm_notifier_lock); +list_for_each_entry (bcm_busy_notifier, &bcm_notifier_list, notifier) { +spin_unlock (&bcm_notifier_lock); +bcm_notify (bcm_busy_notifier, msg, dev); +spin_lock (&bcm_notifier_lock); + } + bcm_busy_notifier =NULL ; +spin_unlock (&bcm_notifier_lock);return NOTIFY_DONE ; }
@@ -1507,9 +1527,9 @@ static int bcm_init(struct sock *sk)INIT_LIST_HEAD (&bo->rx_ops);/* set notifier */ - bo->notifier.notifier_call = bcm_notifier; - -register_netdevice_notifier (&bo->notifier); +spin_lock (&bcm_notifier_lock); +list_add_tail (&bo->notifier, &bcm_notifier_list); +spin_unlock (&bcm_notifier_lock);return 0 ; }
@@ -1530,7 +1550,14 @@ static int bcm_release(struct socket *sock)/* remove bcm_ops, timer, rx_unregister(), etc. */ -unregister_netdevice_notifier (&bo->notifier); +spin_lock (&bcm_notifier_lock); +while (bcm_busy_notifier == bo) { +spin_unlock (&bcm_notifier_lock); +schedule_timeout_uninterruptible (1 ); +spin_lock (&bcm_notifier_lock); + } +list_del (&bo->notifier); +spin_unlock (&bcm_notifier_lock);lock_sock (sk);
@@ -1716,6 +1743,10 @@ static const struct can_proto bcm_can_proto = { .prot = &bcm_proto, }; +static struct notifier_block canbcm_notifier = { + .notifier_call = bcm_notifier +}; +static int __init bcm_module_init (void ) {int err;
@@ -1730,6 +1761,8 @@ static int __init bcm_module_init(void)/* create /proc/net/can-bcm directory */ proc_dir =proc_mkdir ("can-bcm" , init_net.proc_net); +register_netdevice_notifier (&canbcm_notifier); +return 0 ; }
@@ -1739,6 +1772,8 @@ static void __exit bcm_module_exit(void)if (proc_dir)remove_proc_entry ("can-bcm" , init_net.proc_net); + +unregister_netdevice_notifier (&canbcm_notifier); }module_init (bcm_module_init);
net/can/raw.c +48 -14
123 lines not on this page · raw message
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 46/71 usb: dwc3: core: fix kernel panic when do reboot
In reply to Sasha LevinFrom: Peter Chen <[email protected]>
commit 4bf584a03eec674975ee9fe36c8583d9d470dab1 upstream.
When do system reboot, it calls dwc3_shutdown and the whole debugfs for dwc3 has removed first, when the gadget tries to do deinit, and remove debugfs for its endpoints, it meets NULL pointer dereference issue when call debugfs_lookup. Fix it by removing the whole dwc3 debugfs later than dwc3_drd_exit.
[ 2924.958838] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000002 .... [ 2925.030994] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--) [ 2925.037005] pc : inode_permission+0x2c/0x198 [ 2925.041281] lr : lookup_one_len_common+0xb0/0xf8 [ 2925.045903] sp : ffff80001276ba70 [ 2925.049218] x29: ffff80001276ba70 x28: ffff0000c01f0000 x27: 0000000000000000 [ 2925.056364] x26: ffff800011791e70 x25: 0000000000000008 x24: dead000000000100 [ 2925.063510] x23: dead000000000122 x22: 0000000000000000 x21: 0000000000000001 [ 2925.070652] x20: ffff8000122c6188 x19: 0000000000000000 x18: 0000000000000000 [ 2925.077797] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000004 [ 2925.084943] x14: ffffffffffffffff x13: 0000000000000000 x12: 0000000000000030 [ 2925.092087] x11: 0101010101010101 x10: 7f7f7f7f7f7f7f7f x9 : ffff8000102b2420 [ 2925.099232] x8 : 7f7f7f7f7f7f7f7f x7 : feff73746e2f6f64 x6 : 0000000000008080 [ 2925.106378] x5 : 61c8864680b583eb x4 : 209e6ec2d263dbb7 x3 : 000074756f307065 [ 2925.113523] x2 : 0000000000000001 x1 : 0000000000000000 x0 : ffff8000122c6188 [ 2925.120671] Call trace: [ 2925.123119] inode_permission+0x2c/0x198 [ 2925.127042] lookup_one_len_common+0xb0/0xf8 [ 2925.131315] lookup_one_len_unlocked+0x34/0xb0 [ 2925.135764] lookup_positive_unlocked+0x14/0x50 [ 2925.140296] debugfs_lookup+0x68/0xa0 [ 2925.143964] dwc3_gadget_free_endpoints+0x84/0xb0 [ 2925.148675] dwc3_gadget_exit+0x28/0x78 [ 2925.152518] dwc3_drd_exit+0x100/0x1f8 [ 2925.156267] dwc3_remove+0x11c/0x120 [ 2925.159851] dwc3_shutdown+0x14/0x20 [ 2925.163432] platform_shutdown+0x28/0x38 [ 2925.167360] device_shutdown+0x15c/0x378 [ 2925.171291] kernel_restart_prepare+0x3c/0x48 [ 2925.175650] kernel_restart+0x1c/0x68 [ 2925.179316] __do_sys_reboot+0x218/0x240 [ 2925.183247] __arm64_sys_reboot+0x28/0x30 [ 2925.187262] invoke_syscall+0x48/0x100 [ 2925.191017] el0_svc_common.constprop.0+0x48/0xc8 [ 2925.195726] do_el0_svc+0x28/0x88 [ 2925.199045] el0_svc+0x20/0x30 [ 2925.202104] el0_sync_handler+0xa8/0xb0 [ 2925.205942] el0_sync+0x148/0x180 [ 2925.209270] Code: a9025bf5 2a0203f5 121f0056 370802b5 (79400660) [ 2925.215372] ---[ end trace 124254d8e485a58b ]--- [ 2925.220012] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b [ 2925.227676] Kernel Offset: disabled [ 2925.231164] CPU features: 0x00001001,20000846 [ 2925.235521] Memory Limit: none [ 2925.238580] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---
--- drivers/usb/dwc3/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/core.c +1 -1
@@ -1199,8 +1199,8 @@ static int dwc3_remove(struct platform_device *pdev)*/ res->start -=DWC3_GLOBALS_REGS_START ; -dwc3_debugfs_exit (dwc);dwc3_core_exit_mode (dwc); +dwc3_debugfs_exit (dwc);dwc3_core_exit (dwc);dwc3_ulpi_exit (dwc);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 47/71 tracing: Do not stop recording cmdlines when tracing is off
In reply to Sasha LevinFrom: "Steven Rostedt (VMware)" <[email protected]>
commit 85550c83da421fb12dc1816c45012e1e638d2b38 upstream.
The saved_cmdlines is used to map pids to the task name, such that the output of the tracing does not just show pids, but also gives a human readable name for the task.
If the name is not mapped, the output looks like this:
<...>-1316 [005] ...2 132.044039: ...
Instead of this:
gnome-shell-1316 [005] ...2 132.044039: ...
The names are updated when tracing is running, but are skipped if tracing is stopped. Unfortunately, this stops the recording of the names if the top level tracer is stopped, and not if there's other tracers active.
The recording of a name only happens when a new event is written into a ring buffer, so there is no need to test if tracing is on or not. If tracing is off, then no event is written and no need to test if tracing is off or not.
Remove the check, as it hides the names of tasks for events in the instance buffers.
--- kernel/trace/trace.c | 3 --- 1 file changed, 3 deletions(-)
kernel/trace/trace.c +0 -3
@@ -1882,9 +1882,6 @@ void trace_find_cmdline(int pid, char comm[])void tracing_record_cmdline (struct task_struct *tsk) { -if (atomic_read (&trace_record_cmdline_disabled) || !tracing_is_on ()) -return ; -if (!__this_cpu_read (trace_cmdline_save))return ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 48/71 tracing: Do not stop recording comms if the trace file is being read
In reply to Sasha LevinFrom: "Steven Rostedt (VMware)" <[email protected]>
commit 4fdd595e4f9a1ff6d93ec702eaecae451cfc6591 upstream.
A while ago, when the "trace" file was opened, tracing was stopped, and code was added to stop recording the comms to saved_cmdlines, for mapping of the pids to the task name.
Code has been added that only records the comm if a trace event occurred, and there's no reason to not trace it if the trace file is opened.
--- kernel/trace/trace.c | 9 --------- 1 file changed, 9 deletions(-)
kernel/trace/trace.c +0 -9
@@ -1616,9 +1616,6 @@ struct saved_cmdlines_buffer { };static struct saved_cmdlines_buffer *savedcmd; -/* temporary disable recording */ -static atomic_t trace_record_cmdline_disabled__read_mostly ; -static inline char *get_saved_cmdlines (int idx) {return &savedcmd->saved_cmdlines[idx *TASK_COMM_LEN ];
@@ -2825,9 +2822,6 @@ static void *s_start(struct seq_file *m, loff_t *pos)return ERR_PTR (-EBUSY );#endif -if (!iter->snapshot) -atomic_inc (&trace_record_cmdline_disabled); -if (*pos != iter->pos) { iter->ent =NULL ; iter->cpu =0 ;
@@ -2870,9 +2864,6 @@ static void s_stop(struct seq_file *m, void *p)return ;#endif -if (!iter->snapshot) -atomic_dec (&trace_record_cmdline_disabled); -trace_access_unlock (iter->cpu_file);trace_event_read_unlock (); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 49/71 x86/fpu: Reset state for all signal restore failures
In reply to Sasha LevinFrom: Thomas Gleixner <[email protected]>
commit efa165504943f2128d50f63de0c02faf6dcceb0d upstream.
If access_ok() or fpregs_soft_set() fails in __fpu__restore_sig() then the function just returns but does not clear the FPU state as it does for all other fatal failures.
Clear the FPU state for these failures as well.
--- arch/x86/kernel/fpu/signal.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
arch/x86/kernel/fpu/signal.c +13 -5
@@ -276,15 +276,23 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)return 0 ; } -if (!access_ok (VERIFY_READ , buf, size)) +if (!access_ok (VERIFY_READ , buf, size)) { +fpu__clear (fpu);return -EACCES ; + }fpu__activate_curr (fpu); -if (!static_cpu_has (X86_FEATURE_FPU )) -return fpregs_soft_set (current,NULL , -0 ,sizeof (struct user_i387_ia32_struct ), -NULL , buf) !=0 ; +if (!static_cpu_has (X86_FEATURE_FPU )) { +int ret =fpregs_soft_set (current,NULL ,0 , +sizeof (struct user_i387_ia32_struct ), +NULL , buf); + +if (ret) +fpu__clear (fpu); + +return ret !=0 ; + }if (use_xsave ()) {struct _fpx_sw_bytes fx_sw_user;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 50/71 inet: use bigger hash table for IP ID generation
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
commit aa6dd211e4b1dde9d5dc25d699d35f789ae7eeba upstream.
In commit 73f156a6e8c1 ("inetpeer: get rid of ip_id_count") I used a very small hash table that could be abused by patient attackers to reveal sensitive information.
Switch to a dynamic sizing, depending on RAM size.
Typical big hosts will now use 128x more storage (2 MB) to get a similar increase in security and reduction of hash collisions.
As a bonus, use of alloc_large_system_hash() spreads allocated memory among all NUMA nodes.
--- net/ipv4/route.c | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-)
net/ipv4/route.c +29 -13
@@ -70,6 +70,7 @@#include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> +#include <linux/bootmem.h> #include <linux/string.h> #include <linux/socket.h> #include <linux/sockios.h>
@@ -463,8 +464,10 @@ static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,return neigh_create (&arp_tbl, pkey, dev); } -#define IP_IDENTS_SZ 2048u - +/* Hash tables of size 2048..262144 depending on RAM size. +* Each bucket uses 8 bytes. +*/ +static u32 ip_idents_mask__read_mostly ;static atomic_t *ip_idents__read_mostly ;static u32 *ip_tstamps__read_mostly ;
@@ -474,12 +477,16 @@ static u32 *ip_tstamps __read_mostly;*/ u32 ip_idents_reserve (u32 hash,int segs) { -u32 *p_tstamp = ip_tstamps + hash %IP_IDENTS_SZ ; -atomic_t *p_id = ip_idents + hash %IP_IDENTS_SZ ; -u32 old =ACCESS_ONCE (*p_tstamp); -u32 now = (u32 )jiffies; +u32 bucket, old, now = (u32 )jiffies; +atomic_t *p_id; +u32 *p_tstamp;u32 delta =0 ; + bucket = hash & ip_idents_mask; + p_tstamp = ip_tstamps + bucket; + p_id = ip_idents + bucket; + old =ACCESS_ONCE (*p_tstamp); +if (old != now &&cmpxchg (p_tstamp, old, now) == old) delta =prandom_u32_max (now - old);
@@ -2936,18 +2943,27 @@ struct ip_rt_acct __percpu *ip_rt_acct __read_mostly;int __init ip_rt_init (void ) { +void *idents_hash;int rc =0 ;int cpu; - ip_idents =kmalloc (IP_IDENTS_SZ *sizeof (*ip_idents),GFP_KERNEL ); -if (!ip_idents) -panic ("IP: failed to allocate ip_idents\n" ); +/* For modern hosts, this will use 2 MB of memory */ + idents_hash =alloc_large_system_hash ("IP idents" , +sizeof (*ip_idents) +sizeof (*ip_tstamps), +0 , +16 ,/* one bucket per 64 KB */ +0 , +NULL , + &ip_idents_mask, +2048 , +256 *1024 ); + + ip_idents = idents_hash; -prandom_bytes (ip_idents,IP_IDENTS_SZ *sizeof (*ip_idents)); +prandom_bytes (ip_idents, (ip_idents_mask +1 ) *sizeof (*ip_idents)); - ip_tstamps =kcalloc (IP_IDENTS_SZ ,sizeof (*ip_tstamps),GFP_KERNEL ); -if (!ip_tstamps) -panic ("IP: failed to allocate ip_tstamps\n" ); + ip_tstamps = idents_hash + (ip_idents_mask +1 ) *sizeof (*ip_idents); +memset (ip_tstamps,0 , (ip_idents_mask +1 ) *sizeof (*ip_tstamps));for_each_possible_cpu (cpu) {struct uncached_list *ul = &per_cpu (rt_uncached_list, cpu);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 51/71 i40e: Be much more verbose about what we can and cannot offload
In reply to Sasha LevinFrom: Alexander Duyck <[email protected]>
commit f114dca2533ca770aebebffb5ed56e5e7d1fb3fb upstream.
This change makes it so that we are much more robust about defining what we can and cannot offload. Previously we were just checking for the L4 tunnel header length, however there are other fields we should be verifying as there are multiple scenarios in which we cannot perform hardware offloads.
In addition the device only supports GSO as long as the MSS is 64 or greater. We were not checking this so an MSS less than that was resulting in Tx hangs.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 52 +++++++++++++++++---- 1 file changed, 44 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +44 -8
@@ -9059,10 +9059,6 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, 0, 0, nlflags, filter_mask, NULL); } -/* Hardware supports L4 tunnel length of 128B (=2^7) which includes -* inner mac plus all inner ethertypes. -*/ -#define I40E_MAX_TUNNEL_HDR_LEN 128/** * i40e_features_check - Validate encapsulated packet conforms to limits * @skb: skb buff
@@ -9073,12 +9069,52 @@ static netdev_features_t i40e_features_check(struct sk_buff *skb,struct net_device *dev, netdev_features_t features) { -if (skb->encapsulation && - ((skb_inner_network_header (skb) -skb_transport_header (skb)) > -I40E_MAX_TUNNEL_HDR_LEN )) -return features & ~(NETIF_F_CSUM_MASK |NETIF_F_GSO_MASK ); + size_t len; + +/* No point in doing any of this if neither checksum nor GSO are +* being requested for this frame. We can rule out both by just +* checking for CHECKSUM_PARTIAL +*/ +if (skb->ip_summed !=CHECKSUM_PARTIAL ) +return features; + +/* We cannot support GSO if the MSS is going to be less than +* 64 bytes. If it is then we need to drop support for GSO. +*/ +if (skb_is_gso (skb) && (skb_shinfo (skb)->gso_size <64 )) + features &= ~NETIF_F_GSO_MASK ; + +/* MACLEN can support at most 63 words */ + len =skb_network_header (skb) - skb->data; +if (len & ~(63 *2 )) + goto out_err; + +/* IPLEN and EIPLEN can support at most 127 dwords */ + len =skb_transport_header (skb) -skb_network_header (skb); +if (len & ~(127 *4 )) + goto out_err; + +if (skb->encapsulation) { +/* L4TUNLEN can support 127 words */ + len =skb_inner_network_header (skb) -skb_transport_header (skb); +if (len & ~(127 *2 )) + goto out_err; + +/* IPLEN can support at most 127 dwords */ + len =skb_inner_transport_header (skb) - +skb_inner_network_header (skb); +if (len & ~(127 *4 )) + goto out_err; + } + +/* No need to validate L4LEN as TCP is the only protocol with a +* a flexible value and we support all possible values supported +* by TCP, which is at most 15 dwords +*/ return features; +out_err: +return features & ~(NETIF_F_CSUM_MASK |NETIF_F_GSO_MASK ); } static const struct net_device_ops i40e_netdev_ops = {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 52/71 ARM: 9081/1: fix gcc-10 thumb2-kernel regression
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
commit dad7b9896a5dbac5da8275d5a6147c65c81fb5f2 upstream.
When building the kernel wtih gcc-10 or higher using the CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y flag, the compiler picks a slightly different set of registers for the inline assembly in cpu_init() that subsequently results in a corrupt kernel stack as well as remaining in FIQ mode. If a banked register is used for the last argument, the wrong version of that register gets loaded into CPSR_c. When building in Arm mode, the arguments are passed as immediate values and the bug cannot happen.
This got introduced when Daniel reworked the FIQ handling and was technically always broken, but happened to work with both clang and gcc before gcc-10 as long as they picked one of the lower registers. This is probably an indication that still very few people build the kernel in Thumb2 mode.
Marek pointed out the problem on IRC, Arnd narrowed it down to this inline assembly and Russell pinpointed the exact bug.
Change the constraints to force the final mode switch to use a non-banked register for the argument to ensure that the correct constant gets loaded. Another alternative would be to always use registers for the constant arguments to avoid the #ifdef that has now become more complex.
--- arch/arm/kernel/setup.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
arch/arm/kernel/setup.c +9 -7
@@ -547,9 +547,11 @@ void notrace cpu_init(void)* In Thumb-2, msr with an immediate value is not allowed. */ #ifdef CONFIG_THUMB2_KERNEL -#define PLC "r" +#define PLC_l "l" +#define PLC_r "r"#else -#define PLC "I" +#define PLC_l "I" +#define PLC_r "I"#endif /*
@@ -571,15 +573,15 @@ void notrace cpu_init(void) "msr cpsr_c, %9" : : "r" (stk), - PLC (PSR_F_BIT | PSR_I_BIT | IRQ_MODE), + PLC_r (PSR_F_BIT | PSR_I_BIT | IRQ_MODE), "I" (offsetof(struct stack, irq[0])), - PLC (PSR_F_BIT | PSR_I_BIT | ABT_MODE), + PLC_r (PSR_F_BIT | PSR_I_BIT | ABT_MODE), "I" (offsetof(struct stack, abt[0])), - PLC (PSR_F_BIT | PSR_I_BIT | UND_MODE), + PLC_r (PSR_F_BIT | PSR_I_BIT | UND_MODE), "I" (offsetof(struct stack, und[0])), - PLC (PSR_F_BIT | PSR_I_BIT | FIQ_MODE), + PLC_r (PSR_F_BIT | PSR_I_BIT | FIQ_MODE), "I" (offsetof(struct stack, fiq[0])), - PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE) + PLC_l (PSR_F_BIT | PSR_I_BIT | SVC_MODE) : "r14");#endif }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 53/71 Makefile: Move -Wno-unused-but-set-variable out of GCC only block
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
commit 885480b084696331bea61a4f7eba10652999a9c1 upstream.
Currently, -Wunused-but-set-variable is only supported by GCC so it is disabled unconditionally in a GCC only block (it is enabled with W=1). clang currently has its implementation for this warning in review so preemptively move this statement out of the GCC only block and wrap it with cc-disable-warning so that both compilers function the same.
--- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Makefile +1 -2
@@ -718,12 +718,11 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) # See modpost pattern 2 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) -else +endif # These warnings generated too much noise in a regular build. # Use make W=1 to enable them (see scripts/Makefile.extrawarn) KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) -endif KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) ifdef CONFIG_FRAME_POINTER
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 54/71 arm64: perf: Disable PMU while processing counter overflows
In reply to Sasha LevinFrom: Suzuki K Poulose <[email protected]>
commit 3cce50dfec4a5b0414c974190940f47dd32c6dee upstream.
The arm64 PMU updates the event counters and reprograms the counters in the overflow IRQ handler without disabling the PMU. This could potentially cause skews in for group counters, where the overflowed counters may potentially loose some event counts, while they are reprogrammed. To prevent this, disable the PMU while we process the counter overflows and enable it right back when we are done.
This patch also moves the PMU stop/start routines to avoid a forward declaration.
--- arch/arm64/kernel/perf_event.c | 50 +++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 22 deletions(-)
arch/arm64/kernel/perf_event.c +28 -22
@@ -748,6 +748,28 @@ static void armv8pmu_disable_event(struct perf_event *event)raw_spin_unlock_irqrestore (&events->pmu_lock, flags); } +static void armv8pmu_start (struct arm_pmu *cpu_pmu) +{ +unsigned long flags; +struct pmu_hw_events *events =this_cpu_ptr (cpu_pmu->hw_events); + +raw_spin_lock_irqsave (&events->pmu_lock, flags); +/* Enable all counters */ +armv8pmu_pmcr_write (armv8pmu_pmcr_read () |ARMV8_PMU_PMCR_E ); +raw_spin_unlock_irqrestore (&events->pmu_lock, flags); +} + +static void armv8pmu_stop (struct arm_pmu *cpu_pmu) +{ +unsigned long flags; +struct pmu_hw_events *events =this_cpu_ptr (cpu_pmu->hw_events); + +raw_spin_lock_irqsave (&events->pmu_lock, flags); +/* Disable all counters */ +armv8pmu_pmcr_write (armv8pmu_pmcr_read () & ~ARMV8_PMU_PMCR_E ); +raw_spin_unlock_irqrestore (&events->pmu_lock, flags); +} +static irqreturn_t armv8pmu_handle_irq (int irq_num,void *dev) {u32 pmovsr;
@@ -773,6 +795,11 @@ static irqreturn_t armv8pmu_handle_irq(int irq_num, void *dev)*/ regs =get_irq_regs (); +/* +* Stop the PMU while processing the counter overflows +* to prevent skews in group events. +*/ +armv8pmu_stop (cpu_pmu);for (idx =0 ; idx < cpu_pmu->num_events; ++idx) {struct perf_event *event = cpuc->events[idx];struct hw_perf_event *hwc;
@@ -797,6 +824,7 @@ static irqreturn_t armv8pmu_handle_irq(int irq_num, void *dev)if (perf_event_overflow (event, &data, regs)) cpu_pmu->disable (event); } +armv8pmu_start (cpu_pmu);/* * Handle the pending perf events.
@@ -810,28 +838,6 @@ static irqreturn_t armv8pmu_handle_irq(int irq_num, void *dev)return IRQ_HANDLED ; } -static void armv8pmu_start (struct arm_pmu *cpu_pmu) -{ -unsigned long flags; -struct pmu_hw_events *events =this_cpu_ptr (cpu_pmu->hw_events); - -raw_spin_lock_irqsave (&events->pmu_lock, flags); -/* Enable all counters */ -armv8pmu_pmcr_write (armv8pmu_pmcr_read () |ARMV8_PMU_PMCR_E ); -raw_spin_unlock_irqrestore (&events->pmu_lock, flags); -} - -static void armv8pmu_stop (struct arm_pmu *cpu_pmu) -{ -unsigned long flags; -struct pmu_hw_events *events =this_cpu_ptr (cpu_pmu->hw_events); - -raw_spin_lock_irqsave (&events->pmu_lock, flags); -/* Disable all counters */ -armv8pmu_pmcr_write (armv8pmu_pmcr_read () & ~ARMV8_PMU_PMCR_E ); -raw_spin_unlock_irqrestore (&events->pmu_lock, flags); -} -static int armv8pmu_get_event_idx (struct pmu_hw_events *cpuc,struct perf_event *event) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 55/71 Revert "PCI: PM: Do not read power state in pci_enable_device_flags()"
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 4d6035f9bf4ea12776322746a216e856dfe46698 ]
Revert commit 4514d991d992 ("PCI: PM: Do not read power state in pci_enable_device_flags()") that is reported to cause PCI device initialization issues on some systems.
--- drivers/pci/pci.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/pci/pci.c +13 -3
@@ -1378,11 +1378,21 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)int err;int i, bars =0 ; -if (atomic_inc_return (&dev->enable_cnt) >1 ) { -pci_update_current_state (dev, dev->current_state); -return 0 ;/* already enabled */ +/* +* Power state could be unknown at this point, either due to a fresh +* boot or a device removal call. So get the current power state +* so that things like MSI message writing will behave as expected +* (e.g. if the device really is in D0 at enable time). +*/ +if (dev->pm_cap) { +u16 pmcsr; +pci_read_config_word (dev, dev->pm_cap +PCI_PM_CTRL , &pmcsr); + dev->current_state = (pmcsr &PCI_PM_CTRL_STATE_MASK ); } +if (atomic_inc_return (&dev->enable_cnt) >1 ) +return 0 ;/* already enabled */ + bridge =pci_upstream_bridge (dev);if (bridge)pci_enable_bridge (bridge);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 56/71 mac80211: remove warning in ieee80211_get_sband()
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 0ee4d55534f82a0624701d0bb9fc2304d4529086 ]
Syzbot reports that it's possible to hit this from userspace, by trying to add a station before any other connection setup has been done. Instead of trying to catch this in some other way simply remove the warning, that will appropriately reject the call from userspace.
--- net/mac80211/ieee80211_i.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/ieee80211_i.h +1 -1
@@ -1391,7 +1391,7 @@ ieee80211_get_sband(struct ieee80211_sub_if_data *sdata)rcu_read_lock (); chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); -if (WARN_ON_ONCE (!chanctx_conf)) { +if (!chanctx_conf) {rcu_read_unlock ();return NULL ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 57/71 cfg80211: call cfg80211_leave_ocb when switching away from OCB
In reply to Sasha LevinFrom: Du Cheng <[email protected]>
[ Upstream commit a64b6a25dd9f984ed05fade603a00e2eae787d2f ]
If the userland switches back-and-forth between NL80211_IFTYPE_OCB and NL80211_IFTYPE_ADHOC via send_msg(NL80211_CMD_SET_INTERFACE), there is a chance where the cleanup cfg80211_leave_ocb() is not called. This leads to initialization of in-use memory (e.g. init u.ibss while in-use by u.ocb) due to a shared struct/union within ieee80211_sub_if_data:
struct ieee80211_sub_if_data {
...
union {
struct ieee80211_if_ap ap;
struct ieee80211_if_vlan vlan;
struct ieee80211_if_managed mgd;
struct ieee80211_if_ibss ibss; // <- shares address
struct ieee80211_if_mesh mesh;
struct ieee80211_if_ocb ocb; // <- shares address
struct ieee80211_if_mntr mntr;
struct ieee80211_if_nan nan;
} u;
...
}Therefore add handling of otype == NL80211_IFTYPE_OCB, during cfg80211_change_iface() to perform cleanup when leaving OCB mode.
link to syzkaller bug:
https://syzkaller.appspot.com/bug?id=0612dbfa595bf4b9b680ff7b4948257b8e3732d5
--- net/wireless/util.c | 3 +++ 1 file changed, 3 insertions(+)
net/wireless/util.c +3 -0
@@ -1050,6 +1050,9 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,case NL80211_IFTYPE_MESH_POINT :/* mesh should be handled? */ break ; +case NL80211_IFTYPE_OCB : +cfg80211_leave_ocb (rdev, dev); +break ;default :break ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 58/71 mac80211: drop multicast fragments
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit a9799541ca34652d9996e45f80e8e03144c12949 ]
These are not permitted by the spec, just drop them.
--- net/mac80211/rx.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
net/mac80211/rx.c +3 -6
@@ -1988,17 +1988,15 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) sc =le16_to_cpu (hdr->seq_ctrl); frag = sc &IEEE80211_SCTL_FRAG ; -if (is_multicast_ether_addr (hdr->addr1)) { -I802_DEBUG_INC (rx->local->dot11MulticastReceivedFrameCount); - goto out_no_led; - } -if (rx->sta) cache = &rx->sta->frags;if (likely (!ieee80211_has_morefrags (fc) && frag ==0 )) goto out; +if (is_multicast_ether_addr (hdr->addr1)) +return RX_DROP_MONITOR ; +I802_DEBUG_INC (rx->local->rx_handlers_fragments);if (skb_linearize (rx->skb))
@@ -2127,7 +2125,6 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) out:ieee80211_led_rx (rx->local); - out_no_led:if (rx->sta) rx->sta->rx_stats.packets++;return RX_CONTINUE ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 59/71 ping: Check return value of function 'ping_queue_rcv_skb'
In reply to Sasha LevinFrom: Zheng Yongjun <[email protected]>
[ Upstream commit 9d44fa3e50cc91691896934d106c86e4027e61ca ]
Function 'ping_queue_rcv_skb' not always return success, which will also return fail. If not check the wrong return value of it, lead to function ping_rcv return success.
--- net/ipv4/ping.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/ipv4/ping.c +7 -5
@@ -976,6 +976,7 @@ bool ping_rcv(struct sk_buff *skb)struct sock *sk;struct net *net =dev_net (skb->dev);struct icmphdr *icmph =icmp_hdr (skb); +bool rc = false;/* We assume the packet has already been checked by icmp_rcv */
@@ -990,14 +991,15 @@ bool ping_rcv(struct sk_buff *skb)struct sk_buff *skb2 =skb_clone (skb,GFP_ATOMIC );pr_debug ("rcv on socket %p\n" , sk); -if (skb2) -ping_queue_rcv_skb (sk, skb2); +if (skb2 && !ping_queue_rcv_skb (sk, skb2)) + rc = true;sock_put (sk); -return true; } -pr_debug ("no socket, dropping\n" ); -return false; +if (!rc) +pr_debug ("no socket, dropping\n" ); + +return rc; }EXPORT_SYMBOL_GPL (ping_rcv);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 60/71 inet: annotate date races around sk->sk_txhash
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit b71eaed8c04f72a919a9c44e83e4ee254e69e7f3 ]
UDP sendmsg() path can be lockless, it is possible for another thread to re-connect an change sk->sk_txhash under us.
There is no serious impact, but we can use READ_ONCE()/WRITE_ONCE() pair to document the race.
BUG: KCSAN: data-race in __ip4_datagram_connect / skb_set_owner_w
write to 0xffff88813397920c of 4 bytes by task 30997 on cpu 1:
sk_set_txhash include/net/sock.h:1937 [inline] __ip4_datagram_connect+0x69e/0x710 net/ipv4/datagram.c:75 __ip6_datagram_connect+0x551/0x840 net/ipv6/datagram.c:189 ip6_datagram_connect+0x2a/0x40 net/ipv6/datagram.c:272 inet_dgram_connect+0xfd/0x180 net/ipv4/af_inet.c:580 __sys_connect_file net/socket.c:1837 [inline] __sys_connect+0x245/0x280 net/socket.c:1854 __do_sys_connect net/socket.c:1864 [inline] __se_sys_connect net/socket.c:1861 [inline] __x64_sys_connect+0x3d/0x50 net/socket.c:1861 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae
read to 0xffff88813397920c of 4 bytes by task 31039 on cpu 0:
skb_set_hash_from_sk include/net/sock.h:2211 [inline] skb_set_owner_w+0x118/0x220 net/core/sock.c:2101 sock_alloc_send_pskb+0x452/0x4e0 net/core/sock.c:2359 sock_alloc_send_skb+0x2d/0x40 net/core/sock.c:2373 __ip6_append_data+0x1743/0x21a0 net/ipv6/ip6_output.c:1621 ip6_make_skb+0x258/0x420 net/ipv6/ip6_output.c:1983 udpv6_sendmsg+0x160a/0x16b0 net/ipv6/udp.c:1527 inet6_sendmsg+0x5f/0x80 net/ipv6/af_inet6.c:642 sock_sendmsg_nosec net/socket.c:654 [inline] sock_sendmsg net/socket.c:674 [inline] ____sys_sendmsg+0x360/0x4d0 net/socket.c:2350 ___sys_sendmsg net/socket.c:2404 [inline] __sys_sendmmsg+0x315/0x4b0 net/socket.c:2490 __do_sys_sendmmsg net/socket.c:2519 [inline] __se_sys_sendmmsg net/socket.c:2516 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2516 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae
value changed: 0xbca3c43d -> 0xfdb309e0
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 31039 Comm: syz-executor.2 Not tainted 5.13.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- include/net/sock.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
include/net/sock.h +7 -3
@@ -1681,7 +1681,8 @@ static inline u32 net_tx_rndhash(void)static inline void sk_set_txhash (struct sock *sk) { - sk->sk_txhash =net_tx_rndhash (); +/* This pairs with READ_ONCE() in skb_set_hash_from_sk() */ +WRITE_ONCE (sk->sk_txhash,net_tx_rndhash ()); }static inline void sk_rethink_txhash (struct sock *sk)
@@ -1936,9 +1937,12 @@ static inline void sock_poll_wait(struct file *filp,static inline void skb_set_hash_from_sk (struct sk_buff *skb,struct sock *sk) { -if (sk->sk_txhash) { +/* This pairs with WRITE_ONCE() in sk_set_txhash() */ +u32 txhash =READ_ONCE (sk->sk_txhash); + +if (txhash) { skb->l4_hash =1 ; - skb->hash = sk->sk_txhash; + skb->hash = txhash; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 61/71 net: caif: fix memory leak in ldisc_open
In reply to Sasha LevinFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 58af3d3d54e87bfc1f936e16c04ade3369d34011 ]
Syzbot reported memory leak in tty_init_dev().
The problem was in unputted tty in ldisc_open()
static int ldisc_open(struct tty_struct *tty)
{
...
ser->tty = tty_kref_get(tty);
...
result = register_netdevice(dev);
if (result) {
rtnl_unlock();
free_netdev(dev);
return -ENODEV;
}...
}
Ser pointer is netdev private_data, so after free_netdev() this pointer goes away with unputted tty reference. So, fix it by adding tty_kref_put() before freeing netdev.
--- drivers/net/caif/caif_serial.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/caif/caif_serial.c +1 -0
@@ -362,6 +362,7 @@ static int ldisc_open(struct tty_struct *tty)rtnl_lock (); result =register_netdevice (dev);if (result) { +tty_kref_put (tty);rtnl_unlock ();free_netdev (dev);return -ENODEV ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 62/71 net/packet: annotate accesses to po->bind
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit c7d2ef5dd4b03ed0ee1d13bc0c55f9cf62d49bd6 ]
tpacket_snd(), packet_snd(), packet_getname() and packet_seq_show() can read po->num without holding a lock. This means other threads can change po->num at the same time.
KCSAN complained about this known fact [1] Add READ_ONCE()/WRITE_ONCE() to address the issue.
[1] BUG: KCSAN: data-race in packet_do_bind / packet_sendmsg
write to 0xffff888131a0dcc0 of 2 bytes by task 24714 on cpu 0:
packet_do_bind+0x3ab/0x7e0 net/packet/af_packet.c:3181 packet_bind+0xc3/0xd0 net/packet/af_packet.c:3255 __sys_bind+0x200/0x290 net/socket.c:1637 __do_sys_bind net/socket.c:1648 [inline] __se_sys_bind net/socket.c:1646 [inline] __x64_sys_bind+0x3d/0x50 net/socket.c:1646 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae
read to 0xffff888131a0dcc0 of 2 bytes by task 24719 on cpu 1:
packet_snd net/packet/af_packet.c:2899 [inline] packet_sendmsg+0x317/0x3570 net/packet/af_packet.c:3040 sock_sendmsg_nosec net/socket.c:654 [inline] sock_sendmsg net/socket.c:674 [inline] ____sys_sendmsg+0x360/0x4d0 net/socket.c:2350 ___sys_sendmsg net/socket.c:2404 [inline] __sys_sendmsg+0x1ed/0x270 net/socket.c:2433 __do_sys_sendmsg net/socket.c:2442 [inline] __se_sys_sendmsg net/socket.c:2440 [inline] __x64_sys_sendmsg+0x42/0x50 net/socket.c:2440 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae
value changed: 0x0000 -> 0x1200
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 24719 Comm: syz-executor.5 Not tainted 5.13.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- net/packet/af_packet.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
net/packet/af_packet.c +8 -8
@@ -2674,7 +2674,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) }if (likely (saddr ==NULL )) { dev =packet_cached_dev_get (po); - proto = po->num; + proto =READ_ONCE (po->num); }else { err = -EINVAL ;if (msg->msg_namelen <sizeof (struct sockaddr_ll ))
@@ -2886,7 +2886,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)if (likely (saddr ==NULL )) { dev =packet_cached_dev_get (po); - proto = po->num; + proto =READ_ONCE (po->num); }else { err = -EINVAL ;if (msg->msg_namelen <sizeof (struct sockaddr_ll ))
@@ -3157,7 +3157,7 @@ static int packet_do_bind(struct sock *sk, const char *name, int ifindex,/* prevents packet_notifier() from calling * register_prot_hook() */ - po->num =0 ; +WRITE_ONCE (po->num,0 );__unregister_prot_hook (sk, true);rcu_read_lock (); dev_curr = po->prot_hook.dev;
@@ -3167,7 +3167,7 @@ static int packet_do_bind(struct sock *sk, const char *name, int ifindex, }BUG_ON (po->running); - po->num = proto; +WRITE_ONCE (po->num, proto); po->prot_hook.type = proto;if (unlikely (unlisted)) {
@@ -3514,7 +3514,7 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr, sll->sll_family =AF_PACKET ; sll->sll_ifindex = po->ifindex; - sll->sll_protocol = po->num; + sll->sll_protocol =READ_ONCE (po->num); sll->sll_pkttype =0 ;rcu_read_lock (); dev =dev_get_by_index_rcu (sock_net (sk), po->ifindex);
@@ -4400,7 +4400,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, was_running = po->running; num = po->num;if (was_running) { - po->num =0 ; +WRITE_ONCE (po->num,0 );__unregister_prot_hook (sk, false); }spin_unlock (&po->bind_lock);
@@ -4433,7 +4433,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,spin_lock (&po->bind_lock);if (was_running) { - po->num = num; +WRITE_ONCE (po->num, num);register_prot_hook (sk); }spin_unlock (&po->bind_lock);
@@ -4602,7 +4602,7 @@ static int packet_seq_show(struct seq_file *seq, void *v) s,atomic_read (&s->sk_refcnt), s->sk_type, -ntohs (po->num), +ntohs (READ_ONCE (po->num)), po->ifindex, po->running, atomic_read(&s->sk_rmem_alloc),
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 63/71 net/packet: annotate accesses to po->ifindex
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit e032f7c9c7cefffcfb79b9fc16c53011d2d9d11f ]
Like prior patch, we need to annotate lockless accesses to po->ifindex For instance, packet_getname() is reading po->ifindex (twice) while another thread is able to change po->ifindex.
KCSAN reported:
BUG: KCSAN: data-race in packet_do_bind / packet_getname
write to 0xffff888143ce3cbc of 4 bytes by task 25573 on cpu 1:
packet_do_bind+0x420/0x7e0 net/packet/af_packet.c:3191 packet_bind+0xc3/0xd0 net/packet/af_packet.c:3255 __sys_bind+0x200/0x290 net/socket.c:1637 __do_sys_bind net/socket.c:1648 [inline] __se_sys_bind net/socket.c:1646 [inline] __x64_sys_bind+0x3d/0x50 net/socket.c:1646 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae
read to 0xffff888143ce3cbc of 4 bytes by task 25578 on cpu 0:
packet_getname+0x5b/0x1a0 net/packet/af_packet.c:3525 __sys_getsockname+0x10e/0x1a0 net/socket.c:1887 __do_sys_getsockname net/socket.c:1902 [inline] __se_sys_getsockname net/socket.c:1899 [inline] __x64_sys_getsockname+0x3e/0x50 net/socket.c:1899 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae
value changed: 0x00000000 -> 0x00000001
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 25578 Comm: syz-executor.5 Not tainted 5.13.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- net/packet/af_packet.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
net/packet/af_packet.c +9 -7
@@ -3173,11 +3173,11 @@ static int packet_do_bind(struct sock *sk, const char *name, int ifindex,if (unlikely (unlisted)) {dev_put (dev); po->prot_hook.dev =NULL ; - po->ifindex =-1 ; +WRITE_ONCE (po->ifindex,-1 );packet_cached_dev_reset (po); }else { po->prot_hook.dev = dev; - po->ifindex = dev ? dev->ifindex :0 ; +WRITE_ONCE (po->ifindex, dev ? dev->ifindex :0 );packet_cached_dev_assign (po, dev); } }
@@ -3492,7 +3492,7 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, uaddr->sa_family =AF_PACKET ;memset (uaddr->sa_data,0 ,sizeof (uaddr->sa_data));rcu_read_lock (); - dev =dev_get_by_index_rcu (sock_net (sk),pkt_sk (sk)->ifindex); + dev =dev_get_by_index_rcu (sock_net (sk),READ_ONCE (pkt_sk (sk)->ifindex));if (dev)strlcpy (uaddr->sa_data, dev->name,sizeof (uaddr->sa_data));rcu_read_unlock ();
@@ -3508,16 +3508,18 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr,struct sock *sk = sock->sk;struct packet_sock *po =pkt_sk (sk); DECLARE_SOCKADDR(struct sockaddr_ll *, sll, uaddr); +int ifindex;if (peer)return -EOPNOTSUPP ; + ifindex =READ_ONCE (po->ifindex); sll->sll_family =AF_PACKET ; - sll->sll_ifindex = po->ifindex; + sll->sll_ifindex = ifindex; sll->sll_protocol =READ_ONCE (po->num); sll->sll_pkttype =0 ;rcu_read_lock (); - dev =dev_get_by_index_rcu (sock_net (sk), po->ifindex); + dev =dev_get_by_index_rcu (sock_net (sk), ifindex);if (dev) { sll->sll_hatype = dev->type; sll->sll_halen = dev->addr_len;
@@ -4097,7 +4099,7 @@ static int packet_notifier(struct notifier_block *this, }if (msg ==NETDEV_UNREGISTER ) {packet_cached_dev_reset (po); - po->ifindex =-1 ; +WRITE_ONCE (po->ifindex,-1 );if (po->prot_hook.dev)dev_put (po->prot_hook.dev); po->prot_hook.dev =NULL ;
@@ -4603,7 +4605,7 @@ static int packet_seq_show(struct seq_file *seq, void *v)atomic_read (&s->sk_refcnt), s->sk_type,ntohs (READ_ONCE (po->num)), - po->ifindex, +READ_ONCE (po->ifindex), po->running,atomic_read (&s->sk_rmem_alloc), from_kuid_munged(seq_user_ns(seq), sock_i_uid(s)),
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 64/71 r8152: Avoid memcpy() over-reading of ETH_SS_STATS
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 99718abdc00e86e4f286dd836408e2834886c16e ]
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally reading across neighboring array fields.
The memcpy() is copying the entire structure, not just the first array. Adjust the source argument so the compiler can do appropriate bounds checking.
--- drivers/net/usb/r8152.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/r8152.c +1 -1
@@ -3938,7 +3938,7 @@ static void rtl8152_get_strings(struct net_device *dev, u32 stringset, u8 *data) {switch (stringset) {case ETH_SS_STATS : -memcpy (data, *rtl8152_gstrings,sizeof (rtl8152_gstrings)); +memcpy (data, rtl8152_gstrings,sizeof (rtl8152_gstrings));break ; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 65/71 sh_eth: Avoid memcpy() over-reading of ETH_SS_STATS
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 224004fbb033600715dbd626bceec10bfd9c58bc ]
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally reading across neighboring array fields.
The memcpy() is copying the entire structure, not just the first array. Adjust the source argument so the compiler can do appropriate bounds checking.
--- drivers/net/ethernet/renesas/sh_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/renesas/sh_eth.c +1 -1
@@ -2117,7 +2117,7 @@ static void sh_eth_get_strings(struct net_device *ndev, u32 stringset, u8 *data) {switch (stringset) {case ETH_SS_STATS : -memcpy (data, *sh_eth_gstrings_stats, +memcpy (data, sh_eth_gstrings_stats,sizeof (sh_eth_gstrings_stats));break ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 66/71 r8169: Avoid memcpy() over-reading of ETH_SS_STATS
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit da5ac772cfe2a03058b0accfac03fad60c46c24d ]
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally reading across neighboring array fields.
The memcpy() is copying the entire structure, not just the first array. Adjust the source argument so the compiler can do appropriate bounds checking.
--- drivers/net/ethernet/realtek/r8169.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169.c +1 -1
@@ -2338,7 +2338,7 @@ static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data) {switch (stringset) {case ETH_SS_STATS : -memcpy (data, *rtl8169_gstrings,sizeof (rtl8169_gstrings)); +memcpy (data, rtl8169_gstrings,sizeof (rtl8169_gstrings));break ; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 67/71 net: qed: Fix memcpy() overflow of qed_dcbx_params()
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 1c200f832e14420fa770193f9871f4ce2df00d07 ]
The source (&dcbx_info->operational.params) and dest (&p_hwfn->p_dcbx_info->set.config.params) are both struct qed_dcbx_params (560 bytes), not struct qed_dcbx_admin_params (564 bytes), which is used as the memcpy() size.
However it seems that struct qed_dcbx_operational_params (dcbx_info->operational)'s layout matches struct qed_dcbx_admin_params (p_hwfn->p_dcbx_info->set.config)'s 4 byte difference (3 padding, 1 byte for "valid").
On the assumption that the size is wrong (rather than the source structure type), adjust the memcpy() size argument to be 4 bytes smaller and add a BUILD_BUG_ON() to validate any changes to the structure sizes.
--- drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qed/qed_dcbx.c +3 -1
@@ -1205,9 +1205,11 @@ int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn, p_hwfn->p_dcbx_info->set.ver_num |=DCBX_CONFIG_VERSION_IEEE ; p_hwfn->p_dcbx_info->set.enabled = dcbx_info->operational.enabled; +BUILD_BUG_ON (sizeof (dcbx_info->operational.params) != +sizeof (p_hwfn->p_dcbx_info->set.config.params));memcpy (&p_hwfn->p_dcbx_info->set.config.params, &dcbx_info->operational.params, -sizeof (struct qed_dcbx_admin_params )); +sizeof (p_hwfn->p_dcbx_info->set.config.params)); p_hwfn->p_dcbx_info->set.config.valid = true;memcpy (params, &p_hwfn->p_dcbx_info->set,sizeof (struct qed_dcbx_set ));
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 68/71 net: ll_temac: Avoid ndo_start_xmit returning NETDEV_TX_BUSY
In reply to Sasha LevinFrom: Esben Haabendal <[email protected]>
[ Upstream commit f6396341194234e9b01cd7538bc2c6ac4501ab14 ]
As documented in Documentation/networking/driver.rst, the ndo_start_xmit method must not return NETDEV_TX_BUSY under any normal circumstances, and as recommended, we simply stop the tx queue in advance, when there is a risk that the next xmit would cause a NETDEV_TX_BUSY return.
--- drivers/net/ethernet/xilinx/ll_temac_main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/xilinx/ll_temac_main.c +5 -0
@@ -735,6 +735,11 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)/* Kick off the transfer */ lp->dma_out (lp,TX_TAILDESC_PTR , tail_p);/* DMA start */ +if (temac_check_tx_bd_space (lp,MAX_SKB_FRAGS +1 )) { +netdev_info (ndev,"%s -> netif_stop_queue\n" , __func__); +netif_stop_queue (ndev); + } +return NETDEV_TX_OK ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 69/71 nilfs2: fix memory leak in nilfs_sysfs_delete_device_group
In reply to Sasha LevinFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 8fd0c1b0647a6bda4067ee0cd61e8395954b6f28 ]
My local syzbot instance hit memory leak in nilfs2. The problem was in missing kobject_put() in nilfs_sysfs_delete_device_group().
kobject_del() does not call kobject_cleanup() for passed kobject and it leads to leaking duped kobject name if kobject_put() was not called.
Fail log:
BUG: memory leak
unreferenced object 0xffff8880596171e0 (size 8):
comm "syz-executor379", pid 8381, jiffies 4294980258 (age 21.100s)
hex dump (first 8 bytes):
6c 6f 6f 70 30 00 00 00 loop0...
backtrace:
kstrdup+0x36/0x70 mm/util.c:60
kstrdup_const+0x53/0x80 mm/util.c:83
kvasprintf_const+0x108/0x190 lib/kasprintf.c:48
kobject_set_name_vargs+0x56/0x150 lib/kobject.c:289
kobject_add_varg lib/kobject.c:384 [inline]
kobject_init_and_add+0xc9/0x160 lib/kobject.c:473
nilfs_sysfs_create_device_group+0x150/0x800 fs/nilfs2/sysfs.c:999
init_nilfs+0xe26/0x12b0 fs/nilfs2/the_nilfs.c:637--- fs/nilfs2/sysfs.c | 1 + 1 file changed, 1 insertion(+)
fs/nilfs2/sysfs.c +1 -0
@@ -1064,6 +1064,7 @@ void nilfs_sysfs_delete_device_group(struct the_nilfs *nilfs)nilfs_sysfs_delete_superblock_group (nilfs);nilfs_sysfs_delete_segctor_group (nilfs);kobject_del (&nilfs->ns_dev_kobj); +kobject_put (&nilfs->ns_dev_kobj);kfree (nilfs->ns_dev_subgroups); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 70/71 i2c: robotfuzz-osif: fix control-request directions
In reply to Sasha LevinFrom: Johan Hovold <[email protected]>
commit 4ca070ef0dd885616ef294d269a9bf8e3b258e1a upstream.
The direction of the pipe argument must match the request-type direction bit or control requests may fail depending on the host-controller-driver implementation.
Control transfers without a data stage are treated as OUT requests by the USB stack and should be using usb_sndctrlpipe(). Failing to do so will now trigger a warning.
Fix the OSIFI2C_SET_BIT_RATE and OSIFI2C_STOP requests which erroneously used the osif_usb_read() helper and set the IN direction bit.
--- drivers/i2c/busses/i2c-robotfuzz-osif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-robotfuzz-osif.c +2 -2
@@ -89,7 +89,7 @@ static int osif_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, } } - ret =osif_usb_read (adapter,OSIFI2C_STOP ,0 ,0 ,NULL ,0 ); + ret =osif_usb_write (adapter,OSIFI2C_STOP ,0 ,0 ,NULL ,0 );if (ret) {dev_err (&adapter->dev,"failure sending STOP\n" );return -EREMOTEIO ;
@@ -159,7 +159,7 @@ static int osif_probe(struct usb_interface *interface,* Set bus frequency. The frequency is: * 120,000,000 / ( 16 + 2 * div * 4^prescale). * Using dev = 52, prescale = 0 give 100KHz */ - ret =osif_usb_read (&priv->adapter,OSIFI2C_SET_BIT_RATE ,52 ,0 , + ret =osif_usb_write (&priv->adapter,OSIFI2C_SET_BIT_RATE ,52 ,0 ,NULL ,0 );if (ret) {dev_err (&interface->dev,"failure sending bit rate" );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 71/71 Linux 4.9.274-rc1
In reply to Sasha Levin--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -1,7 +1,7 @@ VERSION = 4 PATCHLEVEL = 9 -SUBLEVEL = 273 -EXTRAVERSION = +SUBLEVEL = 274 +EXTRAVERSION = -rc1 NAME = Roaring Lionus # *DOCUMENTATION*
Signature · 1 line
2.30.2
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 4.9.274 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:39:51 PM UTC. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-4.9.y&id2=v4.9.273or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.Thanks,
Sasha
All tests passing for Tegra ...
Test results for stable-v4.9:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
32 tests: 32 pass, 0 failLinux version: 4.9.274-rc1-ga12e33370009
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Jon
Quoted 10 lines · Sasha Levin
This is the start of the stable review cycle for the 4.9.274 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:39:51 PM UTC. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-4.9.y&id2=v4.9.273or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.Thanks,
Sasha
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 4.9.274-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git branch: linux-4.9.y
* git commit: a12e33370009130a2628d2a2cdca0cfd421a2f5b
* git describe: v4.9.273-71-ga12e33370009
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.9.y/build/v4.9.273-71-ga12e33370009
## No regressions (compared to v4.9.273-55-g9cd83a1b77d2)
## No fixes (compared to v4.9.273-55-g9cd83a1b77d2)
## Test result summary
total: 59943, pass: 46910, fail: 1073, skip: 10404, xfail: 1556,
## Build Summary
* arm: 97 total, 97 passed, 0 failed
* arm64: 24 total, 24 passed, 0 failed
* dragonboard-410c: 1 total, 1 passed, 0 failed
* hi6220-hikey: 1 total, 1 passed, 0 failed
* i386: 14 total, 14 passed, 0 failed
* juno-r2: 1 total, 1 passed, 0 failed
* mips: 36 total, 36 passed, 0 failed
* sparc: 9 total, 9 passed, 0 failed
* x15: 1 total, 1 passed, 0 failed
* x86: 1 total, 1 passed, 0 failed
* x86_64: 14 total, 14 passed, 0 failed
## Test suites summary
* fwts
* igt-gpu-tools
* install-android-platform-tools-r2600
* kselftest-android
* kselftest-bpf
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-lkdtm
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-x86
* kselftest-zram
* kvm-unit-tests
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* ssuite
* v4l2-compliance
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 4.9.274 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:39:51 PM UTC. Anything received after that time might be too late.
Build reference: v4.9.273-71-ga12e33370009
gcc version: arc-elf-gcc (GCC) 10.3.0
Building arc:tb10x_defconfig ... failed
--------------
Error log:
In file included from include/asm-generic/signal.h:10,
from arch/arc/include/uapi/asm/signal.h:25,
from include/uapi/linux/signal.h:4,
from include/linux/signal.h:6,
from include/linux/sched.h:37,
from arch/arc/kernel/asm-offsets.c:9:arch/arc/include/uapi/asm/sigcontext.h:20:25: error: field 'v2abi' has incomplete type
---
Building arcv2:defconfig ... failed
--------------
Error log:
In file included from include/asm-generic/signal.h:10,
from arch/arc/include/uapi/asm/signal.h:25,
from include/uapi/linux/signal.h:4,
from include/linux/signal.h:6,
from include/linux/sched.h:37,
from arch/arc/kernel/asm-offsets.c:9:arch/arc/include/uapi/asm/sigcontext.h:20:25: error: field 'v2abi' has incomplete type
Guenter
Sasha Levin
maintainerQuoted 28 lines · Guenter Roeck
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 4.9.274 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:39:51 PM UTC. Anything received after that time might be too late.
Build reference: v4.9.273-71-ga12e33370009
gcc version: arc-elf-gcc (GCC) 10.3.0Building arc:tb10x_defconfig ... failed
--------------
Error log:
In file included frominclude/asm-generic/signal.h:10,
fromarch/arc/include/uapi/asm/signal.h:25,
frominclude/uapi/linux/signal.h:4,
frominclude/linux/signal.h:6,
frominclude/linux/sched.h:37,
fromarch/arc/kernel/asm-offsets.c:9:arch/arc/include/uapi/asm/sigcontext.h:20:25: error: field 'v2abi' has incomplete type---
Quoted 10 lines
Building arcv2:defconfig ... failed
--------------
Error log:
In file included frominclude/asm-generic/signal.h:10,
fromarch/arc/include/uapi/asm/signal.h:25,
frominclude/uapi/linux/signal.h:4,
frominclude/linux/signal.h:6,
frominclude/linux/sched.h:37,
fromarch/arc/kernel/asm-offsets.c:9:arch/arc/include/uapi/asm/sigcontext.h:20:25: error: field 'v2abi' has incomplete type
Thanks! I'll drop 96f1b00138cb ("ARCv2: save ABI registers across signal handling") from 4.9 and 4.4, and will re-push -rc1.
Signature · 2 lines
Thanks, Sasha
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 4.9.274 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:39:51 PM UTC. Anything received after that time might be too late.
Build results:
total: 163 pass: 156 fail: 7 Failed builds: arc:tb10x_defconfig arcv2:defconfig arcv2:allnoconfig arcv2:tinyconfig arcv2:axs103_defconfig arcv2:nsim_hs_smp_defconfig arcv2:vdk_hs38_smp_defconfig Qemu test results: total: 383 pass: 383 fail: 0
Build failures as already reported.
Guenter
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 4.9.274 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:39:51 PM UTC. Anything received after that time might be too late.
For v4.9.273-70-ga70498c:
Build results:
total: 163 pass: 163 fail: 0 Qemu test results: total: 383 pass: 383 fail: 0
Guenter