7.3.6-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 2564/2651 ice: E822: keep Tx timestamps disabled during offset calibration
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karol Kolacinski <[email protected]>
[ Upstream commit 56af436b90acce7eaa7531189c827773983f7d07 ]
Do not clear the tx.calibrating flag immediately after starting the PHY timer in ice_ptp_port_phy_restart(). Instead, keep Tx timestamps disabled until the offset verification work (ice_ptp_wait_for_offsets) has confirmed that the Tx PHY offset is properly configured.
Previously, tx.calibrating was set to true, then immediately back to false right after ice_start_phy_timer_e82x() returned. This allowed Tx timestamp requests to be served during the window where offset verification was still pending. Timestamps produced during this window should have their valid bit cleared, but it is better to prevent requests until the driver has confirmed calibration is complete.
Rename the tx.calibrating field to tx.disabled, and change where it is cleared. Only clear it in ice_ptp_wait_for_offsets(), and only after Tx offset configuration has completed successfully. This ensures that new Tx timestamp requests are only accepted after the PHY has properly calibrated the Tx offset.
If ice_start_phy_timer_e82x() fails, do not restore disabled to false. The device is in a state where timestamps cannot succeed properly anyways. A dev_err message is already logged on failure to start the timer at the end of the function.
Renaming the field improves clarity and will better reflect the nature of the flag in a future change that also applies disabling Tx timestamps in software in a following commit.
Log a debug message while offset calibration is still pending, including the specific Tx/Rx error codes to aid debugging stalled calibration. This path is expected on every routine link-up: ov_work is first queued with no delay and the vernier offset cannot be computed until at least one packet has been transmitted, so the first several invocations normally land here. Use dev_dbg() rather than a rate-limited warning to avoid emitting KERN_WARNING on every link-up during normal operation. Log a debug message when calibration completes successfully.
Note that sashiko review has previously complained that leaving the disabled flag set "permanently" disables Tx timestamps if vernier calibration never completes. This is true, but its important to realize that timestamps would still fail regardless of whether the flag is set. Until vernier calibration completes the device will not report valid timestamps regardless. Thus, keeping the calibrating flag set simply prevents new timestamp requests from software while it is known that the hardware will not complete them.
--- drivers/net/ethernet/intel/ice/ice_ptp.c | 37 +++++++++++++++++------- drivers/net/ethernet/intel/ice/ice_ptp.h | 6 ++-- 2 files changed, 29 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/ice/ice_ptp.c +26 -11
@@ -367,7 +367,7 @@ ice_ptp_is_tx_tracker_up(struct ice_ptp_tx *tx) {lockdep_assert_held (&tx->lock); -return tx->init && !tx->calibrating; +return tx->init && !tx->disabled; }/**
@@ -1168,6 +1168,7 @@ static int ice_ptp_check_tx_fifo(struct ice_ptp_port *port)static void ice_ptp_wait_for_offsets (struct kthread_work *work) {struct ice_ptp_port *port; +unsigned long flags;struct ice_pf *pf;struct ice_hw *hw;int tx_err;
@@ -1188,9 +1189,26 @@ static void ice_ptp_wait_for_offsets(struct kthread_work *work) tx_err =ice_ptp_check_tx_fifo (port);if (!tx_err) tx_err =ice_phy_cfg_tx_offset_e82x (hw, port->port_num); +if (!tx_err) { +/* Tx offset has been configured, re-enable Tx timestamps */ +spin_lock_irqsave (&port->tx.lock, flags); +if (port->tx.disabled) { + port->tx.disabled = false; +dev_dbg (ice_pf_to_dev (pf),"PTP Tx offset valid for port %u, Tx timestamps enabled\n" , + port->port_num); + } +spin_unlock_irqrestore (&port->tx.lock, flags); + } + rx_err =ice_phy_cfg_rx_offset_e82x (hw, port->port_num);if (tx_err || rx_err) { -/* Tx and/or Rx offset not yet configured, try again later */ +/* Tx and/or Rx offset not yet configured, try again later. +* This is expected during normal link-up: the vernier offset +* calibration cannot complete until at least one packet has +* been transmitted, so the first retries routinely land here. +*/ +dev_dbg (ice_pf_to_dev (pf),"PTP offset not yet valid for port %u (tx_err=%d rx_err=%d)\n" , + port->port_num, tx_err, rx_err);kthread_queue_delayed_work (pf->ptp.kworker, &port->ov_work,msecs_to_jiffies (100 ));
@@ -1268,11 +1286,9 @@ ice_ptp_port_phy_restart(struct ice_ptp_port *ptp_port)/* Start the PHY timer in Vernier mode */ kthread_cancel_delayed_work_sync (&ptp_port->ov_work); -/* temporarily disable Tx timestamps while calibrating -* PHY offset -*/ +/* Disable Tx timestamps until PHY calibration completes */ spin_lock_irqsave (&ptp_port->tx.lock, flags); - ptp_port->tx.calibrating = true; + ptp_port->tx.disabled = true;spin_unlock_irqrestore (&ptp_port->tx.lock, flags); ptp_port->tx_fifo_busy_cnt =0 ;
@@ -1281,11 +1297,10 @@ ice_ptp_port_phy_restart(struct ice_ptp_port *ptp_port)if (err)break ; -/* Enable Tx timestamps right away */ -spin_lock_irqsave (&ptp_port->tx.lock, flags); - ptp_port->tx.calibrating = false; -spin_unlock_irqrestore (&ptp_port->tx.lock, flags); - +/* Do not clear disabled flag here. Tx timestamp requests +* remain disabled until ice_ptp_wait_for_offsets() has +* verified that the Tx offset calibration has completed. +*/ kthread_queue_delayed_work (pf->ptp.kworker, &ptp_port->ov_work,0 );break ;
drivers/net/ethernet/intel/ice/ice_ptp.h +3 -3
@@ -106,8 +106,8 @@ enum ice_tx_tstamp_work {* @offset: offset into timestamp block to get the real index * @len: length of the tstamps and in_use fields. * @init: if true, the tracker is initialized; -* @calibrating: if true, the PHY is calibrating the Tx offset. During this -* window, timestamps are temporarily disabled. +* @disabled: set to true when new Tx timestamp requests are disabled, such as +* while the PHY Tx offset configuration has not yet completed. * @has_ready_bitmap: if true, the hardware has a valid Tx timestamp ready * bitmap register. If false, fall back to verifying new * timestamp values against previously cached copy.
@@ -122,7 +122,7 @@ struct ice_ptp_tx {u8 offset;u8 len; u8 init : 1; - u8 calibrating : 1; + u8 disabled : 1; u8 has_ready_bitmap : 1;s8 last_ll_ts_idx_read; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2565/2651 net: bridge: netlink: do not clear the vlan info dump error
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linkui Xiao <[email protected]>
[ Upstream commit fcc00b15cb21a6de76826e5012b2c758505f5e65 ]
br_fill_ifinfo() assigns the result of br_fill_vlan_tunnel_info() over the result of br_fill_ifvlaninfo() or br_fill_ifvlaninfo_compressed() instead of only running the second helper when the first one succeeded.
When the vlan information no longer fits in the skb but the port has no vlan mapped to a tunnel dst, br_fill_vlan_tunnel_info() walks the vlan list and returns 0 without touching the skb. The -EMSGSIZE is lost, br_fill_ifinfo() completes a message whose IFLA_AF_SPEC is truncated, and the dump carries on to the next interface instead of stopping, so userspace silently sees an incomplete vlan list.
Only fill the tunnel information when the vlan information was filled successfully.
This was flagged as a pre-existing issue in the Sashiko review of the net-next series, which noted that the VLAN fill result is overwritten before it is tested (see the Link tag below). Not triggered or tested.
--- net/bridge/br_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_netlink.c +1 -1
@@ -540,7 +540,7 @@ static int br_fill_ifinfo(struct sk_buff *skb,else err =br_fill_ifvlaninfo (skb, vg); -if (port &&test_bit (BR_VLAN_TUNNEL_BIT , &port->flags)) +if (!err && port &&test_bit (BR_VLAN_TUNNEL_BIT , &port->flags)) err =br_fill_vlan_tunnel_info (skb, vg);rcu_read_unlock ();if (err)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2566/2651 net/mlx5: Only set num_doorbells on a fully initialized SF
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Ratiu <[email protected]>
[ Upstream commit fa503935c2d6603856dafff0a0852631ab6e9503 ]
The validation for the num_doorbells devlink param rejects values greater than num_channels. For lightweight SFs, this ends up accessing a NULL priv->eq_table, leading to a crash.
Fix that by rejecting setting num_doorbells on uninitialized SFs.
--- drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +6 -0
@@ -542,6 +542,12 @@ static int mlx5_devlink_num_doorbells_validate(struct devlink *devlink, u32 id,u32 val32 = val->vu32;u32 max_num_channels; +if (mlx5_dev_is_lightweight (mdev)) { +NL_SET_ERR_MSG_MOD (extack, +"Setting num_doorbells requires full device initialization; reload the device first" ); +return -EOPNOTSUPP ; + } + max_num_channels =mlx5e_get_max_num_channels (mdev);if (val32 > max_num_channels) { NL_SET_ERR_MSG_FMT_MOD(extack,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2567/2651 writeback: dont kick a missing wb for dontcache writes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit aa6439028dc39230e62917ba0a7dafdc103564cf ]
With CONFIG_CGROUP_WRITEBACK, inode->i_wb stays NULL until the inode is dirtied for the first time (folio_account_dirtied(), __mark_inode_dirty() or wbc_attach_fdatawrite_inode() attach it). generic_write_sync() calls filemap_dontcache_kick_writeback() for every IOCB_DONTCACHE write, including O_DIRECT ones, which never dirty the page cache. The function then passes the NULL returned by unlocked_inode_to_wb_begin() to wb_has_dirty_io():
fd = open("/dev/ram0", O_WRONLY | O_DIRECT);
pwritev2(fd, &iov, 1, 0, RWF_DONTCACHE);BUG: KASAN: null-ptr-deref in filemap_dontcache_kick_writeback+0xec Oops: general protection fault, probably for non-canonical address RIP: 0010:filemap_dontcache_kick_writeback+0xfd/0x7a0
The task dies inside rcu_read_lock(). blkdev_write_iter() gets there for any block device whose page cache has not been dirtied yet. nfs_file_direct_write() calls generic_write_sync() the same way.
An inode without a wb has never had dirty pages, so there is nothing to
flush: skip the kick.
--- fs/fs-writeback.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/fs-writeback.c +2 -1
@@ -2579,8 +2579,9 @@ void filemap_dontcache_kick_writeback(struct address_space *mapping)struct wb_lock_cookie cookie = {};bool need_wakeup = false; +/* An inode which was never dirtied has no wb and nothing to flush. */ wb =unlocked_inode_to_wb_begin (inode, &cookie); -if (wb_has_dirty_io (wb) && +if (wb &&wb_has_dirty_io (wb) && !test_bit (WB_start_dontcache, &wb->state) && !test_and_set_bit (WB_start_dontcache, &wb->state)) {wb_get (wb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2568/2651 net: mctp: free reassembly head skb when key_add fails on SOM
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joas Antonio dos Santos <[email protected]>
[ Upstream commit d2bfe74a8fe219a86b86c1f126e1d722a5001790 ]
When a start-of-message fragment creates a new reassembly key on the broadcast/bind path, mctp_frag_queue() stores the skb as key->reasm_head before the key is made observable with mctp_key_add().
If mctp_key_add() fails (a race with another SOM packet for the same source/dest/tag, or the receiving socket going away), the error path only drops the key reference via mctp_key_unref(). The final key destructor frees the key itself but not key->reasm_head, and since the key was never added to any list, neither the expiry worker nor socket teardown can reach it to release the queued fragment. The skb is leaked.
Free key->reasm_head on the key_add failure path before releasing the key. Other teardown paths (__mctp_key_done_in(), EOM delivery) already clear reasm_head before the final unref, so this only affects the failure path.
--- net/mctp/route.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
net/mctp/route.c +9 -1
@@ -552,8 +552,16 @@ static int mctp_dst_input(struct mctp_dst *dst, struct sk_buff *skb)* can do is drop. */ rc =mctp_key_add (key, msk); -if (!rc) +if (!rc) {trace_mctp_key_acquire (key); + }else { +/* key_add failed: the key is not observable by +* any cleanup path, so free the fragment we +* just queued on it to avoid leaking the skb. +*/ +kfree_skb (key->reasm_head); + key->reasm_head =NULL ; + }/* we don't need to release key->lock on exit, so * clean up here and suppress the unlock via
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2569/2651 rtc: s35390a: Add missing newline to dev_err
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markus Probst <[email protected]>
[ Upstream commit a27b25bb9b422c8468cb6965b2d72b7b64187fd2 ]
--- drivers/rtc/rtc-s35390a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-s35390a.c +1 -1
@@ -494,7 +494,7 @@ static int s35390a_probe(struct i2c_client *client) buf =0 ; err =s35390a_set_reg (s35390a,S35390A_CMD_STATUS2 , &buf,1 );if (err <0 ) { -dev_err (dev,"error disabling alarm" ); +dev_err (dev,"error disabling alarm\n" );return err; } }else {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2570/2651 rtc: s35390a: Fix alarm not disabling
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markus Probst <[email protected]>
[ Upstream commit d93f29e41089bbb14637289fe77bdd72b71e9ac5 ]
Implement alarm_irq_enable callback.
--- drivers/rtc/rtc-s35390a.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/rtc/rtc-s35390a.c +24 -5
@@ -270,6 +270,24 @@ static int s35390a_rtc_read_time(struct device *dev, struct rtc_time *tm)return 0 ; } +static int s35390a_rtc_alarm_irq_enable (struct device *dev,unsigned int enabled) +{ +struct s35390a *s35390a =dev_get_drvdata (dev); +u8 sts; +int err; + +if (enabled) + sts =S35390A_INT2_MODE_ALARM ; +else + sts =S35390A_INT2_MODE_NOINTR ; + + err =s35390a_set_reg (s35390a,S35390A_CMD_STATUS2 , &sts,sizeof (sts)); +if (err <0 ) +return err; + +return 0 ; +} +static int s35390a_rtc_set_alarm (struct device *dev,struct rtc_wkalrm *alm) {struct i2c_client *client =to_i2c_client (dev);
@@ -410,11 +428,12 @@ static int s35390a_rtc_ioctl(struct device *dev, unsigned int cmd, }static const struct rtc_class_ops s35390a_rtc_ops = { - .read_time = s35390a_rtc_read_time, - .set_time = s35390a_rtc_set_time, - .set_alarm = s35390a_rtc_set_alarm, - .read_alarm = s35390a_rtc_read_alarm, - .ioctl = s35390a_rtc_ioctl, + .read_time = s35390a_rtc_read_time, + .set_time = s35390a_rtc_set_time, + .set_alarm = s35390a_rtc_set_alarm, + .read_alarm = s35390a_rtc_read_alarm, + .alarm_irq_enable = s35390a_rtc_alarm_irq_enable, + .ioctl = s35390a_rtc_ioctl, }; static int s35390a_nvmem_read(void *priv, unsigned int offset, void *val,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2571/2651 rtc: s35390a: Read 24-hour mode on access
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markus Probst <[email protected]>
[ Upstream commit 6199051016cddba920b6023a44199c5221352c44 ]
Instead of reading if the 24-hour mode is used on probe once, read it on access. This makes it impossible for the mode to be out of sync and fixes time corruption if resetting the chip while in 12-hour mode, as s35390a_init did not update the cached value.
--- drivers/rtc/rtc-s35390a.c | 78 +++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 36 deletions(-)
drivers/rtc/rtc-s35390a.c +42 -36
@@ -64,7 +64,6 @@ MODULE_DEVICE_TABLE(of, s35390a_of_match);struct s35390a {struct i2c_client *client[8 ]; -int twentyfourhour; };static int s35390a_set_reg (struct s35390a *s35390a,int reg,u8 *buf,int len)
@@ -102,9 +101,8 @@ static int s35390a_get_reg(struct s35390a *s35390a, int reg, u8 *buf, int len)return 0 ; } -static int s35390a_init (struct s35390a *s35390a) +static int s35390a_init (struct s35390a *s35390a,u8 *sts) { -u8 buf;int ret;unsigned initcount =0 ;
@@ -117,17 +115,17 @@ static int s35390a_init(struct s35390a *s35390a)* The 24H bit is kept over reset, so set it already here. */ initialize: - buf =S35390A_FLAG_RESET |S35390A_FLAG_24H ; - ret =s35390a_set_reg (s35390a,S35390A_CMD_STATUS1 , &buf,1 ); + *sts =S35390A_FLAG_RESET |S35390A_FLAG_24H ; + ret =s35390a_set_reg (s35390a,S35390A_CMD_STATUS1 , sts,1 );if (ret <0 )return ret; - ret =s35390a_get_reg (s35390a,S35390A_CMD_STATUS1 , &buf,1 ); + ret =s35390a_get_reg (s35390a,S35390A_CMD_STATUS1 , sts,1 );if (ret <0 )return ret; -if (buf & (S35390A_FLAG_POC |S35390A_FLAG_BLD )) { +if (*sts & (S35390A_FLAG_POC |S35390A_FLAG_BLD )) {/* Try up to five times to reset the chip */ if (initcount <5 ) { ++initcount;
@@ -181,9 +179,9 @@ static int s35390a_disable_test_mode(struct s35390a *s35390a)return s35390a_set_reg (s35390a,S35390A_CMD_STATUS2 , buf,sizeof (buf)); } -static char s35390a_hr2reg (struct s35390a *s35390a,int hour) +static char s35390a_hr2reg (int hour,bool twentyfourhour) { -if (s35390a->twentyfourhour) +if (twentyfourhour)return bin2bcd (hour);if (hour <12 )
@@ -192,11 +190,11 @@ static char s35390a_hr2reg(struct s35390a *s35390a, int hour)return 0x40 |bin2bcd (hour -12 ); } -static int s35390a_reg2hr (struct s35390a *s35390a,char reg) +static int s35390a_reg2hr (char reg,bool twentyfourhour) {unsigned hour; -if (s35390a->twentyfourhour) +if (twentyfourhour)return bcd2bin (reg &0x3f ); hour =bcd2bin (reg &0x3f );
@@ -210,7 +208,7 @@ static int s35390a_rtc_set_time(struct device *dev, struct rtc_time *tm) {struct i2c_client *client =to_i2c_client (dev);struct s35390a *s35390a =i2c_get_clientdata (client); -int i; +int i, err;u8 buf[7 ], status; dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d mday=%d, "
@@ -218,14 +216,18 @@ static int s35390a_rtc_set_time(struct device *dev, struct rtc_time *tm) tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); -if (s35390a_read_status (s35390a, &status) ==1 ) -s35390a_init (s35390a); + err =s35390a_read_status (s35390a, &status); +if (err ==1 ) + err =s35390a_init (s35390a, &status); + +if (err <0 ) +return err; buf[S35390A_BYTE_YEAR ] =bin2bcd (tm->tm_year -100 ); buf[S35390A_BYTE_MONTH ] =bin2bcd (tm->tm_mon +1 ); buf[S35390A_BYTE_DAY ] =bin2bcd (tm->tm_mday); buf[S35390A_BYTE_WDAY ] =bin2bcd (tm->tm_wday); - buf[S35390A_BYTE_HOURS ] =s35390a_hr2reg (s35390a, tm->tm_hour); + buf[S35390A_BYTE_HOURS ] =s35390a_hr2reg (tm->tm_hour, status &S35390A_FLAG_24H ); buf[S35390A_BYTE_MINS ] =bin2bcd (tm->tm_min); buf[S35390A_BYTE_SECS ] =bin2bcd (tm->tm_sec);
@@ -243,8 +245,11 @@ static int s35390a_rtc_read_time(struct device *dev, struct rtc_time *tm)u8 buf[7 ], status;int i, err; -if (s35390a_read_status (s35390a, &status) ==1 ) + err =s35390a_read_status (s35390a, &status); +if (err ==1 )return -EINVAL ; +if (err <0 ) +return err; err =s35390a_get_reg (s35390a,S35390A_CMD_TIME1 , buf,sizeof (buf));if (err <0 )
@@ -256,7 +261,7 @@ static int s35390a_rtc_read_time(struct device *dev, struct rtc_time *tm) tm->tm_sec =bcd2bin (buf[S35390A_BYTE_SECS ]); tm->tm_min =bcd2bin (buf[S35390A_BYTE_MINS ]); - tm->tm_hour =s35390a_reg2hr (s35390a, buf[S35390A_BYTE_HOURS ]); + tm->tm_hour =s35390a_reg2hr (buf[S35390A_BYTE_HOURS ], status &S35390A_FLAG_24H ); tm->tm_wday =bcd2bin (buf[S35390A_BYTE_WDAY ]); tm->tm_mday =bcd2bin (buf[S35390A_BYTE_DAY ]); tm->tm_mon =bcd2bin (buf[S35390A_BYTE_MONTH ]) -1 ;
@@ -292,7 +297,7 @@ static int s35390a_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) {struct i2c_client *client =to_i2c_client (dev);struct s35390a *s35390a =i2c_get_clientdata (client); -u8 buf[3 ], sts =0 ; +u8 buf[3 ], status1, status2 =0 ;int err, i; dev_dbg(&client->dev, "%s: alm is secs=%d, mins=%d, hours=%d mday=%d, "\
@@ -301,22 +306,22 @@ static int s35390a_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) alm->time.tm_mon, alm->time.tm_year, alm->time.tm_wday);/* disable interrupt (which deasserts the irq line) */ - err =s35390a_set_reg (s35390a,S35390A_CMD_STATUS2 , &sts,sizeof (sts)); + err =s35390a_set_reg (s35390a,S35390A_CMD_STATUS2 , &status2,sizeof (status2));if (err <0 )return err;/* clear pending interrupt (in STATUS1 only), if any */ - err =s35390a_get_reg (s35390a,S35390A_CMD_STATUS1 , &sts,sizeof (sts)); + err =s35390a_get_reg (s35390a,S35390A_CMD_STATUS1 , &status1,sizeof (status1));if (err <0 )return err;if (alm->enabled) - sts =S35390A_INT2_MODE_ALARM ; + status2 =S35390A_INT2_MODE_ALARM ;else - sts =S35390A_INT2_MODE_NOINTR ; + status2 =S35390A_INT2_MODE_NOINTR ;/* set interrupt mode*/ - err =s35390a_set_reg (s35390a,S35390A_CMD_STATUS2 , &sts,sizeof (sts)); + err =s35390a_set_reg (s35390a,S35390A_CMD_STATUS2 , &status2,sizeof (status2));if (err <0 )return err;
@@ -325,8 +330,8 @@ static int s35390a_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)else buf[S35390A_ALRM_BYTE_WDAY ] =0 ; - buf[S35390A_ALRM_BYTE_HOURS ] =s35390a_hr2reg (s35390a, - alm->time.tm_hour) |0x80 ; + buf[S35390A_ALRM_BYTE_HOURS ] =s35390a_hr2reg (alm->time.tm_hour, + status1 &S35390A_FLAG_24H ) |0x80 ; buf[S35390A_ALRM_BYTE_MINS ] =bin2bcd (alm->time.tm_min) |0x80 ;if (alm->time.tm_hour >=12 )
@@ -345,14 +350,20 @@ static int s35390a_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) {struct i2c_client *client =to_i2c_client (dev);struct s35390a *s35390a =i2c_get_clientdata (client); -u8 buf[3 ], sts; +u8 buf[3 ], status1, status2;int i, err; - err =s35390a_get_reg (s35390a,S35390A_CMD_STATUS2 , &sts,sizeof (sts)); + err =s35390a_read_status (s35390a, &status1); +if (err ==1 ) +return -EINVAL ; +if (err <0 ) +return err; + + err =s35390a_get_reg (s35390a,S35390A_CMD_STATUS2 , &status2,sizeof (status2));if (err <0 )return err; -if ((sts &S35390A_INT2_MODE_MASK ) !=S35390A_INT2_MODE_ALARM ) { +if ((status2 &S35390A_INT2_MODE_MASK ) !=S35390A_INT2_MODE_ALARM ) {/* * When the alarm isn't enabled, the register to configure * the alarm time isn't accessible.
@@ -381,8 +392,8 @@ static int s35390a_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)if (buf[S35390A_ALRM_BYTE_HOURS ] &0x80 ) alm->time.tm_hour = -s35390a_reg2hr (s35390a, - buf[S35390A_ALRM_BYTE_HOURS ] & ~0x80 ); +s35390a_reg2hr (buf[S35390A_ALRM_BYTE_HOURS ] & ~0x80 , + status1 &S35390A_FLAG_24H );if (buf[S35390A_ALRM_BYTE_MINS ] &0x80 ) alm->time.tm_min =bcd2bin (buf[S35390A_ALRM_BYTE_MINS ] & ~0x80 );
@@ -416,7 +427,7 @@ static int s35390a_rtc_ioctl(struct device *dev, unsigned int cmd,break ;case RTC_VL_CLR :/* update flag and clear register */ - err =s35390a_init (s35390a); + err =s35390a_init (s35390a, &sts);if (err <0 )return err;break ;
@@ -503,11 +514,6 @@ static int s35390a_probe(struct i2c_client *client)return err_read; } -if (status1 &S35390A_FLAG_24H ) - s35390a->twentyfourhour =1 ; -else - s35390a->twentyfourhour =0 ; -if (status1 &S35390A_FLAG_INT2 ) {/* disable alarm (and maybe test mode) */ buf =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2572/2651 octeontx2-pf: fix skb use-after-free on ipsec transmit drop
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Buchwitz <[email protected]>
[ Upstream commit 14d01ff1a4952198abae713a4ad428e07819b4aa ]
When an SA is removed while packets for it are still queued, the transmit path frees the packet but reports the queue as busy. The stack then requeues the freed skb, and the DMA mappings leak.
--- drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c +4 -1
@@ -1037,6 +1037,9 @@ bool cn10k_ipsec_transmit(struct otx2_nic *pf, struct netdev_queue *txq,cn10k_cpt_inst_flush (pf, &inst,sizeof (struct cpt_inst_s ));return true; drop: +otx2_dma_unmap_skb_frags (pf, &sq->sg[sq->head]); + sq->sg[sq->head].skb = (u64 )NULL ; +atomic_long_inc (&pf->hw.dev_stats.tx_discards);dev_kfree_skb_any (skb); -return false; +return true; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2573/2651 octeontx2-pf: pass the skb to otx2_dma_unmap_skb_frags()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Buchwitz <[email protected]>
[ Upstream commit 92cb8653970e4efaa7d2c2e2819c6d050b25e462 ]
After a DMA mapping error, the unmap reads an skb pointer that is not set yet. It can be NULL or left over from an earlier packet.
--- .../net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c | 2 +- .../net/ethernet/marvell/octeontx2/nic/otx2_common.c | 5 ++--- .../net/ethernet/marvell/octeontx2/nic/otx2_common.h | 3 ++- drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c +1 -1
@@ -1037,7 +1037,7 @@ bool cn10k_ipsec_transmit(struct otx2_nic *pf, struct netdev_queue *txq,cn10k_cpt_inst_flush (pf, &inst,sizeof (struct cpt_inst_s ));return true; drop: -otx2_dma_unmap_skb_frags (pf, &sq->sg[sq->head]); +otx2_dma_unmap_skb_frags (pf, &sq->sg[sq->head], skb); sq->sg[sq->head].skb = (u64 )NULL ;atomic_long_inc (&pf->hw.dev_stats.tx_discards);dev_kfree_skb_any (skb);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +2 -3
@@ -2140,13 +2140,12 @@ dma_addr_t otx2_dma_map_skb_frag(struct otx2_nic *pfvf,return otx2_dma_map_page (pfvf, page, offset, *len, dir); } -void otx2_dma_unmap_skb_frags (struct otx2_nic *pfvf,struct sg_list *sg) +void otx2_dma_unmap_skb_frags (struct otx2_nic *pfvf,struct sg_list *sg, +struct sk_buff *skb) {enum dma_data_direction dir =DMA_TO_DEVICE ; -struct sk_buff *skb =NULL ;int seg; - skb = (struct sk_buff *)sg->skb;if (unlikely (xfrm_offload (skb))) dir =DMA_BIDIRECTIONAL ;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +2 -1
@@ -1253,7 +1253,8 @@ static inline int mcam_entry_cmp(const void *a, const void *b)dma_addr_t otx2_dma_map_skb_frag (struct otx2_nic *pfvf,struct sk_buff *skb,int seg,int *len); -void otx2_dma_unmap_skb_frags (struct otx2_nic *pfvf,struct sg_list *sg); +void otx2_dma_unmap_skb_frags (struct otx2_nic *pfvf,struct sg_list *sg, +struct sk_buff *skb);int otx2_read_free_sqe (struct otx2_nic *pfvf,u16 qidx);void otx2_queue_vf_work (struct mbox *mw,struct workqueue_struct *mbox_wq,int first,int mdevs,u64 intr);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +5 -5
@@ -160,7 +160,7 @@ static void otx2_snd_pkt_handler(struct otx2_nic *pfvf, *tx_bytes += skb->len; (*tx_pkts)++; -otx2_dma_unmap_skb_frags (pfvf, sg); +otx2_dma_unmap_skb_frags (pfvf, sg, skb);napi_consume_skb (skb, budget); sg->skb = (u64 )NULL ; }
@@ -872,7 +872,7 @@ static int otx2_dma_map_tso_skb(struct otx2_nic *pfvf, }return 0 ; unmap: -otx2_dma_unmap_skb_frags (pfvf, sg); +otx2_dma_unmap_skb_frags (pfvf, sg, skb);return -EINVAL ; }
@@ -1252,7 +1252,7 @@ bool otx2_sq_append_skb(void *dev, struct netdev_queue *txq, ret =otx2_sqe_add_sg (pfvf, sq, skb, num_segs, &offset);if (!ret) { -otx2_dma_unmap_skb_frags (pfvf, &sq->sg[sq->head]); +otx2_dma_unmap_skb_frags (pfvf, &sq->sg[sq->head], skb);return false; }
@@ -1344,7 +1344,7 @@ void otx2_cleanup_tx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq)if (skb) { tx_bytes += skb->len; tx_pkts++; -otx2_dma_unmap_skb_frags (pfvf, sg); +otx2_dma_unmap_skb_frags (pfvf, sg, skb);dev_kfree_skb_any (skb); sg->skb = (u64 )NULL ; }
@@ -1399,7 +1399,7 @@ void otx2_free_pending_sqe(struct otx2_nic *pfvf)if (skb) { tx_bytes += skb->len; tx_pkts++; -otx2_dma_unmap_skb_frags (pfvf, sg); +otx2_dma_unmap_skb_frags (pfvf, sg, skb);dev_kfree_skb_any (skb); sg->skb = (u64 )NULL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2574/2651 fork: Let nobody keep a task that may not come to life
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 5cf0881344cfa0a3b558107741884d8f43269d7b ]
dup_task_struct() sets rcu_users to 2. From then on bpf_task_acquire() hands out references to the new task, which BPF programs see as a trusted pointer long before it is sure to live: in the task_alloc LSM hook and in ops.init_task() of sched_ext.
If copy_process() fails later on, it undoes what it has done and frees the task without a look at the count. A program that has stored its reference in a map is left with a pointer to freed memory:
BUG: KASAN: slab-use-after-free in put_task_struct_rcu_user+0x22/0x90
The program is loaded by the administrator, but any user can make a fork fail, for example at the pids.max of a cgroup.
Honouring the count would not do: the task would stay behind with its mm, files and credentials freed. Leave rcu_users at zero until copy_process() cannot fail any more. bpf_task_acquire() returns NULL until then, which its callers have to be prepared for, and which they get for init_task, whose count has always been zero. The other users of rcu_users deal with tasks that have run.
--- kernel/fork.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
kernel/fork.c +9 -3
@@ -971,10 +971,10 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node)dup_user_cpus_ptr (tsk, orig, node);/* -* One for the user space visible state that goes away when reaped. -* One for the scheduler. +* Nobody can keep the task while copy_process() may still fail, which +* frees it no matter what. */ -refcount_set (&tsk->rcu_users,2 ); +refcount_set (&tsk->rcu_users,0 );/* One for the rcu users */ refcount_set (&tsk->usage,1 );#ifdef CONFIG_BLK_DEV_IO_TRACE
@@ -2522,6 +2522,12 @@ __latent_entropy struct task_struct *copy_process(/* No more failure paths after this point. */ +/* +* One for the user space visible state that goes away when reaped. +* One for the scheduler. +*/ +refcount_set (&p->rcu_users,2 ); +/* * Copy seccomp details explicitly here, in case they were changed * before holding sighand lock.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2575/2651 ASoC: SOF: Intel: hda: Stop the controller before freeing its DMA buffers
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 11ae63bd9030349a0136fb2edd1622a4a029edc8 ]
hda_dsp_probe() starts the CORB/RIRB DMA engines through hda_dsp_ctrl_init_chip(), but neither hda_dsp_remove() nor the error path of hda_dsp_probe() stops them before hda_dsp_stream_free() frees the CORB/RIRB ring buffer and the position buffer. Unsolicited responses also stay enabled, so the controller can keep writing RIRB entries into the freed page.
Until commit 9e6966f70404 ("ASoC: SOF: Intel: hda: Keep non-alt mlinks powered at probe on ACE2+"), hda_init_caps() dropped the initial references to the non-alternate links, and dropping the last one stopped the command DMA, so a probe that failed later, e.g. because the firmware is missing, did not leave it running. Now it does, and as the probe runs from a work item, the device stays bound after the failure, with bus mastering enabled and the DMA engines pointed at freed memory.
Normal removal resumes the device first, which restarts the command DMA, so there the ring buffer is freed while the DMA is running until pci_disable_device() clears bus mastering.
Stop the controller with hda_dsp_ctrl_stop_chip() before freeing the buffers, as is done on suspend, and export it for use from hda.c.
This was reproduced by binding SOF in DSPless mode to a QEMU
ich9-intel-hda: after the probe fails with "SOF firmware and/or topology file not found", CORB and RIRB DMA are still running with unsolicited responses and bus mastering enabled, and the page they use is soon reused as a page table.
--- sound/soc/sof/intel/hda-ctrl.c | 1 + sound/soc/sof/intel/hda.c | 4 ++++ 2 files changed, 5 insertions(+)
sound/soc/sof/intel/hda-ctrl.c +1 -0
@@ -349,6 +349,7 @@ void hda_dsp_ctrl_stop_chip(struct snd_sof_dev *sdev) bus->chip_init = false; } +EXPORT_SYMBOL_NS (hda_dsp_ctrl_stop_chip,"SND_SOC_SOF_INTEL_HDA_COMMON" );MODULE_LICENSE ("Dual BSD/GPL" );MODULE_DESCRIPTION ("SOF helpers for HDaudio platforms" );
sound/soc/sof/intel/hda.c +4 -0
@@ -939,6 +939,7 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)hda_dsp_ctrl_ppcap_enable (sdev, false); } free_ipc_irq: +hda_dsp_ctrl_stop_chip (sdev);free_irq (sdev->ipc_irq, sdev); free_irq_vector:if (sdev->msi_enabled)
@@ -1006,6 +1007,9 @@ void hda_dsp_remove(struct snd_sof_dev *sdev)snd_dma_free_pages (&hda->iccmax_dmab); skip_disable_dsp: +/* stop CORB/RIRB and position buffer DMA before the buffers are freed */ +hda_dsp_ctrl_stop_chip (sdev); +free_irq (sdev->ipc_irq, sdev);if (sdev->msi_enabled)pci_free_irq_vectors (pci);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2576/2651 xattr: always invoke cap_convert_nscap() for security.capability writes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominik Maier <[email protected]>
[ Upstream commit 0f4a9e682f7fa5becc3af7204606d9bf4780e425 ]
Commit 8db6c34f1dbc ("Introduce v3 namespaced file capabilities") changed cap_inode_setxattr() to return 0 unconditionally for XATTR_NAME_CAPS ("security.capability") and moved capability validation into cap_convert_nscap(), but placed the call inside the "if (size)" block in setxattr(). Commit 7c03e2cda4a5 ("vfs: move cap_convert_nscap() call into vfs_setxattr()") preserved that "size &&" condition in vfs_setxattr():
if (size && strcmp(name, XATTR_NAME_CAPS) == 0) {
error = cap_convert_nscap(idmap, dentry, &value, size);
...
}For security.* extended attributes, xattr_permission() skips inode_permission(MAY_WRITE) and leaves permission checks to the security module, while cap_inode_setxattr() returns 0 for XATTR_NAME_CAPS assuming cap_convert_nscap() has already validated the write. Because __vfs_setxattr() treats size == 0 as an empty attribute write (setting value = "") rather than a removal, calling setxattr(2) on "security.capability" with size == 0 bypasses cap_convert_nscap() and allows an unprivileged caller without CAP_SETFCAP or write permission on the target inode to write a 0-byte security.capability xattr (or overwrite an existing one).
When that binary is subsequently executed, get_vfs_caps_from_disk() reads the 0-byte security.capability xattr and fails the
size < sizeof(magic_etc) check with -EINVAL, causing execve(2) to fail with -EINVAL.
Always invoke cap_convert_nscap() when strcmp(name, XATTR_NAME_CAPS) == 0 regardless of size, so that 0-byte writes hit the existing !*ivalue / !validheader() checks in cap_convert_nscap() and are rejected with -EINVAL.
--- fs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xattr.c +1 -1
@@ -332,7 +332,7 @@ vfs_setxattr(struct mnt_idmap *idmap, struct dentry *dentry,const void *orig_value = value;int error; -if (size &&strcmp (name,XATTR_NAME_CAPS ) ==0 ) { +if (strcmp (name,XATTR_NAME_CAPS ) ==0 ) { error =cap_convert_nscap (idmap, dentry, &value, size);if (error <0 )return error;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2577/2651 selftests/ovl: fix detached layer mountinfo expectations
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
[ Upstream commit aefaf9521c999206b7cd2df8435a270ea8b8112b ]
set_layers_via_detached_mount_fds was copied from the attached-fd test and still looks for /tmp paths. Detached open_tree() layers are recorded by d_path() as upperdir=/upper, workdir=/work, and lowerdir+=/ and datadir+=/ for each cloned directory. The test has failed since it was added.
--- .../filesystems/overlayfs/set_layers_via_fds.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
tools/testing/selftests/filesystems/overlayfs/set_layers_via_fds.c +9 -9
@@ -686,23 +686,23 @@ TEST_F(set_layers_via_fds, set_layers_via_detached_mount_fds)while (getline (&line, &len, f_mountinfo) !=-1 ) {char *haystack = line; -if (strstr (haystack,"workdir=/tmp/w" )) +if (strstr (haystack,"workdir=/work" )) layers_found[0 ] = true; -if (strstr (haystack,"upperdir=/tmp/u" )) +if (strstr (haystack,"upperdir=/upper" )) layers_found[1 ] = true; -if (strstr (haystack,"lowerdir+=/tmp/l1" )) +if (strstr (haystack,"lowerdir+=/" )) layers_found[2 ] = true; -if (strstr (haystack,"lowerdir+=/tmp/l2" )) +if (strstr (haystack,"lowerdir+=/" )) layers_found[3 ] = true; -if (strstr (haystack,"lowerdir+=/tmp/l3" )) +if (strstr (haystack,"lowerdir+=/" )) layers_found[4 ] = true; -if (strstr (haystack,"lowerdir+=/tmp/l4" )) +if (strstr (haystack,"lowerdir+=/" )) layers_found[5 ] = true; -if (strstr (haystack,"datadir+=/tmp/d1" )) +if (strstr (haystack,"datadir+=/" )) layers_found[6 ] = true; -if (strstr (haystack,"datadir+=/tmp/d2" )) +if (strstr (haystack,"datadir+=/" )) layers_found[7 ] = true; -if (strstr (haystack,"datadir+=/tmp/d3" )) +if (strstr (haystack,"datadir+=/" )) layers_found[8 ] = true; }free (line);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2578/2651 namei: dont assert S_ISDIR on a stale rcu-walk inode
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit e227cdac03dffa896e02ed7260f9149c4c382715 ]
lookup_inode_permission_may_exec() asserts that it is only ever handed a directory, on the grounds that link_path_walk() has already checked d_can_lookup(). In rcu-walk that does not follow. step_into() samples ->d_inode and validates it against ->d_seq, but link_path_walk() loads ->d_flags again afterwards, and nothing orders that load against changes of the dentry:
CPU0 (rcu-walk of "x/y") CPU1
step_into(x)
inode = x->d_inode // regular file
read_seqcount_retry(&x->d_seq) == 0
nd->inode = inode
unlink("x")
d_delete() // x goes negative
mkdir("x")
d_instantiate() // same dentry
d_can_lookup(x) // true now
may_lookup()
VFS_BUG_ON_INODE(!S_ISDIR(nd->inode->i_mode))With CONFIG_PREEMPT_RCU the walker can be preempted in that window, so it is not limited to a few instructions. mkdir() only gets the same dentry back if the filesystem keeps negative dentries around. tmpfs doesn't, ext4 does.
Apart from the assertion the stale inode is harmless, and has been there since before the assertion was added: nd->seq no longer matches x->d_seq, so lookup_fast(), follow_dotdot_rcu() and try_to_unlazy() all fail with -ECHILD and the walk is redone in ref-walk, whatever the permission check on the old inode said.
Keep the assertion for ref-walk, where the dentry is pinned and can't change type, and skip it for rcu-walk. No change for kernels without CONFIG_DEBUG_VFS.
--- fs/namei.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
fs/namei.c +8 -2
@@ -683,8 +683,14 @@ EXPORT_SYMBOL(inode_permission); static __always_inline int lookup_inode_permission_may_exec(struct mnt_idmap *idmap,struct inode *inode,int mask) { -/* Lookup already checked this to return -ENOTDIR */ -VFS_BUG_ON_INODE (!S_ISDIR (inode->i_mode), inode); +/* +* Lookup already checked this to return -ENOTDIR. In rcu-walk that +* check looks at ->d_flags after ->d_seq had been validated, so it can +* see a dentry which went negative and then became a directory while +* nd->inode is still the old non-directory. Any such walk fails the +* next ->d_seq check and gets redone in ref-walk. +*/ +VFS_BUG_ON_INODE (!S_ISDIR (inode->i_mode) && !(mask &MAY_NOT_BLOCK ), inode);VFS_BUG_ON ((mask & ~MAY_NOT_BLOCK ) !=0 ); mask |=MAY_EXEC ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2579/2651 block: fix use-after-free of the disk in sync_bdevs()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit cebb1c2331c2af1b7f1c822ac672a7f77b54bd90 ]
sync_bdevs() holds a reference to the bdev inode while it takes bd_disk->open_mutex. For a partition the inode doesn't keep the gendisk alive, the device reference does: part_release() drops the disk as soon as the last reference to the partition device is gone. A sync(2) racing with the last close of a partition of an already deleted disk locks a freed open_mutex.
Take a device reference before touching the disk, like blkdev_get_no_open() does, and skip the bdev if it's on its way out.
--- block/bdev.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
block/bdev.c +10 -0
@@ -1366,6 +1366,15 @@ void sync_bdevs(bool wait) old_inode = inode; bdev =I_BDEV (inode); +/* +* The inode does not keep the gendisk of a partition alive, the +* device does. +*/ +if (!kobject_get_unless_zero (&bdev->bd_device.kobj)) { +spin_lock (&blockdev_superblock->s_inode_list_lock); +continue ; + } +mutex_lock (&bdev->bd_disk->open_mutex);if (!atomic_read (&bdev->bd_openers)) { ;/* skip */
@@ -1381,6 +1390,7 @@ void sync_bdevs(bool wait)filemap_fdatawrite (inode->i_mapping); }mutex_unlock (&bdev->bd_disk->open_mutex); +put_device (&bdev->bd_device);spin_lock (&blockdev_superblock->s_inode_list_lock); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2580/2651 block: dont lose the status of a failed flush request
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 67c43ceaa29e9b904216651697adf20445b219fc ]
flush_end_io() stores the status in fq->rq_status for whoever drops the last reference to finish the flush sequence. blk_mq_put_rq_ref() calls it with BLK_STS_OK from tag iterators and the timeout handler and overwrites an error the real completion stored. With two extra references, reading /sys/block/<disk>/inflight is enough for that, a failed flush completes everything waiting on it with success and fsync() lies to the application.
Only store a status that is an error.
--- block/blk-flush.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
block/blk-flush.c +7 -1
@@ -212,7 +212,13 @@ static enum rq_end_io_ret flush_end_io(struct request *flush_rq,spin_lock_irqsave (&fq->mq_flush_lock, flags);if (!req_ref_put_and_test (flush_rq)) { - fq->rq_status = error; +/* +* Remember the status of the flush for whoever drops the last +* reference. blk_mq_put_rq_ref() gets here with BLK_STS_OK and +* must not wipe it out. +*/ +if (error !=BLK_STS_OK ) + fq->rq_status = error;spin_unlock_irqrestore (&fq->mq_flush_lock, flags);return RQ_END_IO_NONE ; }
Signature · 1 line
2.53.0
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 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.
We see a build failure here.
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/pipelines/3084792704
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-7.3.y
Best regards,
Pavel
In file included from ./include/linux/device.h:31, 1965
16:37:20
from ./include/linux/pci.h:38,
1966
16:37:20
from drivers/pci/controller/pcie-iproc-bcma.c:8:
1967
16:37:20drivers/pci/controller/pcie-iproc-bcma.c: In function 'iproc_bcma_pcie_probe':
1968
16:37:20drivers/pci/controller/pcie-iproc-bcma.c:72:45: error: 'devm_pci_alloc_host_bridge_release' undeclared (first use in this function); did you mean 'devm_pci_alloc_host_bridge'? 1969
16:37:20
72 | ret = devm_add_action_or_reset(dev, devm_pci_alloc_host_bridge_release,
1970
16:37:20
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1971
16:37:20./include/linux/device/devres.h:181:41: note: in definition of macro 'devm_add_action_or_reset'
1972
16:37:20
181 | __devm_add_action_or_reset(dev, action, data, #action)
1973
16:37:20
| ^~~~~~
1974
16:37:20drivers/pci/controller/pcie-iproc-bcma.c:72:45: note: each undeclared identifier is reported only once for each function it appears in 1975
16:37:20
72 | ret = devm_add_action_or_reset(dev, devm_pci_alloc_host_bridge_release,
1976
16:37:20
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1977
16:37:20./include/linux/device/devres.h:181:41: note: in definition of macro 'devm_add_action_or_reset' 1978
16:37:20
181 | __devm_add_action_or_reset(dev, action, data, #action)
1979
16:37:20
| ^~~~~~
1980
16:37:20
make[5]: *** [scripts/Makefile.build:290: drivers/pci/controller/pcie-iproc-bcma.o] Error 1 1981
16:37:20
make[5]: *** Waiting for unfinished jobs....
1982
16:37:20
CC net/core/net-traces.o
Best regards,
Pavel
Greg Kroah-Hartman
maintainerPATCH 2581/2651 blk-mq: dont trust the cookie in blk_mq_poll()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 24974185999fd80b676fbe2a6c7a97bbd38aaf3a ]
blk_mq_poll() indexes queue_hw_ctx[] with bio->bi_cookie unchecked. Zone write plugging keeps the segment count of a plugged write in __bi_nr_segments, which shares a union with the cookie, and clears REQ_POLLED, but bio_poll() only looks at the cookie. A plugged polled write with more segments than there are hardware queues reads past the array. The bio is also SLAB_TYPESAFE_BY_RCU, so a cookie from a bio reused for another device can meet the wrong array as well.
Ignore a cookie that is out of range or doesn't name a poll queue.
--- block/blk-mq.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
block/blk-mq.c +14 -1
@@ -5245,9 +5245,22 @@ static int blk_hctx_poll(struct request_queue *q, struct blk_mq_hw_ctx *hctx,int blk_mq_poll (struct request_queue *q,blk_qc_t cookie,struct io_comp_batch *iob,unsigned int flags) { +struct blk_mq_hw_ctx *hctx; +if (!blk_mq_can_poll (q))return 0 ; -return blk_hctx_poll (q, q->queue_hw_ctx[cookie], iob, flags); + +/* +* The cookie is no more than a hint. iocb_bio_iopoll() may have read it +* from a bio that was reused for another queue right afterwards, and +* zone write plugging keeps the number of segments in the same field. +*/ +if (cookie >= q->nr_hw_queues) +return 0 ; + hctx = q->queue_hw_ctx[cookie]; +if (hctx->type !=HCTX_TYPE_POLL ) +return 0 ; +return blk_hctx_poll (q, hctx, iob, flags); } int blk_rq_poll(struct request *rq, struct io_comp_batch *iob,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2582/2651 blk-mq: keep sharing tags fairly after a queue update
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 620cfc7a664278a55d068ed88fff1242fddc4ef2 ]
A hctx only gets BLK_MQ_F_TAG_QUEUE_SHARED from blk_mq_add_queue_tag_set(). The hctxs blk_mq_update_nr_hw_queues() allocates for queues that joined long ago never get it, so they aren't counted in active_queues and hctx_may_queue() lets them take all the tags. One NVMe namespace can starve the others after the first update.
Set the flag on the new hctxs.
--- block/blk-mq.c | 3 +++ 1 file changed, 3 insertions(+)
block/blk-mq.c +3 -0
@@ -5184,6 +5184,9 @@ static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, goto fallback; }blk_mq_map_swqueue (q); +/* The new hctxs don't know yet that they share their tags */ +if (set->flags &BLK_MQ_F_TAG_QUEUE_SHARED ) +queue_set_hctx_shared (q, true); } switch_back:/* The blk_mq_elv_switch_back unfreezes queue for us. */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2583/2651 blk-mq: dont bring back flags of a completed request
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 9531230ee1fcb8eca2c9cbb9bf02651cbf798842 ]
The timeout handler sets and clears RQF_TIMED_OUT in a request it only holds a reference to, with a plain read-modify-write, while the completion clears flags in rq_flags the same way. If the two interleave, blk_mq_finish_request() runs twice with the flags back: the zone write plug reference is dropped twice and the scheduler's ->finish_request() is called again.
Change RQF_TIMED_OUT with cmpxchg, so the handler never writes back a flag that changed under it.
--- block/blk-mq.c | 2 +- block/blk-timeout.c | 3 ++- block/blk.h | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-)
block/blk-mq.c +1 -1
@@ -1639,7 +1639,7 @@ EXPORT_SYMBOL_GPL(blk_mq_queue_inflight);static void blk_mq_rq_timed_out (struct request *req) { - req->rq_flags |=RQF_TIMED_OUT ; +blk_rq_change_timed_out (req, true);if (req->q->mq_ops->timeout) {enum blk_eh_timer_return ret;
block/blk-timeout.c +2 -1
@@ -137,7 +137,8 @@ void blk_add_timer(struct request *req)if (!req->timeout) req->timeout = q->rq_timeout; - req->rq_flags &= ~RQF_TIMED_OUT ; +if (req->rq_flags &RQF_TIMED_OUT ) +blk_rq_change_timed_out (req, false); expiry = jiffies + req->timeout;WRITE_ONCE (req->deadline, expiry);
block/blk.h +14 -0
@@ -332,6 +332,20 @@ static inline void bio_integrity_free(struct bio *bio)unsigned long blk_rq_timeout (unsigned long timeout);void blk_add_timer (struct request *req); +/* +* The timeout handler changes RQF_TIMED_OUT in a request which it does not +* own: whoever completes it changes rq_flags at the same time, with plain +* loads and stores. Never write back a flag that has changed under us. +*/ +static inline void blk_rq_change_timed_out (struct request *rq,bool set) +{ +req_flags_t old =READ_ONCE (rq->rq_flags), new; + +do { + new = set ? old |RQF_TIMED_OUT : old & ~RQF_TIMED_OUT ; + }while (!try_cmpxchg (&rq->rq_flags, &old, new)); +} +enum bio_merge_status {BIO_MERGE_OK ,BIO_MERGE_NONE ,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2584/2651 blk-mq: dont forget a timer the driver has restarted
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 0db9f8968a8941d4fc9fddf220d4983d9b68deaf ]
If ->timeout() returns BLK_EH_RESET_TIMER, blk_add_timer() gives the request a new deadline that blk_mq_timeout_work() doesn't know about when it picks the next expiry. A 2s nbd read next to a 60s one expires once and then not again for a minute. Let the new deadline take part.
--- block/blk-mq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
block/blk-mq.c +4 -1
@@ -1710,8 +1710,11 @@ static bool blk_mq_handle_expired(struct request *rq, void *priv) {struct blk_expired_data *expired = priv; -if (blk_mq_req_expired (rq, expired)) +if (blk_mq_req_expired (rq, expired)) {blk_mq_rq_timed_out (rq); +/* If its timer has been started again, count the new deadline */ +blk_mq_req_expired (rq, expired); + }return true; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2585/2651 blk-mq-dma: initialize the dma state for P2P, too
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 035236c9e135a2ce7d0f68cb56e63d4a3da2abe1 ]
blk_rq_dma_map_iter_start() promises that the caller need not initialize the dma_iova_state, but the P2P bus address path returns before it does so. The state then holds what the last request with that tag left, and blk_rq_dma_map_coalesce() describes a transfer as one IOVA range that it isn't. Clear it on that path too.
--- block/blk-mq-dma.c | 2 ++ 1 file changed, 2 insertions(+)
block/blk-mq-dma.c +2 -0
@@ -181,6 +181,8 @@ static bool blk_dma_map_iter_start(struct request *req, struct device *dma_dev,switch (pci_p2pdma_state (&iter->p2pdma, dma_dev,phys_to_page (vec.paddr))) {case PCI_P2PDMA_MAP_BUS_ADDR : +/* don't leave the state of an earlier mapping to the caller */ +memset (state,0 ,sizeof (*state));return blk_dma_map_bus (iter, &vec);case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE :/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2586/2651 blk-mq: quiesce a queue that joins a quiesced tag set
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 71ec3c7d6db80737b781d2739d1325b7e39758e1 ]
blk_mq_quiesce_tagset() only quiesces the queues on the list at that moment. A queue added before blk_mq_unquiesce_tagset() runs unquiesced, and then gets unquiesced without ever having been quiesced, which trips the warning in blk_mq_unquiesce_queue(). NVMe gets there when a controller fails while its namespaces are being scanned.
Count the quiesce calls in the tag set and quiesce a joining queue that many times, under a spinlock that also serializes the two functions. It can't be tag_list_lock, see commit 59e25ef2b413.
--- block/blk-mq.c | 22 ++++++++++++++++++++++ include/linux/blk-mq.h | 6 ++++++ 2 files changed, 28 insertions(+)
block/blk-mq.c +22 -0
@@ -336,12 +336,15 @@ void blk_mq_quiesce_tagset(struct blk_mq_tag_set *set) {struct request_queue *q; +spin_lock (&set->quiesce_lock); + set->quiesce_depth++;rcu_read_lock ();list_for_each_entry_rcu (q, &set->tag_list, tag_set_list) {if (!blk_queue_skip_tagset_quiesce (q))blk_mq_quiesce_queue_nowait (q); }rcu_read_unlock (); +spin_unlock (&set->quiesce_lock);blk_mq_wait_quiesce_done (set); }
@@ -351,12 +354,16 @@ void blk_mq_unquiesce_tagset(struct blk_mq_tag_set *set) {struct request_queue *q; +spin_lock (&set->quiesce_lock); +if (set->quiesce_depth) + set->quiesce_depth--;rcu_read_lock ();list_for_each_entry_rcu (q, &set->tag_list, tag_set_list) {if (!blk_queue_skip_tagset_quiesce (q))blk_mq_unquiesce_queue (q); }rcu_read_unlock (); +spin_unlock (&set->quiesce_lock); }EXPORT_SYMBOL_GPL (blk_mq_unquiesce_tagset);
@@ -4346,6 +4353,8 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q)static void blk_mq_add_queue_tag_set (struct blk_mq_tag_set *set,struct request_queue *q) { +unsigned int i; +mutex_lock (&set->tag_list_lock);/*
@@ -4359,7 +4368,18 @@ static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set, }if (set->flags &BLK_MQ_F_TAG_QUEUE_SHARED )queue_set_hctx_shared (q, true); + +/* +* A queue that joins a quiesced tag set is quiesced like the others, +* and blk_mq_unquiesce_tagset() finds what it is going to undo. +*/ +spin_lock (&set->quiesce_lock);list_add_tail_rcu (&q->tag_set_list, &set->tag_list); +if (!blk_queue_skip_tagset_quiesce (q)) { +for (i =0 ; i < set->quiesce_depth; i++) +blk_mq_quiesce_queue_nowait (q); + } +spin_unlock (&set->quiesce_lock);mutex_unlock (&set->tag_list_lock); }
@@ -4928,6 +4948,8 @@ int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set)mutex_init (&set->tag_list_lock);INIT_LIST_HEAD (&set->tag_list); +spin_lock_init (&set->quiesce_lock); + set->quiesce_depth =0 ;return 0 ;
include/linux/blk-mq.h +6 -0
@@ -523,6 +523,10 @@ enum hctx_type {* @tag_list_lock: Serializes tag_list accesses. * @tag_list: List of the request queues that use this tag set. See also * request_queue.tag_set_list. +* @quiesce_lock: Serializes blk_mq_[un]quiesce_tagset() against each other +* and against a request queue being added to @tag_list. +* @quiesce_depth: How often blk_mq_quiesce_tagset() has been called without +* blk_mq_unquiesce_tagset(). * @srcu: Use as lock when type of the request queue is blocking * (BLK_MQ_F_BLOCKING). * @update_nr_hwq_lock:
@@ -548,6 +552,8 @@ struct blk_mq_tag_set {struct mutex tag_list_lock;struct list_head tag_list; +spinlock_t quiesce_lock; +unsigned int quiesce_depth;struct srcu_struct *srcu;struct rw_semaphore update_nr_hwq_lock;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2587/2651 blk-mq: exit the hctxs of a queue under tag_list_lock
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 89a2381482d8ff8e4fe0b7d32797bb4f77503b89 ]
blk_mq_update_nr_hw_queues() exits and replaces the hctxs of every queue on set->tag_list under tag_list_lock. blk_mq_exit_queue() exits its hctxs without the lock and only then takes the queue off the list, so an update running at the same time exits them again and sets up new ones that nobody exits. del_gendisk() is kept away by update_nr_hwq_lock, disk_release() of a never added disk and blk_mq_destroy_queue() are not, and nvme_alloc_ns() drops such a disk when it finds the queues frozen by a reset.
Hold tag_list_lock for both steps.
--- block/blk-mq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
block/blk-mq.c +8 -2
@@ -4339,7 +4339,8 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q) {struct blk_mq_tag_set *set = q->tag_set; -mutex_lock (&set->tag_list_lock); +lockdep_assert_held (&set->tag_list_lock); +list_del_rcu (&q->tag_set_list);if (list_is_singular (&set->tag_list)) {/* just transitioned to unshared */
@@ -4347,7 +4348,6 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q)/* update existing queue */ blk_mq_update_tag_set_shared (set, false); } -mutex_unlock (&set->tag_list_lock); } static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set,
@@ -4711,10 +4711,16 @@ void blk_mq_exit_queue(struct request_queue *q) {struct blk_mq_tag_set *set = q->tag_set; +/* +* As long as the queue is on set->tag_list, its hctxs belong to +* blk_mq_update_nr_hw_queues() as well, which exits and replaces them. +*/ +mutex_lock (&set->tag_list_lock);/* Checks hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED. */ blk_mq_exit_hw_queues (q, set, set->nr_hw_queues);/* May clear BLK_MQ_F_TAG_QUEUE_SHARED in hctx->flags. */ blk_mq_del_queue_tag_set (q); +mutex_unlock (&set->tag_list_lock); }static int __blk_mq_alloc_rq_maps (struct blk_mq_tag_set *set)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2588/2651 blk-mq: set up a queue under tag_list_lock
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 4fcc499ea9bc31b02393904a1903e794d146f5f7 ]
blk_mq_init_allocated_queue() only takes tag_list_lock at the end, when it adds the queue to the set. Before that it sizes the queue by set->nr_hw_queues, hands out set->tags[], maps by set->map[], and blk_mq_map_swqueue() frees tags of the set. An update clearing the maps at that time makes the new queue free tags that all the other queues share. An NVMe controller reset during a namespace scan does exactly that.
Take the lock before the first look at the set. An update can be part of error handling, so the allocations under the lock must not wait for IO:memalloc_noio_save(), as in add_disk_fwnode().
--- block/blk-mq.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
block/blk-mq.c +18 -3
@@ -4355,7 +4355,7 @@ static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set, {unsigned int i; -mutex_lock (&set->tag_list_lock); +lockdep_assert_held (&set->tag_list_lock);/* * Check to see if we're transitioning to shared (from 1 to 2 queues).
@@ -4380,8 +4380,6 @@ static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set,blk_mq_quiesce_queue_nowait (q); }spin_unlock (&set->quiesce_lock); - -mutex_unlock (&set->tag_list_lock); }/* All allocations will be freed in release handler of q->mq_kobj */
@@ -4658,6 +4656,8 @@ static void blk_mq_realloc_hw_ctxs(struct blk_mq_tag_set *set,int blk_mq_init_allocated_queue (struct blk_mq_tag_set *set,struct request_queue *q) { +unsigned int memflags; +/* mark the queue as mq asap */ q->mq_ops = set->ops;
@@ -4676,6 +4676,16 @@ int blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,INIT_LIST_HEAD (&q->unused_hctx_list);spin_lock_init (&q->unused_hctx_lock); +/* +* Keep blk_mq_update_nr_hw_queues() away until the queue is on +* set->tag_list: it changes the number of hardware queues, the tags and +* the maps, and blk_mq_map_swqueue() allocates and frees tags of the set. +* An update can be part of the error handling of a driver, so it must +* not have to wait for somebody who waits for I/O. +*/ + memflags =memalloc_noio_save (); +mutex_lock (&set->tag_list_lock); +blk_mq_realloc_hw_ctxs (set, q);if (!q->nr_hw_queues) goto err_hctxs;
@@ -4696,9 +4706,14 @@ int blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,blk_mq_init_cpu_queues (q, set->nr_hw_queues);blk_mq_map_swqueue (q);blk_mq_add_queue_tag_set (set, q); + +mutex_unlock (&set->tag_list_lock); +memalloc_noio_restore (memflags);return 0 ; err_hctxs: +mutex_unlock (&set->tag_list_lock); +memalloc_noio_restore (memflags);blk_mq_release (q); err_exit: q->mq_ops =NULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2589/2651 block: partitions/mac: compute the sectors in 64 bits
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 6c55f94317249bc195e197f6a8730c843e72ea8c ]
start_block and block_count are converted to 512 byte sectors in 32-bit arithmetic, although put_partition() takes a sector_t. With a block size above 512 bytes anything beyond 2TiB wraps and the partition lands on top of another one.
--- block/partitions/mac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block/partitions/mac.c +2 -2
@@ -97,8 +97,8 @@ int mac_partition(struct parsed_partitions *state)if (be16_to_cpu (part->signature) !=MAC_PARTITION_MAGIC )break ;put_partition (state, slot, -be32_to_cpu (part->start_block) * (secsize/512 ), -be32_to_cpu (part->block_count) * (secsize/512 )); + (sector_t )be32_to_cpu (part->start_block) * (secsize/512 ), + (sector_t )be32_to_cpu (part->block_count) * (secsize/512 ));if (!strncasecmp (part->type,"Linux_RAID" ,10 )) state->parts[slot].flags =ADDPART_FLAG_RAID ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2590/2651 blk-mq: free the bitmaps of tags in the SRCU callback
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 10b249e9b05eed0c4c65b9b89dfc2cf33d68d19a ]
Commit ad0d05dbddc1 keeps struct blk_mq_tags and the requests until the iterators under tags_srcu are gone, but the two bitmaps they walk are still freed right away. When the number of hardware queues shrinks, blk_mq_tagset_busy_iter() may be about to walk tags that __blk_mq_update_nr_hw_queues() frees. sbitmap_free() clears the map pointer, so that's a NULL dereference or a use-after-free, depending on the timing.
Free the bitmaps with the rest in the callback.
--- block/blk-mq-tag.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
block/blk-mq-tag.c +4 -4
@@ -611,17 +611,17 @@ static void blk_mq_free_tags_callback(struct rcu_head *head)kmemleak_free (page_address (page));__free_pages (page, page->private); } +/* An iterator may walk the bitmaps for as long as it may see the tags */ +sbitmap_queue_free (&tags->bitmap_tags); +sbitmap_queue_free (&tags->breserved_tags);kfree (tags); }void blk_mq_free_tags (struct blk_mq_tag_set *set,struct blk_mq_tags *tags) { -sbitmap_queue_free (&tags->bitmap_tags); -sbitmap_queue_free (&tags->breserved_tags); -/* if tags pages is not allocated yet, free tags directly */ if (list_empty (&tags->page_list)) { -kfree (tags); +blk_mq_free_tags_callback (&tags->rcu_head);return ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2591/2651 block: apply the segment size to the integrity buffer
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 26edfdee11eb2afe08fb5f874edcdf0786d6b66c ]
The integrity buffer is a single segment and must not exceed max_segment_size. max_integrity_io_size() applies that limit to the data size instead, which is off by a factor of 64 for 8 bytes of PI per 512 bytes of data. A SCSI host that doesn't set a maximum segment size gets 64KiB, lpfc and qla2xxx among them, so a DIX disk behind one of those does no IO above 64KiB.
Limit the buffer and derive the data size from that, which makes it 4MiB for that case.
--- include/linux/blkdev.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
include/linux/blkdev.h +5 -4
@@ -1814,11 +1814,12 @@ static inline int bio_split_rw_at(struct bio *bio,*/ static inline unsigned int max_integrity_io_size (struct queue_limits *lim) { -u64 max_intervals; + unsigned int buf_size = min_t(unsigned int, lim->max_segment_size, +BLK_INTEGRITY_MAX_SIZE ); - max_intervals =BLK_INTEGRITY_MAX_SIZE / lim->integrity.metadata_size; -return min_t (u64, lim->max_segment_size, - max_intervals << lim->integrity.interval_exp); +return min_t (u64,UINT_MAX , + (u64)(buf_size / lim->integrity.metadata_size) << + lim->integrity.interval_exp); }#define DEFINE_IO_COMP_BATCH (name) struct io_comp_batch name = { }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2592/2651 drbd: stop the start_resync timer of a dying device
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit a439d3fe3ec2bfe0b4ccb77973ae97949bcf46ec ]
start_resync_timer gets armed for up to a second and nothing ever deletes it, so drbd_destroy_device() can free the device with the timer pending. Shut it down where request_timer is shut down.
--- drivers/block/drbd/drbd_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/drbd/drbd_main.c +1 -0
@@ -2163,6 +2163,7 @@ void drbd_destroy_device(struct kref *kref)struct drbd_peer_device *peer_device, *tmp_peer_device;timer_shutdown_sync (&device->request_timer); +timer_shutdown_sync (&device->start_resync_timer);/* paranoia asserts */ D_ASSERT (device, device->open_cnt ==0 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2593/2651 drbd: take req_lock to skip the initial sync as peer
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit bf7fff620c890a7ee0b444f1c7e9f0d1263a30ac ]
_drbd_set_state() must be called with req_lock held. drbd_adm_new_c_uuid() does, receive_uuids() on the peer doesn't, so a concurrent state change gets lost: the device is Secondary again, or its failed disk UpToDate, while the work for the lost change is already queued.
--- drivers/block/drbd/drbd_receiver.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/block/drbd/drbd_receiver.c +2 -0
@@ -4096,8 +4096,10 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info BM_LOCKED_TEST_ALLOWED, NULL);_drbd_uuid_set (device,UI_CURRENT , p_uuid[UI_CURRENT ]);_drbd_uuid_set (device,UI_BITMAP ,0 ); +spin_lock_irq (&device->resource->req_lock);_drbd_set_state (_NS2 (device, disk,D_UP_TO_DATE , pdsk,D_UP_TO_DATE ),CS_VERBOSE ,NULL ); +spin_unlock_irq (&device->resource->req_lock);drbd_md_sync (device); updated_uuids =1 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2594/2651 block/rnbd-srv: dont free the device on a sysfs error
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit d9667ade40f986c565769a900ced6ee95edd33c6 ]
rnbd_srv_create_dev_sysfs() drops the only kobject reference on its error paths, and the release function frees the rnbd_srv_dev. process_msg_open() keeps using it and ends in destroy_device() with a list_del() and a second kfree(). This doesn't need memory pressure: a client opening a device while its last mapping goes away gets -EEXIST from kobject_add() against the old directory.
Only undo kobject_add() on failure and leave the reference to destroy_device(). Initialise the kobject once, the next open retries.
--- drivers/block/rnbd/rnbd-srv-sysfs.c | 16 ++++++++++------ drivers/block/rnbd/rnbd-srv.c | 3 +++ 2 files changed, 13 insertions(+), 6 deletions(-)
drivers/block/rnbd/rnbd-srv-sysfs.c +10 -6
@@ -44,12 +44,17 @@ int rnbd_srv_create_dev_sysfs(struct rnbd_srv_dev *dev,struct kobject *bdev_kobj;int ret; - ret =kobject_init_and_add (&dev->dev_kobj, &dev_ktype, - rnbd_devs_kobj,"%pg" , bdev); -if (ret) { -kobject_put (&dev->dev_kobj); +/* +* The release function frees the device, which the caller goes on +* using and which others may share: never drop the reference of the +* kobject here. That is for destroy_device(). +*/ +if (!dev->dev_kobj.state_initialized) +kobject_init (&dev->dev_kobj, &dev_ktype); + + ret =kobject_add (&dev->dev_kobj, rnbd_devs_kobj,"%pg" , bdev); +if (ret)return ret; - } dev->dev_sessions_kobj =kobject_create_and_add ("sessions" , &dev->dev_kobj);
@@ -69,7 +74,6 @@ int rnbd_srv_create_dev_sysfs(struct rnbd_srv_dev *dev,kobject_put (dev->dev_sessions_kobj); free_dev_kobj:kobject_del (&dev->dev_kobj); -kobject_put (&dev->dev_kobj);return ret; }
drivers/block/rnbd/rnbd-srv.c +3 -0
@@ -208,6 +208,9 @@ static void destroy_device(struct kref *kref)* Destroy kobj only if it was really created. */ rnbd_srv_destroy_dev_sysfs (dev); + else if (dev->dev_kobj.state_initialized) + /* The files could not be created. Frees the name, too. */ + kobject_put(&dev->dev_kobj); elsekfree (dev ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2595/2651 block/rnbd-srv: drop the sess_dev kobject unlocked
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 81941915d53ef3384ab4e4b68e92673e66cf66d7 ]
rnbd_srv_create_dev_session_sysfs() drops the kobject reference when it fails. The release function is rnbd_destroy_sess_dev(), which takes srv_dev->lock, and the caller holds that lock: the worker deadlocks on itself. A client opening one device as "ram0" and "./ram0" gets there through -EEXIST from kobject_add().
Have process_msg_open() drop the reference after releasing the lock, and leave the rest of the cleanup to the release function.
--- drivers/block/rnbd/rnbd-srv-sysfs.c | 12 ++++++------ drivers/block/rnbd/rnbd-srv.c | 8 +++++++- 2 files changed, 13 insertions(+), 7 deletions(-)
drivers/block/rnbd/rnbd-srv-sysfs.c +6 -6
@@ -193,6 +193,10 @@ static const struct kobj_type rnbd_srv_sess_dev_ktype = { .release = rnbd_srv_sess_dev_release, }; +/* +* On failure the caller has to drop the reference of the kobject. The release +* function takes the lock of the device, which the caller holds here. +*/ int rnbd_srv_create_dev_session_sysfs (struct rnbd_srv_sess_dev *sess_dev) {int ret;
@@ -200,17 +204,13 @@ int rnbd_srv_create_dev_session_sysfs(struct rnbd_srv_sess_dev *sess_dev) ret =kobject_init_and_add (&sess_dev->kobj, &rnbd_srv_sess_dev_ktype, sess_dev->dev->dev_sessions_kobj,"%s" , sess_dev->sess->sessname); -if (ret) { -kobject_put (&sess_dev->kobj); +if (ret)return ret; - } ret =sysfs_create_group (&sess_dev->kobj, &rnbd_srv_default_dev_session_attr_group); -if (ret) { +if (ret)kobject_del (&sess_dev->kobj); -kobject_put (&sess_dev->kobj); - }return ret; }
drivers/block/rnbd/rnbd-srv.c +7 -1
@@ -590,6 +590,7 @@ rnbd_srv_create_set_sess_dev(struct rnbd_srv_session *srv_sess,return sdev;kref_init (&sdev->kref); +INIT_LIST_HEAD (&sdev->dev_list);strscpy (sdev->pathname, open_msg->dev_name,sizeof (sdev->pathname));
@@ -789,7 +790,12 @@ static int process_msg_open(struct rnbd_srv_session *srv_sess,rnbd_srv_err (srv_sess_dev,"Opening device failed, failed to create dev client sysfs files, err: %d\n" , ret); - goto free_srv_sess_dev; +/* +* rnbd_destroy_sess_dev() undoes everything down to the open +* of the block device. +*/ +kobject_put (&srv_sess_dev->kobj); + goto free_path; }list_add (&srv_sess_dev->dev_list, &srv_dev->sess_dev_list);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2596/2651 rnbd-srv: fix use-after-free on two CLOSE messages
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
[ Upstream commit 4912dab88baa5f7034dc9e38807804d470ae5438 ]
process_msg_close() looks the sess_dev up with a kref, drops it right away, and only then takes the session mutex for the teardown. A session has several connections handled by different workers, so two CLOSE messages for the same ID both finish the lookup before either one tears the sess_dev down, and the second one works on freed memory. Any host that can open a device on the server can do that.
Take the mutex first and look the ID up with xa_load() under it. The second CLOSE then finds nothing.
--- drivers/block/rnbd/rnbd-srv.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/block/rnbd/rnbd-srv.c +8 -7
@@ -360,14 +360,15 @@ static void process_msg_close(struct rnbd_srv_session *srv_sess,trace_process_msg_close (srv_sess, close_msg); - sess_dev =rnbd_get_sess_dev (le32_to_cpu (close_msg->device_id), - srv_sess); -if (IS_ERR (sess_dev)) -return ; - -rnbd_put_sess_dev (sess_dev); +/* +* Each teardown of a sess_dev runs under srv_sess->lock and erases the +* ID, so an entry that is found under the lock is alive. +*/ mutex_lock (&srv_sess->lock); -rnbd_srv_destroy_dev_session_sysfs (sess_dev); + sess_dev =xa_load (&srv_sess->index_idr, +le32_to_cpu (close_msg->device_id)); +if (sess_dev) +rnbd_srv_destroy_dev_session_sysfs (sess_dev);mutex_unlock (&srv_sess->lock); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2597/2651 rnbd-srv: publish the sess_dev at the end of OPEN
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
[ Upstream commit 08ebf69c78a02afb39b7728f3358c09bc4cf067d ]
rnbd_sess_dev_alloc() stores the empty sess_dev in the XArray as its first step. An IO message with the new ID from another connection can find it before bdev_file is set, or hold a reference while a failing OPEN frees it after a mere RCU grace period. Both are reachable from any host that can open a device.
Reserve the ID with a NULL entry and store the sess_dev once nothing can fail anymore. The error path still erases the ID, and no longer needs synchronize_rcu().
--- drivers/block/rnbd/rnbd-srv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/block/rnbd/rnbd-srv.c +8 -2
@@ -431,7 +431,7 @@ static struct rnbd_srv_sess_devif (!sess_dev)return ERR_PTR (-ENOMEM ); - error =xa_alloc (&srv_sess->index_idr, &sess_dev->device_id, sess_dev, + error =xa_alloc (&srv_sess->index_idr, &sess_dev->device_id,NULL , xa_limit_32b,GFP_NOWAIT );if (error <0 ) {pr_warn ("Allocating idr failed, err: %d\n" , error);
@@ -802,6 +802,13 @@ static int process_msg_open(struct rnbd_srv_session *srv_sess,list_add (&srv_sess_dev->dev_list, &srv_dev->sess_dev_list);mutex_unlock (&srv_dev->lock); +/* +* Nothing fails from here on, so let I/O messages find the sess_dev. +* The ID is reserved, so this store allocates nothing. +*/ +xa_store (&srv_sess->index_idr, srv_sess_dev->device_id, srv_sess_dev, +GFP_KERNEL ); +rnbd_srv_info (srv_sess_dev,"Opened device '%s'\n" , srv_dev->name);kfree (full_path);
@@ -813,7 +820,6 @@ static int process_msg_open(struct rnbd_srv_session *srv_sess, free_srv_sess_dev:xa_erase (&srv_sess->index_idr, srv_sess_dev->device_id); -synchronize_rcu ();kfree (srv_sess_dev); srv_dev_put:if (open_msg->access_mode !=RNBD_ACCESS_RO ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2598/2651 blk-iocost: publish hweights as one atomic value
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunhai Dai <[email protected]>
[ Upstream commit 0150554a3f38e1850d5964102eb89a720c5fe789 ]
current_hweight() publishes the cache generation and both weights with separate stores. Refreshers running on different CPUs can interleave their stores and leave a new generation paired with weights from an older calculation. The compiler can also reorder the generation store before the weight stores, so a reader that sees the new generation can accept stale weights.
A stale weight is not only a reporting artifact. It feeds the cost calculation and the donation logic, where an inconsistent combination can lead to a zero divisor in transfer_surpluses().
In addition, the slow path rereads iocg->hweight_active/inuse after publishing them, so the value it returns can be the one written by another refresher instead of the locally computed one.
Pack the generation and both weights into a single atomic64_t and publish them with one atomic write. Readers take one atomic snapshot and return the local values. Weights are in [1, WEIGHT_ONE]; storing each minus one preserves the full range in 16 bits and leaves 32 bits for the generation.
The two weight fields remain as the donation workspace used under ioc->lock. Tracepoints decode the packed cache without refreshing it and iocost_monitor.py is updated accordingly.
Developed with assistance from Claude Code (Anthropic): the assistant drafted the packed representation, the helpers and the tracepoint/monitor changes, and ran the checks listed below. The author reviewed the result and remains responsible for it.
--- block/blk-iocost.c | 109 +++++++++++++++++++++++++++------ include/trace/events/iocost.h | 7 ++- tools/cgroup/iocost_monitor.py | 7 ++- 3 files changed, 99 insertions(+), 24 deletions(-)
block/blk-iocost.c +89 -20
@@ -173,6 +173,7 @@*/ #include <linux/kernel.h> +#include <linux/bitfield.h> #include <linux/module.h> #include <linux/timer.h> #include <linux/time64.h>
@@ -472,8 +473,8 @@ struct ioc_gq {* * When an idle cgroup becomes active its `active` goes from 0 to * `weight`. `inuse` is the surplus adjusted active weight. -* `active` and `inuse` are used to calculate `hweight_active` and -* `hweight_inuse`. +* `active` and `inuse` determine the hierarchical weights cached in +* `hweight_cache`. * * `last_inuse` remembers `inuse` while an iocg is idle to persist * surplus adjustments.
@@ -520,7 +521,9 @@ struct ioc_gq {u64 child_active_sum;u64 child_inuse_sum;u64 child_adjusted_sum; -int hweight_gen; +/* Generation in bits 63:32; active - 1 and inuse - 1 in 31:16/15:0. */ +atomic64_t hweight_cache; +/* Donation workspace, protected by ioc->lock. */ u32 hweight_active;u32 hweight_inuse;u32 hweight_donating;
@@ -727,6 +730,54 @@ static void iocg_commit_bio(struct ioc_gq *iocg, struct bio *bio,put_cpu_ptr (gcs); } +/* +* The hierarchical weights are in [1, WEIGHT_ONE] and the generation is a +* 32-bit counter. Pack generation and both weights into one 64-bit value so +* that a reader or a refresher always observes a complete snapshot: +* +* bits 63:32 generation +* bits 31:16 hweight_active - 1 +* bits 15:0 hweight_inuse - 1 +*/ +#define HWEIGHT_GEN_MASK GENMASK_ULL(63, 32) +#define HWEIGHT_ACTIVE_MASK GENMASK_ULL(31, 16) +#define HWEIGHT_INUSE_MASK GENMASK_ULL(15, 0) + +static inline u64 hweight_cache_pack (u32 gen,u32 active,u32 inuse) +{ +return FIELD_PREP (HWEIGHT_GEN_MASK , gen) | +FIELD_PREP (HWEIGHT_ACTIVE_MASK , active -1 ) | +FIELD_PREP (HWEIGHT_INUSE_MASK , inuse -1 ); +} + +static inline void hweight_cache_unpack (u64 cache,u32 *genp,u32 *activep, +u32 *inusep) +{ +if (genp) + *genp =FIELD_GET (HWEIGHT_GEN_MASK , cache); +if (activep) + *activep =FIELD_GET (HWEIGHT_ACTIVE_MASK , cache) +1 ; +if (inusep) + *inusep =FIELD_GET (HWEIGHT_INUSE_MASK , cache) +1 ; +} + +/* Decode the published weights without refreshing the cache. */ +static inline void iocg_hweight_cache (struct ioc_gq *iocg,u32 *activep, +u32 *inusep) +{ +hweight_cache_unpack (atomic64_read (&iocg->hweight_cache),NULL , + activep, inusep); +} + +/* Decode the cached inuse weight; only used by tracepoints. */ +static inline u32 iocg_hweight_cache_inuse (struct ioc_gq *iocg) +{ +u32 inuse; + +iocg_hweight_cache (iocg,NULL , &inuse); +return inuse; +} +#define CREATE_TRACE_POINTS #include <trace/events/iocost.h>
@@ -1154,12 +1205,15 @@ static void current_hweight(struct ioc_gq *iocg, u32 *hw_activep, u32 *hw_inusep {struct ioc *ioc = iocg->ioc;int lvl; -u32 hwa, hwi; -int ioc_gen; +u32 hwa, hwi, ioc_gen, cache_gen; +u64 cache; + + ioc_gen = (u32 )atomic_read (&ioc->hweight_gen); -/* hot path - if uptodate, use cached */ - ioc_gen =atomic_read (&ioc->hweight_gen); -if (ioc_gen == iocg->hweight_gen) +/* hot path - if uptodate, use the cached snapshot */ + cache =atomic64_read (&iocg->hweight_cache); +hweight_cache_unpack (cache, &cache_gen, &hwa, &hwi); +if (cache_gen == ioc_gen) goto out;/*
@@ -1194,14 +1248,20 @@ static void current_hweight(struct ioc_gq *iocg, u32 *hw_activep, u32 *hw_inusep hwi =div64_u64 ((u64 )hwi * inuse, inuse_sum); } - iocg->hweight_active =max_t (u32, hwa,1 ); - iocg->hweight_inuse =max_t (u32, hwi,1 ); - iocg->hweight_gen = ioc_gen; + hwa =max_t (u32, hwa,1 ); + hwi =max_t (u32, hwi,1 ); +/* +* Publish the generation and both weights as one atomic snapshot. +* A concurrent refresher may overwrite this with its own snapshot, +* but the generation travels with the weights so the next reader +* detects the mismatch and refreshes again. +*/ +atomic64_set (&iocg->hweight_cache,hweight_cache_pack (ioc_gen, hwa, hwi)); out:if (hw_activep) - *hw_activep = iocg->hweight_active; + *hw_activep = hwa;if (hw_inusep) - *hw_inusep = iocg->hweight_inuse; + *hw_inusep = hwi; }/*
@@ -1249,7 +1309,8 @@ static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now) {struct ioc *ioc = iocg->ioc;u64 __maybe_unused last_period, cur_period; -u64 vtime, vtarget; +u64 vtime, vtarget, cache; +u32 active, inuse;int i;/*
@@ -1299,11 +1360,16 @@ static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now) vtime = vtarget;/* -* Activate, propagate weight and start period timer if not -* running. Reset hweight_gen to avoid accidental match from -* wrapping. +* Activate, propagate weight and start period timer if not running. +* Invalidate the cached generation to avoid an accidental match from +* wrapping. Keep the last published weights so that the activation +* tracepoint can report them; the next current_hweight() recomputes. */ - iocg->hweight_gen =atomic_read (&ioc->hweight_gen) -1 ; + cache =atomic64_read (&iocg->hweight_cache); +hweight_cache_unpack (cache,NULL , &active, &inuse); +atomic64_set (&iocg->hweight_cache, +hweight_cache_pack ((u32)(atomic_read (&ioc->hweight_gen) -1 ), + active, inuse));list_add (&iocg->active_list, &ioc->active_iocgs); propagate_weights(iocg, iocg->weight,
@@ -2049,7 +2115,7 @@ static void transfer_surpluses(struct list_head *surpluses, struct ioc_now *now)TRACE_IOCG_PATH (inuse_transfer, iocg, now, iocg->inuse, inuse, - iocg->hweight_inuse, +iocg_hweight_cache_inuse (iocg), iocg->hweight_after_donation);__propagate_weights (iocg, iocg->active, inuse, true, now);
@@ -2362,7 +2428,7 @@ static void ioc_timer_fn(struct timer_list *timer)*/ TRACE_IOCG_PATH (inuse_shortage, iocg, &now, iocg->inuse, iocg->active, - iocg->hweight_inuse, new_hwi); + old_hwi, new_hwi);__propagate_weights (iocg, iocg->active, iocg->active, true, &now);
@@ -3042,6 +3108,9 @@ static void ioc_pd_init(struct blkg_policy_data *pd)INIT_LIST_HEAD (&iocg->active_list);INIT_LIST_HEAD (&iocg->walk_list);INIT_LIST_HEAD (&iocg->surplus_list); +atomic64_set (&iocg->hweight_cache, +hweight_cache_pack ((u32)(atomic_read (&ioc->hweight_gen) -1 ), +WEIGHT_ONE ,WEIGHT_ONE )); iocg->hweight_active =WEIGHT_ONE ; iocg->hweight_inuse =WEIGHT_ONE ;
include/trace/events/iocost.h +5 -2
@@ -34,6 +34,9 @@ DECLARE_EVENT_CLASS(iocost_iocg_state, ),TP_fast_assign ( + u32 hwa, hwi; + +iocg_hweight_cache (iocg, &hwa, &hwi);__assign_str (devname);__assign_str (cgroup); __entry->now = now->now;
@@ -44,8 +47,8 @@ DECLARE_EVENT_CLASS(iocost_iocg_state, __entry->vtime = vtime; __entry->weight = iocg->weight; __entry->inuse = iocg->inuse; - __entry->hweight_active = iocg->hweight_active; - __entry->hweight_inuse = iocg->hweight_inuse; + __entry->hweight_active = hwa; + __entry->hweight_inuse = hwi; ), TP_printk("[%s:%s] now=%llu:%llu vrate=%llu "
tools/cgroup/iocost_monitor.py +5 -2
@@ -149,8 +149,11 @@ class IocgStat: self.weight = iocg.weight.value_() / WEIGHT_ONE self.active = iocg.active.value_() / WEIGHT_ONE self.inuse = iocg.inuse.value_() / WEIGHT_ONE - self.hwa_pct = iocg.hweight_active.value_() * 100 / WEIGHT_ONE - self.hwi_pct = iocg.hweight_inuse.value_() * 100 / WEIGHT_ONE + hweight_cache = iocg.hweight_cache.counter.value_() + hwa = ((hweight_cache >> 16) & (WEIGHT_ONE - 1)) + 1 + hwi = (hweight_cache & (WEIGHT_ONE - 1)) + 1 + self.hwa_pct = hwa * 100 / WEIGHT_ONE + self.hwi_pct = hwi * 100 / WEIGHT_ONE self.address = iocg.value_() vdone = iocg.done_vtime.counter.value_()
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2599/2651 selftests: net: txtimestamp: fix out-of-bounds read in raw UDP checksum
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamie Nguyen <[email protected]>
[ Upstream commit 8daacee78b3d2798fcf92398b6dff364eab64466 ]
With -r (SOCK_RAW, IPPROTO_UDP) the test writes only the UDP header and payload, and the kernel adds the IP header. get_udp_csum() still expects the IP source and destination addresses to directly precede the UDP header, and reads 2 * alen bytes before the start of the buffer: 8 bytes for IPv4, 32 bytes for IPv6.
ASan reports a heap-buffer-overflow for both -4 -r and -6 -r. Without ASan the read usually goes unnoticed, but it faults when the buffer is the first chunk in the heap. That happens on Ubuntu 26.04, where the kselftest runner wraps the test in uutils stdbuf, and txtimestamp.sh fails with SIGSEGV on every run.
Even without a crash, -r packets were sent with a checksum computed over unrelated heap memory, so their UDP checksum was invalid.
Build the pseudo-header from the destination address and checksum only the UDP header and payload. -R and -P already write daddr as both the source and destination address, so their checksums are unchanged. With -r the kernel selects the source address, which equals daddr for the loopback addresses used by txtimestamp.sh.
--- tools/testing/selftests/net/txtimestamp.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
tools/testing/selftests/net/txtimestamp.c +14 -9
@@ -418,19 +418,25 @@ static uint16_t get_ip_csum(const uint16_t *start, int num_words,return ~sum; } -static uint16_t get_udp_csum (const struct udphdr *udph,int alen) +static uint16_t get_udp_csum (const struct udphdr *udph,bool is_ipv4) { -unsigned long pseudo_sum, csum_len; -const void *csum_start = udph; +const void *addr = is_ipv4 ? (void *)&daddr.sin_addr : &daddr6.sin6_addr; +int alen = is_ipv4 ?sizeof (struct in_addr ) :sizeof (struct in6_addr ); +uint16_t addr16[sizeof (struct in6_addr ) /sizeof (uint16_t )]; +unsigned long pseudo_sum; +int i; pseudo_sum =htons (IPPROTO_UDP ); pseudo_sum += udph->len; -/* checksum ip(v6) addresses + udp header + payload */ - csum_start -= alen *2 ; - csum_len =ntohs (udph->len) + alen *2 ; +/* pseudo-header source and destination: both are daddr */ +memcpy (addr16, addr, alen); +for (i =0 ; i < alen /2 ; i++) + pseudo_sum +=2 * addr16[i]; -return get_ip_csum (csum_start, csum_len >>1 , pseudo_sum); +/* checksum udp header + payload */ +return get_ip_csum ((const uint16_t *)udph,ntohs (udph->len) >>1 , + pseudo_sum); }static int fill_header_ipv4 (void *p)
@@ -479,8 +485,7 @@ static void fill_header_udp(void *p, bool is_ipv4) udph->len =ntohs (sizeof (*udph) + cfg_payload_len); udph->check =0 ; - udph->check =get_udp_csum (udph, is_ipv4 ?sizeof (struct in_addr ) : -sizeof (struct in6_addr )); + udph->check =get_udp_csum (udph, is_ipv4); }static void do_test (int family,unsigned int report_opt)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2600/2651 apparmor: mediate AF_UNSPEC socket disconnects
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: shaos <[email protected]>
[ Upstream commit 049760746597cfd054c181fe850531be3c1e7358 ]
aa_inet_connect_perm() returns success immediately for AF_UNSPEC before checking the active AppArmor profile. AF_UNSPEC is the socket disconnect operation for TCP and UDP. A process confined by a profile containing deny network can therefore disconnect inherited sockets even though ordinary socket creation and connect calls are denied.
console output:
https://gist.githubusercontent.com/shaos26/73b057c77b9ea22d5e6813c259dbf43c/raw/fab5c58d6f184f5fab88a3a31a80c2b919efecf0/console-output.txt
reproduction kernel config:
https://gist.githubusercontent.com/shaos26/73b057c77b9ea22d5e6813c259dbf43c/raw/b9192c97c92fdd3b59089704bad6fbd0a33ccf06/kernel-config.txt
reproducer:
https://gist.githubusercontent.com/shaos26/73b057c77b9ea22d5e6813c259dbf43c/raw/92c7dd098a227276fe3daeea45996e2848e66439/poc.c
Build the kernel from HEAD with the attached reproduction config, then make a one-file initramfs. The PoC mounts sysfs and securityfs itself; DEVTMPFS_MOUNT supplies /dev/console.
mkdir -p build rootfs
cp kernel-config.txt build/.config
make O=build olddefconfig
make O=build -j"$(nproc)" bzImage
cc -O2 -static -Wall -Wextra -o poc poc.c
cp poc rootfs/poc
(cd rootfs && find poc | cpio -o -H newc --owner=0:0) | gzip -9 > initramfs.cpio.gz
timeout 900 qemu-system-x86_64 -kernel build/arch/x86/boot/bzImage \
-initrd initramfs.cpio.gz -append "console=ttyS0 rdinit=/poc panic=-1 loglevel=7 lsm=apparmor security=apparmor apparmor=1" \
-nographic -m 1024 -smp 1 -no-reboot 2>&1 | tee console.log
Under the deny-network profile, socket() and connect(AF_INET) returned EACCES, but connect(fd, AF_UNSPEC) returned success and tore down the inherited connection and listener. Two fresh boots matched. A one-line control that routed AF_UNSPEC through aa_sk_perm returned EACCES and kept both sockets alive.
Impact and prerequisites: A confined process that inherits a TCP/UDP socket can bypass the profile's network mediation for disconnect and disrupt that socket. The finding does not permit socket creation, bind, or arbitrary peer connections; no privilege escalation is demonstrated.
--- security/apparmor/af_inet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/af_inet.c +1 -1
@@ -425,7 +425,7 @@ int aa_inet_connect_perm(struct socket *sock, struct sockaddr *addr, if (addrlen < offsetofend(struct sockaddr, sa_family))return -EINVAL ;if (addr->sa_family ==AF_UNSPEC ) -return 0 ; +return aa_sk_perm (OP_CONNECT ,AA_MAY_CONNECT , sock->sk);/* do we need early bailout for !family ... */ return sk_has_perm2(sock->sk, OP_CONNECT, AA_MAY_CONNECT, profile, ad,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2601/2651 apparmor: check address length before reading AF_UNSPEC bind address
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michail Andreas Michalopoulos <[email protected]>
[ Upstream commit 4890a8b1a9df880dd188adb8b8e8fab107ad69d9 ]
bind_map_addr() handles AF_UNSPEC on an IPv4 socket by reading addr4->sin_addr.s_addr to check for INADDR_ANY. At that point the only length check done is addrlen >= offsetofend(struct sockaddr, sa_family), i.e. 2 bytes, while sin_addr sits at offset 4. move_addr_to_kernel() copies only addrlen bytes into the on-stack sockaddr_storage, so a bind() with a short AF_UNSPEC address makes AppArmor branch on bytes the caller never supplied.
Depending on those bytes, a confined task gets -EAFNOSUPPORT instead of the -EINVAL that inet_bind_sk() returns for the same request. Kernels built with CONFIG_INIT_STACK_ALL_ZERO read zeroes and happen to behave correctly.
Check the length first, as inet_bind_sk() does, and as the AF_INET6 case above already does for inet6_bind_sk().
--- security/apparmor/af_inet.c | 3 +++ 1 file changed, 3 insertions(+)
security/apparmor/af_inet.c +3 -0
@@ -196,6 +196,9 @@ static int bind_map_addr(const struct sock *sk, struct sockaddr *addr,* AF_UNSPEC if the address is INADDR_ANY */ addr4 = (struct sockaddr_in *)addr; +/* Length check from inet_bind_sk() */ +if (addrlen <sizeof (struct sockaddr_in )) +return -EINVAL ;if (addr4->sin_addr.s_addr !=htonl (INADDR_ANY ))return -EAFNOSUPPORT ; family =AF_INET ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2602/2651 apparmor: remove unconfined_profile() check in inet socket mediation
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Johansen <[email protected]>
[ Upstream commit 1f5428b9f9bfb9dab6828015a5254dcd7c582a01 ]
When a stacked label is used the early bailout !unconfined(label) fails, and the individual profile components of the label are checked. This can lead to aa_profile_af_perm() being called which results in
WARNING: security/apparmor/net.c:263 at aa_profile_af_perm+0x228/0x3b0
on any inet socket using basic socket mediation.
Remove the AA_BUG(profile_unconfined(profile)) check, it is not needed as the code already handles the unconfined_profile() case. In addition also a comment to indicate that this case is covered.
--- security/apparmor/net.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
security/apparmor/net.c +1 -2
@@ -260,7 +260,6 @@ int aa_profile_af_perm(struct aa_profile *profile,AA_BUG (family >=AF_MAX );AA_BUG (type <0 || type >=SOCK_MAX ); -AA_BUG (profile_unconfined (profile)); state =RULE_MEDIATES_NET (rules);if (state) {
@@ -268,7 +267,7 @@ int aa_profile_af_perm(struct aa_profile *profile, type, protocol, &p, &ad->info);return aa_do_perms (profile, rules->policy, state, request, p, ad); - }/* else */ + }/* else - not mediated this covers the profile_unconfined() case */ return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2603/2651 apparmor: fix a leak on a rejected string table entry
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Bélair <[email protected]>
[ Upstream commit f7bd6285ffeb425793334f6d48ccb5035cab2fa7 ]
unpack_strs_table() stores each entry into the table only after validating it, so an entry the validation rejects is never freed. Up to 64KB leaks per rejected entry.
Store the pointer before validating it.
--- security/apparmor/policy_unpack.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
security/apparmor/policy_unpack.c +3 -2
@@ -558,6 +558,9 @@ static int unpack_strs_table(struct aa_ext *e, const char *name, bool multi,/* aa_unpack_strdup verifies that the last character is * null termination byte. */ +/* publish before validating; the error path frees it */ + table[i].strs = str; + table[i].size = size2; c =process_strs_entry (str, size2, multi);if (c <=0 ) { AA_DEBUG(DEBUG_UNPACK, "process_strs %d i %d pos %ld",
@@ -570,9 +573,7 @@ static int unpack_strs_table(struct aa_ext *e, const char *name, bool multi,/* fail - all other cases with embedded \0 */ goto fail; } - table[i].strs = str; table[i].count = c; - table[i].size = size2; }if (!aa_unpack_nameX (e,AA_ARRAYEND ,NULL )) goto fail;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2604/2651 apparmor: report a label allocation failure as -ENOMEM
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Bélair <[email protected]>
[ Upstream commit 07aee062c6ecaa7199be583c83a1c74ae9885f03 ]
aa_label_strn_parse() returns -ENOENT for every failure, so a caller cannot tell "no such profile" from "could not allocate a label".
Report an allocation failure as -ENOMEM.
--- security/apparmor/label.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
security/apparmor/label.c +10 -4
@@ -1954,12 +1954,18 @@ struct aa_label *aa_label_strn_parse(struct aa_label *base, const char *str, goto out; } -if (create) +if (create) { label =aa_vec_find_or_create_label (vec, len, gfp); -else +if (!label) { +/* not absence: creating only fails on allocation */ + label =ERR_PTR (-ENOMEM ); + goto out; + } + }else { label =vec_find (vec, len); -if (!label) - goto fail; +if (!label) + goto fail; + } out:/* use adjusted len from after vec_unique, not original */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2605/2651 zloop: remove a duplicate call to zloop_get_block_size
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 0835f4909553e78a97d1ac59ed6eb776b4f78c92 ]
The sequential zone path has two calls to zloop_get_block_size, one conditional on not having a block size, and one unconditionally.
Remove the latter as the block size only needs to be queried once.
--- drivers/block/zloop.c | 2 -- 1 file changed, 2 deletions(-)
drivers/block/zloop.c +0 -2
@@ -1173,8 +1173,6 @@ static int zloop_init_zone(struct zloop_device *zlo, struct zloop_options *opts,return ret; } -zloop_get_block_size (zlo, zone); -mutex_lock (&zone->lock); ret =zloop_update_seq_zone (zlo, zone_no);mutex_unlock (&zone->lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2606/2651 zloop: share more code for opening a zone backing file
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 5e9929e2f03c79574e76605e1a82509575db2d30 ]
Use a common path for opening and querying the block size.
Stable-dep-of: 134ffb075562 ("zloop: fput file after failed zone init")
--- drivers/block/zloop.c | 65 +++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 39 deletions(-)
drivers/block/zloop.c +26 -39
@@ -1097,8 +1097,6 @@ static int zloop_init_zone(struct zloop_device *zlo, struct zloop_options *opts, {struct zloop_zone *zone = &zlo->zones[zone_no];int oflags =O_RDWR ; -struct kstat stat; -sector_t file_sectors;int ret;mutex_init (&zone->lock);
@@ -1112,27 +1110,33 @@ static int zloop_init_zone(struct zloop_device *zlo, struct zloop_options *opts,if (!opts->buffered_io) oflags |=O_DIRECT ; + zone->file =zloop_filp_open_fmt (oflags,0600 ,"%s/%u/%s-%06u" , + zlo->base_dir, zlo->id, + zone_no < zlo->nr_conv_zones ?"cnv" :"seq" , + zone_no); +if (IS_ERR (zone->file)) { +pr_err ("Failed to open zone %u file %s/%u/%s-%06u (err=%ld)" , + zone_no, zlo->base_dir, zlo->id, + zone_no < zlo->nr_conv_zones ?"cnv" :"seq" , + zone_no,PTR_ERR (zone->file)); +return PTR_ERR (zone->file); + } + +if (zlo->block_size) { + ret =zloop_get_block_size (zlo, zone); +if (ret) +return ret; + } +if (zone_no < zlo->nr_conv_zones) { +sector_t file_sectors; +struct kstat stat; +/* Conventional zone file. */ set_bit (ZLOOP_ZONE_CONV , &zone->flags); zone->cond =BLK_ZONE_COND_NOT_WP ; zone->wp =U64_MAX ; - zone->file =zloop_filp_open_fmt (oflags,0600 ,"%s/%u/cnv-%06u" , - zlo->base_dir, zlo->id, zone_no); -if (IS_ERR (zone->file)) { -pr_err ("Failed to open zone %u file %s/%u/cnv-%06u (err=%ld)" , - zone_no, zlo->base_dir, zlo->id, zone_no, -PTR_ERR (zone->file)); -return PTR_ERR (zone->file); - } - -if (!zlo->block_size) { - ret =zloop_get_block_size (zlo, zone); -if (ret) -return ret; - } - ret =vfs_getattr (&zone->file->f_path, &stat,STATX_SIZE ,0 );if (ret <0 ) {pr_err ("Failed to get zone %u file stat\n" , zone_no);
@@ -1153,30 +1157,13 @@ static int zloop_init_zone(struct zloop_device *zlo, struct zloop_options *opts, zone_no, ret);return ret; } - -return 0 ; - } - -/* Sequential zone file. */ - zone->file =zloop_filp_open_fmt (oflags,0600 ,"%s/%u/seq-%06u" , - zlo->base_dir, zlo->id, zone_no); -if (IS_ERR (zone->file)) { -pr_err ("Failed to open zone %u file %s/%u/seq-%06u (err=%ld)" , - zone_no, zlo->base_dir, zlo->id, zone_no, -PTR_ERR (zone->file)); -return PTR_ERR (zone->file); - } - -if (!zlo->block_size) { - ret =zloop_get_block_size (zlo, zone); -if (ret) -return ret; + }else { +/* Sequential zone file. */ +mutex_lock (&zone->lock); + ret =zloop_update_seq_zone (zlo, zone_no); +mutex_unlock (&zone->lock); } -mutex_lock (&zone->lock); - ret =zloop_update_seq_zone (zlo, zone_no); -mutex_unlock (&zone->lock); -return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2607/2651 zloop: fput file after failed zone init
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 134ffb0755626c91af82fc7debc8b6f75f1f777e ]
Clean up after failure in zloop_init_zone, as the caller only cleans up the zones before the current one.
--- drivers/block/zloop.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/block/zloop.c +10 -4
@@ -1125,7 +1125,7 @@ static int zloop_init_zone(struct zloop_device *zlo, struct zloop_options *opts,if (zlo->block_size) { ret =zloop_get_block_size (zlo, zone);if (ret) -return ret; + goto out_fput; }if (zone_no < zlo->nr_conv_zones) {
@@ -1140,14 +1140,14 @@ static int zloop_init_zone(struct zloop_device *zlo, struct zloop_options *opts, ret =vfs_getattr (&zone->file->f_path, &stat,STATX_SIZE ,0 );if (ret <0 ) {pr_err ("Failed to get zone %u file stat\n" , zone_no); -return ret; + goto out_fput; } file_sectors = stat.size >>SECTOR_SHIFT ;if (restore && file_sectors != zlo->zone_size) {pr_err ("Invalid conventional zone %u file size (%llu sectors != %llu)\n" , zone_no, file_sectors, zlo->zone_capacity); -return ret; + goto out_fput; } ret = vfs_truncate(&zone->file->f_path,
@@ -1155,15 +1155,21 @@ static int zloop_init_zone(struct zloop_device *zlo, struct zloop_options *opts,if (ret <0 ) {pr_err ("Failed to truncate zone %u file (err=%d)\n" , zone_no, ret); -return ret; + goto out_fput; } }else {/* Sequential zone file. */ mutex_lock (&zone->lock); ret =zloop_update_seq_zone (zlo, zone_no);mutex_unlock (&zone->lock); +if (ret) + goto out_fput; } +return 0 ; + +out_fput: +fput (zone->file);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2608/2651 zloop: check that the zone backing file support ->{read,write}_iter
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 0c10f8a1a7ae1502ea4ea7e13f222df89c28adf4 ]
I/O to backing files requires support for iter based read/write, so check for that upfront instead of dereferencing a NULL pointer later.
--- drivers/block/zloop.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/block/zloop.c +5 -0
@@ -1122,6 +1122,11 @@ static int zloop_init_zone(struct zloop_device *zlo, struct zloop_options *opts,return PTR_ERR (zone->file); } +if (!zone->file->f_op->read_iter || !zone->file->f_op->write_iter) { + ret = -EINVAL ; + goto out_fput; + } +if (zlo->block_size) { ret =zloop_get_block_size (zlo, zone);if (ret)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2609/2651 apparmor: fix table_size() integer overflow on 32 bit
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Bélair <[email protected]>
[ Upstream commit 449195a4bb7d9c456c02b871eec6905edb449bd2 ]
table_size() checks ALIGN(sizeof(struct table_header) + len * el_size, 8) in size_t, where @len is td_lolen, a u32 user-provided value from the policy blob. On 32 bit kernels both operations can overflow.
Triggering this bug allows to:
- overflow a 16 byte allocation with up to 4GiB of policy data
- store the table header at address ZERO_SIZE_PTR (kvzalloc(0))
However, this bug requires CAP_MAC_ADMIN, only affects 32 bit kernels, and the copy runs until the machine is destroyed, so it gives no controllable primitive and is therefore not a security issue.
Compute the size with the checked helpers and return 0 when the result is not representable, so the callers can reject the table. A valid table is never 0 bytes, the header alone is 12.
64 bit kernels cannot overflow (these structs are 32 bit), and are hence not affected.
--- security/apparmor/include/match.h | 11 ++++++++++- security/apparmor/match.c | 6 +++++- security/apparmor/policy_unpack.c | 5 +++++ 3 files changed, 20 insertions(+), 2 deletions(-)
security/apparmor/include/match.h +10 -1
@@ -12,6 +12,7 @@#define __AA_MATCH_H#include <linux/kref.h> +#include <linux/overflow.h> #define DFA_NOMATCH 0#define DFA_START 1
@@ -120,7 +121,15 @@ struct aa_dfa {static inline size_t table_size (size_t len,size_t el_size) { -return ALIGN (sizeof (struct table_header ) + len * el_size,8 ); +size_t size; + +/* Need check_*_overflow for 32 bit machines */ +if (check_mul_overflow (len, el_size, &size) || +check_add_overflow (size,sizeof (struct table_header ), &size) || + size >SIZE_MAX -7 ) +return 0 ; + +return ALIGN (size,8 ); }#define aa_state_t unsigned int
security/apparmor/match.c +5 -1
@@ -58,7 +58,7 @@ static struct table_header *unpack_table(const char *blob, size_t bsize)if (th.td_lolen ==0 ) goto out; tsize =table_size (th.td_lolen, th.td_flags); -if (bsize < tsize) +if (!tsize || bsize < tsize) goto out; table =kvzalloc (tsize,GFP_KERNEL );
@@ -281,6 +281,10 @@ static struct table_header *remap_data16_to_data32(struct table_header *old)u32 i; tsize =table_size (old->td_lolen,YYTD_DATA32 ); +if (!tsize) { +kvfree (old); +return NULL ; + } new =kvzalloc (tsize,GFP_KERNEL );if (!new) {kvfree (old);
security/apparmor/policy_unpack.c +5 -0
@@ -1053,6 +1053,11 @@ static int unpack_pdb(struct aa_ext *e, struct aa_policydb **policy,u16 tdflags = pdb->dfa->tables[YYTD_ID_ACCEPT ]->td_flags;size_t tsize =table_size (noents, tdflags); +if (!tsize) { + *info ="invalid dfa flags table size" ; + error = -EPROTO ; + goto fail; + } pdb->dfa->tables[YYTD_ID_ACCEPT2 ] =kvzalloc (tsize,GFP_KERNEL );if (!pdb->dfa->tables[YYTD_ID_ACCEPT2 ]) { *info ="failed to alloc dfa flags table" ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2610/2651 apparmor: convert duplicated dfa transitions to match_char()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Bélair <[email protected]>
[ Upstream commit e667fc72f7f4a54674962c324048ca2cc58bc703 ]
For historical reasons several matchers duplicate the dfa character transition instead of using match_char().
This is because aa_dfa_match_until() and aa_dfa_matchn_until() were written on a branch that did not yet have match_char(), and copied code from aa_dfa_match(). leftmatch_fb() used the same pattern.
When match_char() added support for diff-encoded states, the change was never ported to these copies.
match_char() resolves a diff encoded state by using def[state] and retrying the same character, until it reaches a state with a valid transition. The copies instead do a simple state = def[state]; after the character is consumed, so on a diff encoded state one byte is dropped and the walk continues from the diff parent in the wrong state.
This makes an unnamed px/Px/cx/Cx transition resolve to no profile, and exec fails with
apparmor="DENIED" operation="exec" info="profile transition not found"
Convert the three copies to match_char(). For a dfa with no diff encoded state this is a no-op.
This bug is latent until the kernel advertises policy/diff-encode.
--- security/apparmor/match.c | 52 ++++++++++++++------------------------- 1 file changed, 19 insertions(+), 33 deletions(-)
security/apparmor/match.c +19 -33
@@ -617,7 +617,7 @@ aa_state_t aa_dfa_match_until(const struct aa_dfa *dfa, aa_state_t start,u32 *next =NEXT_TABLE (dfa);u32 *check =CHECK_TABLE (dfa);u32 *accept =ACCEPT_TABLE (dfa); -aa_state_t state = start, pos; +aa_state_t state = start;if (state ==DFA_NOMATCH )return DFA_NOMATCH ;
@@ -628,22 +628,18 @@ aa_state_t aa_dfa_match_until(const struct aa_dfa *dfa, aa_state_t start,u8 *equiv =EQUIV_TABLE (dfa);/* default is direct to next state */ while (*str) { - pos =base_idx (base[state]) + equiv[(u8) *str++]; -if (check[pos] == state) - state = next[pos]; -else - state = def[state]; +u8 c = equiv[(u8) *str++]; + +match_char (state, def, base, next, check, c);if (accept[state])break ; } }else {/* default is direct to next state */ while (*str) { - pos =base_idx (base[state]) + (u8) *str++; -if (check[pos] == state) - state = next[pos]; -else - state = def[state]; +u8 c = (u8) *str++; + +match_char (state, def, base, next, check, c);if (accept[state])break ; }
@@ -678,7 +674,7 @@ aa_state_t aa_dfa_matchn_until(const struct aa_dfa *dfa, aa_state_t start,u32 *next =NEXT_TABLE (dfa);u32 *check =CHECK_TABLE (dfa);u32 *accept =ACCEPT_TABLE (dfa); -aa_state_t state = start, pos; +aa_state_t state = start; *retpos =NULL ;if (state ==DFA_NOMATCH )
@@ -690,22 +686,18 @@ aa_state_t aa_dfa_matchn_until(const struct aa_dfa *dfa, aa_state_t start,u8 *equiv =EQUIV_TABLE (dfa);/* default is direct to next state */ for (; n; n--) { - pos =base_idx (base[state]) + equiv[(u8) *str++]; -if (check[pos] == state) - state = next[pos]; -else - state = def[state]; +u8 c = equiv[(u8) *str++]; + +match_char (state, def, base, next, check, c);if (accept[state])break ; } }else {/* default is direct to next state */ for (; n; n--) { - pos =base_idx (base[state]) + (u8) *str++; -if (check[pos] == state) - state = next[pos]; -else - state = def[state]; +u8 c = (u8) *str++; + +match_char (state, def, base, next, check, c);if (accept[state])break ; }
@@ -754,7 +746,7 @@ static aa_state_t leftmatch_fb(const struct aa_dfa *dfa, aa_state_t start,u32 *base =BASE_TABLE (dfa);u32 *next =NEXT_TABLE (dfa);u32 *check =CHECK_TABLE (dfa); -aa_state_t state = start, pos; +aa_state_t state = start;AA_BUG (!dfa);AA_BUG (!str);
@@ -772,13 +764,10 @@ static aa_state_t leftmatch_fb(const struct aa_dfa *dfa, aa_state_t start,/* default is direct to next state */ while (*str) {unsigned int adjust; +u8 c = equiv[(u8) *str++]; wb->history[wb->pos] = state; - pos =base_idx (base[state]) + equiv[(u8) *str++]; -if (check[pos] == state) - state = next[pos]; -else - state = def[state]; +match_char (state, def, base, next, check, c);if (is_loop (wb, state, &adjust)) { state =aa_dfa_match (dfa, state, str); *count -= adjust;
@@ -791,13 +780,10 @@ static aa_state_t leftmatch_fb(const struct aa_dfa *dfa, aa_state_t start,/* default is direct to next state */ while (*str) {unsigned int adjust; +u8 c = (u8) *str++; wb->history[wb->pos] = state; - pos =base_idx (base[state]) + (u8) *str++; -if (check[pos] == state) - state = next[pos]; -else - state = def[state]; +match_char (state, def, base, next, check, c);if (is_loop (wb, state, &adjust)) { state =aa_dfa_match (dfa, state, str); *count -= adjust;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2611/2651 apparmor: Fix namespace reference leak in __aa_find_or_create_ns()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 8f1f7f664c1822af34c5465f9820b4e39146786b ]
When the namespace already exists, the reference taken by aa_get_ns() is overwritten with ERR_PTR(-EEXIST) without being released. The caller in apparmorfs.c clears ns on IS_ERR() and so cannot drop it either, leaking the reference on raced mkdir of an existing namespace.
Release the reference before returning -EEXIST.
--- security/apparmor/policy_ns.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
security/apparmor/policy_ns.c +4 -2
@@ -265,10 +265,12 @@ struct aa_ns *__aa_find_or_create_ns(struct aa_ns *parent, const char *name,/* try and find the specified ns */ /* released by caller */ ns =aa_get_ns (__aa_find_ns (&parent->sub_ns, name)); -if (!ns) +if (!ns) { ns =__aa_create_ns (parent, name, dir); -else + }else { +aa_put_ns (ns); ns =ERR_PTR (-EEXIST ); + }/* return ref */ return ns;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2612/2651 apparmor: check connect permission for SCTP
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jérémy Jean <[email protected]>
[ Upstream commit 2f764c08bb191a8c8f4051926dba0d25d195f39b ]
SCTP can start an association through sendmsg() or CONNECTX. These paths call the SCTP-specific sctp_bind_connect hook instead of the normal socket connect hook, but AppArmor does not register it. As a result, a profile can deny connect and allow send or setopt, yet a task can still create an SCTP association.
Register the SCTP hook. Ask for connect permission when SENDMSG_CONNECT or CONNECTX creates an association.
--- security/apparmor/lsm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
security/apparmor/lsm.c +14 -0
@@ -15,6 +15,7 @@#include <linux/mount.h> #include <linux/namei.h> #include <linux/ptrace.h> +#include <linux/sctp.h> #include <linux/ctype.h> #include <linux/sysctl.h> #include <linux/sysfs.h>
@@ -1405,6 +1406,18 @@ static int apparmor_socket_connect(struct socket *sock,return aa_sk_perm (OP_CONNECT ,AA_MAY_CONNECT , sock->sk); } +static int apparmor_sctp_bind_connect (struct sock *sk,int optname, +struct sockaddr *address,int addrlen) +{ +switch (optname) { +case SCTP_SOCKOPT_CONNECTX : +case SCTP_SENDMSG_CONNECT : +return aa_sk_perm (OP_CONNECT ,AA_MAY_CONNECT , sk); + } + +return 0 ; +} +static int apparmor_socket_listen (struct socket *sock,int backlog) {AA_BUG (!sock);
@@ -1823,6 +1836,7 @@ static struct security_hook_list apparmor_hooks[] __ro_after_init = {LSM_HOOK_INIT (socket_getsockopt, apparmor_socket_getsockopt),LSM_HOOK_INIT (socket_setsockopt, apparmor_socket_setsockopt),LSM_HOOK_INIT (socket_shutdown, apparmor_socket_shutdown), +LSM_HOOK_INIT (sctp_bind_connect, apparmor_sctp_bind_connect), #ifdef CONFIG_NETWORK_SECMARK LSM_HOOK_INIT(socket_sock_rcv_skb, apparmor_socket_sock_rcv_skb), #endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2613/2651 netdev-genl: ignore NETDEV_UNREGISTER rebroadcasts
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naman Gulati <[email protected]>
[ Upstream commit fd0909e963ed8f36967bd072ed484be7babe46de ]
netdev_wait_allrefs_any() re-sends NETDEV_UNREGISTER every second while it waits for the last references on a device to be dropped. By then netdev_run_todo() has already marked the device NETREG_UNREGISTERED and RTNL has been dropped at least once since the initial notification sent by unregister_netdevice_many_notify().
netdev_genl_netdevice_event() does not tell these rebroadcasts apart from the initial notification and sends a NETDEV_CMD_DEV_DEL_NTF multicast for each of them. At best this spams NETDEV_NLGRP_MGMT listeners with duplicate notifications; at worst the pernet state of the netns the device belongs to is already gone and the handler dereferences a NULL pointer.
default_device_exit_batch() only unregisters the devices still listed in the exiting netns; it does not wait for in-flight unregistrations of devices that were already unlisted (the barrier doing that was removed by commit 8a4fc54b07d7 ("net: get rid of rtnl_lock_unregistering()")). So when a device is unregistered by something other than the cleanup_net() of its own netns while references on it are still held, e.g. a veth whose peer in another netns gets deleted, and that netns exits while the device is stuck in netdev_wait_allrefs_any(), the remaining pernet exit handlers run and genl_pernet_exit() sets net->genl_sock to NULL. The next rebroadcast then crashes in genl_has_listeners():
BUG: KASAN: null-ptr-deref in netlink_has_listeners+0x3d/0x3f0 net/netlink/af_netlink.c:1388 Read of size 8 at addr 0000000000000578 by task syz.0.0/5325 Call Trace: <TASK> netlink_has_listeners+0x3d/0x3f0 net/netlink/af_netlink.c:1388 genl_has_listeners include/net/genetlink.h:644 [inline] netdev_genl_dev_notify+0x161/0x450 net/core/netdev-genl.c:93 netdev_genl_netdevice_event+0x98/0x3c0 net/core/netdev-genl.c:1491 notifier_call_chain+0x1a5/0x3d0 kernel/notifier.c:85 netdev_wait_allrefs_any net/core/dev.c:11690 [inline] netdev_run_todo+0x731/0x1060 net/core/dev.c:11808 rtnl_unlock net/core/rtnetlink.c:157 [inline] rtnl_dellink+0x68f/0x810 net/core/rtnetlink.c:3707
syzbot hit this by moving one end of a veth pair into a short-lived netns while netdevsim's deferred FIB event processing still held a reference on it, and then deleting the other end (repro [1]). While the source of this bug is netdevsim deferring FIB processing for and holding onto the device reference for O(seconds) which is being fixed separately [2], any driver may introduce such a delay and trigger the null-ptr-deref.
Skip the rebroadcasts, which are the only NETDEV_UNREGISTER events delivered with reg_state == NETREG_UNREGISTERED. The notifications sent by unregister_netdevice_many_notify() and, for a device leaving a netns, by __dev_change_net_namespace() are issued under RTNL in the same critical section that unlists the device, before its netns can be torn down, and keep being handled. This mirrors what ip6_route_dev_notify() already does to cope with the rebroadcasts.
This change should not break the UAPI spec as it defines dev-del-ntf as a "Notification about device disappearing." which is a single event. The rebroadcast in netdev_wait_allrefs_any() exists to re-kick in-kernel subsystems holding references; netdev-genl happens to be on the notifier chain and forwards it.
[1] https://gist.github.com/NamanGulati/2d1b49b8757f9a88b0bd6e55018c02ae
[2] https://lore.kernel.org/r/[email protected]
--- net/core/netdev-genl.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/core/netdev-genl.c +6 -0
@@ -1488,6 +1488,12 @@ static int netdev_genl_netdevice_event(struct notifier_block *nb,netdev_unlock_full_to_ops (netdev);break ;case NETDEV_UNREGISTER : +/* netdev_wait_allrefs_any() rebroadcasts NETDEV_UNREGISTER +* while waiting for the last references to be dropped; the +* netns may already be torn down by then. Notify only once. +*/ +if (READ_ONCE (netdev->reg_state) ==NETREG_UNREGISTERED ) +break ;netdev_lock (netdev);netdev_genl_dev_notify (netdev,NETDEV_CMD_DEV_DEL_NTF );netdev_unlock (netdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2614/2651 eth: bnxt: recycle agg buffers when Rx head buffer allocation fails
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit db2c610df81e34d497f49b68a0a1681c3f203bdb ]
bnxt_rx_pkt() tries to return the aggregation buffers of a packet to the ring when the copybreak allocation fails, but the same logic is missing on the rx_skb_func() failure path. The agg BDs consumed by the device are then never posted again. The agg ring is only refilled one-for-one as completions consume its buffers, so each such failure permanently shrinks it. Under sustained memory pressure the ring drains completely, and the queue stops receiving anything that does not fit into the head buffer, even once memory is available again. Only re-creating the rings (e.g. ifdown / ifup) recovers it.
Commit 296d5b541639 ("bnxt_en: Fix aggregation buffer leak under OOM condition.") fixed the copybreak path only. Recently commit bd3beb5c8691 ("eth: bnxt: disable rx-copybreak by default") made the non-copybreak path the default, re-surfacing the issue.
With XDP, the agg buffers are attached to the xdp_buff as frags by this point. Their agg ring slots have already been refilled. We need to keep the original head page (and therefore shinfo) around until the xdp_buff cleanup.
Note the odd split of ownership here: rx_skb_func() only deals with the head buffer, the agg buffers stay with the caller in whatever state they are in, still on the ring without XDP, or frags of the xdp_buff with XDP. This complicates rx_skb_func() cleaning up all the buffers (head and frags), which would be more intuitive.
Discovered in production, severe packet loss would persist after a transient OOM event. Tested on a BCM57504 by failing the head buffer allocations in bnxt_rx_skb() (bpftrace override() of should_failslab() and should_fail_alloc_page()) while receiving 1400B ICMPv6 echo requests. 341k packets were dropped on that queue, enough to drain its 8188 entry agg ring 40 times over, and the queue kept receiving large frames afterwards with no loss and no new HW drops. With a frags-capable XDP_PASS program at MTU 9000, receiving 8000B ICMPv6 echo requests while napi_build_skb() called from bnxt_rx_multi_page_skb() failed, 9.2k packets were dropped, the page pools' inflight count stayed flat and
there were no KASAN or DEBUG_PAGEALLOC splats.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 33 ++++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +20 -13
@@ -1215,7 +1215,15 @@ static struct sk_buff *bnxt_rx_multi_page_skb(struct bnxt *bp, bp->rx_dir); skb =napi_build_skb (frag_start, rxr->rx_page_size);if (!skb) { -page_pool_recycle_direct (rxr->page_pool, page); +struct page *new_page; + + new_page = rxr->rx_buf_ring[RING_RX (bp, prod)].data; +/* The caller may still need the XDP frags from shinfo at the +* end of the head page. Release the new buffer instead and +* put the head back on the ring. +*/ +page_pool_recycle_direct (rxr->page_pool, new_page); +bnxt_reuse_rx_data (rxr, cons, data);return NULL ; }skb_mark_for_recycle (skb);
@@ -2313,17 +2321,8 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, skb =bnxt_copy_xdp (bnapi, &bnxt_xdp.xdp, len, dma_addr);bnxt_reuse_rx_data (rxr, cons, data); -if (!skb) { -if (agg_bufs) { -if (!xdp_active) -bnxt_reuse_rx_agg_bufs (cpr, cp_cons,0 , - agg_bufs, false); -else -bnxt_xdp_buff_frags_free (rxr, - &bnxt_xdp.xdp); - } - goto oom_next_rx; - } +if (!skb) + goto oom_next_rx_agg; }else {u32 payload;
@@ -2334,7 +2333,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, skb = bp->rx_skb_func (bp, rxr, cons, data, data_ptr, dma_addr, payload | len);if (!skb) - goto oom_next_rx; + goto oom_next_rx_agg; }if (agg_bufs) {
@@ -2424,6 +2423,14 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,return rc; +oom_next_rx_agg: +if (agg_bufs) { +if (!xdp_active) +bnxt_reuse_rx_agg_bufs (cpr, cp_cons,0 , agg_bufs, + false); +else +bnxt_xdp_buff_frags_free (rxr, &bnxt_xdp.xdp); + } oom_next_rx: cpr->sw_stats->rx.rx_oom_discards +=1 ; rc = -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2615/2651 eth: bnxt: resize Rx head buffers when rx-copybreak changes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 09f10efee6f93863ea71489ce84563f4d51787f6 ]
Since rx-copybreak became configurable, bnxt_set_ring_params() sizes the head buffers to fit at least rx_copybreak bytes, and the copybreak path in bnxt_copy_data() syncs rx_copybreak bytes of the head buffer. bnxt_set_tunable() however only updates bp->rx_copybreak, and nothing on the open path recalculates the ring parameters. After raising rx-copybreak the head buffers keep their old size until some other setting changes, and bnxt_copy_data() syncs past their end, into the next buffer in the page or past the end of the page:
DMA-API: bnxt_en 0000:01:00.0: device driver tries to sync DMA memory it has not allocated [device address=0x00000002aa210c40] [size=1024 bytes]
WARNING: kernel/dma/debug.c:1162 at check_sync+0x577/0x1eb0, CPU#22: swapper/22/0 Call Trace: <IRQ> debug_dma_sync_single_for_cpu+0x66/0x90 bnxt_copy_data+0x12f/0x290 bnxt_rx_pkt+0x24ea/0x50f0 __bnxt_poll_work+0x42c/0xc00 bnxt_poll_p5+0x579/0x17a0 __napi_poll+0x8b/0x2c0 net_rx_action+0x58f/0xbb0
Here the head buffers were still sized for the 640B HDS threshold, four 1kB buffers per page, while rx-copybreak was raised to 1024. Without coherent DMA or with swiotlb the oversized sync can corrupt a neighboring buffer owned by the device or by an skb.
The device must be down for rx-copybreak to change, so recalculate the ring parameters right away, like bnxt_set_ringparam() does.
Hit while testing patch 1, tested on BCM57504 - boot; set rx-copybreak to 1024 with the link down (CONFIG_DMA_API_DEBUG); ifup.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +1 -0
@@ -4601,6 +4601,7 @@ static int bnxt_set_tunable(struct net_device *dev,if (netif_running (dev))return -EBUSY ; bp->rx_copybreak = rx_copybreak; +bnxt_set_ring_params (bp); }return 0 ;case ETHTOOL_PFC_PREVENTION_TOUT :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2616/2651 eth: bnxt: dont leak buffers when XDP agg buffer allocation fails
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 1b2f02fb4ba92d01603c8261c94be8d348de65b0 ]
If a replacement agg buffer can't be allocated for a packet received with XDP attached, bnxt_rx_pkt() drops the packet without returning its head buffer to the ring. The head buffer leaks, and since rx_prod still advances, the device gets a BD with a stale DMA address which points at a buffer the driver no longer owns. When that BD completes the driver finds no buffer in the slot.
The agg buffers consumed before the failing one have already been replaced on the agg ring, they are referenced only by the frags of the xdp_buff, which nobody frees. bnxt_xdp_buff_frags_free() would skip them since the frags flag is set only on success, so set it upfront.
Pointed out in LLM review of the first patch of the series. Tested on a BCM57504 at MTU 9000 with a frags-capable XDP_PASS program, receiving 8000B ICMPv6 echo requests (a head and two agg buffers each) while page_pool_alloc_netmems() called from bnxt_rx_agg_netmems_xdp() failed half of the time (bpftrace override()). 44.7k packets were dropped, the page pools' inflight count stayed flat and there were no KASAN or DEBUG_PAGEALLOC splats.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +11 -6
@@ -1427,16 +1427,19 @@ static u32 bnxt_rx_agg_netmems_xdp(struct bnxt *bp,struct skb_shared_info *shinfo =xdp_get_shared_info_from_buff (xdp);u32 total_frag_len =0 ; -if (!xdp_buff_has_frags (xdp)) +if (!xdp_buff_has_frags (xdp)) { +xdp_buff_set_frags_flag (xdp); shinfo->nr_frags =0 ; + } total_frag_len =__bnxt_rx_agg_netmems (bp, cpr, idx, agg_bufs, tpa,NULL , xdp); -if (total_frag_len) { -xdp_buff_set_frags_flag (xdp); - shinfo->nr_frags = agg_bufs; - shinfo->xdp_frags_size = total_frag_len; +if (!total_frag_len) { +bnxt_xdp_buff_frags_free (cpr->bnapi->rx_ring, xdp); +return 0 ; } + shinfo->nr_frags = agg_bufs; + shinfo->xdp_frags_size = total_frag_len;return total_frag_len; }
@@ -2293,8 +2296,10 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, cp_cons, agg_bufs, false); -if (!frag_len) +if (!frag_len) { +bnxt_reuse_rx_data (rxr, cons, data); goto oom_next_rx; + } } xdp_active = true;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2617/2651 eth: bnxt: free XDP frags when xdp_do_redirect() fails
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit c10f3420d59859df107838aa97b49357616d9b47 ]
When xdp_do_redirect() fails bnxt_rx_xdp() recycles the head page but not the frags of a multi-buffer frame. Their agg ring slots have already been refilled, so the pages leak, and the page pool can't be destroyed until they are returned, which will never happen. Redirect to an AF_XDP socket in copy mode fails this way with -ENOMEM whenever the socket's fill ring runs out of buffers.
A socket bound without XDP_USE_SG also fails with -ENOSPC for every frame that doesn't fit in a single chunk.
All the other drop paths in this function free the frags.
Pointed out in LLM review of the first patch of the series. Tested on a BCM57504 at MTU 9000 by redirecting 60k 8000B ICMPv6 echo requests (a head and two agg buffers each) to lo, which can't transmit XDP frames. The page pools' inflight count stayed flat rather than growing by two pages per frame.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +1 -0
@@ -307,6 +307,7 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons,if (xdp_do_redirect (bp->dev, xdp, xdp_prog)) {trace_xdp_exception (bp->dev, xdp_prog, act); +bnxt_xdp_buff_frags_free (rxr, xdp);page_pool_recycle_direct (rxr->page_pool, page);return true; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2618/2651 eth: bnxt: hand XDP frags over to the copybreak skb
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 364b88b54fc260d22ee318bae862c2d7d8c31dc6 ]
With a multi-buffer XDP program attached, a packet only has agg buffers if it filled its head buffer, which in page mode holds most of a page. The program can still move the start of the packet forward with bpf_xdp_adjust_head() and leave at most rx_copybreak bytes in the head. bnxt_rx_pkt() then copies the head into a new skb, puts the head page back on the ring, and calls bnxt_xdp_build_skb() on the copy. bnxt_xdp_build_skb() only sets nr_frags and the skb's length accounting, because it expects an skb built around the head page, sharing its shinfo with the xdp_buff. The copy ends up with nr_frags set but no frag descriptors, and the stack later reads and releases whatever its frags array happens to contain. The real frags leak.
Copy the frag descriptors to the new skb in bnxt_copy_xdp(), so that bnxt_xdp_build_skb() finds the frags where it expects them. The frags now belong to the skb, and the head page goes back on the ring as before.
Pointed out in LLM review of the first patch of the series. Confirmed by reading the code, the unfixed kernel was not run with the reproducer below.
Tested on a BCM57504 at MTU 9000 with rx-copybreak raised to 1024 and a frags-capable XDP program moving the start of multi-buffer frames 3000B forward with bpf_xdp_adjust_head(), receiving 8000B ICMPv6 echo requests (a head and two agg buffers each). All 60k frames took the copybreak path with frags attached, the sampled skbs reached GRO with len=4998 data_len=4492 nr_frags=2, and were freed by the stack with the page pools' inflight count staying flat, no KASAN or DEBUG_PAGEALLOC splats.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +8 -0
@@ -1511,6 +1511,14 @@ static struct sk_buff *bnxt_copy_xdp(struct bnxt_napi *bnapi,__skb_pull (skb, metasize); } +if (unlikely (xdp_buff_has_frags (xdp))) { +struct skb_shared_info *sinfo; + + sinfo =xdp_get_shared_info_from_buff (xdp); +memcpy (skb_shinfo (skb)->frags, sinfo->frags, + sinfo->nr_frags *sizeof (skb_frag_t)); + } +return skb; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2619/2651 gro: do not GRO GSO packets with inconsistent payload
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <[email protected]>
[ Upstream commit de788d8a7032475f900c16e9cc0c1417f4f719eb ]
tcp_gro_receive() excludes empty non-GSO packets with the unsigned len - 1 check, but its GSO branch only checks that gso_size matches the held packet's MSS. A trusted TCP GSO skb can reach GRO again with no payload after TC pedit increases its TCP data offset.
If the skb is fully linear, skb_gro_receive() then enters its fragment transfer path with nr_frags == 0. The do-while loop copies skb_frag_t entries backwards beyond both fragment arrays. An unprivileged process using its own user and network namespaces can trigger a KASAN slab-out-of-bounds write and panic through veth, pedit and GRE.
More generally, the payload of such a packet can be shrunk to any value, making it inconsistent with its gso_segs, and a GSO packet with gso_segs == 0 contributes no segment to the GRO packet.
Do not aggregate GSO packets with gso_segs == 0, and require the payload of GSO packets to be consistent with gso_segs and gso_size, the last segment being allowed to be short. This rejects the empty skb before either TCP merge helper, and covers both IPv4 and IPv6.
--- net/core/gro.c | 5 +++-- net/ipv4/tcp_offload.c | 12 +++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-)
net/core/gro.c +3 -2
@@ -513,9 +513,10 @@ static enum gro_result dev_gro_receive(struct gro_node *gro,NAPI_GRO_CB (skb)->count =1 ;if (unlikely (skb_is_gso (skb))) {NAPI_GRO_CB (skb)->count =skb_shinfo (skb)->gso_segs; -/* Only support TCP and non DODGY users. */ +/* Only support TCP and non DODGY users, with a sane gso_segs. */ if (!skb_is_gso_tcp (skb) || - (skb_shinfo (skb)->gso_type &SKB_GSO_DODGY )) + (skb_shinfo (skb)->gso_type &SKB_GSO_DODGY ) || + !NAPI_GRO_CB (skb)->count)NAPI_GRO_CB (skb)->flush =1 ; }
net/ipv4/tcp_offload.c +9 -3
@@ -315,14 +315,20 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb, mss =skb_shinfo (p)->gso_size; -/* If skb is a GRO packet, make sure its gso_size matches prior packet mss. +/* If skb is a GRO packet, make sure its gso_size matches prior packet +* mss, and that its payload is consistent with its gso_segs +* (the last segment can be short). * If it is a single frame, do not aggregate it if its length * is bigger than our mss. */ -if (unlikely (skb_is_gso (skb))) +if (unlikely (skb_is_gso (skb))) { +unsigned int segs =NAPI_GRO_CB (skb)->count; + flush |= (mss !=skb_shinfo (skb)->gso_size); -else + flush |= len <= (segs -1 ) * mss || len > segs * mss; + }else { flush |= (len -1 ) >= mss; + } flush |= (ntohl (th2->seq) +skb_gro_len (p)) ^ntohl (th->seq); flush |=skb_cmp_decrypted (p, skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2620/2651 net: bgmac: fix TX DMA unmapping and slot cleanup
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 4f45e97b3aac2282f2b436d97338c9c2c484d093 ]
When mapping a fragment fails, bgmac_dma_tx_add() unwinds with the wrong slots. It passes the failed fragment's slot->dma_addr, which holds the mapping error, to dma_unmap_single() for the head. The fragment loop indexes from ring->end instead of ring->end + 1, so it unmaps the head a second time as a page and leaves the last mapped fragment mapped. None of the affected slots get their dma_addr cleared either, which includes the head slot when mapping the head fails.
bgmac_dma_tx_ring_free() unmaps every slot with a non-zero dma_addr, so tearing down the ring unmaps these addresses again. It also frees the skbs of pending TX slots but leaves slot->skb and slot->dma_addr set. The slots survive a down/up cycle, and bgmac_dma_tx_add() only sets slot->skb on the last slot of a packet. If a slot with a stale pointer is later used for the head or a fragment of a scatter/gather packet, bgmac_dma_tx_free() frees the old skb a second time when that slot completes.
bgmac_dma_tx_ring_free() also picks dma_unmap_single() or dma_unmap_page() by looking at slot->skb, which is set on the last slot of a packet, while the head was mapped with dma_map_single() and the fragments with skb_frag_dma_map().
In the error path, unmap the head and each mapped fragment from their own slots, and clear dma_addr on every slot the failed packet touched. In bgmac_dma_tx_ring_free(), choose the unmap function by the SOF flag of the descriptor like bgmac_dma_tx_free() does, unmap every slot before freeing any skb, since a packet can wrap around the end of the ring with its skb on the last slot, and clear both fields.
This was found through code inspection by an LLM while hitting other bugs on an Asus RT-N16. It did not hit these ones specifically.
--- drivers/net/ethernet/broadcom/bgmac.c | 47 +++++++++++++++++---------- 1 file changed, 30 insertions(+), 17 deletions(-)
drivers/net/ethernet/broadcom/bgmac.c +30 -17
@@ -208,19 +208,24 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,return NETDEV_TX_OK ; err_dma: -dma_unmap_single (dma_dev, slot->dma_addr,skb_headlen (skb), -DMA_TO_DEVICE ); + slot->dma_addr =0 ;while (i-- >0 ) { -int index = (ring->end + i) %BGMAC_TX_RING_SLOTS ; -struct bgmac_slot_info *slot = &ring->slots[index]; -u32 ctl1 =le32_to_cpu (ring->cpu_base[index].ctl1); -int len = ctl1 &BGMAC_DESC_CTL1_LEN ; - -dma_unmap_page (dma_dev, slot->dma_addr, len,DMA_TO_DEVICE ); + index = (ring->end +1 + i) %BGMAC_TX_RING_SLOTS ; + slot = &ring->slots[index]; +dma_unmap_page (dma_dev, slot->dma_addr, +skb_frag_size (&skb_shinfo (skb)->frags[i]), +DMA_TO_DEVICE ); + slot->dma_addr =0 ; } + slot = &ring->slots[ring->end %BGMAC_TX_RING_SLOTS ]; +dma_unmap_single (dma_dev, slot->dma_addr,skb_headlen (skb), +DMA_TO_DEVICE ); + err_dma_head: + slot->dma_addr =0 ; +netdev_err (bgmac->net_dev,"Mapping error of skb on ring 0x%X\n" , ring->mmio_base);
@@ -535,17 +540,25 @@ static void bgmac_dma_tx_ring_free(struct bgmac *bgmac,unsigned int len = ctl1 &BGMAC_DESC_CTL1_LEN ; slot = &ring->slots[i]; -dev_kfree_skb (slot->skb); -if (!slot->dma_addr) -continue ; +if (slot->dma_addr) { +if (le32_to_cpu (dma_desc[i].ctl0) &BGMAC_DESC_CTL0_SOF ) +dma_unmap_single (dma_dev, slot->dma_addr, + len,DMA_TO_DEVICE ); +else +dma_unmap_page (dma_dev, slot->dma_addr, + len,DMA_TO_DEVICE ); + slot->dma_addr =0 ; + } + } -if (slot->skb) -dma_unmap_single (dma_dev, slot->dma_addr, - len,DMA_TO_DEVICE ); -else -dma_unmap_page (dma_dev, slot->dma_addr, - len,DMA_TO_DEVICE ); +/* A packet can wrap around the end of the ring with its skb on the +* last slot, so free the skbs only once every slot is unmapped. +*/ +for (i =0 ; i <BGMAC_TX_RING_SLOTS ; i++) { + slot = &ring->slots[i]; +dev_kfree_skb (slot->skb); + slot->skb =NULL ; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2621/2651 tcp: avoid double destroy in tcp_abort() of an unaccepted child
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <[email protected]>
[ Upstream commit dbd62ad55a4c898f5a4c9edb20c0c062afb799df ]
tcp_abort() checks for TCP_CLOSE while only owning the socket lock, then grabs the BH lock before calling tcp_done_with_error().
For a child still sitting in a listener accept queue (which can be reached via SOCK_DESTROY or bpf_sock_destroy()), inet_csk_listen_stop() can run in this window: it only holds the child BH lock, and calls inet_child_forget(), which disconnects, orphans and destroys the child.
tcp_abort() then calls tcp_done_with_error() -> tcp_done(), which sees SOCK_DEAD and calls inet_csk_destroy_sock() a second time, leading to a double sock_put() and a use-after-free.
Recheck TCP_CLOSE after acquiring the BH lock, unless we just closed a listener ourselves, in which case tcp_done_with_error() must still run to report the error.
Note that the WARN_ON(sock_owned_by_user(child)) in inet_csk_listen_stop() can still trigger in this window.
--- net/ipv4/tcp.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
net/ipv4/tcp.c +13 -1
@@ -5124,6 +5124,8 @@ void tcp_done(struct sock *sk)int tcp_abort (struct sock *sk,int err) {int state =inet_sk_state_load (sk); +bool listener = false; +int ret =0 ;if (state ==TCP_NEW_SYN_RECV ) {struct request_sock *req =inet_reqsk (sk);
@@ -5158,21 +5160,31 @@ int tcp_abort(struct sock *sk, int err)if (sk->sk_state ==TCP_LISTEN ) {tcp_set_state (sk,TCP_CLOSE );inet_csk_listen_stop (sk); + listener = true; }/* Don't race with BH socket closes such as inet_csk_listen_stop. */ local_bh_disable ();bh_lock_sock (sk); +/* An unaccepted child might have been closed by +* inet_csk_listen_stop() while we were not holding its BH lock. +*/ +if (!listener && sk->sk_state ==TCP_CLOSE ) { + ret = -ENOENT ; + goto out; + } +if (tcp_need_reset (sk->sk_state))tcp_send_active_reset (sk,SK_RST_REASON_TCP_STATE );tcp_done_with_error (sk, err); +out:bh_unlock_sock (sk);local_bh_enable ();if (!has_current_bpf_ctx ())release_sock (sk); -return 0 ; +return ret; }EXPORT_SYMBOL_GPL (tcp_abort);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2622/2651 apparmor: fix check SCTP bind, and connect permission checks
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Johansen <[email protected]>
[ Upstream commit 7a82f9a06459ff1c37b5e97b204430442cc076e3 ]
SCTP mediation of bind is not being checked correctly because bind permission needs to be checked in the sctp_bind_connect() hook.
Require for bind permissions when CTP_SET_PEER_PRIMARY_ADDR, and SCTP_SOCKOPT_BINDX_ADD are asked for.
The peer initialized ASCONF cases (SCTP_PARAM_ADD_IP and SCTP_PARAM_SET_PRIMARY) are processed in softirq context and are not mediated atm. SCTP_PRIMATEY_ADDR, and SCTP_SET_PEER_PRIMARY_ADDR only select among address already in the association.
--- security/apparmor/lsm.c | 5 +++++ 1 file changed, 5 insertions(+)
security/apparmor/lsm.c +5 -0
@@ -1410,6 +1410,11 @@ static int apparmor_sctp_bind_connect(struct sock *sk, int optname, struct sockaddr *address, int addrlen) {switch (optname) { +/* Bind checks */ +case SCTP_SET_PEER_PRIMARY_ADDR : +case SCTP_SOCKOPT_BINDX_ADD : +return aa_sk_perm (OP_BIND ,AA_MAY_BIND , sk); +/* Connect checks */ case SCTP_SOCKOPT_CONNECTX :case SCTP_SENDMSG_CONNECT :return aa_sk_perm (OP_CONNECT ,AA_MAY_CONNECT , sk);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2623/2651 tcp: initialize mapped children before route lookup
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <[email protected]>
[ Upstream commit b7ff0e7a9ae3df2f123807a7e670bc348b1e1b9d ]
IPv4 passive opens on a dual-stack listener go through tcp_v4_syn_recv_sock() with tcp_v6_mapped_child_init() as the optional initializer. The callback currently runs after the output route lookup. If that lookup fails, tcp_done() destroys a clone whose pinet6 and ipv6_fl_list still refer to the listener's state.
With the flowlabel list head in inet_sock, fl6_free_socklist() walks the clone's list and RCU-frees its nodes without unlinking them from the live listener. Subsequent flowlabel operations can use or free the nodes again. Commit 858d2a4f67ff ("tcp: fix potential race in tcp_v6_syn_recv_sock()") moved the initializer before ehash insertion, but did not cover this error path.
Invoke the existing initializer after the IPv4 fields it consumes have been set, but before route lookup can fail. It needs neither the destination nor sk_setup_caps(), and all later disposal paths remain covered.
--- net/ipv4/tcp_ipv4.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/ipv4/tcp_ipv4.c +6 -4
@@ -1723,6 +1723,12 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,if (READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_reflect_tos)) newinet->tos =tcp_rsk (req)->syn_tos & ~INET_ECN_MASK ; +#if IS_ENABLED (CONFIG_IPV6 ) +/* Detach IPv6 state before a route lookup can fail. */ +if (opt_child_init) +opt_child_init (newsk, sk); +#endif +if (!dst) { dst =inet_csk_route_child_sock (sk, newsk, req);if (!dst)
@@ -1732,10 +1738,6 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb, }sk_setup_caps (newsk, dst); -#if IS_ENABLED (CONFIG_IPV6 ) -if (opt_child_init) -opt_child_init (newsk, sk); -#endif tcp_ca_openreq_child (newsk, dst);tcp_sync_mss (newsk,dst4_mtu (dst));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2624/2651 net: add eth_type_trans_careful()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 2519a6fe7a8bba57a961eb804e43e7df35ac40fe ]
eth_type_trans() assumes ETH_HLEN bytes are present in skb->head. NIC drivers always provide this, and they should keep using the fast version.
Devices looping skbs from their transmit path back to their receive path get skbs built by the stack instead. Their link-layer header might have been popped by tc actions (act_vlan pop_eth, act_ife decode) or OVS actions (pop_eth + pop_mpls / pop_nsh), leaving fewer than ETH_HLEN bytes in the linear part. eth_type_trans() then hits the BUG() in __skb_pull().
Add eth_type_trans_careful(), which first pulls the Ethernet header, and returns a drop reason on failure, so that the few devices exposed to this can drop such packets.
Stable-dep-of: 093a28998374 ("loopback: use eth_type_trans_careful()")
--- include/linux/etherdevice.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
include/linux/etherdevice.h +28 -0
@@ -38,6 +38,34 @@ int fwnode_get_mac_address(struct fwnode_handle *fwnode, char *addr);u32 eth_get_headlen (const struct net_device *dev,const void *data,u32 len);__be16 eth_type_trans (struct sk_buff *skb,struct net_device *dev); + +/** +* eth_type_trans_careful - eth_type_trans() for skbs coming from the stack +* @skb: buffer, possibly with less than ETH_HLEN bytes in its linear area +* @dev: receiving network device +* +* eth_type_trans() expects ETH_HLEN bytes in skb->head, which NIC drivers +* provide. Devices looping skbs from their transmit path back to the +* receive path (loopback, OVS internal ports) get skbs built by the stack, +* whose link-layer header might have been popped by tc or OVS actions. +* +* Sets skb->protocol on success. +* +* Return: SKB_NOT_DROPPED_YET on success, or a drop reason. In the latter +* case, the caller must free @skb. +*/ +static inline enum skb_drop_reason +eth_type_trans_careful (struct sk_buff *skb,struct net_device *dev) +{ +enum skb_drop_reason reason =pskb_may_pull_reason (skb,ETH_HLEN ); + +if (unlikely (reason)) +return reason; + + skb->protocol =eth_type_trans (skb, dev); +return SKB_NOT_DROPPED_YET ; +} +extern const struct header_ops eth_header_ops; int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2625/2651 loopback: use eth_type_trans_careful()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 093a28998374f4007ffe67cc661f8192c1b062a9 ]
tc egress actions can leave an skb with fewer than ETH_HLEN bytes in its linear part. loopback_xmit() then crashes in eth_type_trans():
tc qdisc add dev lo clsact
tc filter add dev lo egress matchall action vlan pop_eth # AF_PACKET SOCK_RAW: eth / eth / 8192 bytes of payload
kernel BUG at include/linux/skbuff.h:2839!
RIP: 0010:eth_type_trans (include/linux/etherdevice.h:635 net/ethernet/eth.c:163) Call Trace: loopback_xmit (drivers/net/loopback.c:87) dev_hard_start_xmit (include/linux/netdevice.h:5455 include/linux/netdevice.h:5464 net/core/dev.c:4057 net/core/dev.c:4073) __dev_queue_xmit (net/core/dev.c:5066) packet_sendmsg (net/packet/af_packet.c:3157 net/packet/af_packet.c:3189)
The same happens with "action ife decode" on lo egress.
Use eth_type_trans_careful(), and drop the packet if the Ethernet header can not be pulled.
--- drivers/net/loopback.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/loopback.c +7 -1
@@ -70,6 +70,7 @@ EXPORT_SYMBOL(blackhole_netdev);static netdev_tx_t loopback_xmit (struct sk_buff *skb,struct net_device *dev) { +enum skb_drop_reason reason;int len;skb_tx_timestamp (skb);
@@ -84,7 +85,12 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb,*/ skb_dst_force (skb); - skb->protocol =eth_type_trans (skb, dev); + reason =eth_type_trans_careful (skb, dev); +if (unlikely (reason)) { +dev_core_stats_tx_dropped_inc (dev); +kfree_skb_reason (skb, reason); +return NETDEV_TX_OK ; + } len = skb->len;if (likely (__netif_rx (skb) ==NET_RX_SUCCESS ))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2626/2651 net: use eth_type_trans_careful() in __dev_forward_skb2()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 695e1408eb908ac7acf78069933201f92b95727c ]
A tc egress BPF program can push a tiny link-layer header with bpf_skb_change_head() on an skb whose head is almost empty, then redirect it to an Ethernet device ingress. __bpf_redirect_common() only checks mac_header < network_header, and __dev_forward_skb2() crashes in eth_type_trans():
tc filter add dev lo egress pref 1 matchall action vlan pop_eth continue tc filter add dev lo egress pref 2 bpf da obj prog.o
# prog: bpf_skb_change_head(skb, 1, 0);
# return bpf_redirect(veth1_ifindex, BPF_F_INGRESS);
# AF_PACKET SOCK_RAW on lo: eth / eth / 8192 bytes of payload
kernel BUG at include/linux/skbuff.h:2839!
RIP: 0010:eth_type_trans (include/linux/etherdevice.h:635 net/ethernet/eth.c:163) Call Trace: __dev_forward_skb2 (net/core/dev.c:2507) dev_forward_skb_nomtu (net/core/dev.c:2546) __dev_queue_xmit (net/core/dev.c:4738 net/core/dev.c:4998) packet_sendmsg (net/packet/af_packet.c:3157 net/packet/af_packet.c:3189)
Use eth_type_trans_careful(), and drop the packet if the Ethernet header can not be pulled. This also covers other dev_forward_skb() users (veth, macvlan, ipvlan, netdevsim, l2tp_eth).
Update the empty_skb BPF selftest: at lwt_xmit, BPF_PROG_TEST_RUN strips the Ethernet header, so the "veth ETH_HLEN+1" packet is a 1-byte skb. Redirecting it to veth ingress used to read the Ethernet header past skb->tail and deliver a 1-byte frame; it is now dropped with NET_RX_DROP, as veth_xmit() already does at egress.
--- net/core/dev.c | 18 +++++++++++++----- .../selftests/bpf/prog_tests/empty_skb.c | 19 ++++++++++++------- 2 files changed, 25 insertions(+), 12 deletions(-)
net/core/dev.c +13 -5
@@ -2463,14 +2463,22 @@ EXPORT_SYMBOL_GPL(is_skb_forwardable);static int __dev_forward_skb2 (struct net_device *dev,struct sk_buff *skb,bool check_mtu) { -int ret =____dev_forward_skb (dev, skb, check_mtu); +enum skb_drop_reason reason; +int ret; + + ret =____dev_forward_skb (dev, skb, check_mtu); +if (unlikely (ret)) +return ret; -if (likely (!ret)) { - skb->protocol =eth_type_trans (skb, dev); -skb_postpull_rcsum (skb,eth_hdr (skb),ETH_HLEN ); + reason =eth_type_trans_careful (skb, dev); +if (unlikely (reason)) { +dev_core_stats_rx_dropped_inc (dev); +kfree_skb_reason (skb, reason); +return NET_RX_DROP ; } +skb_postpull_rcsum (skb,eth_hdr (skb),ETH_HLEN ); -return ret; +return 0 ; }int __dev_forward_skb (struct net_device *dev,struct sk_buff *skb)
tools/testing/selftests/bpf/prog_tests/empty_skb.c +12 -7
@@ -24,7 +24,7 @@ void test_empty_skb(void)int *ifindex;int err;int ret; -int lwt_egress_ret;/* expected retval at lwt/egress */ +int lwt_ret;/* expected retval at lwt */ __be16 h_proto;bool success_on_tc;bool adjust_room;
@@ -82,7 +82,7 @@ void test_empty_skb(void) .data_size_in = sizeof(eth_hlen), .ifindex = &veth_ifindex, .ret = -ERANGE, - .lwt_egress_ret = -ERANGE, + .lwt_ret = -ERANGE, .success_on_tc = true, }, {
@@ -96,17 +96,23 @@ void test_empty_skb(void) .data_size_in = sizeof(eth_hlen), .ifindex = &ipip_ifindex, .ret = -ERANGE, - .lwt_egress_ret = -ERANGE, + .lwt_ret = -ERANGE, }, -/* ETH_HLEN+1-sized packet should be redirected. */ +/* ETH_HLEN+1-sized packet should be redirected at TC. +* At LWT, the Ethernet header is not part of the skb, and +* a 1-byte packet is too short for an Ethernet device. +*/ { .msg = "veth ETH_HLEN+1 packet ingress", .data_in = eth_hlen_pp, .data_size_in = sizeof(eth_hlen_pp), .ifindex = &veth_ifindex, - .lwt_egress_ret = 1, /* veth_xmit NET_XMIT_DROP */ +/* lwt: skb->len=1, dropped by veth_xmit() at egress +* and by __dev_forward_skb2() at ingress. +*/ + .lwt_ret =1 ,/* NET_XMIT_DROP / NET_RX_DROP */ }, { .msg = "ipip ETH_HLEN+1 packet ingress",
@@ -144,7 +150,6 @@ void test_empty_skb(void) eth_hlen.h_proto = tests[i].h_proto;bpf_object__for_each_program (prog, bpf_obj->obj) { -bool at_egress =strstr (bpf_program__name (prog),"egress" ) !=NULL ;bool at_tc = !strncmp (bpf_program__section_name (prog),"tc" ,2 );bool is_adjust_room = !strcmp (bpf_program__name (prog),"tc_adjust_room" );int expected_ret;
@@ -153,7 +158,7 @@ void test_empty_skb(void)if (tests[i].adjust_room != is_adjust_room)continue ; - expected_ret = at_egress && !at_tc ? tests[i].lwt_egress_ret : tests[i].ret; + expected_ret = at_tc ? tests[i].ret : tests[i].lwt_ret; tattr.data_in = tests[i].data_in; tattr.data_size_in = tests[i].data_size_in;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2627/2651 openvswitch: use eth_type_trans_careful() in internal_dev_recv()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit b55e5a0159c8f53edefcb7848d95eb93db37bce1 ]
OVS actions like pop_eth followed by pop_mpls(ETH_P_TEB) or pop_nsh can expose an inner Ethernet header which is not in the linear part of the skb. Output to an internal port then crashes in eth_type_trans():
flow: in_port(0),eth(),eth_type(0x8847),mpls(lse=0x00010140)
actions: pop_eth,pop_mpls(0x6558),0
# AF_PACKET SOCK_RAW on dp0: eth / mpls / eth / 4096 bytes of payload
kernel BUG at include/linux/skbuff.h:2839!
RIP: 0010:eth_type_trans (include/linux/etherdevice.h:635 net/ethernet/eth.c:163) Call Trace: internal_dev_recv (net/openvswitch/vport-internal_dev.c:202) openvswitch do_execute_actions (net/openvswitch/actions.c:1296) openvswitch ovs_execute_actions (net/openvswitch/actions.c:1606) openvswitch ovs_dp_process_packet (net/openvswitch/datapath.c:310) openvswitch ovs_vport_receive (net/openvswitch/vport.c:448) openvswitch internal_dev_xmit (net/openvswitch/vport-internal_dev.c:42) openvswitch dev_hard_start_xmit (include/linux/netdevice.h:5455 include/linux/netdevice.h:5464 net/core/dev.c:4057 net/core/dev.c:4073) __dev_queue_xmit (net/core/dev.c:5066) packet_sendmsg (net/packet/af_packet.c:3157 net/packet/af_packet.c:3189)
Use eth_type_trans_careful(), and drop the packet if the Ethernet header can not be pulled. This covers all OVS actions at the consumer, instead of fixing each producer.
--- net/openvswitch/vport-internal_dev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/openvswitch/vport-internal_dev.c +7 -1
@@ -186,6 +186,7 @@ static void internal_dev_destroy(struct vport *vport)static int internal_dev_recv (struct sk_buff *skb) {struct net_device *netdev = skb->dev; +enum skb_drop_reason reason;if (unlikely (!(netdev->flags &IFF_UP ))) {kfree_skb (skb);
@@ -197,7 +198,12 @@ static int internal_dev_recv(struct sk_buff *skb)nf_reset_ct (skb); skb->pkt_type =PACKET_HOST ; - skb->protocol =eth_type_trans (skb, netdev); + reason =eth_type_trans_careful (skb, netdev); +if (unlikely (reason)) { +dev_core_stats_rx_dropped_inc (netdev); +kfree_skb_reason (skb, reason); +return NETDEV_TX_OK ; + }skb_postpull_rcsum (skb,eth_hdr (skb),ETH_HLEN );dev_sw_netstats_rx_add (netdev, skb->len);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2628/2651 netlink: check sk_rcvbuf before charging the dump skb
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jhonata Poma-Hansen <[email protected]>
[ Upstream commit b45d37740cfb4bdfccef3fbd9fd970fd3224438f ]
Since commit ae8f160e7eb2 ("netlink: Fix wraparounds of sk->sk_rmem_alloc."), netlink_dump() charges the dump skb first and queues it only if sk_rmem_alloc is still below sk_rcvbuf. Commit a215b5723922 ("netlink: make sure we allow at least one dump skb") added an exception for an empty socket.
A dump that starts while something else is still charged to a socket with a small receive buffer fails with ENOBUFS and stays running. Every recvmsg() retries it, fails again and sets sk_err, so a reader that peeks before reading, as libnl does, gets ENOBUFS on the read after each peek, never consumes the message at the head of the queue and spins forever.
I hit this with "iw dev wlan0 scan" hanging at 100% CPU on an arm64 board with a 6.6 based kernel (iw 5.19 sets SO_RCVBUF to 8KiB). A kprobe trace showed the scan dump starting while the NEW_SCAN_RESULTS notification iw had just read was still charged to its socket, because iw had preempted the sender before netlink_broadcast() returned.
Check the limit before charging, as before ae8f160e7eb2, which also covers the empty socket. netlink_recvmsg() continues a dump only at or below half of sk_rcvbuf, so the skb is then always queued, and a dump goes over the limit by at most one skb. Refuse a skb that would take sk_rmem_alloc past INT_MAX, so the wraparound stays fixed.
Reproduced on net in a KVM guest with a userspace reproducer and the selftest in the next patch; both pass with this fix.
--- net/netlink/af_netlink.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/netlink/af_netlink.c +5 -1
@@ -2325,9 +2325,13 @@ static int netlink_dump(struct sock *sk, bool lock_taken)if (!skb) goto errout_skb; +/* Check the limit before charging the skb: netlink_recvmsg() continues +* the dump at or below half of sk_rcvbuf, and the skb must be queued +* then. Keep sk_rmem_alloc at or below INT_MAX. +*/ rcvbuf =READ_ONCE (sk->sk_rcvbuf); rmem =atomic_add_return (skb->truesize, &sk->sk_rmem_alloc); -if (rmem != skb->truesize && rmem >= rcvbuf) { +if (rmem - skb->truesize >= rcvbuf || rmem >INT_MAX ) {atomic_sub (skb->truesize, &sk->sk_rmem_alloc); goto errout_skb; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2629/2651 apparmor: advertise that sctp is being mediated
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Johansen <[email protected]>
[ Upstream commit 35b8ab3f36ac0fcd8fc910da0bed889b6c75c426 ]
Enable the test harness to detect that the kernel should be properly mediating sctp.
--- security/apparmor/net.c | 1 + 1 file changed, 1 insertion(+)
security/apparmor/net.c +1 -0
@@ -24,6 +24,7 @@struct aa_sfs_entry aa_sfs_entry_network[] = {AA_SFS_FILE_STRING ("af_mask" ,AA_SFS_AF_MASK ),AA_SFS_FILE_BOOLEAN ("tcp-fast-open" ,1 ), +AA_SFS_FILE_BOOLEAN ("sctp" ,1 ), { } };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2630/2651 tun: drop batched packets while the device is down
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiao Liang <[email protected]>
[ Upstream commit 8f44631ba02afe9fff2f0a0fb66560ab19df87fd ]
tun_sendmsg() handles TUN_MSG_PTR batches from vhost-net by calling tun_xdp_one() instead of tun_get_user(). But this path does not check IFF_UP, allowing packets from a guest to be injected into the host receive path while the device is administratively down.
Check IFF_UP in tun_xdp_one() before running XDP or building an skb. Drop the packet when the device is down, matching tun_get_user().
--- drivers/net/tun.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/tun.c +6 -0
@@ -2553,6 +2553,12 @@ static int tun_xdp_one(struct tun_struct *tun,return -EINVAL ; } +if (unlikely (!(READ_ONCE (tun->dev->flags) &IFF_UP ))) { +put_page (virt_to_head_page (xdp->data)); +dev_core_stats_rx_dropped_inc (tun->dev); +return -EIO ; + } + xdp_prog =rcu_dereference (tun->xdp_prog);if (xdp_prog) {if (gso->gso_type) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2631/2651 iomap: only follow dio alignment requirement if specified
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 87d02f3e98a86abf70441b0a0418e01cb1d64b44 ]
After commit 4025185cf953 ("iomap: follow the alignment requirement for iomap_dio_hole_iter()"), generic/091 fails on both xfs and ext4.
The reason is that ext4 and xfs (except COW write) do not require full block alignment for direct IO. They are totally fine reading a sub-block range.
That commit fails any direct read of sub-block holes/prealloc, even those filesystems can handle it without any problem.
Fix the regression by only follow the block alignment if the IOMAP_DIO_FSBLOCK_ALIGNED flag is set.
--- fs/iomap/direct-io.c | 26 ++++++++++++++++---------- include/linux/iomap.h | 3 ++- 2 files changed, 18 insertions(+), 11 deletions(-)
fs/iomap/direct-io.c +16 -10
@@ -590,18 +590,24 @@ static int iomap_dio_bio_iter(struct iomap_iter *iter, struct iomap_dio *dio)static int iomap_dio_hole_iter (struct iomap_iter *iter,struct iomap_dio *dio) {loff_t copied =iov_iter_zero (iomap_length (iter), dio->submit.iter); -unsigned int bs =i_blocksize (iter->inode); -loff_t aligned_copied =round_down (copied, bs); -/* -* If fs block size is larger than page size, page fault failure -* can cause @copied to be page aligned but not fs block aligned. -*/ -iov_iter_revert (dio->submit.iter, copied - aligned_copied); - dio->size += aligned_copied; -if (!aligned_copied) +if (dio->flags &IOMAP_DIO_FSBLOCK_ALIGNED ) { +loff_t aligned_copied =round_down (copied, +i_blocksize (iter->inode)); + +/* +* For fs passing IOMAP_DIO_FSBLOCK_ALIGNED flag, if fs block +* size is larger than page size, page fault failure +* can cause @copied to be page aligned but not fs block +* aligned. +*/ +iov_iter_revert (dio->submit.iter, copied - aligned_copied); + copied = aligned_copied; + } + dio->size += copied; +if (!copied)return -EFAULT ; -return iomap_iter_advance (iter, aligned_copied); +return iomap_iter_advance (iter, copied); }static int iomap_dio_inline_iter (struct iomap_iter *iomi,struct iomap_dio *dio)
include/linux/iomap.h +2 -1
@@ -665,7 +665,8 @@ struct iomap_dio_ops {#define IOMAP_DIO_PARTIAL (1 << 2)/* -* Ensure each bio is aligned to fs block size. +* Ensure every operation, including bio and hole zeroing, is aligned to fs +* block size. * * For filesystems which need to calculate/verify the checksum of each fs * block. Otherwise they may not be able to handle unaligned bios.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2632/2651 watch_queue: keep info_id separate from rcu_head
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhiyu Zhang <[email protected]>
[ Upstream commit 53d72818f9e2aeb03a6053544ee6efa4eb2a3988 ]
struct watch overlays info_id with rcu_head. A notification poster reads info_id under rcu_read_lock(), but a concurrent final put can enqueue the watch with call_rcu(). Enqueueing the callback writes rcu_head before the grace period has elapsed, so it can corrupt info_id while the object remains legally visible to the reader.
__post_watch_notification() then merges that value into the notification info word without masking it. Pointer bits can corrupt WATCH_INFO_LENGTH and make post_one_notification() copy beyond the posting task's stack record.
Give info_id storage separate from rcu_head so RCU enqueueing cannot modify it. Place it after the kref, which uses existing tail padding on x86-64. Mask info_id with WATCH_INFO_ID at the point of use as an additional invariant check.
An unprivileged shell and keyctl reproducer was run for 30 seconds in QEMU. The vulnerable baseline produced malformed notification lengths, while this change completed with 288631 key notifications and no malformed record.
--- include/linux/watch_queue.h | 6 ++---- kernel/watch_queue.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-)
include/linux/watch_queue.h +2 -4
@@ -52,10 +52,7 @@ struct watch_queue {* Representation of a watch on an object. */ struct watch { -union { -struct rcu_head rcu; -u32 info_id;/* ID to be OR'd in to info field */ - }; +struct rcu_head rcu;struct watch_queue __rcu *queue;/* Queue to post events to */ struct hlist_node queue_node;/* Link in queue->watches */ struct watch_list __rcu *watch_list;
@@ -64,6 +61,7 @@ struct watch {void *private;/* Private data for the watched object */ u64 id;/* Internal identifier */ struct kref usage;/* Object usage count */ +u32 info_id;/* ID to be OR'd in to info field */ };/*
kernel/watch_queue.c +1 -1
@@ -212,7 +212,7 @@ void __post_watch_notification(struct watch_list *wlist,if (watch->id != id)continue ; n->info &= ~WATCH_INFO_ID ; - n->info |= watch->info_id; + n->info |= watch->info_id &WATCH_INFO_ID ; wqueue =rcu_dereference (watch->queue); wf =rcu_dereference (wqueue->filter);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2633/2651 pidfs: do not report fields that do not fit into the callers struct
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nickolai Zeldovich <[email protected]>
[ Upstream commit 1534c37167488f2b85c74de048e1d6a4ba3848de ]
The documentation of struct pidfd_info promises that "If the structure size is too small to contain a field (requested or not), to avoid confusion the mask will not contain a bit for that field", and asks userspace to trust the returned mask when deciding which fields hold valid data.
pidfd_info() does not keep that promise. It builds kinfo.mask without looking at the size encoded in the ioctl command, and copy_struct_to_user() then truncates the copy to that size. A caller that passes a 64-byte struct (PIDFD_INFO_SIZE_VER0) and requests PIDFD_INFO_COREDUMP or PIDFD_INFO_SUPPORTED_MASK gets a mask with PIDFD_INFO_COREDUMP, PIDFD_INFO_COREDUMP_SIGNAL, PIDFD_INFO_COREDUMP_CODE and PIDFD_INFO_SUPPORTED_MASK set, while the coredump_* and supported_mask fields behind the 64 bytes were never written. Trusting the mask as documented, userspace then reads whatever its own buffer held at those offsets. The same happens for a 72- or 80-byte struct and the fields added after it.
Clear the bits of the fields that lie beyond the caller's size before the copy, in the one place that knows both the final mask and the size. A request for a field that cannot be returned is thereby answered the way the header describes: the field is simply absent from the mask.
--- fs/pidfs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/pidfs.c +8 -0
@@ -511,6 +511,14 @@ static long pidfd_info(struct file *file, unsigned int cmd, unsigned long arg) kinfo.supported_mask =PIDFD_INFO_SUPPORTED ; } +/* Only report fields that fit into the caller's struct. */ +if (usize <PIDFD_INFO_SIZE_VER1 ) + kinfo.mask &= ~(PIDFD_INFO_COREDUMP |PIDFD_INFO_COREDUMP_SIGNAL ); +if (usize <PIDFD_INFO_SIZE_VER2 ) + kinfo.mask &= ~PIDFD_INFO_COREDUMP_CODE ; +if (usize <PIDFD_INFO_SIZE_VER3 ) + kinfo.mask &= ~PIDFD_INFO_SUPPORTED_MASK ; +/* Are there bits in the return mask not present in PIDFD_INFO_SUPPORTED? */ WARN_ON_ONCE (~PIDFD_INFO_SUPPORTED & kinfo.mask);/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2634/2651 splice: retry tee() instead of returning 0 when it races
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nickolai Zeldovich <[email protected]>
[ Upstream commit b2aa970a0a03c117306f48d75a4c3125a8cc9957 ]
tee() can return 0 while the input pipe still has writers, when another task reads the input pipe or fills the output pipe at the same time. tee(2) documents 0 as "no data was copied" because the input pipe has no writers, and loops built on it (the man page example breaks out on 0) stop early. In a test with one thread writing 1 byte at a time to the input pipe, one reading it and one draining the output pipe, about one tee() call in 150 returned 0.
do_tee() runs ipipe_prep() and opipe_prep() to wait for data and room, each under its own pipe lock, and only then takes both locks in link_pipe(). If the input pipe was emptied or the output pipe filled in between, link_pipe() finds nothing to do and returns 0. splice_pipe_to_pipe(), which was modelled on tee(), handles the same race by dropping both locks and going back to the prep steps ("A zero return value means EOF, so retry instead"), and returns -EAGAIN for SPLICE_F_NONBLOCK.
Do the same in link_pipe(): move the prep steps into it and retry when nothing was linked although the input pipe still has writers.
Tested under QEMU (x86_64) with the program in the notes: 154 of 22698 tee() calls returned 0 before the change, none of 34429 after it.
--- fs/splice.c | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-)
fs/splice.c +31 -12
@@ -1856,6 +1856,15 @@ static ssize_t link_pipe(struct pipe_inode_info *ipipe,unsigned int i_tail, o_tail;ssize_t ret =0 ; +retry: + ret =ipipe_prep (ipipe, flags); +if (ret) +return ret; + + ret =opipe_prep (opipe, flags); +if (ret) +return ret; +/* * Potential ABBA deadlock, work around it by ordering lock * grabbing by pipe info address. Otherwise two different processes
@@ -1877,13 +1886,32 @@ static ssize_t link_pipe(struct pipe_inode_info *ipipe, i_head = ipipe->head; o_tail = opipe->tail; +if (pipe_empty (i_head, i_tail) && !ipipe->writers) +break ; +/* * If we have iterated all input buffers or run out of * output room, break. */ if (pipe_empty (i_head, i_tail) || -pipe_full (o_head, o_tail, opipe->max_usage)) -break ; +pipe_full (o_head, o_tail, opipe->max_usage)) { +if (ret) +break ; + +if (flags &SPLICE_F_NONBLOCK ) { + ret = -EAGAIN ; +break ; + } + +/* +* We raced with another reader/writer and haven't +* linked any buffers. A zero return value means EOF, +* so retry instead. +*/ +pipe_unlock (ipipe); +pipe_unlock (opipe); + goto retry; + } ibuf =pipe_buf (ipipe, i_tail); obuf =pipe_buf (opipe, o_head);
@@ -1954,16 +1982,7 @@ ssize_t do_tee(struct file *in, struct file *out, size_t len,if ((in->f_flags | out->f_flags) &O_NONBLOCK ) flags |=SPLICE_F_NONBLOCK ; -/* -* Keep going, unless we encounter an error. The ipipe/opipe -* ordering doesn't really matter. -*/ - ret =ipipe_prep (ipipe, flags); -if (!ret) { - ret =opipe_prep (opipe, flags); -if (!ret) - ret =link_pipe (ipipe, opipe, len, flags); - } + ret =link_pipe (ipipe, opipe, len, flags); }if (ret >0 ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2635/2651 ucount: read the parent ucounts before dropping the rlimit count
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nickolai Zeldovich <[email protected]>
[ Upstream commit 38bf603d1ea5d5a65a9cb277df75327ffec01ff1 ]
do_dec_rlimit_put_ucounts() drops its share of iter->rlimit[type] and only then loads iter->ns->ucounts. If the decrement leaves the count non-zero, a concurrent caller can take it to zero and put the last reference, which frees the ucounts and possibly its user namespace with kfree_rcu(). An exiting task frees its pending signals without siglock or any RCU read-side section, so when it is preempted between the decrement and the load for a grace period it reads freed memory and then decrements a counter through the pointer it found there.
A pending signal holds no reference on its ucounts: the reference is taken by whoever moves the count from 0 to 1 and dropped by whoever moves it back to 0, so the caller's share of the count is all that keeps iter alive, and only until it is dropped.
Load the parent first; it stays pinned by the caller's share of its own count.
--- kernel/ucount.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/ucount.c +5 -2
@@ -285,9 +285,12 @@ static void do_dec_rlimit_put_ucounts(struct ucounts *ucounts, {struct ucounts *iter, *next;for (iter = ucounts; iter != last; iter = next) { -long dec =atomic_long_sub_return (1 , &iter->rlimit[type]); -WARN_ON_ONCE (dec <0 ); +long dec; + +/* Our count pins @iter; once it is dropped @iter may be freed. */ next = iter->ns->ucounts; + dec =atomic_long_sub_return (1 , &iter->rlimit[type]); +WARN_ON_ONCE (dec <0 );if (dec ==0 )put_ucounts (iter); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2636/2651 fs_pin: do not trust the pin after a spurious wakeup in pin_kill()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nickolai Zeldovich <[email protected]>
[ Upstream commit f3a6dae67c9ca3d913cbb42fe324c9b47c8d9e53 ]
A task waiting in pin_kill() for another task's ->kill() can take p->wait.lock after the pin has been freed, and can return with its on-stack wait entry still on p->wait. With BSD process accounting this is a use-after-free of the acct structure when umount() of the mount holding the accounting file races with acct(2).
pin_kill() takes a still-queued entry as proof that pin_remove() has not run, so p is alive. But autoremove_wake_function() dequeues only when try_to_wake_up() succeeds: if the waiter was already woken spuriously, pin_remove() leaves the entry queued, acct_pin_kill() frees the acct with kfree_rcu(), and the grace period can end while the waiter sits between schedule() and rcu_read_lock().
Dequeue the entry unconditionally in a private wake function; pin_remove() is the only waker and sets p->done first.
Reproduced under QEMU with KASAN and test-only delays: a slab-use-after-free in pin_kill() before the patch, no report after.
--- fs/fs_pin.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
fs/fs_pin.c +14 -1
@@ -28,6 +28,19 @@ void pin_insert(struct fs_pin *pin, struct vfsmount *m)spin_unlock (&pin_lock); } +/* +* Unlike autoremove_wake_function(), dequeue even if the waiter was already +* running: pin_kill() trusts @p only while its entry is still queued. +*/ +static int pin_kill_wake_function (struct wait_queue_entry *wait, +unsigned int mode,int sync,void *key) +{ +int ret =default_wake_function (wait, mode, sync, key); + +list_del_init_careful (&wait->entry); +return ret; +} +void pin_kill (struct fs_pin *p) {wait_queue_entry_t wait;
@@ -36,7 +49,7 @@ void pin_kill(struct fs_pin *p)rcu_read_unlock ();return ; } -init_wait (&wait); +init_wait_func (&wait, pin_kill_wake_function);spin_lock_irq (&p->wait.lock);if (likely (!p->done)) { p->done =-1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2637/2651 minix: reject rmdir of a directory with a corrupted link count
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nguyen Ngoc Thang <[email protected]>
[ Upstream commit fc9577079df8a44ccbf39d2f06634017d286e4f0 ]
minix_rmdir() calls minix_unlink(), which drops the victim's link count once, and then drops it a second time for the "." entry. An image where an empty directory has i_nlink < 2 makes the second drop hit drop_nlink() with i_nlink == 0:
WARNING: fs/inode.c:408 at drop_nlink minix_rmdir+0xe9/0x150 vfs_rmdir filename_rmdir __do_sys_unlinkat
The parent's link count is already validated; do the same for the directory being removed and fail with -EFSCORRUPTED.
--- fs/minix/namei.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/minix/namei.c +4 -0
@@ -172,6 +172,10 @@ static int minix_rmdir(struct inode * dir, struct dentry *dentry)minix_error_inode (dir,"inode has corrupted nlink" ); goto out; } +if (inode->i_nlink <2 ) { +minix_error_inode (inode,"inode has corrupted nlink" ); + goto out; + } err = -ENOTEMPTY ;if (!minix_empty_dir (inode))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2638/2651 rtc: ds1685: arm the wake-up alarm at power-off only if an alarm is set
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Kaloz <[email protected]>
[ Upstream commit c2373bcd50d9654b76eac585c7c98105665b3321 ]
ds1685_rtc_poweroff() always sets WIE. The wake-up alarm then compares the time-of-day and date alarm registers, which hold whatever was last written to them, and a match powers the machine straight back on.
Set WIE only when AIE is set in Control B, and clear it otherwise.
--- drivers/rtc/rtc-ds1685.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/rtc/rtc-ds1685.c +12 -6
@@ -1367,7 +1367,7 @@ module_platform_driver(ds1685_rtc_driver);void __noreturn ds1685_rtc_poweroff (struct platform_device *pdev) { -u8 ctrla, ctrl4a, ctrl4b; +u8 ctrla, ctrlb, ctrl4a, ctrl4b;struct ds1685_priv *rtc;/* Check for valid RTC data, else, spin forever. */
@@ -1394,6 +1394,8 @@ ds1685_rtc_poweroff(struct platform_device *pdev) ctrla &= ~(RTC_CTRL_A_DV2 ); rtc->write (rtc,RTC_CTRL_A , ctrla); + ctrlb = rtc->read (rtc,RTC_CTRL_B ); +/* * Read Control 4A and check the status of the auxillary * battery. This must be present and working (VRT2 = 1)
@@ -1408,13 +1410,17 @@ ds1685_rtc_poweroff(struct platform_device *pdev)/* * The auxillary battery is present and working. -* Enable extended functions (ABE=1), enable -* wake-up (WIE=1), and enable kickstart (KSE=1) -* in Control 4B. +* Enable extended functions (ABE=1) and kickstart +* (KSE=1) in Control 4B. Enable wake-up (WIE=1) only +* if an alarm is set, else stale alarm registers +* can power the system back on. */ ctrl4b = rtc->read (rtc,RTC_EXT_CTRL_4B ); - ctrl4b |= (RTC_CTRL_4B_ABE |RTC_CTRL_4B_WIE | -RTC_CTRL_4B_KSE ); + ctrl4b |= (RTC_CTRL_4B_ABE |RTC_CTRL_4B_KSE ); +if (ctrlb &RTC_CTRL_B_AIE ) + ctrl4b |=RTC_CTRL_4B_WIE ; +else + ctrl4b &= ~(RTC_CTRL_4B_WIE ); rtc->write (rtc,RTC_EXT_CTRL_4B , ctrl4b); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2639/2651 rtc: ds1685: do not sleep in the power-off handler
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Kaloz <[email protected]>
[ Upstream commit 21a829af60a7f5c7456f1f0ff9b6b0eff0ceb738 ]
Power-off handlers run from an atomic notifier chain and must not sleep. Use mdelay() for the delay before setting PAB.
--- drivers/rtc/rtc-ds1685.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ds1685.c +1 -1
@@ -1426,7 +1426,7 @@ ds1685_rtc_poweroff(struct platform_device *pdev)/* Set PAB to 1 in Control 4A to power the system down. */ dev_warn (&pdev->dev,"Powerdown.\n" ); -msleep (20 ); +mdelay (20 ); rtc->write (rtc,RTC_EXT_CTRL_4A , (ctrl4a |RTC_CTRL_4A_PAB ));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2640/2651 sched/cputime: Dont warn when the tick period starts after idle exit
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stian Halseth <[email protected]>
[ Upstream commit b327e63683a2b894b500027375342c25222b58ef ]
kcpustat_dyntick_stop() warns if idle ends before the tick period that the next tick will account has started. That happens on x86 in a CPU's first idle period with the tick stopped, right after the switch from the jiffies clocksource to tsc-early.
On the jiffies clocksource ktime only moves at the tick. When the clocksource switches some time d after a tick, that d is lost: ktime continues from the value of the last tick. The next tick comes TICK_NSEC after the last one, but ktime has only moved TICK_NSEC - d, while tick_periodic() still adds a full TICK_NSEC to tick_next_period, which is now d ahead of ktime. When NOHZ starts, tick_init_jiffy_update() rounds it up to a multiple of TICK_NSEC and the sched timer is armed there, up to nearly two ticks after now. A tick stop saves that as ts->last_tick, and an idle exit before now reaches ts->last_tick - TICK_NSEC sees the tick period in the future.
Nothing is accounted twice then. The first tick covers a period that starts after the idle exit, and the code already handles it. Drop the warning.
--
kernel/sched/cputime.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
--- kernel/sched/cputime.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/sched/cputime.c +6 -1
@@ -479,7 +479,12 @@ void kcpustat_dyntick_stop(u64 now, u64 tick_start) kc->idle_tick_overlap =0 ; } tick_start =max (tick_start, kc->idle_dyntick_entry); -if (!WARN_ON_ONCE (now < tick_start)) +/* +* After a switch from the jiffies clocksource the tick can be +* armed more than a tick ahead, so the period may not have +* started yet. +*/ +if (now > tick_start) kc->idle_tick_overlap += now - tick_start;kcpustat_idle_stop (kc, now); kc->idle_dyntick = false;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2641/2651 vdpa_sim: disable page faults around vringh_need_notify_iotlb()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
[ Upstream commit 05fb07c40e0013ba5ae373c6ea1bcc622eaea7f0 ]
When vdpa_sim runs with use_va (the default), its rings live in user memory, and vringh reads the ring's flags and event index with __get_user() through the user address. The net and block simulators call vringh_need_notify_iotlb() with bottom halves disabled, so those reads happen in atomic context.
That only works today because __get_user() has no might_fault() check: a fault is not handled in atomic context and simply comes back as -EFAULT. Make that explicit with pagefault_disable() around the call, so vringh can use the normal user accessors without complaint. Only the notification check needs this: the rest of the ring processing runs in the same kthread without bottom halves disabled, and can fault normally.
--- drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 9 ++++++++- drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-)
drivers/vdpa/vdpa_sim/vdpa_sim_blk.c +8 -1
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/device.h> #include <linux/kernel.h> +#include <linux/uaccess.h> #include <linux/blkdev.h> #include <linux/vringh.h> #include <linux/vdpa.h>
@@ -343,11 +344,17 @@ static void vdpasim_blk_work(struct vdpasim *vdpasim)continue ;while (vdpasim_blk_handle_req (vdpasim, vq)) { +bool notify; +/* Make sure used is visible before rasing the interrupt. */ smp_wmb ();local_bh_disable (); -if (vringh_need_notify_iotlb (&vq->vring) >0 ) +/* The ring may be in user memory, and we can't take faults here */ +pagefault_disable (); + notify =vringh_need_notify_iotlb (&vq->vring) >0 ; +pagefault_enable (); +if (notify)vringh_notify (&vq->vring);local_bh_enable ();
drivers/vdpa/vdpa_sim/vdpa_sim_net.c +8 -1
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/device.h> #include <linux/kernel.h> +#include <linux/uaccess.h> #include <linux/etherdevice.h> #include <linux/vringh.h> #include <linux/vdpa.h>
@@ -68,6 +69,8 @@ static struct vdpasim_net *sim_to_net(struct vdpasim *vdpasim)static void vdpasim_net_complete (struct vdpasim_virtqueue *vq,size_t len) { +bool notify; +/* Make sure data is wrote before advancing index */ smp_wmb ();
@@ -77,7 +80,11 @@ static void vdpasim_net_complete(struct vdpasim_virtqueue *vq, size_t len)smp_wmb ();local_bh_disable (); -if (vringh_need_notify_iotlb (&vq->vring) >0 ) +/* The ring may be in user memory, and we can't take faults here */ +pagefault_disable (); + notify =vringh_need_notify_iotlb (&vq->vring) >0 ; +pagefault_enable (); +if (notify)vringh_notify (&vq->vring);local_bh_enable (); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2642/2651 PCI/sysfs: Decouple acpi_index from the optional device name element
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Wilczyński <[email protected]>
[ Upstream commit 337bdf853101a0ee66eadf668f0fef21f8276b52 ]
The "_DSM for Naming a PCI or PCI Express Device Under Operating Systems" (PCI Firmware r3.3, sec 4.6.7) returns a package of two elements:
1) Instance number (mandatory Integer)
2) String name (optional String, null string if not populated)
These are exposed as sysfs 'acpi_index' and 'label'. Previously, if the name was malformed, reads of 'acpi_index' failed unnecessarily.
Validate each element only for the attribute that exports it. So "acpi_index" now depends on the instance number alone, and "label" reads fail with -EIO when the name element is neither a string nor a buffer. The package elements pointer is read only after the object type has been checked.
On platforms with a valid instance number and a malformed name element the "acpi_index" attribute starts returning data. Because udev derives the onboard interface name from "acpi_index", an interface on such a platform may be renamed once, on the first boot after this change. That is the attribute assuming the value the firmware always provided.
--- drivers/pci/pci-label.c | 53 +++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 20 deletions(-)
drivers/pci/pci-label.c +33 -20
@@ -157,7 +157,7 @@ static int dsm_get_label(struct device *dev, char *buf, {acpi_handle handle =ACPI_HANDLE (dev);union acpi_object *obj, *tmp; -int len =0 ; +int len;if (!handle)return -ENODEV ;
@@ -167,30 +167,43 @@ static int dsm_get_label(struct device *dev, char *buf,if (!obj)return -EIO ; +if (obj->type !=ACPI_TYPE_PACKAGE || obj->package.count !=2 ) { + len = -EIO ; + goto out; + } + tmp = obj->package.elements; -if (obj->type ==ACPI_TYPE_PACKAGE && obj->package.count ==2 && - tmp[0 ].type ==ACPI_TYPE_INTEGER && - (tmp[1 ].type ==ACPI_TYPE_STRING || - tmp[1 ].type ==ACPI_TYPE_BUFFER )) { -/* -* The second string element is optional even when -* this _DSM is implemented; when not implemented, -* this entry must return a null string. -*/ -if (attr ==ACPI_ATTR_INDEX_SHOW ) { - len =sysfs_emit (buf,"%llu\n" , tmp->integer.value); - }else if (attr ==ACPI_ATTR_LABEL_SHOW ) { -if (tmp[1 ].type ==ACPI_TYPE_STRING ) - len =sysfs_emit (buf,"%s\n" , - tmp[1 ].string.pointer); -else if (tmp[1 ].type ==ACPI_TYPE_BUFFER ) - len =dsm_label_utf16s_to_utf8s (tmp +1 , buf); - } +if (tmp[0 ].type !=ACPI_TYPE_INTEGER ) { + len = -EIO ; + goto out; } +if (attr ==ACPI_ATTR_INDEX_SHOW ) { + len =sysfs_emit (buf,"%llu\n" , tmp[0 ].integer.value); + goto out; + } + +/* +* Per PCI Firmware r3.3, sec 4.6.7, the device name is optional +* even when this _DSM is implemented. When not implemented, this +* entry must return a NULL string. +*/ +switch (tmp[1 ].type) { +case ACPI_TYPE_STRING : + len =sysfs_emit (buf,"%s\n" , tmp[1 ].string.pointer); +break ; +case ACPI_TYPE_BUFFER : + len =dsm_label_utf16s_to_utf8s (&tmp[1 ], buf); +break ; +default : + len = -EIO ; +break ; + } + +out:ACPI_FREE (obj); -return len >0 ? len : -EIO ; +return len; } static ssize_t label_show(struct device *dev, struct device_attribute *attr,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2643/2651 scsi: core: Fix additional sense code definition
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit 3b7ccba37858dd3d7d3780eb42ab943152e5b7ec upstream.
The ASC() macro used to define an additional sense code with no additional sense code qualifier conflicts with the ASC macro definition of the file arch/sparc/include/asm/ns87303.h, leading to compilation errors. Avoid this conflict by renaming the macro as SCSI_ASC() and the ASC_DEF() macro to SCSI_ASC_DEF() to be consistent.
--- include/scsi/scsi_sense.h | 236 +++++++++++++++++++++++----------------------- 1 file changed, 118 insertions(+), 118 deletions(-)
include/scsi/scsi_sense.h +118 -118
@@ -30,10 +30,10 @@ enum scsi_sense_key { COMPLETED = 0x0f, }; -#define ASC_DEF (name) ASC_##name -#define ASC (name, code) \ - ASC_DEF(name) = (code), \ - name = ((code) << 8) | 0x00 +#define SCSI_ASC_DEF (name) ASC_##name +#define SCSI_ASC (name, code) \ + SCSI_ASC_DEF(name) = (code), \ + name = ((code) << 8) | 0x00/* * SCSI additional sense codes and sense codes qualifiers.
@@ -49,7 +49,7 @@ enum scsi_sense_key {* are prefixed with "SSC_" (e.g. WARNING and WRITE_ERROR). */ enum scsi_sense_code { - ASC(NO_ADDITIONAL_SENSE_INFORMATION, 0x00), + SCSI_ASC(NO_ADDITIONAL_SENSE_INFORMATION, 0x00),FILEMARK_DETECTED =0x0001 ,END_OF_PARTITION_MEDIUM_DETECTED =0x0002 ,SETMARK_DETECTED =0x0003 ,
@@ -77,15 +77,15 @@ enum scsi_sense_code {DEFERRED_MICROCODE_IS_PENDING =0x0022 ,OVERLAPPING_ATOMIC_COMMAND_IN_PROGRESS =0x0023 , -ASC (NO_INDEX_SECTOR_SIGNAL ,0x01 ), +SCSI_ASC (NO_INDEX_SECTOR_SIGNAL ,0x01 ), -ASC (NO_SEEK_COMPLETE ,0x02 ), +SCSI_ASC (NO_SEEK_COMPLETE ,0x02 ), -ASC (PERIPHERAL_DEVICE_WRITE_FAULT ,0x03 ), +SCSI_ASC (PERIPHERAL_DEVICE_WRITE_FAULT ,0x03 ),NO_WRITE_CURRENT =0x0301 ,EXCESSIVE_WRITE_ERRORS =0x0302 , -ASC (LU_NOT_READY ,0x04 ), +SCSI_ASC (LU_NOT_READY ,0x04 ),LU_IS_IN_PROCESS_OF_BECOMING_READY =0x0401 ,LU_NOT_READY_INITIALIZING_COMMAND_REQUIRED =0x0402 , LU_NOT_READY_MANUAL_INTERVENTION_REQUIRED = 0x0403,
@@ -123,28 +123,28 @@ enum scsi_sense_code {DEPOPULATION_IN_PROGRESS =0x0424 ,DEPOPULATION_RESTORATION_IN_PROGRESS =0x0425 , -ASC (LU_DOES_NOT_RESPOND_TO_SELECTION ,0x05 ), +SCSI_ASC (LU_DOES_NOT_RESPOND_TO_SELECTION ,0x05 ), -ASC (NO_REFERENCE_POSITION_FOUND ,0x06 ), +SCSI_ASC (NO_REFERENCE_POSITION_FOUND ,0x06 ), -ASC (MULTIPLE_PERIPHERAL_DEVICES_SELECTED ,0x07 ), +SCSI_ASC (MULTIPLE_PERIPHERAL_DEVICES_SELECTED ,0x07 ), -ASC (LU_COMMUNICATION_FAILURE ,0x08 ), +SCSI_ASC (LU_COMMUNICATION_FAILURE ,0x08 ),LU_COMMUNICATION_TIMEOUT =0x0801 ,LU_COMMUNICATION_PARITY_ERROR =0x0802 ,LU_COMMUNICATION_CRC_ERROR =0x0803 ,UNREACHABLE_COPY_TARGET =0x0804 , -ASC (TRACK_FOLLOWING_ERROR ,0x09 ), +SCSI_ASC (TRACK_FOLLOWING_ERROR ,0x09 ),TRACKING_SERVO_FAILURE =0x0901 ,FOCUS_SERVO_FAILURE =0x0902 ,SPINDLE_SERVO_FAILURE =0x0903 ,HEAD_SELECT_FAULT =0x0904 ,VIBRATION_INDUCED_TRACKING_ERROR =0x0905 , -ASC (ERROR_LOG_OVERFLOW ,0x0A ), +SCSI_ASC (ERROR_LOG_OVERFLOW ,0x0A ), -ASC (SSC_WARNING ,0x0B ), +SCSI_ASC (SSC_WARNING ,0x0B ),WARNING_SPECIFIED_TEMPERATURE_EXCEEDED =0x0B01 ,WARNING_ENCLOSURE_DEGRADED =0x0B02 , WARNING_BACKGROUND_SELFTEST_FAILED = 0x0B03,
@@ -167,7 +167,7 @@ enum scsi_sense_code {WARNING_PHYSICAL_ELEMENT_STATUS_CHANGE =0x0B14 ,/* Defined as "WRITE ERROR" in T10. */ -ASC (SSC_WRITE_ERROR ,0x0C ), +SCSI_ASC (SSC_WRITE_ERROR ,0x0C ),WRITE_ERROR_RECOVERED_WITH_AUTO_REALLOCATION =0x0C01 ,WRITE_ERROR_AUTO_REALLOCATION_FAILED =0x0C02 , WRITE_ERROR_RECOMMEND_REASSIGNMENT = 0x0C03,
@@ -187,26 +187,26 @@ enum scsi_sense_code {WRITE_ERROR_RECOVERY_SCAN_NEEDED =0x0C11 ,WRITE_ERROR_INSUFFICIENT_ZONE_RESOURCES =0x0C12 , -ASC (ERROR_DETECTED_BY_THIRD_PARTY_TEMPORARY_INITIATOR ,0x0D ), +SCSI_ASC (ERROR_DETECTED_BY_THIRD_PARTY_TEMPORARY_INITIATOR ,0x0D ),THIRD_PARTY_DEVICE_FAILURE =0x0D01 ,COPY_TARGET_DEVICE_NOT_REACHABLE =0x0D02 ,INCORRECT_COPY_TARGET_DEVICE_TYPE =0x0D03 ,COPY_TARGET_DEVICE_DATA_UNDERRUN =0x0D04 ,COPY_TARGET_DEVICE_DATA_OVERRUN =0x0D05 , -ASC (INVALID_INFORMATION_UNIT ,0x0E ), +SCSI_ASC (INVALID_INFORMATION_UNIT ,0x0E ),INFORMATION_UNIT_TOO_SHORT =0x0E01 ,INFORMATION_UNIT_TOO_LONG =0x0E02 ,INVALID_FIELD_IN_COMMAND_INFORMATION_UNIT =0x0E03 , -ASC (ID_CRC_OR_ECC_ERROR ,0x10 ), +SCSI_ASC (ID_CRC_OR_ECC_ERROR ,0x10 ),LOGICAL_BLOCK_GUARD_CHECK_FAILED =0x1001 ,LOGICAL_BLOCK_APPLICATION_TAG_CHECK_FAILED =0x1002 ,LOGICAL_BLOCK_REFERENCE_TAG_CHECK_FAILED =0x1003 ,LOGICAL_BLOCK_PROTECTION_ERROR_ON_RECOVER_BUFFERED_DATA =0x1004 ,LOGICAL_BLOCK_PROTECTION_METHOD_ERROR =0x1005 , -ASC (UNRECOVERED_READ_ERROR ,0x11 ), +SCSI_ASC (UNRECOVERED_READ_ERROR ,0x11 ),READ_RETRIES_EXHAUSTED =0x1101 ,ERROR_TOO_LONG_TO_CORRECT =0x1102 , MULTIPLE_READ_ERRORS = 0x1103,
@@ -229,11 +229,11 @@ enum scsi_sense_code {READ_ERROR_LBA_MARKED_BAD_BY_APPLICATION_CLIENT =0x1114 ,WRITE_AFTER_SANITIZE_REQUIRED =0x1115 , -ASC (ADDRESS_MARK_NOT_FOUND_FOR_ID_FIELD ,0x12 ), +SCSI_ASC (ADDRESS_MARK_NOT_FOUND_FOR_ID_FIELD ,0x12 ), -ASC (ADDRESS_MARK_NOT_FOUND_FOR_DATA_FIELD ,0x13 ), +SCSI_ASC (ADDRESS_MARK_NOT_FOUND_FOR_DATA_FIELD ,0x13 ), -ASC (RECORDED_ENTITY_NOT_FOUND ,0x14 ), +SCSI_ASC (RECORDED_ENTITY_NOT_FOUND ,0x14 ),RECORD_NOT_FOUND =0x1401 ,FILEMARK_OR_SETMARK_NOT_FOUND =0x1402 , END_OF_DATA_NOT_FOUND = 0x1403,
@@ -242,17 +242,17 @@ enum scsi_sense_code {RECORD_NOT_FOUND_DATA_AUTO_REALLOCATED =0x1406 ,LOCATE_OPERATION_FAILURE =0x1407 , -ASC (RANDOM_POSITIONING_ERROR ,0x15 ), +SCSI_ASC (RANDOM_POSITIONING_ERROR ,0x15 ),MECHANICAL_POSITIONING_ERROR =0x1501 ,POSITIONING_ERROR_DETECTED_BY_READ_OF_MEDIUM =0x1502 , -ASC (DATA_SYNCHRONIZATION_MARK_ERROR ,0x16 ), +SCSI_ASC (DATA_SYNCHRONIZATION_MARK_ERROR ,0x16 ),DATA_SYNC_ERROR_DATA_REWRITTEN =0x1601 ,DATA_SYNC_ERROR_RECOMMEND_REWRITE =0x1602 ,DATA_SYNC_ERROR_DATA_AUTO_REALLOCATED =0x1603 ,DATA_SYNC_ERROR_RECOMMEND_REASSIGNMENT =0x1604 , -ASC (RECOVERED_DATA_WITH_NO_ERROR_CORRECTION_APPLIED ,0x17 ), +SCSI_ASC (RECOVERED_DATA_WITH_NO_ERROR_CORRECTION_APPLIED ,0x17 ),RECOVERED_DATA_WITH_RETRIES =0x1701 ,RECOVERED_DATA_WITH_POSITIVE_HEAD_OFFSET =0x1702 , RECOVERED_DATA_WITH_NEGATIVE_HEAD_OFFSET = 0x1703,
@@ -263,7 +263,7 @@ enum scsi_sense_code {RECOVERED_DATA_WITHOUT_ECC_RECOMMEND_REWRITE =0x1708 ,RECOVERED_DATA_WITHOUT_ECC_DATA_REWRITTEN =0x1709 , -ASC (RECOVERED_DATA_WITH_ERROR_CORRECTION_APPLIED ,0x18 ), +SCSI_ASC (RECOVERED_DATA_WITH_ERROR_CORRECTION_APPLIED ,0x18 ),RECOVERED_DATA_WITH_ERROR_CORRECTION_RETRIES_APPLIED =0x1801 ,RECOVERED_DATA_DATA_AUTO_REALLOCATED =0x1802 , RECOVERED_DATA_WITH_CIRC = 0x1803,
@@ -273,27 +273,27 @@ enum scsi_sense_code {RECOVERED_DATA_WITH_ECC_DATA_REWRITTEN =0x1807 ,RECOVERED_DATA_WITH_LINKING =0x1808 , -ASC (DEFECT_LIST_ERROR ,0x19 ), +SCSI_ASC (DEFECT_LIST_ERROR ,0x19 ),DEFECT_LIST_NOT_AVAILABLE =0x1901 ,DEFECT_LIST_ERROR_IN_PRIMARY_LIST =0x1902 ,DEFECT_LIST_ERROR_IN_GROWN_LIST =0x1903 , -ASC (PARAMETER_LIST_LENGTH_ERROR ,0x1A ), +SCSI_ASC (PARAMETER_LIST_LENGTH_ERROR ,0x1A ), -ASC (SYNCHRONOUS_DATA_TRANSFER_ERROR ,0x1B ), +SCSI_ASC (SYNCHRONOUS_DATA_TRANSFER_ERROR ,0x1B ), -ASC (DEFECT_LIST_NOT_FOUND ,0x1C ), +SCSI_ASC (DEFECT_LIST_NOT_FOUND ,0x1C ),PRIMARY_DEFECT_LIST_NOT_FOUND =0x1C01 ,GROWN_DEFECT_LIST_NOT_FOUND =0x1C02 , -ASC (MISCOMPARE_DURING_VERIFY_OPERATION ,0x1D ), +SCSI_ASC (MISCOMPARE_DURING_VERIFY_OPERATION ,0x1D ),MISCOMPARE_VERIFY_OF_UNMAPPED_LBA =0x1D01 , -ASC (RECOVERED_ID_WITH_ECC_CORRECTION ,0x1E ), +SCSI_ASC (RECOVERED_ID_WITH_ECC_CORRECTION ,0x1E ), -ASC (PARTIAL_DEFECT_LIST_TRANSFER ,0x1F ), +SCSI_ASC (PARTIAL_DEFECT_LIST_TRANSFER ,0x1F ), -ASC (INVALID_COMMAND_OP_CODE ,0x20 ), +SCSI_ASC (INVALID_COMMAND_OP_CODE ,0x20 ),ACCESS_DENIED_INITIATOR_PENDING_ENROLLED =0x2001 ,ACCESS_DENIED_NO_ACCESS_RIGHTS =0x2002 , ACCESS_DENIED_INVALID_MGMT_ID_KEY = 0x2003,
@@ -309,7 +309,7 @@ enum scsi_sense_code {NOT_A_SUBSIDIARY_LOGICAL_UNIT =0x200E ,NOT_A_CONGLOMERATE_LOGICAL_UNIT =0x200F , -ASC (LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE ,0x21 ), +SCSI_ASC (LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE ,0x21 ),INVALID_ELEMENT_ADDRESS =0x2101 ,INVALID_ADDRESS_FOR_WRITE =0x2102 , INVALID_WRITE_CROSSING_LAYER_JUMP = 0x2103,
@@ -320,9 +320,9 @@ enum scsi_sense_code {MISALIGNED_WRITE_COMMAND =0x2108 ,ATTEMPT_TO_ACCESS_GAP_ZONE =0x2109 , -ASC (ILLEGAL_FUNCTION ,0x22 ), +SCSI_ASC (ILLEGAL_FUNCTION ,0x22 ), -ASC (INVALID_TOKEN_OP ,0x23 ), +SCSI_ASC (INVALID_TOKEN_OP ,0x23 ),INVALID_TOKEN_OP_UNSUPPORTED_TOKEN_TYPE =0x2301 ,INVALID_TOKEN_OP_REMOTE_TOKEN_USAGE_NOT_SUPPORTED =0x2302 , INVALID_TOKEN_OP_REMOTE_ROD_TOKEN_CREATION_NOT_SUPPORTED = 0x2303,
@@ -334,7 +334,7 @@ enum scsi_sense_code {INVALID_TOKEN_OP_TOKEN_DELETED =0x2309 ,INVALID_TOKEN_OP_INVALID_TOKEN_LENGTH =0x230A , -ASC (INVALID_FIELD_IN_CDB ,0x24 ), +SCSI_ASC (INVALID_FIELD_IN_CDB ,0x24 ),CDB_DECRYPTION_ERROR =0x2401 ,SECURITY_AUDIT_VALUE_FROZEN =0x2404 , SECURITY_WORKING_KEY_FROZEN = 0x2405,
@@ -343,9 +343,9 @@ enum scsi_sense_code {INVALID_XCDB =0x2408 ,INVALID_FAST_FORMAT =0x2409 , -ASC (LU_NOT_SUPPORTED ,0x25 ), +SCSI_ASC (LU_NOT_SUPPORTED ,0x25 ), -ASC (INVALID_FIELD_IN_PARAMETER_LIST ,0x26 ), +SCSI_ASC (INVALID_FIELD_IN_PARAMETER_LIST ,0x26 ),PARAMETER_NOT_SUPPORTED =0x2601 ,PARAMETER_VALUE_INVALID =0x2602 , THRESHOLD_PARAMETERS_NOT_SUPPORTED = 0x2603,
@@ -369,7 +369,7 @@ enum scsi_sense_code {COPY_SOURCE_OR_COPY_DESTINATION_NOT_AUTHORIZED =0x2615 ,FAST_COPY_NOT_POSSIBLE =0x2616 , -ASC (WRITE_PROTECTED ,0x27 ), +SCSI_ASC (WRITE_PROTECTED ,0x27 ),HW_WRITE_PROTECTED =0x2701 ,LU_SOFTWARE_WRITE_PROTECTED =0x2702 , ASSOCIATED_WRITE_PROTECT = 0x2703,
@@ -379,12 +379,12 @@ enum scsi_sense_code {SPACE_ALLOCATION_FAILED_WRITE_PROTECT =0x2707 ,ZONE_IS_READ_ONLY =0x2708 , -ASC (NOT_READY_TO_READY_CHANGE_MEDIUM_MAY_HAVE_CHANGED ,0x28 ), +SCSI_ASC (NOT_READY_TO_READY_CHANGE_MEDIUM_MAY_HAVE_CHANGED ,0x28 ),IMPORT_OR_EXPORT_ELEMENT_ACCESSED =0x2801 ,FORMAT_LAYER_MAY_HAVE_CHANGED =0x2802 ,IMPORT_EXPORT_ELEMENT_ACCESSED_MEDIUM_CHANGED =0x2803 , -ASC (POWER_ON_RESET_OR_BUS_DEVICE_RESET_OCCURRED ,0x29 ), +SCSI_ASC (POWER_ON_RESET_OR_BUS_DEVICE_RESET_OCCURRED ,0x29 ),POWER_ON_OCCURRED =0x2901 ,SCSI_BUS_RESET_OCCURRED =0x2902 , BUS_DEVICE_RESET_FUNCTION_OCCURRED = 0x2903,
@@ -393,7 +393,7 @@ enum scsi_sense_code {TRANSCEIVER_MODE_CHANGED_TO_LVD =0x2906 ,I_T_NEXUS_LOSS_OCCURRED =0x2907 , -ASC (PARAMETERS_CHANGED ,0x2A ), +SCSI_ASC (PARAMETERS_CHANGED ,0x2A ),MODE_PARAMETERS_CHANGED =0x2A01 ,LOG_PARAMETERS_CHANGED =0x2A02 , RESERVATIONS_PREEMPTED = 0x2A03,
@@ -415,9 +415,9 @@ enum scsi_sense_code {MEDIUM_REMOVAL_PREVENTION_PREEMPTED =0x2A15 ,ZONE_RESET_WRITE_POINTER_RECOMMENDED =0x2A16 , -ASC (COPY_CANNOT_EXECUTE_SINCE_HOST_CANNOT_DISCONNECT ,0x2B ), +SCSI_ASC (COPY_CANNOT_EXECUTE_SINCE_HOST_CANNOT_DISCONNECT ,0x2B ), -ASC (COMMAND_SEQUENCE_ERROR ,0x2C ), +SCSI_ASC (COMMAND_SEQUENCE_ERROR ,0x2C ),TOO_MANY_WINDOWS_SPECIFIED =0x2C01 ,INVALID_COMBINATION_OF_WINDOWS_SPECIFIED =0x2C02 , CURRENT_PROGRAM_AREA_IS_NOT_EMPTY = 0x2C03,
@@ -438,19 +438,19 @@ enum scsi_sense_code {ZONE_IS_INACTIVE =0x2C12 ,WELL_KNOWN_LU_ACCESS_REQUIRED =0x2C13 , -ASC (OVERWRITE_ERROR_ON_UPDATE_IN_PLACE ,0x2D ), +SCSI_ASC (OVERWRITE_ERROR_ON_UPDATE_IN_PLACE ,0x2D ), -ASC (INSUFFICIENT_TIME_FOR_OPERATION ,0x2E ), +SCSI_ASC (INSUFFICIENT_TIME_FOR_OPERATION ,0x2E ),COMMAND_TIMEOUT_BEFORE_PROCESSING =0x2E01 ,COMMAND_TIMEOUT_DURING_PROCESSING =0x2E02 ,COMMAND_TIMEOUT_DURING_PROCESSING_DUE_TO_ERROR_RECOVERY =0x2E03 , -ASC (COMMANDS_CLEARED_BY_ANOTHER_INITIATOR ,0x2F ), +SCSI_ASC (COMMANDS_CLEARED_BY_ANOTHER_INITIATOR ,0x2F ),COMMANDS_CLEARED_BY_POWER_LOSS_NOTIFICATION =0x2F01 ,COMMANDS_CLEARED_BY_DEVICE_SERVER =0x2F02 ,SOME_COMMANDS_CLEARED_BY_QUEUING_LAYER_EVENT =0x2F03 , -ASC (INCOMPATIBLE_MEDIUM_INSTALLED ,0x30 ), +SCSI_ASC (INCOMPATIBLE_MEDIUM_INSTALLED ,0x30 ),CANNOT_READ_MEDIUM_UNKNOWN_FORMAT =0x3001 ,CANNOT_READ_MEDIUM_INCOMPATIBLE_FORMAT =0x3002 , CLEANING_CARTRIDGE_INSTALLED = 0x3003,
@@ -468,32 +468,32 @@ enum scsi_sense_code {INCOMPATIBLE_VOLUME_QUALIFIER =0x3012 ,CLEANING_VOLUME_EXPIRED =0x3013 , -ASC (MEDIUM_FORMAT_CORRUPTED ,0x31 ), +SCSI_ASC (MEDIUM_FORMAT_CORRUPTED ,0x31 ),FORMAT_COMMAND_FAILED =0x3101 ,ZONED_FORMATTING_FAILED_DUE_TO_SPARE_LINKING =0x3102 ,SANITIZE_COMMAND_FAILED =0x3103 ,DEPOPULATION_FAILED =0x3104 ,DEPOPULATION_RESTORATION_FAILED =0x3105 , -ASC (NO_DEFECT_SPARE_LOCATION_AVAILABLE ,0x32 ), +SCSI_ASC (NO_DEFECT_SPARE_LOCATION_AVAILABLE ,0x32 ),DEFECT_LIST_UPDATE_FAILURE =0x3201 , -ASC (TAPE_LENGTH_ERROR ,0x33 ), +SCSI_ASC (TAPE_LENGTH_ERROR ,0x33 ), -ASC (ENCLOSURE_FAILURE ,0x34 ), +SCSI_ASC (ENCLOSURE_FAILURE ,0x34 ), -ASC (ENCLOSURE_SERVICES_FAILURE ,0x35 ), +SCSI_ASC (ENCLOSURE_SERVICES_FAILURE ,0x35 ),UNSUPPORTED_ENCLOSURE_FUNCTION =0x3501 ,ENCLOSURE_SERVICES_UNAVAILABLE =0x3502 ,ENCLOSURE_SERVICES_TRANSFER_FAILURE =0x3503 ,ENCLOSURE_SERVICES_TRANSFER_REFUSED =0x3504 ,ENCLOSURE_SERVICES_CHECKSUM_ERROR =0x3505 , -ASC (RIBBON_INK_OR_TONER_FAILURE ,0x36 ), +SCSI_ASC (RIBBON_INK_OR_TONER_FAILURE ,0x36 ), -ASC (ROUNDED_PARAMETER ,0x37 ), +SCSI_ASC (ROUNDED_PARAMETER ,0x37 ), -ASC (EVENT_STATUS_NOTIFICATION ,0x38 ), +SCSI_ASC (EVENT_STATUS_NOTIFICATION ,0x38 ),ESN_POWER_MANAGEMENT_CLASS_EVENT =0x3802 ,ESN_MEDIA_CLASS_EVENT =0x3804 , ESN_DEVICE_BUSY_CLASS_EVENT = 0x3806,
@@ -501,15 +501,15 @@ enum scsi_sense_code {DEPOPULATION_INTERRUPTED =0x3808 ,DEPOPULATION_RESTORATION_INTERRUPTED =0x3809 , -ASC (SAVING_PARAMETERS_NOT_SUPPORTED ,0x39 ), +SCSI_ASC (SAVING_PARAMETERS_NOT_SUPPORTED ,0x39 ), -ASC (MEDIUM_NOT_PRESENT ,0x3A ), +SCSI_ASC (MEDIUM_NOT_PRESENT ,0x3A ),MEDIUM_NOT_PRESENT_TRAY_CLOSED =0x3A01 ,MEDIUM_NOT_PRESENT_TRAY_OPEN =0x3A02 ,MEDIUM_NOT_PRESENT_LOADABLE =0x3A03 ,MEDIUM_NOT_PRESENT_MEDIUM_AUXILIARY_MEMORY_ACCESSIBLE =0x3A04 , -ASC (SEQUENTIAL_POSITIONING_ERROR ,0x3B ), +SCSI_ASC (SEQUENTIAL_POSITIONING_ERROR ,0x3B ),TAPE_POSITION_ERROR_AT_BEGINNING_OF_MEDIUM =0x3B01 ,TAPE_POSITION_ERROR_AT_END_OF_MEDIUM =0x3B02 , TAPE_OR_ELECTRONIC_VERTICAL_FORMS_UNIT_NOT_READY = 0x3B03,
@@ -539,15 +539,15 @@ enum scsi_sense_code {TOO_MANY_LOGICAL_OBJECTS_ON_PARTITION_TO_SUPPORT_OP =0x3B1C ,ELEMENT_STATIC_INFORMATION_CHANGED =0x3B20 , -ASC (INVALID_BITS_IN_IDENTIFY_MESSAGE ,0x3D ), +SCSI_ASC (INVALID_BITS_IN_IDENTIFY_MESSAGE ,0x3D ), -ASC (LU_HAS_NOT_SELF_CONFIGURED_YET ,0x3E ), +SCSI_ASC (LU_HAS_NOT_SELF_CONFIGURED_YET ,0x3E ),LU_FAILURE =0x3E01 ,TIMEOUT_ON_LOGICAL_UNIT =0x3E02 ,LU_FAILED_SELF_TEST =0x3E03 ,LU_UNABLE_TO_UPDATE_SELFTEST_LOG =0x3E04 , -ASC (TARGET_OPERATING_CONDITIONS_HAVE_CHANGED ,0x3F ), +SCSI_ASC (TARGET_OPERATING_CONDITIONS_HAVE_CHANGED ,0x3F ),MICROCODE_HAS_BEEN_CHANGED =0x3F01 ,CHANGED_OPERATING_DEFINITION =0x3F02 , INQUIRY_DATA_HAS_CHANGED = 0x3F03,
@@ -575,24 +575,24 @@ enum scsi_sense_code {BIND_REDIRECTED =0x3F19 ,SUBSIDIARY_BINDING_CHANGED =0x3F1A , -ASC (RAM_FAILURE ,0x40 ), +SCSI_ASC (RAM_FAILURE ,0x40 ),/* DIAGNOSTIC_FAILURE_ON_COMPONENT_NN = 0x40NN */ -ASC (DATA_PATH_FAILURE ,0x41 ), +SCSI_ASC (DATA_PATH_FAILURE ,0x41 ), -ASC (POWER_ON_OR_SELFTEST_FAILURE ,0x42 ), +SCSI_ASC (POWER_ON_OR_SELFTEST_FAILURE ,0x42 ), -ASC (MESSAGE_ERROR ,0x43 ), +SCSI_ASC (MESSAGE_ERROR ,0x43 ), -ASC (INTERNAL_TARGET_FAILURE ,0x44 ), +SCSI_ASC (INTERNAL_TARGET_FAILURE ,0x44 ),PERSISTENT_RESERVATION_INFORMATION_LOST =0x4401 ,ATA_DEVICE_FAILED_SET_FEATURES =0x4471 , -ASC (SELECT_OR_RESELECT_FAILURE ,0x45 ), +SCSI_ASC (SELECT_OR_RESELECT_FAILURE ,0x45 ), -ASC (UNSUCCESSFUL_SOFT_RESET ,0x46 ), +SCSI_ASC (UNSUCCESSFUL_SOFT_RESET ,0x46 ), -ASC (SCSI_PARITY_ERROR ,0x47 ), +SCSI_ASC (SCSI_PARITY_ERROR ,0x47 ),DATA_PHASE_CRC_ERROR_DETECTED =0x4701 ,SCSI_PARITY_ERROR_DETECTED_DURING_ST_DATA_PHASE =0x4702 , INFORMATION_UNIT_iuCRC_ERROR_DETECTED = 0x4703,
@@ -601,13 +601,13 @@ enum scsi_sense_code {PHY_TEST_FUNCTION_IN_PROGRESS =0x4706 ,SOME_COMMANDS_CLEARED_BY_ISCSI_PROTOCOL_EVENT =0x477F , -ASC (INITIATOR_DETECTED_ERROR_MESSAGE_RECEIVED ,0x48 ), +SCSI_ASC (INITIATOR_DETECTED_ERROR_MESSAGE_RECEIVED ,0x48 ), -ASC (INVALID_MESSAGE_ERROR ,0x49 ), +SCSI_ASC (INVALID_MESSAGE_ERROR ,0x49 ), -ASC (COMMAND_PHASE_ERROR ,0x4A ), +SCSI_ASC (COMMAND_PHASE_ERROR ,0x4A ), -ASC (DATA_PHASE_ERROR ,0x4B ), +SCSI_ASC (DATA_PHASE_ERROR ,0x4B ),INVALID_TARGET_PORT_TRANSFER_TAG_RECEIVED =0x4B01 ,TOO_MUCH_WRITE_DATA =0x4B02 , ACK_NAK_TIMEOUT = 0x4B03,
@@ -630,22 +630,22 @@ enum scsi_sense_code {PCIE_ACS_VIOLATION =0x4B14 ,PCIE_TLP_PREFIX_BLOCKED =0x4B15 , -ASC (LU_FAILED_SELF_CONFIGURATION ,0x4C ), +SCSI_ASC (LU_FAILED_SELF_CONFIGURATION ,0x4C ), -ASC (TAGGED_OVERLAPPED_COMMANDS ,0x4D ), +SCSI_ASC (TAGGED_OVERLAPPED_COMMANDS ,0x4D ), -ASC (OVERLAPPED_COMMANDS_ATTEMPTED ,0x4E ), +SCSI_ASC (OVERLAPPED_COMMANDS_ATTEMPTED ,0x4E ), -ASC (WRITE_APPEND_ERROR ,0x50 ), +SCSI_ASC (WRITE_APPEND_ERROR ,0x50 ),WRITE_APPEND_POSITION_ERROR =0x5001 ,POSITION_ERROR_RELATED_TO_TIMING =0x5002 , -ASC (ERASE_FAILURE ,0x51 ), +SCSI_ASC (ERASE_FAILURE ,0x51 ),ERASE_FAILURE_INCOMPLETE_ERASE_OP_DETECTED =0x5101 , -ASC (CARTRIDGE_FAULT ,0x52 ), +SCSI_ASC (CARTRIDGE_FAULT ,0x52 ), -ASC (MEDIA_LOAD_OR_EJECT_FAILED ,0x53 ), +SCSI_ASC (MEDIA_LOAD_OR_EJECT_FAILED ,0x53 ),UNLOAD_TAPE_FAILURE =0x5301 ,MEDIUM_REMOVAL_PREVENTED =0x5302 , MEDIUM_REMOVAL_PREVENTED_BY_DATA_TRANSFER_ELEMENT = 0x5303,
@@ -660,9 +660,9 @@ enum scsi_sense_code {DATA_TRANSFER_DEVICE_ERR_EJECT_FAILED =0x530C ,DATA_TRANSFER_DEVICE_ERR_LIBRARY_COMMUNICATION_FAILED =0x530D , -ASC (SCSI_TO_HOST_SYSTEM_INTERFACE_FAILURE ,0x54 ), +SCSI_ASC (SCSI_TO_HOST_SYSTEM_INTERFACE_FAILURE ,0x54 ), -ASC (SYSTEM_RESOURCE_FAILURE ,0x55 ), +SCSI_ASC (SYSTEM_RESOURCE_FAILURE ,0x55 ),SYSTEM_BUFFER_FULL =0x5501 ,INSUFFICIENT_RESERVATION_RESOURCES =0x5502 , INSUFFICIENT_RESOURCES = 0x5503,
@@ -681,27 +681,27 @@ enum scsi_sense_code {MAXIMUM_NUMBER_OF_STREAMS_OPEN =0x5510 ,INSUFFICIENT_RESOURCES_TO_BIND =0x5511 , -ASC (UNABLE_TO_RECOVER_TABLE_OF_CONTENTS ,0x57 ), +SCSI_ASC (UNABLE_TO_RECOVER_TABLE_OF_CONTENTS ,0x57 ), -ASC (GENERATION_DOES_NOT_EXIST ,0x58 ), +SCSI_ASC (GENERATION_DOES_NOT_EXIST ,0x58 ), -ASC (UPDATED_BLOCK_READ ,0x59 ), +SCSI_ASC (UPDATED_BLOCK_READ ,0x59 ), -ASC (OPERATOR_REQUEST_OR_STATE_CHANGE_INPUT ,0x5A ), +SCSI_ASC (OPERATOR_REQUEST_OR_STATE_CHANGE_INPUT ,0x5A ),OPERATOR_MEDIUM_REMOVAL_REQUEST =0x5A01 ,OPERATOR_SELECTED_WRITE_PROTECT =0x5A02 ,OPERATOR_SELECTED_WRITE_PERMIT =0x5A03 , -ASC (LOG_EXCEPTION ,0x5B ), +SCSI_ASC (LOG_EXCEPTION ,0x5B ),THRESHOLD_CONDITION_MET =0x5B01 ,LOG_COUNTER_AT_MAXIMUM =0x5B02 ,LOG_LIST_CODES_EXHAUSTED =0x5B03 , -ASC (RPL_STATUS_CHANGE ,0x5C ), +SCSI_ASC (RPL_STATUS_CHANGE ,0x5C ),SPINDLES_SYNCHRONIZED =0x5C01 ,SPINDLES_NOT_SYNCHRONIZED =0x5C02 , -ASC (FAILURE_PREDICTION_THRESHOLD_EXCEEDED ,0x5D ), +SCSI_ASC (FAILURE_PREDICTION_THRESHOLD_EXCEEDED ,0x5D ),MEDIA_FAILURE_PREDICTION_THRESHOLD_EXCEEDED =0x5D01 ,LU_FAILURE_PREDICTION_THRESHOLD_EXCEEDED =0x5D02 , SPARE_AREA_EXHAUSTION_PREDICTION_THRESHOLD_EXCEEDED = 0x5D03,
@@ -787,7 +787,7 @@ enum scsi_sense_code {MEDIA_IMPENDING_FAILURE_ENDURANCE_LIMIT_MET =0x5D73 ,FAILURE_PREDICTION_THRESHOLD_EXCEEDED_FALSE =0x5DFF , -ASC (LOW_POWER_CONDITION_ON ,0x5E ), +SCSI_ASC (LOW_POWER_CONDITION_ON ,0x5E ),IDLE_CONDITION_ACTIVATED_BY_TIMER =0x5E01 ,STANDBY_CONDITION_ACTIVATED_BY_TIMER =0x5E02 , IDLE_CONDITION_ACTIVATED_BY_COMMAND = 0x5E03,
@@ -804,28 +804,28 @@ enum scsi_sense_code {POWER_STATE_CHANGE_TO_SLEEP =0x5E45 ,POWER_STATE_CHANGE_TO_DEVICE_CONTROL =0x5E47 , -ASC (LAMP_FAILURE ,0x60 ), +SCSI_ASC (LAMP_FAILURE ,0x60 ), -ASC (VIDEO_ACQUISITION_ERROR ,0x61 ), +SCSI_ASC (VIDEO_ACQUISITION_ERROR ,0x61 ),UNABLE_TO_ACQUIRE_VIDEO =0x6101 ,OUT_OF_FOCUS =0x6102 , -ASC (SCAN_HEAD_POSITIONING_ERROR ,0x62 ), +SCSI_ASC (SCAN_HEAD_POSITIONING_ERROR ,0x62 ), -ASC (END_OF_USER_AREA_ENCOUNTERED_ON_THIS_TRACK ,0x63 ), +SCSI_ASC (END_OF_USER_AREA_ENCOUNTERED_ON_THIS_TRACK ,0x63 ),PACKET_DOES_NOT_FIT_IN_AVAILABLE_SPACE =0x6301 , -ASC (ILLEGAL_MODE_FOR_THIS_TRACK ,0x64 ), +SCSI_ASC (ILLEGAL_MODE_FOR_THIS_TRACK ,0x64 ),INVALID_PACKET_SIZE =0x6401 , -ASC (VOLTAGE_FAULT ,0x65 ), +SCSI_ASC (VOLTAGE_FAULT ,0x65 ), -ASC (AUTOMATIC_DOCUMENT_FEEDER_COVER_UP ,0x66 ), +SCSI_ASC (AUTOMATIC_DOCUMENT_FEEDER_COVER_UP ,0x66 ),AUTOMATIC_DOCUMENT_FEEDER_LIFT_UP =0x6601 ,DOCUMENT_JAM_IN_AUTOMATIC_DOCUMENT_FEEDER =0x6602 ,DOCUMENT_MISS_FEED_AUTOMATIC_IN_DOCUMENT_FEEDER =0x6603 , -ASC (CONFIG_FAILURE ,0x67 ), +SCSI_ASC (CONFIG_FAILURE ,0x67 ),CONFIG_OF_INCAPABLE_LOGICAL_UNITS_FAILED =0x6701 ,ADD_LU_FAILED =0x6702 , MODIFICATION_OF_LU_FAILED = 0x6703,
@@ -841,26 +841,26 @@ enum scsi_sense_code {EXPLICIT_BIND_NOT_ALLOWED =0x670D ,FEATURE_NOT_ENABLED =0x670E , -ASC (LU_NOT_CONFIGURED ,0x68 ), +SCSI_ASC (LU_NOT_CONFIGURED ,0x68 ),SUBSIDIARY_LU_NOT_CONFIGURED =0x6801 , -ASC (DATA_LOSS_ON_LOGICAL_UNIT ,0x69 ), +SCSI_ASC (DATA_LOSS_ON_LOGICAL_UNIT ,0x69 ),MULTIPLE_LU_FAILURES =0x6901 ,PARITY_DATA_MISMATCH =0x6902 , -ASC (INFORMATIONAL_REFER_TO_LOG ,0x6A ), +SCSI_ASC (INFORMATIONAL_REFER_TO_LOG ,0x6A ), -ASC (STATE_CHANGE_HAS_OCCURRED ,0x6B ), +SCSI_ASC (STATE_CHANGE_HAS_OCCURRED ,0x6B ),REDUNDANCY_LEVEL_GOT_BETTER =0x6B01 ,REDUNDANCY_LEVEL_GOT_WORSE =0x6B02 , -ASC (REBUILD_FAILURE_OCCURRED ,0x6C ), +SCSI_ASC (REBUILD_FAILURE_OCCURRED ,0x6C ), -ASC (RECALCULATE_FAILURE_OCCURRED ,0x6D ), +SCSI_ASC (RECALCULATE_FAILURE_OCCURRED ,0x6D ), -ASC (COMMAND_TO_LU_FAILED ,0x6E ), +SCSI_ASC (COMMAND_TO_LU_FAILED ,0x6E ), -ASC (COPY_PROTECTION_KEY_EXCHANGE_FAILURE_AUTHENTICATION_FAILURE ,0x6F ), +SCSI_ASC (COPY_PROTECTION_KEY_EXCHANGE_FAILURE_AUTHENTICATION_FAILURE ,0x6F ),COPY_PROTECTION_KEY_EXCHANGE_FAILURE_KEY_NOT_PRESENT =0x6F01 ,COPY_PROTECTION_KEY_EXCHANGE_FAILURE_KEY_NOT_ESTABLISHED =0x6F02 , READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION = 0x6F03,
@@ -872,11 +872,11 @@ enum scsi_sense_code {INVALID_DRIVE_HOST_PAIRING_SERVER =0x6F09 ,DRIVE_HOST_PAIRING_SUSPENDED =0x6F0A , -ASC (DECOMPRESSION_EXCEPTION_SHORT_ALGORITHM_ID ,0x70 ), +SCSI_ASC (DECOMPRESSION_EXCEPTION_SHORT_ALGORITHM_ID ,0x70 ), -ASC (DECOMPRESSION_EXCEPTION_LONG_ALGORITHM_ID ,0x71 ), +SCSI_ASC (DECOMPRESSION_EXCEPTION_LONG_ALGORITHM_ID ,0x71 ), -ASC (SESSION_FIXATION_ERROR ,0x72 ), +SCSI_ASC (SESSION_FIXATION_ERROR ,0x72 ),SESSION_FIXATION_ERROR_WRITING_LEAD_IN =0x7201 ,SESSION_FIXATION_ERROR_WRITING_LEAD_OUT =0x7202 , SESSION_FIXATION_ERROR_INCOMPLETE_TRACK_IN_SESSION = 0x7203,
@@ -885,7 +885,7 @@ enum scsi_sense_code {RMZ_EXTENSION_IS_NOT_ALLOWED =0x7206 ,NO_MORE_TEST_ZONE_EXTENSIONS_ARE_ALLOWED =0x7207 , -ASC (CD_CONTROL_ERROR ,0x73 ), +SCSI_ASC (CD_CONTROL_ERROR ,0x73 ),POWER_CALIBRATION_AREA_ALMOST_FULL =0x7301 ,POWER_CALIBRATION_AREA_IS_FULL =0x7302 , POWER_CALIBRATION_AREA_ERROR = 0x7303,
@@ -896,7 +896,7 @@ enum scsi_sense_code {CURRENT_POWER_CALIBRATION_AREA_IS_FULL =0x7311 ,RDZ_IS_FULL =0x7317 , -ASC (SECURITY_ERROR ,0x74 ), +SCSI_ASC (SECURITY_ERROR ,0x74 ),UNABLE_TO_DECRYPT_DATA =0x7401 ,UNENCRYPTED_DATA_ENCOUNTERED_WHILE_DECRYPTING =0x7402 , INCORRECT_DATA_ENCRYPTION_KEY = 0x7403,
@@ -926,8 +926,8 @@ enum scsi_sense_code { SECURITY_CONFLICT_IN_TRANSLATED_DEVICE = 0x7479, }; -#undef ASC_DEF -#undef ASC +#undef SCSI_ASC_DEF +#undef SCSI_ASC/* * Use this to build non-standard sense codes.
Greg Kroah-Hartman
maintainerPATCH 2644/2651 ALSA: usb-audio: Correct a typo in UMC404HD model comment
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 73e38d178bbd28fe2c30443e6c0cf74e3f584bdb upstream.
The recently added quirk code has a comment for 1397:0509 as if it were UMC204HD, but it's UMC404HD. Correct it.
--- sound/usb/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/quirks.c +1 -1
@@ -1709,7 +1709,7 @@ int snd_usb_apply_boot_quirk_once(struct/* the quirk seems breaking on some Behringer devices */ switch (id) {case USB_ID (0x1397 ,0x0508 ):/* UMC204HD */ -case USB_ID (0x1397 ,0x0509 ):/* UMC204HD */ +case USB_ID (0x1397 ,0x0509 ):/* UMC404HD */ return 0 ; }return snd_usb_cm1a_boot_quirk (dev);
Greg Kroah-Hartman
maintainerPATCH 2645/2651 erofs: fix disallowing superblock_share if device= is set
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhan Xusheng <[email protected]>
commit aafea970fb04633e22c7ad74cba4caf563c6d6a9 upstream.
superblock_share together with device= is rejected in erofs_fc_fill_super():
if (test_opt(&sbi->opt, SUPERBLOCK_SHARE) && sbi->devs->extra_devices) return -EINVAL;
but extra_devices is kept in sbi->devs, not in sbi->opt, and erofs_sb_share_test_super() compares only the backing inode, the fsoffset and sbi->opt. So once the image is mounted with superblock_share, a second mount with superblock_share,device= matches that superblock and get_tree_super() reuses it without calling fill_super() at all.
The same command line therefore either fails with -EINVAL or succeeds with device= quietly dropped, depending on whether a compatible mount already exists.
Refuse to match a context that brought device= options, so that it gets a superblock of its own and fill_super() decides as it does today.
Only the incoming context can be tested: a shared superblock may have extra_devices set itself, because erofs_scan_devices() fills the device table from the image when no device= was given.
--- fs/erofs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/erofs/super.c +2 -1
@@ -827,7 +827,8 @@ static int erofs_sb_share_test_super(strreturn 0 ;return file_inode (sbi->dif0.file) ==file_inode (new_sbi->dif0.file) && sbi->dif0.fsoff == new_sbi->dif0.fsoff && - !memcmp (&sbi->opt, &new_sbi->opt,sizeof (sbi->opt)); + !memcmp (&sbi->opt, &new_sbi->opt,sizeof (sbi->opt)) && + !new_sbi->devs->extra_devices; }static int erofs_file_get_tree (struct fs_context *fc)
Greg Kroah-Hartman
maintainerPATCH 2646/2651 kernfs: avoid READ_ONCE() on a kgid_t in kernfs_new_node()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shakeel Butt <[email protected]>
commit ef179363b04306dbc645c53207b9ad3516ebc75f upstream.
kernfs_new_node() reads the parent's gid with READ_ONCE(attrs->ia_gid). That gid is a kgid_t, which is a struct.
On SMP alpha, READ_ONCE() ends by casting the value it loaded back to the type of its argument. Here that is a cast from a struct to the same struct. GCC accepts that as an extension, but ISO C does not allow a cast to or from a struct type, so sparse warns:
fs/kernfs/dir.c:751:31: sparse: sparse: cast to non-scalar fs/kernfs/dir.c:751:31: sparse: sparse: cast from non-scalar
Read the gid_t inside the kgid_t instead, and wrap it back up with KGIDT_INIT(). This is still a single marked load of the same four bytes.
There is no functional change. With GCC 12 for alpha (the config from the report) and GCC 14 for x86-64 (with and without KCSAN), fs/kernfs/dir.o has the same object code before and after this change.
--- fs/kernfs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/kernfs/dir.c +1 -1
@@ -748,7 +748,7 @@ struct kernfs_node *kernfs_new_node(strustruct kernfs_iattrs *attrs =READ_ONCE (parent->iattr);if (attrs) - gid =READ_ONCE (attrs->ia_gid); + gid =KGIDT_INIT (READ_ONCE (attrs->ia_gid.val));if (flags &KERNFS_DIR ) mode |=S_ISGID ;
Greg Kroah-Hartman
maintainerPATCH 2647/2651 rust: bindings: derive Zeroable for bindgens opaque array wrappers
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <[email protected]>
commit 57d916a3eb765ee0577d269bb2ac1bdf3a7a7f40 upstream.
bindgen 0.73 emits the blob of some opaque types, such as ones aligned to more than 4 bytes, as a __BindgenOpaqueArray or __BindgenOpaqueArray<align> newtype instead of a plain array. The newtype only derives PartialEq, Eq, Copy, Clone, Debug and Hash, and the MaybeZeroable custom derive does not reach it, so a struct that embeds such an opaque type is no longer Zeroable.
spinlock is opaque (see rust/bindgen_parameters), and with lockdep its blob becomes a __BindgenOpaqueArray8<[u8; 72]>. Commit 71ec3c7d6db8 ("blk-mq: quiesce a queue that joins a quiesced tag set") added a spinlock_t to struct blk_mq_tag_set, so an allmodconfig build with bindgen 0.73 now fails:
error[E0277]: the trait bound bindings::__BindgenOpaqueArray8<[u8; 72]>: pin_init::Zeroable is not satisfied
--> rust/kernel/block/mq/tag_set.rs:41:49
Which wrappers exist depends on the bindgen version and on the opaque types of the configuration, so they cannot be covered by unconditional impls in rust/bindings/lib.rs like __BindgenBitfieldUnit is. Derive Zeroable for each wrapper in the generated bindings instead. The pattern allows for the spacing of bindgen's output when rustfmt is not available.
--- rust/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
rust/Makefile +8 -1
@@ -514,13 +514,20 @@ endif bindgen_c_flags_final = $(bindgen_c_flags_lto) -fno-builtin -D__BINDGEN__ # `--rust-target` points to our minimum supported Rust version. +# +# `bindgen` 0.73 emits the blob of some opaque types as a +# `__BindgenOpaqueArray[<align>]` newtype, which the custom derives do not +# reach. Derive `Zeroable` for those wrappers, so that a struct embedding such +# an opaque type (e.g. `spinlock_t` with lockdep) is still `Zeroable`. The +# pattern also matches the unformatted output used when `rustfmt` is missing. quiet_cmd_bindgen = BINDGEN $@ cmd_bindgen = \ $(BINDGEN) $< $(bindgen_target_flags) --rust-target 1.85 \ --use-core --with-derive-default --ctypes-prefix ffi --no-layout-tests \ --no-debug '.*' --enable-function-attribute-detection \ -o $@ -- $(bindgen_c_flags_final) -DMODULE \ - $(bindgen_target_cflags) $(bindgen_target_extra) + $(bindgen_target_cflags) $(bindgen_target_extra); \ + sed -Ei 's/pub struct __BindgenOpaqueArray[0-9]* *< *T *> *\( *pub T *\) *;/$(pound)[derive(pin_init::Zeroable)] &/g' $@ $(obj)/bindings/bindings_generated.rs: private bindgen_target_flags = \ $(shell grep -Ev '^#|^$$' $(src)/bindgen_parameters)
Greg Kroah-Hartman
maintainerPATCH 2648/2651 zloop: fix block size query
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 8fbee85a90789d367c347b1cfd5a5ef37f3a934a upstream.
The block size obviously needs to be queried when it is not set, not when it already is set.
Reported: Damien Le Moal <[email protected]>
--- drivers/block/zloop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/zloop.c +1 -1
@@ -1127,7 +1127,7 @@ static int zloop_init_zone(struct zloop_ goto out_fput; } -if (zlo->block_size) { +if (!zlo->block_size) { ret =zloop_get_block_size (zlo, zone);if (ret) goto out_fput;
Greg Kroah-Hartman
maintainerPATCH 2649/2651 nvmet-auth: reject incomplete DHCHAP messages
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jérémy Jean <[email protected]>
commit 29e027774324dbd5321a67bbd16840e8f7bcd189 upstream.
Commit c9359401036e ("nvmet-auth: reject undersized AUTH_SEND payloads") only ensures that AUTH_SEND has auth_type and auth_id before nvmet_execute_auth_send() starts parsing the payload, but the DHCHAP path reads t_id before it verifies message lengths. A two-byte DHCHAP NEGOTIATE payload can therefore still trigger an OOB read that KASAN reports as:
BUG: KASAN: slab-out-of-bounds in nvmet_execute_auth_send Read of size 2 at addr ffff8880030d8364
Require the payload to cover the minimum DHCHAP message length before parsing it.
--- drivers/nvme/target/fabrics-cmd-auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/fabrics-cmd-auth.c +1 -1
@@ -301,7 +301,7 @@ void nvmet_execute_auth_send(struct nvmenvmet_check_transfer_len (req, tl);return ; } -if (tl < offsetof(struct nvmf_auth_dhchap_success2_data , rsvd1)) { +if (tl <sizeof (struct nvmf_auth_dhchap_failure_data )) { status =NVME_SC_INVALID_FIELD |NVME_STATUS_DNR ; req->error_loc = offsetof(struct nvmf_auth_send_command , tl);
Greg Kroah-Hartman
maintainerPATCH 2650/2651 PM: runtime: Only queue an idle check for RPM-linked suppliers (part 2)
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Norris <[email protected]>
commit bd56424ce808fb1f92a4dc5bdeedc45b85c5d6cd upstream.
Commit be5755f023e7 ("PM: runtime: Only queue an idle check for RPM-linked suppliers") was incomplete. There are two other cases where we perform idle checks on non-DL_FLAG_PM_RUNTIME suppliers -- in pm_runtime_set_suspended(), and in cases where we failed to resume suppliers.
--- drivers/base/power/runtime.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/base/power/runtime.c +3 -0
@@ -343,6 +343,9 @@ static void __rpm_put_suppliers(struct dlist_for_each_entry_rcu (link, &dev->links.suppliers, c_node,device_links_read_lock_held ()) { +if (!device_link_test (link,DL_FLAG_PM_RUNTIME )) +continue ; +pm_runtime_release_supplier (link);if (try_to_suspend)pm_request_idle (link->supplier);
Greg Kroah-Hartman
maintainerPATCH 2651/2651 drm/panfrost: Fix race when restoring reset state in perfcnt
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrián Larumbe <[email protected]>
commit a947f57843f1139821c6f9f94ebe899574e6636e upstream.
struct panfrost_perfcnt::state should always be updated atomically, both in the dump ioctl and the reset sequence.
--- drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/panfrost/panfrost_perfcnt.c +7 -8
@@ -142,18 +142,17 @@ static int panfrost_perfcnt_dump_locked(*/ ret =wait_for_completion_interruptible_timeout (&pfdev->perfcnt->dump_comp,msecs_to_jiffies (1000 )); -if (!ret) ret = -ETIMEDOUT ; -/* We need to restore perfcnt state so the next successful dump can relay it to UM */ -if (ret <0 ) { - perfcnt->state |= *state; - *state =0 ; -return ret; - } - scoped_guard(rwsem_read, &pfdev->reset.lock) { +/* Restore perfcnt state so the next successful dump can relay it to UM */ +if (ret <0 ) { + perfcnt->state |= *state; + *state =0 ; +return ret; + } + *state |= perfcnt->state;/* UM must re-enable their session before requesting new dumps. */
Quoted 11 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 20 Nov 2026 14:55:47 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.3.6-rc1.gz[...]
This failed to build for me due to a problem with rust during the "make bzimage" stage:
"""> error[E0432]: unresolved import crate::util
Quoted 20 lines
-->
rust/pin-init/internal/src/init.rs:17:5| 17 | util::*, | ^^^^ could not find `util` in the crate rooterror[E0599]: no method named
extract_cfg_attrsfound for structVec<Attribute>in the current scope
-->rust/pin-init/internal/src/init.rs:171:39| 171 | let cfg = field.attrs.extract_cfg_attrs(); | ^^^^^^^^^^^^^^^^^ |help: there is a method
extract_ifwith a similar name, but with different arguments
-->library/alloc/src/vec/mod.rs:4245:4error[E0599]: no method named
as_identfound for reference&Memberin the current scope
-->rust/pin-init/internal/src/init.rs:413:28| 413 | let ident = member.as_ident(); | ^^^^^^^^ method not found in `&Member`
Quoted 8 lines
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0432, E0599.
For more information about an error, tryrustc --explain E0432.
make[2]: *** [rust/Makefile:649:rust/libpin_init_internal.so] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builddir/build/BUILD/kernel-7.3.6-build/kernel-7.3.6-rc1/linux-7.3.6-0.rc1.400.vanilla.fc45.x86_64/Makefile:1440: prepare] Error 2
make: *** [Makefile:256: __sub-make] Error 2
Have to run, so not time to look at where this is coming from right now, sorry.
Ciao, Thorsten
Gary Guo
reviewerQuoted 9 lines · Thorsten Leemhuis
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 20 Nov 2026 14:55:47 +0000. Anything received after that time might be too late.
Quoted 35 lines
Quoted 3 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.3.6-rc1.gz[...]
This failed to build for me due to a problem with rust during the "make bzimage" stage:
"""> error[E0432]: unresolved import
crate::utilQuoted 27 lines
-->
rust/pin-init/internal/src/init.rs:17:5| 17 | util::*, | ^^^^ could not find `util` in the crate rooterror[E0599]: no method named
extract_cfg_attrsfound for structVec<Attribute>in the current scope
-->rust/pin-init/internal/src/init.rs:171:39| 171 | let cfg = field.attrs.extract_cfg_attrs(); | ^^^^^^^^^^^^^^^^^ |help: there is a method
extract_ifwith a similar name, but with different arguments
-->library/alloc/src/vec/mod.rs:4245:4error[E0599]: no method named
as_identfound for reference&Memberin the current scope
-->rust/pin-init/internal/src/init.rs:413:28| 413 | let ident = member.as_ident(); | ^^^^^^^^ method not found in `&Member`error: aborting due to 3 previous errors
Some errors have detailed explanations: E0432, E0599.
For more information about an error, tryrustc --explain E0432.
make[2]: *** [rust/Makefile:649:rust/libpin_init_internal.so] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builddir/build/BUILD/kernel-7.3.6-build/kernel-7.3.6-rc1/linux-7.3.6-0.rc1.400.vanilla.fc45.x86_64/Makefile:1440: prepare] Error 2
It looks like there's missing dependency not picked for pin-init changes.
Greg, can you drop
[PATCH 7.3 0580/2651] rust: pin-init: internal: init: emit slot using mixed site hygiene [PATCH 7.3 0579/2651] rust: pin-init: internal: init: support tuple struct constructor syntax [PATCH 7.3 0578/2651] rust: pin-init: internal: init: support tuple structs in [pin_]init!
? While patch 0580 is a fix, pin-init is not used in a way that manifested the issue in 7.3, so it's simpler to just drop it and the other two picked as dep of it.
Best,
Gary
Quoted 9 lines
Quoted 1 line
make: *** [Makefile:256: __sub-make] Error 2
Have to run, so not time to look at where this is coming from right now, sorry.
Ciao, Thorsten
Quoted 54 lines · Gary Guo
Quoted 9 lines · Thorsten Leemhuis
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 20 Nov 2026 14:55:47 +0000. Anything received after that time might be too late.
Quoted 35 lines
Quoted 3 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.3.6-rc1.gz[...]
This failed to build for me due to a problem with rust during the "make bzimage" stage:
"""> error[E0432]: unresolved import
crate::utilQuoted 27 lines
-->
rust/pin-init/internal/src/init.rs:17:5| 17 | util::*, | ^^^^ could not find `util` in the crate rooterror[E0599]: no method named
extract_cfg_attrsfound for structVec<Attribute>in the current scope
-->rust/pin-init/internal/src/init.rs:171:39| 171 | let cfg = field.attrs.extract_cfg_attrs(); | ^^^^^^^^^^^^^^^^^ |help: there is a method
extract_ifwith a similar name, but with different arguments
-->library/alloc/src/vec/mod.rs:4245:4error[E0599]: no method named
as_identfound for reference&Memberin the current scope
-->rust/pin-init/internal/src/init.rs:413:28| 413 | let ident = member.as_ident(); | ^^^^^^^^ method not found in `&Member`error: aborting due to 3 previous errors
Some errors have detailed explanations: E0432, E0599.
For more information about an error, tryrustc --explain E0432.
make[2]: *** [rust/Makefile:649:rust/libpin_init_internal.so] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builddir/build/BUILD/kernel-7.3.6-build/kernel-7.3.6-rc1/linux-7.3.6-0.rc1.400.vanilla.fc45.x86_64/Makefile:1440: prepare] Error 2It looks like there's missing dependency not picked for pin-init changes.
Greg, can you drop
[PATCH 7.3 0580/2651] rust: pin-init: internal: init: emit
slotusing mixed site hygiene [PATCH 7.3 0579/2651] rust: pin-init: internal: init: support tuple struct constructor syntax [PATCH 7.3 0578/2651] rust: pin-init: internal: init: support tuple structs in[pin_]init!
Quoted 7 lines
? While patch 0580 is a fix, pin-init is not used in a way that manifested the issue in 7.3, so it's simpler to just drop it and the other two picked as dep of it.
Best,
Gary
Hey all,
After dropping the above patches there remain a few compilation errors with LLVM=1. They all seem to relate to pointers in bindings being sent across threads. I am unable to diagnose the issue farther than this, as I'm just starting to dabble in rust/ so hopefully someone more experienced can track down the patch at issue.
I've uploaded the build log alongside the config used in the pastebin links below.
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
make: *** [Makefile:256: __sub-make] Error 2
Have to run, so not time to look at where this is coming from right now, sorry.
Ciao, Thorsten
Sorry and best of luck,
- Alice C. Munduruca
Sasha Levin
maintainerQuoted 2 lines
After dropping the above patches there remain a few compilation errors with LLVM=1. They all seem to relate to pointers in bindings being sent across threads.
That's the rnull TagSet issue. It's fixed by 06dad60393f2 ("rust: block:
implement Send and Sync for TagSet"), which is queued ahead of the configfs patch for the next rc.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerQuoted 3 lines · Gary Guo
[PATCH 7.3 0580/2651] rust: pin-init: internal: init: emit
slotusing mixed site hygiene [PATCH 7.3 0579/2651] rust: pin-init: internal: init: support tuple struct constructor syntax [PATCH 7.3 0578/2651] rust: pin-init: internal: init: support tuple structs in[pin_]init!
Dropped all three from the 7.3 queue:
- e30decc3f9a0 ("rust: pin-init: internal: init: emit slot using mixed site hygiene")
- 3b3ff9034a49 ("rust: pin-init: internal: init: support tuple struct constructor syntax")
- d48aa955cb91 ("rust: pin-init: internal: init: support tuple structs
in `[pin_]init!`")
The separate rnull/configfs Send/Sync error is fixed by 06dad60393f2 ("rust: block: implement Send and Sync for TagSet"), which is now queued ahead of the configfs patch in 7.3 and 6.18.
Signature · 2 lines
Thanks, Sasha
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 20 Nov 2026 14:55:47 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.3.6-rc1.gz> [...]
This failed to build for me on s390x while building tools/perf/:
Quoted 18 lines
util/annotate-data.c: In function ‘global_var__collect’:util/annotate-data.c:785:30: error: implicit declaration of function ‘die_get_type_die’; did you mean ‘die_get_typename’? [-Wimplicit-function-declaration]785 | if (!die_get_type_die(dwarf, pos->die_off, pos->die_tag, | ^~~~~~~~~~~~~~~~ | die_get_typename
util/annotate-data.c:785:71: error: ‘struct die_var_type’ has no member named ‘die_tag’
785 | if (!die_get_type_die(dwarf,pos->die_off,pos->die_tag,
| ^~util/annotate-data.c:786:50: error: ‘struct die_var_type’ has no member named ‘from_alt’
786 |pos->from_alt,&type_die))
| ^~util/annotate-data.c:792:44: error: ‘struct die_var_type’ has no member named ‘from_alt’
792 |pos->from_alt);
| ^~util/annotate-data.c: In function ‘get_global_var_type’:util/annotate-data.c:849:26: error: implicit declaration of function ‘die_same_file’ [-Wimplicit-function-declaration]849 | !die_same_file(cu_die, type_die)); | ^~~~~~~~~~~~~
Quoted 13 lines
util/annotate-data.c: In function ‘update_var_state’:util/annotate-data.c:905:42: error: ‘struct die_var_type’ has no member named ‘die_tag’
905 |var->die_tag,var->from_alt,&mem_die))
| ^~util/annotate-data.c:905:56: error: ‘struct die_var_type’ has no member named ‘from_alt’
905 |var->die_tag,var->from_alt,&mem_die))
| ^~
make[4]: *** [/builddir/build/BUILD/kernel-7.3.6-build/kernel-7.3.6-rc1/linux-7.3.6-0.rc1.400.vanilla.fc45.s390x/tools/build/Makefile.build:96:util/annotate-data.o] Error 1 make[4]: *** Waiting for unfinished jobs....
make[3]: *** [/builddir/build/BUILD/kernel-7.3.6-build/kernel-7.3.6-rc1/linux-7.3.6-0.rc1.400.vanilla.fc45.s390x/tools/build/Makefile.build:158: util] Error 2 make[2]: *** [Makefile.perf:573: perf-util-in.o] Error 2
make[1]: *** [Makefile.perf:283: sub-make] Error 2
make: *** [Makefile:76: all] Error 2
Maybe other archs are affected as well, those builds failed earlier for me due to the rust problem I reported a few minutes ago.
Have to run, so not time to look at where this is coming from right now, sorry.
Ciao, Thorsten
Quoted 12 lines · Thorsten Leemhuis
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 20 Nov 2026 14:55:47 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.3.6-rc1.gz> [...]
Quoted 7 lines
This failed to build for me on s390x while building
tools/perf/:Quoted 5 lines
Quoted 1 line
util/annotate-data.c: In function ‘global_var__collect’:
util/annotate-data.c:785:30: error: implicit declaration of function ‘die_get_type_die’; did you mean ‘die_get_typename’? [-Wimplicit-function-declaration]785 | if (!die_get_type_die(dwarf, pos->die_off, pos->die_tag, | ^~~~~~~~~~~~~~~~ | die_get_typename[...]
By just following the hints in the error msg and a bit of searching on lore I was able to fix this on 7.3.y-rc by cherry-picking 3dfdd195c7e45f ("perf dwarf-aux: Add die_same_file() and die_get_type_die()") [v7.4-rc1].
Then I ran into another error (see below), which I was able to fix by cherry-picking fc076b5f4807a3 ("perf trace: Introduce kernel symbol beautifier for virtual addresses") [v7.4-rc1]
Ciao, Thorsten
Quoted 25 lines
builtin-trace.c: In function ‘trace__btf_scnprintf’:
builtin-trace.c:1164:24: error: implicit declaration of function ‘syscall_arg__scnprintf_ksym’; did you mean ‘syscall_arg__scnprintf_buf’? [-Wimplicit-function-declaration]1164 | return syscall_arg__scnprintf_ksym(bf, size, arg); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | syscall_arg__scnprintf_bufmake -f /[...]tools/build/Makefile.build dir=./util/annotate-arch obj=perf-util
make -f /[...]tools/build/Makefile.build dir=./util/perf-regs-arch obj=perf-util
make -f /[...]tools/build/Makefile.build dir=./util/kvm-stat-arch obj=perf-util
make -f /[...]tools/build/Makefile.build dir=./util/intel-pt-decoder obj=perf-util
make -f /[...]tools/build/Makefile.build dir=./util/arm-spe-decoder obj=perf-util
make -f /[...]tools/build/Makefile.build dir=./util/hisi-ptt-decoder obj=perf-util
make -f /[...]tools/build/Makefile.build dir=./util/dwarf-regs-arch obj=perf-util
make -f /[...]tools/build/Makefile.build dir=./util/scripting-engines obj=perf-utilbuiltin-trace.c: In function ‘syscall__scnprintf_args’:
builtin-trace.c:2597:82: error: ‘SCA_KSYM’ undeclared (first use in this function)
2597 |default_scnprintf==SCA_PTR||default_scnprintf==SCA_KSYM) {
| ^~~~~~~~
builtin-trace.c:2597:82: note: each undeclared identifier is reported only once for each function it appears in make[3]: *** [/[...]tools/build/Makefile.build:96:/home/kbuilder/usr/tmp/out/builtin-trace.o] Error 1 make[3]: *** Waiting for unfinished jobs....
make[2]: *** [Makefile.perf:544:/home/kbuilder/usr/tmp/out/perf-in.o] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile.perf:283: sub-make] Error 2
make: *** [Makefile:76: all] Error 2
make: Leaving directory '/[...]tools/perf'
Sasha Levin
maintainerQuoted 3 lines
This failed to build for me on s390x while building
tools/perf/:Quoted 2 lines
util/annotate-data.c: In function ‘global_var__collect’:util/annotate-data.c:785:30: error: implicit declaration of function ‘die_get_type_die’
Thanks. Queued the missing prerequisite for 7.3.
I'm dropping c6dd6161815d ("perf trace: Enhance BTF type formatting to symbolise kernel function pointers") from the 7.3, 6.18 and 6.12 queues, and 14ca0a28de37 ("perf annotate-data: Resolve type DIEs in the debug file they came from") from 6.18 and 6.12.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerQuoted 2 lines · Thorsten Leemhuis
lore I was able to fix this on 7.3.y-rc by cherry-picking
3dfdd195c7e45f("perf dwarf-aux: Adddie_same_file()anddie_get_type_die()") [v7.4-rc1].
Following up on my earlier reply: 14ca0a28de37 ("perf annotate-data: Resolve type DIEs in the debug file they came from") is dropped from the 6.18 and 6.12 queues as I said. 7.3 keeps it, with 3dfdd195c7e4 queued ahead of it.
Quoted 2 lines
cherry-picking
fc076b5f4807a3("perf trace: Introduce kernel symbol beautifier for virtual addresses") [v7.4-rc1]
c6dd6161815d ("perf trace: Enhance BTF type formatting to symbolise kernel function pointers") turned out to be a prerequisite of 024b219744a9 ("perf
trace: Add upper bound checks for augmented BTF struct printing"), so both are dropped from the 7.3, 6.18 and 6.12 queues.
Signature · 2 lines
Thanks, Sasha
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 20 Nov 2026 14:55:47 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.3.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.3.y
and the diffstat can be found below.thanks,
greg k-h
perf fails to build with:
util/annotate-data.c: In function 'global_var__collect':util/annotate-data.c:785:30: warning: implicit declaration of function 'die_get_type_die'; did you mean 'die_get_typename'? [-Wimplicit-function-declaration]
785 | if (!die_get_type_die(dwarf,pos->die_off, pos->die_tag,
| ^~~~~~~~~~~~~~~~
| die_get_typename
util/annotate-data.c:785:71: error: 'struct die_var_type' has no member named 'die_tag'
785 | if (!die_get_type_die(dwarf,
pos->die_off, pos->die_tag,
|
^~util/annotate-data.c:786:50: error: 'struct die_var_type' has no member named 'from_alt'
786 | pos->from_alt,&type_die))
| ^~util/annotate-data.c:792:44: error: 'struct die_var_type' has no member named 'from_alt'
792 | pos->from_alt);
| ^~util/annotate-data.c: In function 'get_global_var_type':util/annotate-data.c:849:26: warning: implicit declaration of function 'die_same_file' [-Wimplicit-function-declaration]
849 | !die_same_file(cu_die, type_die));
| ^~~~~~~~~~~~~util/annotate-data.c: In function 'update_var_state':util/annotate-data.c:905:42: error: 'struct die_var_type' has no member named 'die_tag'
905 | var->die_tag,var->from_alt, &mem_die))
| ^~util/annotate-data.c:905:56: error: 'struct die_var_type' has no member named 'from_alt'
905 | var->die_tag,var->from_alt, &mem_die))
| ^~
Signature · 1 line
Florian
Hi Greg
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 20 Nov 2026 14:55:47 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.3.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.3.y
and the diffstat can be found below.thanks,
greg k-h
Linux version 7.3.6-rc1 tested.
Build successfully completed.
Boot successfully completed.
No dmesg regressions.
Video output normal.
Sound output normal.
Lenovo ThinkPad X1 Carbon Gen10(Intel i7-1260P(x86_64) arch linux)
[ 0.000000] Linux version 7.3.6-rc1rv-g62eba995b019
(takeshi@ThinkPadX1Gen10J0764) (gcc (GCC) 16.2.1 20260810, GNU ld (GNU Binutils) 2.47) #1 SMP PREEMPT_DYNAMIC Thu Nov 19 06:29:24 JST 2026
Am 18.11.2026 um 15:20 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 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.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 20 Nov 2026 14:55:47 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.3.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.3.y
and the diffstat can be found below.thanks,
greg k-h
Hi, Greg:
I see the same rust build error as that reported by Thorsten. That error was not observed with 6.18.65-rc1.
Distribution: Gentoo Linux
Architecture: x86_64 (ASUS Zenbook UM3504DA)
CPU: AMD Ryzen 7 7735U
iGPU: AMD Radeon 680M
Best,
Joungmin
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 20 Nov 2026 14:55:47 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.3.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.3.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 20 Nov 2026 14:55:47 +0000. Anything received after that time might be too late.
7.3.6-rc1 compiles on x86_64 (Xeon E5-1620 v2, Slackware64-15.0), and boots & runs on x86_64 (AMD Ryzen 5 7520U, Slackware64-current). No regressions observed during boot & my custom tests.
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 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.
Built, booted, and tested on hardware for x86_64:
- AMD Ryzen 9 5900X, Nvidia RTX 3080 (nouveau)
- Intel N100
No regressions found.
Thanks!
Sean
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.3.6 release. There are 2651 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 20 Nov 2026 14:55:47 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.3.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.3.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).