6.7.4-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 264/353 PCI/AER: Decode Requester ID when no error info found
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
[ Upstream commit 1291b716bbf969e101d517bfb8ba18d958f758b8 ]
When a device with AER detects an error, it logs error information in its own AER Error Status registers. It may send an Error Message to the Root Port (RCEC in the case of an RCiEP), which logs the fact that an Error Message was received (Root Error Status) and the Requester ID of the message source (Error Source Identification).
aer_print_port_info() prints the Requester ID from the Root Port Error Source in the usual Linux "bb:dd.f" format, but when find_source_device() finds no error details in the hierarchy below the Root Port, it printed the raw Requester ID without decoding it.
Decode the Requester ID in the usual Linux format so it matches other messages.
Sample message changes:
- pcieport 0000:00:1c.5: AER: Correctable error received: 0000:00:1c.5
- pcieport 0000:00:1c.5: AER: can't find device of ID00e5
+ pcieport 0000:00:1c.5: AER: Correctable error message received from 0000:00:1c.5
+ pcieport 0000:00:1c.5: AER: found no error details for 0000:00:1c.5
--- drivers/pci/pcie/aer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pci/pcie/aer.c +7 -2
@@ -740,7 +740,7 @@ static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info)u8 bus = info->id >>8 ;u8 devfn = info->id &0xff ; - pci_info(dev, "%s%s error received: %04x:%02x:%02x.%d\n", + pci_info(dev, "%s%s error message received from %04x:%02x:%02x.%d\n", info->multi_error_valid ? "Multiple " : "", aer_error_severity_string[info->severity], pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn),
@@ -929,7 +929,12 @@ static bool find_source_device(struct pci_dev *parent,pci_walk_bus (parent->subordinate, find_device_iter, e_info);if (!e_info->error_dev_num) { -pci_info (parent,"can't find device of ID%04x\n" , e_info->id); +u8 bus = e_info->id >>8 ; +u8 devfn = e_info->id &0xff ; + +pci_info (parent,"found no error details for %04x:%02x:%02x.%d\n" , +pci_domain_nr (parent->bus), bus,PCI_SLOT (devfn), +PCI_FUNC (devfn));return false; }return true;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 265/353 9p: Fix initialisation of netfs_inode for 9p
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 9546ac78b232bac56ff975072b1965e0e755ebd4 ]
The 9p filesystem is calling netfs_inode_init() in v9fs_init_inode() - before the struct inode fields have been initialised from the obtained file stats (ie. after v9fs_stat2inode*() has been called), but netfslib wants to set a couple of its fields from i_size.
--- fs/9p/v9fs_vfs.h | 1 + fs/9p/vfs_inode.c | 6 +++--- fs/9p/vfs_inode_dotl.c | 1 + 3 files changed, 5 insertions(+), 3 deletions(-)
fs/9p/v9fs_vfs.h +1 -0
@@ -42,6 +42,7 @@ struct inode *v9fs_alloc_inode(struct super_block *sb);void v9fs_free_inode (struct inode *inode);struct inode *v9fs_get_inode (struct super_block *sb,umode_t mode,dev_t rdev); +void v9fs_set_netfs_context (struct inode *inode);int v9fs_init_inode (struct v9fs_session_info *v9ses,struct inode *inode,umode_t mode,dev_t rdev);void v9fs_evict_inode (struct inode *inode);
fs/9p/vfs_inode.c +3 -3
@@ -246,7 +246,7 @@ void v9fs_free_inode(struct inode *inode)/* * Set parameters for the netfs library */ -static void v9fs_set_netfs_context (struct inode *inode) +void v9fs_set_netfs_context (struct inode *inode) {struct v9fs_inode *v9inode =V9FS_I (inode);netfs_inode_init (&v9inode->netfs, &v9fs_req_ops);
@@ -326,8 +326,6 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses, err = -EINVAL ; goto error; } - -v9fs_set_netfs_context (inode); error:return err;
@@ -359,6 +357,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t rdev)iput (inode);return ERR_PTR (err); } +v9fs_set_netfs_context (inode);return inode; }
@@ -464,6 +463,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, goto error;v9fs_stat2inode (st, inode, sb,0 ); +v9fs_set_netfs_context (inode);v9fs_cache_inode_get_cookie (inode);unlock_new_inode (inode);return inode;
fs/9p/vfs_inode_dotl.c +1 -0
@@ -128,6 +128,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, goto error;v9fs_stat2inode_dotl (st, inode,0 ); +v9fs_set_netfs_context (inode);v9fs_cache_inode_get_cookie (inode); retval =v9fs_get_acl (inode, fid);if (retval)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 266/353 tracefs/eventfs: Use root and instance inodes as default ownership
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (Google) <[email protected]>
[ Upstream commit 8186fff7ab649085e2c60d032d9a20a85af1d87c ]
Instead of walking the dentries on mount/remount to update the gid values of all the dentries if a gid option is specified on mount, just update the root inode. Add .getattr, .setattr, and .permissions on the tracefs inode operations to update the permissions of the files and directories.
For all files and directories in the top level instance:
/sys/kernel/tracing/*
It will use the root inode as the default permissions. The inode that
represents: /sys/kernel/tracing (or wherever it is mounted).
When an instance is created:
mkdir /sys/kernel/tracing/instance/foo
The directory "foo" and all its files and directories underneath will use the default of what foo is when it was created. A remount of tracefs will not affect it.
If a user were to modify the permissions of any file or directory in tracefs, it will also no longer be modified by a change in ownership of a remount.
The events directory, if it is in the top level instance, will use the tracefs root inode as the default ownership for itself and all the files and directories below it.
For the events directory in an instance ("foo"), it will keep the ownership of what it was when it was created, and that will be used as the default ownership for the files and directories beneath it.
--- fs/tracefs/event_inode.c | 79 +++++++++++++++- fs/tracefs/inode.c | 198 ++++++++++++++++++++++----------------- fs/tracefs/internal.h | 3 + 3 files changed, 190 insertions(+), 90 deletions(-)
fs/tracefs/event_inode.c +77 -2
@@ -45,6 +45,7 @@ enum {EVENTFS_SAVE_MODE =BIT (16 ),EVENTFS_SAVE_UID =BIT (17 ),EVENTFS_SAVE_GID =BIT (18 ), + EVENTFS_TOPLEVEL = BIT(19), };#define EVENTFS_MODE_MASK (EVENTFS_SAVE_MODE - 1)
@@ -117,10 +118,17 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry,* The events directory dentry is never freed, unless its * part of an instance that is deleted. It's attr is the * default for its child files and directories. -* Do not update it. It's not used for its own mode or ownership +* Do not update it. It's not used for its own mode or ownership. */ -if (!ei->is_events) +if (ei->is_events) { +/* But it still needs to know if it was modified */ +if (iattr->ia_valid &ATTR_UID ) + ei->attr.mode |=EVENTFS_SAVE_UID ; +if (iattr->ia_valid &ATTR_GID ) + ei->attr.mode |=EVENTFS_SAVE_GID ; + }else {update_attr (&ei->attr, iattr); + } }else { name = dentry->d_name.name;
@@ -138,9 +146,66 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry,return ret; } +static void update_top_events_attr (struct eventfs_inode *ei,struct dentry *dentry) +{ +struct inode *inode; + +/* Only update if the "events" was on the top level */ +if (!ei || !(ei->attr.mode &EVENTFS_TOPLEVEL )) +return ; + +/* Get the tracefs root inode. */ + inode =d_inode (dentry->d_sb->s_root); + ei->attr.uid = inode->i_uid; + ei->attr.gid = inode->i_gid; +} + +static void set_top_events_ownership (struct inode *inode) +{ +struct tracefs_inode *ti =get_tracefs (inode); +struct eventfs_inode *ei = ti->private; +struct dentry *dentry; + +/* The top events directory doesn't get automatically updated */ +if (!ei || !ei->is_events || !(ei->attr.mode &EVENTFS_TOPLEVEL )) +return ; + + dentry = ei->dentry; + +update_top_events_attr (ei, dentry); + +if (!(ei->attr.mode &EVENTFS_SAVE_UID )) + inode->i_uid = ei->attr.uid; + +if (!(ei->attr.mode &EVENTFS_SAVE_GID )) + inode->i_gid = ei->attr.gid; +} + +static int eventfs_get_attr (struct mnt_idmap *idmap, +const struct path *path,struct kstat *stat, +u32 request_mask,unsigned int flags) +{ +struct dentry *dentry = path->dentry; +struct inode *inode =d_backing_inode (dentry); + +set_top_events_ownership (inode); + +generic_fillattr (idmap, request_mask, inode, stat); +return 0 ; +} + +static int eventfs_permission (struct mnt_idmap *idmap, +struct inode *inode,int mask) +{ +set_top_events_ownership (inode); +return generic_permission (idmap, inode, mask); +} +static const struct inode_operations eventfs_root_dir_inode_operations = { .lookup = eventfs_root_lookup, .setattr = eventfs_set_attr, + .getattr = eventfs_get_attr, + .permission = eventfs_permission, };static const struct inode_operations eventfs_file_inode_operations = {
@@ -178,6 +243,8 @@ static struct eventfs_inode *eventfs_find_events(struct dentry *dentry) }while (!ei->is_events);mutex_unlock (&eventfs_mutex); +update_top_events_attr (ei, dentry); +return ei; }
@@ -968,6 +1035,14 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry uid =d_inode (dentry->d_parent)->i_uid; gid =d_inode (dentry->d_parent)->i_gid; +/* +* If the events directory is of the top instance, then parent +* is NULL. Set the attr.mode to reflect this and its permissions will +* default to the tracefs root dentry. +*/ +if (!parent) + ei->attr.mode =EVENTFS_TOPLEVEL ; +/* This is used as the default ownership of the files and directories */ ei->attr.uid = uid; ei->attr.gid = gid;
fs/tracefs/inode.c +110 -88
274 lines not on this page · raw message
fs/tracefs/internal.h +3 -0
@@ -5,6 +5,9 @@enum {TRACEFS_EVENT_INODE =BIT (1 ),TRACEFS_EVENT_TOP_INODE =BIT (2 ), +TRACEFS_GID_PERM_SET =BIT (3 ), +TRACEFS_UID_PERM_SET =BIT (4 ), +TRACEFS_INSTANCE_INODE =BIT (5 ), };struct tracefs_inode {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 267/353 usb: xhci-plat: fix usb disconnect issue after s4
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yinbo Zhu <[email protected]>
[ Upstream commit 6d6887c42e946f43bed2e64571a40c8476a1e4a9 ]
The xhci retaining bogus hardware states cause usb disconnect devices connected before hibernation(s4) and refer to the commit 'f3d478858be ("usb: ohci-platform: fix usb disconnect issue after s4")' which set flag "hibernated" as true when resume-from-hibernation and that the drivers will reset the hardware to get rid of any existing state and make sure resume from hibernation re-enumerates everything for xhci.
--- drivers/usb/host/xhci-plat.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/usb/host/xhci-plat.c +19 -4
@@ -433,7 +433,7 @@ void xhci_plat_remove(struct platform_device *dev) }EXPORT_SYMBOL_GPL (xhci_plat_remove); -static int __maybe_unused xhci_plat_suspend (struct device *dev) +static int xhci_plat_suspend (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);struct xhci_hcd *xhci =hcd_to_xhci (hcd);
@@ -461,7 +461,7 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev)return 0 ; } -static int __maybe_unused xhci_plat_resume (struct device *dev) +static int xhci_plat_resume_common (struct device *dev,struct pm_message pmsg) {struct usb_hcd *hcd =dev_get_drvdata (dev);struct xhci_hcd *xhci =hcd_to_xhci (hcd);
@@ -483,7 +483,7 @@ static int __maybe_unused xhci_plat_resume(struct device *dev)if (ret) goto disable_clks; - ret =xhci_resume (xhci,PMSG_RESUME ); + ret =xhci_resume (xhci, pmsg);if (ret) goto disable_clks;
@@ -502,6 +502,16 @@ static int __maybe_unused xhci_plat_resume(struct device *dev)return ret; } +static int xhci_plat_resume (struct device *dev) +{ +return xhci_plat_resume_common (dev,PMSG_RESUME ); +} + +static int xhci_plat_restore (struct device *dev) +{ +return xhci_plat_resume_common (dev,PMSG_RESTORE ); +} +static int __maybe_unused xhci_plat_runtime_suspend (struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);
@@ -524,7 +534,12 @@ static int __maybe_unused xhci_plat_runtime_resume(struct device *dev) }const struct dev_pm_ops xhci_plat_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume) + .suspend =pm_sleep_ptr (xhci_plat_suspend), + .resume =pm_sleep_ptr (xhci_plat_resume), + .freeze =pm_sleep_ptr (xhci_plat_suspend), + .thaw =pm_sleep_ptr (xhci_plat_resume), + .poweroff =pm_sleep_ptr (xhci_plat_suspend), + .restore =pm_sleep_ptr (xhci_plat_restore), SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend, xhci_plat_runtime_resume,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 268/353 misc: lis3lv02d_i2c: Add missing setting of the reg_ctrl callback
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit b1b9f7a494400c0c39f8cd83de3aaa6111c55087 ]
The lis3lv02d_i2c driver was missing a line to set the lis3_dev's reg_ctrl callback.
lis3_reg_ctrl(on) is called from the init callback, but due to the missing reg_ctrl callback the regulators where never turned off again leading to the following oops/backtrace when detaching the driver:
[ 82.313527] ------------[ cut here ]------------ [ 82.313546] WARNING: CPU: 1 PID: 1724 at drivers/regulator/core.c:2396 _regulator_put+0x219/0x230 ... [ 82.313695] RIP: 0010:_regulator_put+0x219/0x230 ... [ 82.314767] Call Trace: [ 82.314770] <TASK> [ 82.314772] ? _regulator_put+0x219/0x230 [ 82.314777] ? __warn+0x81/0x170 [ 82.314784] ? _regulator_put+0x219/0x230 [ 82.314791] ? report_bug+0x18d/0x1c0 [ 82.314801] ? handle_bug+0x3c/0x80 [ 82.314806] ? exc_invalid_op+0x13/0x60 [ 82.314812] ? asm_exc_invalid_op+0x16/0x20 [ 82.314845] ? _regulator_put+0x219/0x230 [ 82.314857] regulator_bulk_free+0x39/0x60 [ 82.314865] i2c_device_remove+0x22/0xb0
Add the missing setting of the callback so that the regulators properly get turned off again when not used.
--- drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/lis3lv02d/lis3lv02d_i2c.c +1 -0
@@ -150,6 +150,7 @@ static int lis3lv02d_i2c_probe(struct i2c_client *client) lis3_dev.init = lis3_i2c_init; lis3_dev.read = lis3_i2c_read; lis3_dev.write = lis3_i2c_write; + lis3_dev.reg_ctrl = lis3_reg_ctrl; lis3_dev.irq = client->irq; lis3_dev.ac = lis3lv02d_axis_map; lis3_dev.pm_dev = &client->dev;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 269/353 libsubcmd: Fix memory leak in uniq()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit ad30469a841b50dbb541df4d6971d891f703c297 ]
uniq() will write one command name over another causing the overwritten string to be leaked. Fix by doing a pass that removes duplicates and a second that removes the holes.
--- tools/lib/subcmd/help.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
tools/lib/subcmd/help.c +14 -4
@@ -52,11 +52,21 @@ void uniq(struct cmdnames *cmds)if (!cmds->cnt)return ; -for (i = j =1 ; i < cmds->cnt; i++) -if (strcmp (cmds->names[i]->name, cmds->names[i-1 ]->name)) - cmds->names[j++] = cmds->names[i]; - +for (i =1 ; i < cmds->cnt; i++) { +if (!strcmp (cmds->names[i]->name, cmds->names[i-1 ]->name)) +zfree (&cmds->names[i -1 ]); + } +for (i =0 , j =0 ; i < cmds->cnt; i++) { +if (cmds->names[i]) { +if (i == j) + j++; +else + cmds->names[j++] = cmds->names[i]; + } + } cmds->cnt = j; +while (j < i) + cmds->names[j++] =NULL ; }void exclude_cmds (struct cmdnames *cmds,struct cmdnames *excludes)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 270/353 ASoC: codecs: rtq9128: Fix PM_RUNTIME usage
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: ChiYuan Huang <[email protected]>
[ Upstream commit 35040410372ca27a33cec8382d42c90b6b6c99f6 ]
If 'pm_runtime_resume_and_get' is used, must check the return value to prevent the active count not matched problem.
--- sound/soc/codecs/rtq9128.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/codecs/rtq9128.c +5 -1
@@ -391,7 +391,11 @@ static int rtq9128_component_probe(struct snd_soc_component *comp)unsigned int val;int i, ret; -pm_runtime_resume_and_get (comp->dev); + ret =pm_runtime_resume_and_get (comp->dev); +if (ret <0 ) { +dev_err (comp->dev,"Failed to resume device (%d)\n" , ret); +return ret; + } val =snd_soc_component_read (comp,RTQ9128_REG_EFUSE_DATA );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 271/353 ASoC: codecs: rtq9128: Fix TDM enable and DAI format control flow
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: ChiYuan Huang <[email protected]>
[ Upstream commit 415d10ccef712f3ec73cd880c1fef3eb48601c3a ]
To enable TDM mode, the current control flow limits the function calling order should be 'set_tdm_slot->set_dai_fmt'. But not all platform sound card like as simeple card to follow this design. To bypass this limit, adjust the DAI format setting in runtime 'hw_param' callback.
--- sound/soc/codecs/rtq9128.c | 67 ++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 31 deletions(-)
sound/soc/codecs/rtq9128.c +36 -31
@@ -59,6 +59,7 @@struct rtq9128_data {struct gpio_desc *enable; +unsigned int daifmt;int tdm_slots;int tdm_slot_width;bool tdm_input_data2_select;
@@ -441,10 +442,7 @@ static const struct snd_soc_component_driver rtq9128_comp_driver = {static int rtq9128_dai_set_fmt (struct snd_soc_dai *dai,unsigned int fmt) {struct rtq9128_data *data =snd_soc_dai_get_drvdata (dai); -struct snd_soc_component *comp = dai->component;struct device *dev = dai->dev; -unsigned int audfmt, fmtval; -int ret;dev_dbg (dev,"%s: fmt 0x%8x\n" , __func__, fmt);
@@ -454,35 +452,10 @@ static int rtq9128_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)return -EINVAL ; } - fmtval = fmt &SND_SOC_DAIFMT_FORMAT_MASK ; -if (data->tdm_slots && fmtval !=SND_SOC_DAIFMT_DSP_A && fmtval !=SND_SOC_DAIFMT_DSP_B ) { -dev_err (dev,"TDM is used, format only support DSP_A or DSP_B\n" ); -return -EINVAL ; - } +/* Store here and will be used in runtime hw_params for DAI format setting */ + data->daifmt = fmt; -switch (fmtval) { -case SND_SOC_DAIFMT_I2S : - audfmt =8 ; -break ; -case SND_SOC_DAIFMT_LEFT_J : - audfmt =9 ; -break ; -case SND_SOC_DAIFMT_RIGHT_J : - audfmt =10 ; -break ; -case SND_SOC_DAIFMT_DSP_A : - audfmt = data->tdm_slots ?12 :11 ; -break ; -case SND_SOC_DAIFMT_DSP_B : - audfmt = data->tdm_slots ?4 :3 ; -break ; -default : -dev_err (dev,"Unsupported format 0x%8x\n" , fmt); -return -EINVAL ; - } - - ret =snd_soc_component_write_field (comp,RTQ9128_REG_I2S_OPT ,RTQ9128_AUDFMT_MASK , audfmt); -return ret <0 ? ret :0 ; +return 0 ; } static int rtq9128_dai_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
@@ -558,10 +531,38 @@ static int rtq9128_dai_hw_params(struct snd_pcm_substream *stream, struct snd_pcunsigned int width, slot_width, bitrate, audbit, dolen;struct snd_soc_component *comp = dai->component;struct device *dev = dai->dev; +unsigned int fmtval, audfmt;int ret;dev_dbg (dev,"%s: width %d\n" , __func__,params_width (param)); + fmtval =FIELD_GET (SND_SOC_DAIFMT_FORMAT_MASK , data->daifmt); +if (data->tdm_slots && fmtval !=SND_SOC_DAIFMT_DSP_A && fmtval !=SND_SOC_DAIFMT_DSP_B ) { +dev_err (dev,"TDM is used, format only support DSP_A or DSP_B\n" ); +return -EINVAL ; + } + +switch (fmtval) { +case SND_SOC_DAIFMT_I2S : + audfmt =8 ; +break ; +case SND_SOC_DAIFMT_LEFT_J : + audfmt =9 ; +break ; +case SND_SOC_DAIFMT_RIGHT_J : + audfmt =10 ; +break ; +case SND_SOC_DAIFMT_DSP_A : + audfmt = data->tdm_slots ?12 :11 ; +break ; +case SND_SOC_DAIFMT_DSP_B : + audfmt = data->tdm_slots ?4 :3 ; +break ; +default : +dev_err (dev,"Unsupported format 0x%8x\n" , fmtval); +return -EINVAL ; + } +switch (width =params_width (param)) {case 16 : audbit =0 ;
@@ -615,6 +616,10 @@ static int rtq9128_dai_hw_params(struct snd_pcm_substream *stream, struct snd_pcreturn -EINVAL ; } + ret =snd_soc_component_write_field (comp,RTQ9128_REG_I2S_OPT ,RTQ9128_AUDFMT_MASK , audfmt); +if (ret <0 ) +return ret; + ret =snd_soc_component_write_field (comp,RTQ9128_REG_I2S_OPT ,RTQ9128_AUDBIT_MASK , audbit);if (ret <0 )return ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 272/353 drm/amdkfd: Fix lock dependency warning
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Kuehling <[email protected]>
[ Upstream commit 47bf0f83fc86df1bf42b385a91aadb910137c5c9 ]
======================================================
WARNING: possible circular locking dependency detected
6.5.0-kfd-fkuehlin #276 Not tainted
------------------------------------------------------
kworker/8:2/2676 is trying to acquire lock:ffff9435aae95c88 ((work_completion)(&svm_bo->eviction_work)){+.+.}-{0:0}, at: __flush_work+0x52/0x550
but task is already holding lock:ffff9435cd8e1720 (&svms->lock){+.+.}-{3:3}, at: svm_range_deferred_list_work+0xe8/0x340 [amdgpu]
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&svms->lock){+.+.}-{3:3}:
__mutex_lock+0x97/0xd30
kfd_ioctl_alloc_memory_of_gpu+0x6d/0x3c0 [amdgpu]
kfd_ioctl+0x1b2/0x5d0 [amdgpu]
__x64_sys_ioctl+0x86/0xc0
do_syscall_64+0x39/0x80
entry_SYSCALL_64_after_hwframe+0x63/0xcd-> #1 (&mm->mmap_lock){++++}-{3:3}:
down_read+0x42/0x160
svm_range_evict_svm_bo_worker+0x8b/0x340 [amdgpu]
process_one_work+0x27a/0x540
worker_thread+0x53/0x3e0
kthread+0xeb/0x120
ret_from_fork+0x31/0x50
ret_from_fork_asm+0x11/0x20-> #0 ((work_completion)(&svm_bo->eviction_work)){+.+.}-{0:0}:
__lock_acquire+0x1426/0x2200
lock_acquire+0xc1/0x2b0
__flush_work+0x80/0x550
__cancel_work_timer+0x109/0x190
svm_range_bo_release+0xdc/0x1c0 [amdgpu]
svm_range_free+0x175/0x180 [amdgpu]
svm_range_deferred_list_work+0x15d/0x340 [amdgpu]
process_one_work+0x27a/0x540
worker_thread+0x53/0x3e0
kthread+0xeb/0x120
ret_from_fork+0x31/0x50
ret_from_fork_asm+0x11/0x20other info that might help us debug this:
Chain exists of: (work_completion)(&svm_bo->eviction_work) --> &mm->mmap_lock --> &svms->lock Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&svms->lock);
lock(&mm->mmap_lock);
lock(&svms->lock);lock((work_completion)(&svm_bo->eviction_work));
I believe this cannot really lead to a deadlock in practice, because svm_range_evict_svm_bo_worker only takes the mmap_read_lock if the BO refcount is non-0. That means it's impossible that svm_range_bo_release is running concurrently. However, there is no good way to annotate this.
To avoid the problem, take a BO reference in svm_range_schedule_evict_svm_bo instead of in the worker. That way it's impossible for a BO to get freed while eviction work is pending and the cancel_work_sync call in svm_range_bo_release can be eliminated.
v2: Use svm_bo_ref_unless_zero and explained why that's safe. Also removed redundant checks that are already done in amdkfd_fence_enable_signaling.
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +10 -16
@@ -400,14 +400,9 @@ static void svm_range_bo_release(struct kref *kref)spin_lock (&svm_bo->list_lock); }spin_unlock (&svm_bo->list_lock); -if (!dma_fence_is_signaled (&svm_bo->eviction_fence->base)) { -/* We're not in the eviction worker. -* Signal the fence and synchronize with any -* pending eviction work. -*/ +if (!dma_fence_is_signaled (&svm_bo->eviction_fence->base)) +/* We're not in the eviction worker. Signal the fence. */ dma_fence_signal (&svm_bo->eviction_fence->base); -cancel_work_sync (&svm_bo->eviction_work); - }dma_fence_put (&svm_bo->eviction_fence->base);amdgpu_bo_unref (&svm_bo->bo);kfree (svm_bo);
@@ -3447,13 +3442,14 @@ svm_range_trigger_migration(struct mm_struct *mm, struct svm_range *prange,int svm_range_schedule_evict_svm_bo (struct amdgpu_amdkfd_fence *fence) { -if (!fence) -return -EINVAL ; - -if (dma_fence_is_signaled (&fence->base)) -return 0 ; - -if (fence->svm_bo) { +/* Dereferencing fence->svm_bo is safe here because the fence hasn't +* signaled yet and we're under the protection of the fence->lock. +* After the fence is signaled in svm_range_bo_release, we cannot get +* here any more. +* +* Reference is dropped in svm_range_evict_svm_bo_worker. +*/ +if (svm_bo_ref_unless_zero (fence->svm_bo)) {WRITE_ONCE (fence->svm_bo->evicting,1 );schedule_work (&fence->svm_bo->eviction_work); }
@@ -3468,8 +3464,6 @@ static void svm_range_evict_svm_bo_worker(struct work_struct *work)int r =0 ; svm_bo = container_of(work, struct svm_range_bo, eviction_work); -if (!svm_bo_ref_unless_zero (svm_bo)) -return ;/* svm_bo was freed while eviction was pending */ if (mmget_not_zero (svm_bo->eviction_fence->mm)) { mm = svm_bo->eviction_fence->mm;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 273/353 drm/amd/display: To adjust dprefclk by down spread percentage
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Tsai <[email protected]>
[ Upstream commit 17e74e11ac2b46e7514705ae7abfb93ac0e20bd6 ]
[Why]
Panels show corruption with high refresh rate timings when ssc is enabled.
[How]
Read down-spread percentage from lut to adjust dprefclk. Issues come from S0i3 with this commit has been fixed by SMU.
--- .../dc/clk_mgr/dcn314/dcn314_clk_mgr.c | 71 ++++++++++++++++++- .../dc/clk_mgr/dcn314/dcn314_clk_mgr.h | 11 +++ .../gpu/drm/amd/display/dc/dce/dce_audio.c | 2 +- .../drm/amd/display/dc/dce/dce_clock_source.c | 9 ++- .../amd/display/dc/hwss/dce110/dce110_hwseq.c | 2 +- .../gpu/drm/amd/display/dc/inc/hw/clk_mgr.h | 1 + .../gpu/drm/amd/display/include/audio_types.h | 2 +- 7 files changed, 93 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c +70 -1
@@ -87,6 +87,20 @@ static const struct IP_BASE CLK_BASE = { { { { 0x00016C00, 0x02401800, 0, 0, 0,#define CLK1_CLK_PLL_REQ__PllSpineDiv_MASK 0x0000F000L#define CLK1_CLK_PLL_REQ__FbMult_frac_MASK 0xFFFF0000L +#define regCLK1_CLK2_BYPASS_CNTL 0x029c +#define regCLK1_CLK2_BYPASS_CNTL_BASE_IDX 0 + +#define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_SEL__SHIFT 0x0 +#define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_DIV__SHIFT 0x10 +#define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_SEL_MASK 0x00000007L +#define CLK1_CLK2_BYPASS_CNTL__CLK2_BYPASS_DIV_MASK 0x000F0000L + +#define regCLK6_0_CLK6_spll_field_8 0x464b +#define regCLK6_0_CLK6_spll_field_8_BASE_IDX 0 + +#define CLK6_0_CLK6_spll_field_8__spll_ssc_en__SHIFT 0xd +#define CLK6_0_CLK6_spll_field_8__spll_ssc_en_MASK 0x00002000L +#define REG (reg_name) \ (CLK_BASE.instance[0].segment[reg ## reg_name ## _BASE_IDX] + reg ## reg_name)
@@ -157,6 +171,37 @@ static void dcn314_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state } } +bool dcn314_is_spll_ssc_enabled (struct clk_mgr *clk_mgr_base) +{ +struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base); +uint32_t ssc_enable; + +REG_GET (CLK6_0_CLK6_spll_field_8, spll_ssc_en, &ssc_enable); + +return ssc_enable ==1 ; +} + +void dcn314_init_clocks (struct clk_mgr *clk_mgr) +{ +struct clk_mgr_internal *clk_mgr_int =TO_CLK_MGR_INTERNAL (clk_mgr); +uint32_t ref_dtbclk = clk_mgr->clks.ref_dtbclk_khz; + +memset (&(clk_mgr->clks),0 ,sizeof (struct dc_clocks )); +// Assumption is that boot state always supports pstate + clk_mgr->clks.ref_dtbclk_khz = ref_dtbclk;// restore ref_dtbclk + clk_mgr->clks.p_state_change_support = true; + clk_mgr->clks.prev_p_state_change_support = true; + clk_mgr->clks.pwr_state =DCN_PWR_STATE_UNKNOWN ; + clk_mgr->clks.zstate_support =DCN_ZSTATE_SUPPORT_UNKNOWN ; + +// to adjust dp_dto reference clock if ssc is enable otherwise to apply dprefclk +if (dcn314_is_spll_ssc_enabled (clk_mgr)) + clk_mgr->dp_dto_source_clock_in_khz = +dce_adjust_dp_ref_freq_for_ss (clk_mgr_int, clk_mgr->dprefclk_khz); +else + clk_mgr->dp_dto_source_clock_in_khz = clk_mgr->dprefclk_khz; +} +void dcn314_update_clocks (struct clk_mgr *clk_mgr_base,struct dc_state *context,bool safe_to_lower)
@@ -433,6 +478,11 @@ static DpmClocks314_t dummy_clocks;static struct dcn314_watermarks dummy_wms = {0 }; +static struct dcn314_ss_info_table ss_info_table = { + .ss_divider =1000 , + .ss_percentage = {0 ,0 ,375 ,375 ,375 } +}; +static void dcn314_build_watermark_ranges (struct clk_bw_params *bw_params,struct dcn314_watermarks *table) {int i, num_valid_sets;
@@ -705,13 +755,31 @@ static struct clk_mgr_funcs dcn314_funcs = { .get_dp_ref_clk_frequency = dce12_get_dp_ref_freq_khz, .get_dtb_ref_clk_frequency = dcn31_get_dtb_ref_freq_khz, .update_clocks = dcn314_update_clocks, - .init_clocks = dcn31_init_clocks, + .init_clocks = dcn314_init_clocks, .enable_pme_wa = dcn314_enable_pme_wa, .are_clock_states_equal = dcn314_are_clock_states_equal, .notify_wm_ranges = dcn314_notify_wm_ranges };extern struct clk_mgr_funcs dcn3_fpga_funcs; +static void dcn314_read_ss_info_from_lut (struct clk_mgr_internal *clk_mgr) +{ +uint32_t clock_source; +//uint32_t ssc_enable; + +REG_GET (CLK1_CLK2_BYPASS_CNTL ,CLK2_BYPASS_SEL , &clock_source); +//REG_GET(CLK6_0_CLK6_spll_field_8, spll_ssc_en, &ssc_enable); + +if (dcn314_is_spll_ssc_enabled (&clk_mgr->base) && (clock_source <ARRAY_SIZE (ss_info_table.ss_percentage))) { + clk_mgr->dprefclk_ss_percentage = ss_info_table.ss_percentage[clock_source]; + +if (clk_mgr->dprefclk_ss_percentage !=0 ) { + clk_mgr->ss_on_dprefclk = true; + clk_mgr->dprefclk_ss_divider = ss_info_table.ss_divider; + } + } +} + void dcn314_clk_mgr_construct( struct dc_context *ctx, struct clk_mgr_dcn314 *clk_mgr,
@@ -779,6 +847,7 @@ void dcn314_clk_mgr_construct( clk_mgr->base.base.dprefclk_khz =600000 ; clk_mgr->base.base.clks.ref_dtbclk_khz =600000 ;dce_clock_read_ss_info (&clk_mgr->base); +dcn314_read_ss_info_from_lut (&clk_mgr->base);/*if bios enabled SS, driver needs to adjust dtb clock, only enable with correct bios*/ clk_mgr->base.base.bw_params = &dcn314_bw_params;
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.h +11 -0
@@ -28,6 +28,8 @@#define __DCN314_CLK_MGR_H__#include "clk_mgr_internal.h" +#define DCN314_NUM_CLOCK_SOURCES 5 +struct dcn314_watermarks ;struct dcn314_smu_watermark_set {
@@ -40,9 +42,18 @@ struct clk_mgr_dcn314 {struct dcn314_smu_watermark_set smu_wm_set; }; +struct dcn314_ss_info_table { +uint32_t ss_divider; +uint32_t ss_percentage[DCN314_NUM_CLOCK_SOURCES ]; +}; +bool dcn314_are_clock_states_equal (struct dc_clocks *a,struct dc_clocks *b); +bool dcn314_is_spll_ssc_enabled (struct clk_mgr *clk_mgr_base); + +void dcn314_init_clocks (struct clk_mgr *clk_mgr); +void dcn314_update_clocks (struct clk_mgr *clk_mgr_base,struct dc_state *context,bool safe_to_lower);
drivers/gpu/drm/amd/display/dc/dce/dce_audio.c +1 -1
@@ -782,7 +782,7 @@ static void get_azalia_clock_info_dp(/*audio_dto_module = dpDtoSourceClockInkhz * 10,000; * [khz] ->[100Hz] */ azalia_clock_info->audio_dto_module = - pll_info->dp_dto_source_clock_in_khz *10 ; + pll_info->audio_dto_source_clock_in_khz *10 ; } void dce_aud_wall_dto_setup(
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +8 -1
@@ -975,6 +975,9 @@ static bool dcn31_program_pix_clk(look_up_in_video_optimized_rate_tlb (pix_clk_params->requested_pix_clk_100hz /10 );struct bp_pixel_clock_parameters bp_pc_params = {0 };enum transmitter_color_depth bp_pc_colour_depth =TRANSMITTER_COLOR_DEPTH_24 ; + +if (clock_source->ctx->dc->clk_mgr->dp_dto_source_clock_in_khz !=0 ) + dp_dto_ref_khz = clock_source->ctx->dc->clk_mgr->dp_dto_source_clock_in_khz;// For these signal types Driver to program DP_DTO without calling VBIOS Command table if (dc_is_dp_signal (pix_clk_params->signal_type) ||dc_is_virtual_signal (pix_clk_params->signal_type)) {if (e) {
@@ -1088,6 +1091,10 @@ static bool get_pixel_clk_frequency_100hz(struct dce110_clk_src *clk_src =TO_DCE110_CLK_SRC (clock_source);unsigned int clock_hz =0 ;unsigned int modulo_hz =0 ; +unsigned int dp_dto_ref_khz = clock_source->ctx->dc->clk_mgr->dprefclk_khz; + +if (clock_source->ctx->dc->clk_mgr->dp_dto_source_clock_in_khz !=0 ) + dp_dto_ref_khz = clock_source->ctx->dc->clk_mgr->dp_dto_source_clock_in_khz;if (clock_source->id ==CLOCK_SOURCE_ID_DP_DTO ) { clock_hz =REG_READ (PHASE [inst]);
@@ -1100,7 +1107,7 @@ static bool get_pixel_clk_frequency_100hz( modulo_hz =REG_READ (MODULO [inst]);if (modulo_hz) *pixel_clk_khz =div_u64 ((uint64_t )clock_hz* - clock_source->ctx->dc->clk_mgr->dprefclk_khz*10 , + dp_dto_ref_khz*10 , modulo_hz);else *pixel_clk_khz =0 ;
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +1 -1
@@ -1353,7 +1353,7 @@ static void build_audio_output(if (state->clk_mgr && (pipe_ctx->stream->signal ==SIGNAL_TYPE_DISPLAY_PORT || pipe_ctx->stream->signal ==SIGNAL_TYPE_DISPLAY_PORT_MST )) { - audio_output->pll_info.dp_dto_source_clock_in_khz = + audio_output->pll_info.audio_dto_source_clock_in_khz = state->clk_mgr->funcs->get_dp_ref_clk_frequency ( state->clk_mgr); }
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h +1 -0
@@ -314,6 +314,7 @@ struct clk_mgr {bool force_smu_not_present;bool dc_mode_softmax_enabled;int dprefclk_khz;// Used by program pixel clock in clock source funcs, need to figureout where this goes +int dp_dto_source_clock_in_khz;// Used to program DP DTO with ss adjustment on DCN314 int dentist_vco_freq_khz;struct clk_state_registers_and_bypass boot_snapshot;struct clk_bw_params *bw_params;
drivers/gpu/drm/amd/display/include/audio_types.h +1 -1
@@ -64,7 +64,7 @@ enum audio_dto_source {/* PLL information required for AZALIA DTO calculation */ struct audio_pll_info { -uint32_t dp_dto_source_clock_in_khz; +uint32_t audio_dto_source_clock_in_khz;uint32_t feed_back_divider;enum audio_dto_source dto_source;bool ss_enabled;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 274/353 Revert "drm/amd/display: Fix conversions between bytes and KB"
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Miess <[email protected]>
[ Upstream commit bf282eb92b84709d99186ad5940b9997eb3c1ff2 ]
This reverts commit d0f639c5869399bf6dde4d694d5f8c0ab8c0ec46.
The previous commit causes failure to light up for 1080p eDP + 8k HDMI panel combo.
--- drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c +1 -1
@@ -6229,7 +6229,7 @@ static void set_calculate_prefetch_schedule_params(struct display_mode_lib_st *m CalculatePrefetchSchedule_params->GPUVMEnable = mode_lib->ms.cache_display_cfg.plane.GPUVMEnable; CalculatePrefetchSchedule_params->HostVMEnable = mode_lib->ms.cache_display_cfg.plane.HostVMEnable; CalculatePrefetchSchedule_params->HostVMMaxNonCachedPageTableLevels = mode_lib->ms.cache_display_cfg.plane.HostVMMaxPageTableLevels; - CalculatePrefetchSchedule_params->HostVMMinPageSize = mode_lib->ms.soc.hostvm_min_page_size_kbytes; + CalculatePrefetchSchedule_params->HostVMMinPageSize = mode_lib->ms.soc.hostvm_min_page_size_kbytes *1024 ; CalculatePrefetchSchedule_params->DynamicMetadataEnable = mode_lib->ms.cache_display_cfg.plane.DynamicMetadataEnable[k]; CalculatePrefetchSchedule_params->DynamicMetadataVMEnabled = mode_lib->ms.ip.dynamic_metadata_vm_enabled; CalculatePrefetchSchedule_params->DynamicMetadataLinesBeforeActiveRequired = mode_lib->ms.cache_display_cfg.plane.DynamicMetadataLinesBeforeActiveRequired[k];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 275/353 drm/amdkfd: Fix lock dependency warning with srcu
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philip Yang <[email protected]>
[ Upstream commit 2a9de42e8d3c82c6990d226198602be44f43f340 ]
======================================================
WARNING: possible circular locking dependency detected 6.5.0-kfd-yangp #2289 Not tainted
------------------------------------------------------
kworker/0:2/996 is trying to acquire lock:
(srcu){.+.+}-{0:0}, at: __synchronize_srcu+0x5/0x1a0but task is already holding lock:
((work_completion)(&svms->deferred_list_work)){+.+.}-{0:0}, at:
process_one_work+0x211/0x560which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #3 ((work_completion)(&svms->deferred_list_work)){+.+.}-{0:0}:
__flush_work+0x88/0x4f0
svm_range_list_lock_and_flush_work+0x3d/0x110 [amdgpu]
svm_range_set_attr+0xd6/0x14c0 [amdgpu]
kfd_ioctl+0x1d1/0x630 [amdgpu]
__x64_sys_ioctl+0x88/0xc0-> #2 (&info->lock#2){+.+.}-{3:3}:
__mutex_lock+0x99/0xc70
amdgpu_amdkfd_gpuvm_restore_process_bos+0x54/0x740 [amdgpu]
restore_process_helper+0x22/0x80 [amdgpu]
restore_process_worker+0x2d/0xa0 [amdgpu]
process_one_work+0x29b/0x560
worker_thread+0x3d/0x3d0-> #1 ((work_completion)(&(&process->restore_work)->work)){+.+.}-{0:0}:
__flush_work+0x88/0x4f0
__cancel_work_timer+0x12c/0x1c0
kfd_process_notifier_release_internal+0x37/0x1f0 [amdgpu]
__mmu_notifier_release+0xad/0x240
exit_mmap+0x6a/0x3a0
mmput+0x6a/0x120
do_exit+0x322/0xb90
do_group_exit+0x37/0xa0
__x64_sys_exit_group+0x18/0x20
do_syscall_64+0x38/0x80-> #0 (srcu){.+.+}-{0:0}:
__lock_acquire+0x1521/0x2510
lock_sync+0x5f/0x90
__synchronize_srcu+0x4f/0x1a0
__mmu_notifier_release+0x128/0x240
exit_mmap+0x6a/0x3a0
mmput+0x6a/0x120
svm_range_deferred_list_work+0x19f/0x350 [amdgpu]
process_one_work+0x29b/0x560
worker_thread+0x3d/0x3d0other info that might help us debug this:
Chain exists of: srcu --> &info->lock#2 --> (work_completion)(&svms->deferred_list_work) Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock((work_completion)(&svms->deferred_list_work));
lock(&info->lock#2);
lock((work_completion)(&svms->deferred_list_work));
sync(srcu);--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +4 -2
@@ -2366,8 +2366,10 @@ static void svm_range_deferred_list_work(struct work_struct *work)mutex_unlock (&svms->lock);mmap_write_unlock (mm); -/* Pairs with mmget in svm_range_add_list_work */ -mmput (mm); +/* Pairs with mmget in svm_range_add_list_work. If dropping the +* last mm refcount, schedule release work to avoid circular locking +*/ +mmput_async (mm);spin_lock (&svms->deferred_list_lock); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 276/353 =?UTF-8?q?virtio=5Fnet:=20Fix=20"=E2=80=98%d=E2=80=99=20directive?= =?UTF-8?q?=20writing=20between=201=20and=2011=20bytes=20into=20a=20region?= =?UTF-8?q?=20of=20size=2010"=20warnings?=
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Yanjun <[email protected]>
[ Upstream commit e3fe8d28c67bf6c291e920c6d04fa22afa14e6e4 ]
Fix the warnings when building virtio_net driver.
"drivers/net/virtio_net.c: In function ‘init_vqs’:drivers/net/virtio_net.c:4551:48: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Wformat-overflow=]
4551 | sprintf(vi->rq[i].name, "input.%d", i);
| ^~
In function ‘virtnet_find_vqs’,
inlined from ‘init_vqs’ at drivers/net/virtio_net.c:4645:8:drivers/net/virtio_net.c:4551:41: note: directive argument in the range [-2147483643, 65534]
4551 | sprintf(vi->rq[i].name, "input.%d", i);
| ^~~~~~~~~~drivers/net/virtio_net.c:4551:17: note: ‘sprintf’ output between 8 and 18 bytes into a destination of size 16
4551 | sprintf(vi->rq[i].name, "input.%d", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/net/virtio_net.c: In function ‘init_vqs’:drivers/net/virtio_net.c:4552:49: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 9 [-Wformat-overflow=]
4552 | sprintf(vi->sq[i].name, "output.%d", i);
| ^~
In function ‘virtnet_find_vqs’,
inlined from ‘init_vqs’ at drivers/net/virtio_net.c:4645:8:drivers/net/virtio_net.c:4552:41: note: directive argument in the range [-2147483643, 65534]
4552 | sprintf(vi->sq[i].name, "output.%d", i);
| ^~~~~~~~~~~drivers/net/virtio_net.c:4552:17: note: ‘sprintf’ output between 9 and 19 bytes into a destination of size 16
4552 | sprintf(vi->sq[i].name, "output.%d", i);
"
--- drivers/net/virtio_net.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/virtio_net.c +5 -4
@@ -4096,10 +4096,11 @@ static int virtnet_find_vqs(struct virtnet_info *vi) {vq_callback_t **callbacks;struct virtqueue **vqs; -int ret = -ENOMEM ; -int i, total_vqs;const char **names; +int ret = -ENOMEM ; +int total_vqs;bool *ctx; +u16 i;/* We expect 1 RX virtqueue followed by 1 TX virtqueue, followed by * possible N-1 RX/TX queue pairs used in multiqueue mode, followed by
@@ -4136,8 +4137,8 @@ static int virtnet_find_vqs(struct virtnet_info *vi)for (i =0 ; i < vi->max_queue_pairs; i++) { callbacks[rxq2vq (i)] = skb_recv_done; callbacks[txq2vq (i)] = skb_xmit_done; -sprintf (vi->rq[i].name,"input.%d" , i); -sprintf (vi->sq[i].name,"output.%d" , i); +sprintf (vi->rq[i].name,"input.%u" , i); +sprintf (vi->sq[i].name,"output.%u" , i); names[rxq2vq (i)] = vi->rq[i].name; names[txq2vq (i)] = vi->sq[i].name;if (ctx)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 277/353 blk-mq: fix IO hang from sbitmap wakeup race
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
[ Upstream commit 5266caaf5660529e3da53004b8b7174cab6374ed ]
In blk_mq_mark_tag_wait(), __add_wait_queue() may be re-ordered with the following blk_mq_get_driver_tag() in case of getting driver tag failure.
Then in __sbitmap_queue_wake_up(), waitqueue_active() may not observe the added waiter in blk_mq_mark_tag_wait() and wake up nothing, meantime blk_mq_mark_tag_wait() can't get driver tag successfully.
This issue can be reproduced by running the following test in loop, and fio hang can be observed in < 30min when running it on my test VM in laptop.
modprobe -r scsi_debug
modprobe scsi_debug delay=0 dev_size_mb=4096 max_queue=1 host_max_queue=1 submit_queues=4 dev=ls -d /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/*/block/* | head -1 | xargs basename fio --filename=/dev/"$dev" --direct=1 --rw=randrw --bs=4k --iodepth=1 \
--runtime=100 --numjobs=40 --time_based --name=test \
--ioengine=libaio
Fix the issue by adding one explicit barrier in blk_mq_mark_tag_wait(), which is just fine in case of running out of tag.
--- block/blk-mq.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
block/blk-mq.c +16 -0
@@ -1858,6 +1858,22 @@ static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx *hctx, wait->flags &= ~WQ_FLAG_EXCLUSIVE ;__add_wait_queue (wq, wait); +/* +* Add one explicit barrier since blk_mq_get_driver_tag() may +* not imply barrier in case of failure. +* +* Order adding us to wait queue and allocating driver tag. +* +* The pair is the one implied in sbitmap_queue_wake_up() which +* orders clearing sbitmap tag bits and waitqueue_active() in +* __sbitmap_queue_wake_up(), since waitqueue_active() is lockless +* +* Otherwise, re-order of adding wait queue and getting driver tag +* may cause __sbitmap_queue_wake_up() to wake up nothing because +* the waitqueue_active() may not observe us in wait queue. +*/ +smp_mb (); +/* * It's possible that a tag was freed in the window between the * allocation failure and adding the hardware queue to the wait
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 278/353 ceph: reinitialize mds feature bit even when session in open
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Venky Shankar <[email protected]>
[ Upstream commit f48e0342a74d7770cdf1d11894bdc3b6d989b29e ]
Following along the same lines as per the user-space fix. Right now this isn't really an issue with the ceph kernel driver because of the feature bit laginess, however, that can change over time (when the new snaprealm info type is ported to the kernel driver) and depending on the MDS version that's being upgraded can cause message decoding issues - so, fix that early on.
--- fs/ceph/mds_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/mds_client.c +1 -1
@@ -4128,12 +4128,12 @@ static void handle_session(struct ceph_mds_session *session,pr_info_client (cl,"mds%d reconnect success\n" , session->s_mds); + session->s_features = features;if (session->s_state ==CEPH_MDS_SESSION_OPEN ) {pr_notice_client (cl,"mds%d is already opened\n" , session->s_mds); }else { session->s_state =CEPH_MDS_SESSION_OPEN ; - session->s_features = features;renewed_caps (mdsc, session,0 );if (test_bit (CEPHFS_FEATURE_METRIC_COLLECT , &session->s_features))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 279/353 ceph: fix deadlock or deadcode of misusing dget()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiubo Li <[email protected]>
[ Upstream commit b493ad718b1f0357394d2cdecbf00a44a36fa085 ]
The lock order is incorrect between denty and its parent, we should always make sure that the parent get the lock first.
But since this deadcode is never used and the parent dir will always be set from the callers, let's just remove it.
--- fs/ceph/caps.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
fs/ceph/caps.c +3 -6
@@ -4887,13 +4887,15 @@ int ceph_encode_dentry_release(void **p, struct dentry *dentry,struct inode *dir, int mds, int drop, int unless) { - struct dentry *parent = NULL; struct ceph_mds_request_release *rel = *p;struct ceph_dentry_info *di =ceph_dentry (dentry);struct ceph_client *cl;int force =0 ;int ret; +/* This shouldn't happen */ +BUG_ON (!dir); +/* * force an record for the directory caps if we have a dentry lease. * this is racy (can't take i_ceph_lock and d_lock together), but it
@@ -4903,14 +4905,9 @@ int ceph_encode_dentry_release(void **p, struct dentry *dentry,spin_lock (&dentry->d_lock);if (di->lease_session && di->lease_session->s_mds == mds) force =1 ; -if (!dir) { - parent =dget (dentry->d_parent); - dir =d_inode (parent); - }spin_unlock (&dentry->d_lock); ret =ceph_encode_inode_release (p, dir, mds, drop, unless, force); -dput (parent); cl =ceph_inode_to_client (dir);spin_lock (&dentry->d_lock);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 280/353 ceph: fix invalid pointer access if get_quota_realm return ERR_PTR
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenchao Hao <[email protected]>
[ Upstream commit 0f4cf64eabc6e16cfc2704f1960e82dc79d91c8d ]
This issue is reported by smatch that get_quota_realm() might return ERR_PTR but we did not handle it. It's not a immediate bug, while we still should address it to avoid potential bugs if get_quota_realm() is changed to return other ERR_PTR in future.
Set ceph_snap_realm's pointer in get_quota_realm()'s to address this issue, the pointer would be set to NULL if get_quota_realm() failed to get struct ceph_snap_realm, so no ERR_PTR would happen any more.
[ xiubli: minor code style clean up ]
--- fs/ceph/quota.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-)
fs/ceph/quota.c +22 -17
@@ -197,10 +197,10 @@ void ceph_cleanup_quotarealms_inodes(struct ceph_mds_client *mdsc) }/* -* This function walks through the snaprealm for an inode and returns the -* ceph_snap_realm for the first snaprealm that has quotas set (max_files, +* This function walks through the snaprealm for an inode and set the +* realmp with the first snaprealm that has quotas set (max_files, * max_bytes, or any, depending on the 'which_quota' argument). If the root is -* reached, return the root ceph_snap_realm instead. +* reached, set the realmp with the root ceph_snap_realm instead. * * Note that the caller is responsible for calling ceph_put_snap_realm() on the * returned realm.
@@ -211,10 +211,9 @@ void ceph_cleanup_quotarealms_inodes(struct ceph_mds_client *mdsc)* this function will return -EAGAIN; otherwise, the snaprealms walk-through * will be restarted. */ -static struct ceph_snap_realm *get_quota_realm (struct ceph_mds_client *mdsc, -struct inode *inode, -enum quota_get_realm which_quota, -bool retry) +static int get_quota_realm (struct ceph_mds_client *mdsc,struct inode *inode, +enum quota_get_realm which_quota, +struct ceph_snap_realm **realmp,bool retry) {struct ceph_client *cl = mdsc->fsc->client;struct ceph_inode_info *ci =NULL ;
@@ -222,8 +221,10 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,struct inode *in;bool has_quota; +if (realmp) + *realmp =NULL ;if (ceph_snap (inode) !=CEPH_NOSNAP ) -return NULL ; +return 0 ; restart: realm =ceph_inode (inode)->i_snap_realm;
@@ -250,7 +251,7 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,break ;ceph_put_snap_realm (mdsc, realm);if (!retry) -return ERR_PTR (-EAGAIN ); +return -EAGAIN ; goto restart; }
@@ -259,8 +260,11 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,iput (in); next = realm->parent; -if (has_quota || !next) -return realm; +if (has_quota || !next) { +if (realmp) + *realmp = realm; +return 0 ; + }ceph_get_snap_realm (mdsc, next);ceph_put_snap_realm (mdsc, realm);
@@ -269,7 +273,7 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,if (realm)ceph_put_snap_realm (mdsc, realm); -return NULL ; +return 0 ; }bool ceph_quota_is_same_realm (struct inode *old,struct inode *new)
@@ -277,6 +281,7 @@ bool ceph_quota_is_same_realm(struct inode *old, struct inode *new)struct ceph_mds_client *mdsc =ceph_sb_to_mdsc (old->i_sb);struct ceph_snap_realm *old_realm, *new_realm;bool is_same; +int ret; restart:/*
@@ -286,9 +291,9 @@ bool ceph_quota_is_same_realm(struct inode *old, struct inode *new)* dropped and we can then restart the whole operation. */ down_read (&mdsc->snap_rwsem); - old_realm =get_quota_realm (mdsc, old,QUOTA_GET_ANY , true); - new_realm =get_quota_realm (mdsc, new,QUOTA_GET_ANY , false); -if (PTR_ERR (new_realm) == -EAGAIN ) { +get_quota_realm (mdsc, old,QUOTA_GET_ANY , &old_realm, true); + ret =get_quota_realm (mdsc, new,QUOTA_GET_ANY , &new_realm, false); +if (ret == -EAGAIN ) {up_read (&mdsc->snap_rwsem);if (old_realm)ceph_put_snap_realm (mdsc, old_realm);
@@ -492,8 +497,8 @@ bool ceph_quota_update_statfs(struct ceph_fs_client *fsc, struct kstatfs *buf)bool is_updated = false;down_read (&mdsc->snap_rwsem); - realm =get_quota_realm (mdsc,d_inode (fsc->sb->s_root), -QUOTA_GET_MAX_BYTES , true); +get_quota_realm (mdsc,d_inode (fsc->sb->s_root),QUOTA_GET_MAX_BYTES , + &realm, true);up_read (&mdsc->snap_rwsem);if (!realm)return false;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 281/353 drm/amdgpu: fix avg vs input power reporting on smu7
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 25852d4b97572ff62ffee574cb8bb4bc551af23a ]
Hawaii, Bonaire, Fiji, and Tonga support average power, the others support current power.
--- .../gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +16 -1
@@ -3999,6 +3999,7 @@ static int smu7_read_sensor(struct pp_hwmgr *hwmgr, int idx,uint32_t sclk, mclk, activity_percent;uint32_t offset, val_vid;struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); +struct amdgpu_device *adev = hwmgr->adev;/* size must be at least 4 bytes for all sensors */ if (*size <4 )
@@ -4042,7 +4043,21 @@ static int smu7_read_sensor(struct pp_hwmgr *hwmgr, int idx, *size =4 ;return 0 ;case AMDGPU_PP_SENSOR_GPU_INPUT_POWER : -return smu7_get_gpu_power (hwmgr, (uint32_t *)value); +if ((adev->asic_type !=CHIP_HAWAII ) && + (adev->asic_type !=CHIP_BONAIRE ) && + (adev->asic_type !=CHIP_FIJI ) && + (adev->asic_type !=CHIP_TONGA )) +return smu7_get_gpu_power (hwmgr, (uint32_t *)value); +else +return -EOPNOTSUPP ; +case AMDGPU_PP_SENSOR_GPU_AVG_POWER : +if ((adev->asic_type !=CHIP_HAWAII ) && + (adev->asic_type !=CHIP_BONAIRE ) && + (adev->asic_type !=CHIP_FIJI ) && + (adev->asic_type !=CHIP_TONGA )) +return -EOPNOTSUPP ; +else +return smu7_get_gpu_power (hwmgr, (uint32_t *)value);case AMDGPU_PP_SENSOR_VDDGFX :if ((data->vr_config &VRCONF_VDDGFX_MASK ) == (VR_SVI2_PLANE_2 <<VRCONF_VDDGFX_SHIFT ))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 282/353 drm/amd/powerplay: Fix kzalloc parameter ATOM_Tonga_PPM_Table in get_platform_power_management_table()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 6616b5e1999146b1304abe78232af810080c67e3 ]
In 'struct phm_ppm_table *ptr' allocation using kzalloc, an incorrect structure type is passed to sizeof() in kzalloc, larger structure types were used, thus using correct type 'struct phm_ppm_table' fixes the below:
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/process_pptables_v1_0.c:203 get_platform_power_management_table() warn: struct type mismatch 'phm_ppm_table vs _ATOM_Tonga_PPM_Table'
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c +1 -1
@@ -200,7 +200,7 @@ static int get_platform_power_management_table(struct pp_hwmgr *hwmgr, ATOM_Tonga_PPM_Table *atom_ppm_table) { - struct phm_ppm_table *ptr = kzalloc(sizeof(ATOM_Tonga_PPM_Table), GFP_KERNEL); + struct phm_ppm_table *ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);struct phm_ppt_v1_information *pp_table_information = (struct phm_ppt_v1_information *)(hwmgr->pptable);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 283/353 drm/amdgpu: Fix with right return code -EIO in amdgpu_gmc_vram_checking()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit fac4ebd79fed60e79cccafdad45a2bb8d3795044 ]
The amdgpu_gmc_vram_checking() function in emulation checks whether all of the memory range of shared system memory could be accessed by GPU, from this aspect, -EIO is returned for error scenarios.
Fixes the below:drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c:919 gmc_v6_0_hw_init() warn: missing error code? 'r' drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c:1103 gmc_v7_0_hw_init() warn: missing error code? 'r' drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c:1223 gmc_v8_0_hw_init() warn: missing error code? 'r' drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c:2344 gmc_v9_0_hw_init() warn: missing error code? 'r'
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +14 -7
@@ -1045,21 +1045,28 @@ int amdgpu_gmc_vram_checking(struct amdgpu_device *adev)* seconds, so here, we just pick up three parts for emulation. */ ret =memcmp (vram_ptr, cptr,10 ); -if (ret) -return ret; +if (ret) { + ret = -EIO ; + goto release_buffer; + } ret =memcmp (vram_ptr + (size /2 ), cptr,10 ); -if (ret) -return ret; +if (ret) { + ret = -EIO ; + goto release_buffer; + } ret =memcmp (vram_ptr + size -10 , cptr,10 ); -if (ret) -return ret; +if (ret) { + ret = -EIO ; + goto release_buffer; + } +release_buffer:amdgpu_bo_free_kernel (&vram_bo, &vram_gpu, &vram_ptr); -return 0 ; +return ret; } static ssize_t current_memory_partition_show(
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 284/353 drm/amdgpu: Release adev->pm.fw before return in amdgpu_device_need_post()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 8a44fdd3cf91debbd09b43bd2519ad2b2486ccf4 ]
In function 'amdgpu_device_need_post(struct amdgpu_device *adev)' - 'adev->pm.fw' may not be released before return.
Using the function release_firmware() to release adev->pm.fw.
Thus fixing the below:drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1571 amdgpu_device_need_post() warn: 'adev->pm.fw' from request_firmware() not released on lines: 1554.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
@@ -1485,6 +1485,7 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev)return true; fw_ver = *((uint32_t *)adev->pm.fw->data +69 ); +release_firmware (adev->pm.fw);if (fw_ver <0x00160e00 )return true; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 285/353 drm/amdkfd: Fix node NULL check in svm_range_get_range_boundaries()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit d7a254fad873775ce6c32b77796c81e81e6b7f2e ]
Range interval [start, last] is ordered by rb_tree, rb_prev, rb_next return value still needs NULL check, thus modified from "node" to "rb_node".
Fixes the below:drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c:2691 svm_range_get_range_boundaries() warn: can 'node' even be NULL?
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +5 -5
@@ -2680,6 +2680,7 @@ svm_range_get_range_boundaries(struct kfd_process *p, int64_t addr, {struct vm_area_struct *vma;struct interval_tree_node *node; +struct rb_node *rb_node;unsigned long start_limit, end_limit; vma =vma_lookup (p->mm, addr <<PAGE_SHIFT );
@@ -2699,16 +2700,15 @@ svm_range_get_range_boundaries(struct kfd_process *p, int64_t addr,if (node) { end_limit =min (end_limit, node->start);/* Last range that ends before the fault address */ - node =container_of (rb_prev (&node->rb), - struct interval_tree_node, rb); + rb_node =rb_prev (&node->rb); }else {/* Last range must end before addr because * there was no range after addr */ - node =container_of (rb_last (&p->svms.objects.rb_root), - struct interval_tree_node, rb); + rb_node =rb_last (&p->svms.objects.rb_root); } -if (node) { +if (rb_node) { + node = container_of(rb_node, struct interval_tree_node, rb);if (node->last >= addr) {WARN (1 ,"Overlap with prev node and page fault addr\n" );return -EFAULT ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 286/353 i2c: rk3x: Adjust mask/value offset for i2c2 on rv1126
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Lunn <[email protected]>
[ Upstream commit 92a85b7c6262f19c65a1c115cf15f411ba65a57c ]
Rockchip RV1126 is using old style i2c controller, the i2c2 bus uses a non-sequential offset in the grf register for the mask/value bits for this bus.
This patch fixes i2c2 bus on rv1126 SoCs.
--- drivers/i2c/busses/i2c-rk3x.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-rk3x.c +6 -2
@@ -1295,8 +1295,12 @@ static int rk3x_i2c_probe(struct platform_device *pdev)return -EINVAL ; } -/* 27+i: write mask, 11+i: value */ - value =BIT (27 + bus_nr) |BIT (11 + bus_nr); +/* rv1126 i2c2 uses non-sequential write mask 20, value 4 */ +if (i2c->soc_data == &rv1126_soc_data && bus_nr ==2 ) + value =BIT (20 ) |BIT (4 ); +else +/* 27+i: write mask, 11+i: value */ + value =BIT (27 + bus_nr) |BIT (11 + bus_nr); ret =regmap_write (grf, i2c->soc_data->grf_offset, value);if (ret !=0 ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 287/353 perf: Fix the nr_addr_filters fix
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit 388a1fb7da6aaa1970c7e2a7d7fcd983a87a8484 ]
Thomas reported that commit 652ffc2104ec ("perf/core: Fix narrow startup race when creating the perf nr_addr_filters sysfs file") made the entire attribute group vanish, instead of only the nr_addr_filters attribute.
Additionally a stray return.
Insufficient coffee was involved with both writing and merging the patch.
--- kernel/events/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/events/core.c +1 -3
@@ -11434,12 +11434,10 @@ static umode_t pmu_dev_is_visible(struct kobject *kobj, struct attribute *a, intstruct device *dev =kobj_to_dev (kobj);struct pmu *pmu =dev_get_drvdata (dev); -if (!pmu->nr_addr_filters) +if (n ==2 && !pmu->nr_addr_filters)return 0 ;return a->mode; - -return 0 ; }static struct attribute_group pmu_dev_attr_group = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 288/353 wifi: cfg80211: fix RCU dereference in __cfg80211_bss_update
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit 1184950e341c11b6f82bc5b59564411d9537ab27 ]
Replace rcu_dereference() with rcu_access_pointer() since we hold the lock here (and aren't in an RCU critical section).
--- net/wireless/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/scan.c +1 -1
@@ -1865,7 +1865,7 @@ __cfg80211_bss_update(struct cfg80211_registered_device *rdev, &hidden->hidden_list); hidden->refcount++; - ies = (void *)rcu_dereference (new->pub.beacon_ies); + ies = (void *)rcu_access_pointer (new->pub.beacon_ies);rcu_assign_pointer (new->pub.beacon_ies, hidden->pub.beacon_ies);if (ies)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 289/353 drm: using mul_u32_u32() requires linux/math64.h
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Rothwell <[email protected]>
[ Upstream commit 933a2a376fb3f22ba4774f74233571504ac56b02 ]
Some pending include file cleanups produced this error:
In file included from include/linux/kernel.h:27,
from drivers/gpu/ipu-v3/ipu-dp.c:7:
include/drm/drm_color_mgmt.h: In function 'drm_color_lut_extract':include/drm/drm_color_mgmt.h:45:46: error: implicit declaration of function 'mul_u32_u32' [-Werror=implicit-function-declaration]
45 | return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(user_input, (1 << bit_precision) - 1),
| ^~~~~~~~~~~
--- include/drm/drm_color_mgmt.h | 1 + 1 file changed, 1 insertion(+)
include/drm/drm_color_mgmt.h +1 -0
@@ -24,6 +24,7 @@#define __DRM_COLOR_MGMT_H__#include <linux/ctype.h> +#include <linux/math64.h> #include <drm/drm_property.h> struct drm_crtc ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 290/353 drm/msm/dpu: Correct UBWC settings for sc8280xp
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <[email protected]>
[ Upstream commit 0b414c731432917c83353c446e60ee838c9a9cfd ]
The UBWC settings need to match between the display and GPU. When we updated the GPU settings, we forgot to make the corresponding update on the display side.
Patchwork: https://patchwork.freedesktop.org/patch/569817/
--- drivers/gpu/drm/msm/msm_mdss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_mdss.c +1 -1
@@ -545,7 +545,7 @@ static const struct msm_mdss_data sc8280xp_data = { .ubwc_dec_version = UBWC_4_0, .ubwc_swizzle = 6, .ubwc_static = 1, - .highest_bank_bit = 2, + .highest_bank_bit = 3, .macrotile_mode = 1, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 291/353 drm/amdkfd: only flush mes process context if mes support is there
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Kim <[email protected]>
[ Upstream commit 24149412dfc71f7f4a54868702e9145e396263d3 ]
Fix up on mes process context flush to prevent non-mes devices from spamming error messages or running into undefined behaviour during process termination.
--- drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +2 -1
@@ -87,7 +87,8 @@ void kfd_process_dequeue_from_device(struct kfd_process_device *pdd)return ; dev->dqm->ops.process_termination (dev->dqm, &pdd->qpd); -amdgpu_mes_flush_shader_debugger (dev->adev, pdd->proc_ctx_gpu_addr); +if (dev->kfd->shared_resources.enable_mes) +amdgpu_mes_flush_shader_debugger (dev->adev, pdd->proc_ctx_gpu_addr); pdd->already_dequeued = true; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 292/353 riscv: Fix build error on rv32 + XIP
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Ghiti <[email protected]>
[ Upstream commit 66f962d8939fd2ac74de901d30d30310c8ddca79 ]
commit 66f1e6809397 ("riscv: Make XIP bootable again") restricted page offset to the sv39 page offset instead of the default sv57, which makes sense since probably the platforms that target XIP kernels do not support anything else than sv39 and we do not try to find out the largest address space supported on XIP kernels (ie set_satp_mode()).
But PAGE_OFFSET_L3 is not defined for rv32, so fix the build error by restoring the previous behaviour which picks CONFIG_PAGE_OFFSET for rv32.
--- arch/riscv/mm/init.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/riscv/mm/init.c +4 -0
@@ -1060,7 +1060,11 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) kernel_map.virt_addr =KERNEL_LINK_ADDR + kernel_map.virt_offset;#ifdef CONFIG_XIP_KERNEL +#ifdef CONFIG_64BIT kernel_map.page_offset =PAGE_OFFSET_L3 ; +#else + kernel_map.page_offset =_AC (CONFIG_PAGE_OFFSET ,UL ); +#endif kernel_map.xiprom = (uintptr_t )CONFIG_XIP_PHYS_ADDR ; kernel_map.xiprom_sz = (uintptr_t )(&_exiprom) - (uintptr_t )(&_xiprom);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 293/353 scsi: isci: Fix an error code problem in isci_io_request_build()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Hui <[email protected]>
[ Upstream commit 658365c6b0857e6a306436e315a8633937e3af42 ]
Clang static complains that Value stored to 'status' is never read. Return 'status' rather than 'SCI_SUCCESS'.
--- drivers/scsi/isci/request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/isci/request.c +1 -1
@@ -3390,7 +3390,7 @@ static enum sci_status isci_io_request_build(struct isci_host *ihost,return SCI_FAILURE ; } -return SCI_SUCCESS ; +return status; }static struct isci_request *isci_request_from_tag (struct isci_host *ihost,u16 tag)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 294/353 kunit: run test suites only after module initialization completes
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Pagani <[email protected]>
[ Upstream commit a1af6a2bfa0cb46d70b7df5352993e750da6c79b ]
Commit 2810c1e99867 ("kunit: Fix wild-memory-access bug in kunit_free_suite_set()") fixed a wild-memory-access bug that could have happened during the loading phase of test suites built and executed as loadable modules. However, it also introduced a problematic side effect that causes test suites modules to crash when they attempt to register fake devices.
When a module is loaded, it traverses the MODULE_STATE_UNFORMED and MODULE_STATE_COMING states before reaching the normal operating state MODULE_STATE_LIVE. Finally, when the module is removed, it moves to MODULE_STATE_GOING before being released. However, if the loading function load_module() fails between complete_formation() and do_init_module(), the module goes directly from MODULE_STATE_COMING to MODULE_STATE_GOING without passing through MODULE_STATE_LIVE.
This behavior was causing kunit_module_exit() to be called without having first executed kunit_module_init(). Since kunit_module_exit() is responsible for freeing the memory allocated by kunit_module_init() through kunit_filter_suites(), this behavior was resulting in a wild-memory-access bug.
Commit 2810c1e99867 ("kunit: Fix wild-memory-access bug in kunit_free_suite_set()") fixed this issue by running the tests when the module is still in MODULE_STATE_COMING. However, modules in that state are not fully initialized, lacking sysfs kobjects. Therefore, if a test module attempts to register a fake device, it will inevitably crash.
This patch proposes a different approach to fix the original wild-memory-access bug while restoring the normal module execution flow by making kunit_module_exit() able to detect if kunit_module_init() has previously initialized the tests suite set. In this way, test modules can once again register fake devices without crashing.
This behavior is achieved by checking whether mod->kunit_suites is a virtual or direct mapping address. If it is a virtual address, then kunit_module_init() has allocated the suite_set in kunit_filter_suites() using kmalloc_array(). On the contrary, if mod->kunit_suites is still pointing to the original address that was set when looking up the .kunit_test_suites section of the module, then the loading phase has failed and there's no memory to be freed.
v4:
- rebased on 6.8
- noted that kunit_filter_suites() must return a virtual address v3:
- add a comment to clarify why the start address is checked v2:
- add include <linux/mm.h>
--- lib/kunit/executor.c | 4 ++++ lib/kunit/test.c | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
lib/kunit/executor.c +4 -0
@@ -144,6 +144,10 @@ void kunit_free_suite_set(struct kunit_suite_set suite_set)kfree (suite_set.start); } +/* +* Filter and reallocate test suites. Must return the filtered test suites set +* allocated at a valid virtual address or NULL in case of error. +*/ struct kunit_suite_set kunit_filter_suites(const struct kunit_suite_set *suite_set, const char *filter_glob,
lib/kunit/test.c +11 -3
@@ -16,6 +16,7 @@#include <linux/panic.h> #include <linux/sched/debug.h> #include <linux/sched.h> +#include <linux/mm.h> #include "debugfs.h" #include "hooks-impl.h"
@@ -776,12 +777,19 @@ static void kunit_module_exit(struct module *mod) };const char *action =kunit_action (); +/* +* Check if the start address is a valid virtual address to detect +* if the module load sequence has failed and the suite set has not +* been initialized and filtered. +*/ +if (!suite_set.start || !virt_addr_valid (suite_set.start)) +return ; +if (!action)__kunit_test_suites_exit (mod->kunit_suites, mod->num_kunit_suites); -if (suite_set.start) -kunit_free_suite_set (suite_set); +kunit_free_suite_set (suite_set); } static int kunit_module_notify(struct notifier_block *nb, unsigned long val,
@@ -791,12 +799,12 @@ static int kunit_module_notify(struct notifier_block *nb, unsigned long val,switch (val) {case MODULE_STATE_LIVE : +kunit_module_init (mod);break ;case MODULE_STATE_GOING :kunit_module_exit (mod);break ;case MODULE_STATE_COMING : -kunit_module_init (mod);break ;case MODULE_STATE_UNFORMED :break ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 295/353 regulator: ti-abb: dont use devm_platform_ioremap_resource_byname for shared interrupt register
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Romain Naour <[email protected]>
[ Upstream commit a67e1f0bd4564b485e0f0c3ed7f6bf17688be268 ]
We can't use devm_platform_ioremap_resource_byname() to remap the interrupt register that can be shared between regulator-abb-{ivahd,dspeve,gpu} drivers instances.
The combined helper introduce a call to devm_request_mem_region() that creates a new busy resource region on PRM_IRQSTATUS_MPU register (0x4ae06010). The first devm_request_mem_region() call succeeds for regulator-abb-ivahd but fails for the two other regulator-abb-dspeve and regulator-abb-gpu.
# cat /proc/iomem | grep -i 4ae06 4ae06010-4ae06013 : 4ae07e34.regulator-abb-ivahd int-address 4ae06014-4ae06017 : 4ae07ddc.regulator-abb-mpu int-address
regulator-abb-dspeve and regulator-abb-gpu are missing due to devm_request_mem_region() failure (EBUSY):
[ 1.326660] ti_abb 4ae07e30.regulator-abb-dspeve: can't request region for resource [mem 0x4ae06010-0x4ae06013] [ 1.326660] ti_abb: probe of 4ae07e30.regulator-abb-dspeve failed with error -16 [ 1.327239] ti_abb 4ae07de4.regulator-abb-gpu: can't request region for resource [mem 0x4ae06010-0x4ae06013] [ 1.327270] ti_abb: probe of 4ae07de4.regulator-abb-gpu failed with error -16
Quoted 1 line
From
arm/boot/dts/dra7.dtsi:
The abb_mpu is the only instance using its own interrupt register:
(0x4ae06014) PRM_IRQSTATUS_MPU_2, ABB_MPU_DONE_ST (bit 7)
The other tree instances (abb_ivahd, abb_dspeve, abb_gpu) share PRM_IRQSTATUS_MPU register (0x4ae06010) but use different bits ABB_IVA_DONE_ST (bit 30), ABB_DSPEVE_DONE_ST( bit 29) and ABB_GPU_DONE_ST (but 28).
The commit b36c6b1887ff ("regulator: ti-abb: Make use of the helper function devm_ioremap related") overlooked the following comment implicitly explaining why devm_ioremap() is used in this case:
/*
* We may have shared interrupt register offsets which are
* write-1-to-clear between domains ensuring exclusivity. */
Fixes and partially reverts commit b36c6b1887ff ("regulator: ti-abb:
Make use of the helper function devm_ioremap related").
Improve the existing comment to avoid further conversion to devm_platform_ioremap_resource_byname().
--- drivers/regulator/ti-abb-regulator.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/regulator/ti-abb-regulator.c +19 -3
@@ -726,9 +726,25 @@ static int ti_abb_probe(struct platform_device *pdev)return PTR_ERR (abb->setup_reg); } - abb->int_base =devm_platform_ioremap_resource_byname (pdev,"int-address" ); -if (IS_ERR (abb->int_base)) -return PTR_ERR (abb->int_base); + pname ="int-address" ; + res =platform_get_resource_byname (pdev,IORESOURCE_MEM , pname); +if (!res) { +dev_err (dev,"Missing '%s' IO resource\n" , pname); +return -ENODEV ; + } +/* +* The MPU interrupt status register (PRM_IRQSTATUS_MPU) is +* shared between regulator-abb-{ivahd,dspeve,gpu} driver +* instances. Therefore use devm_ioremap() rather than +* devm_platform_ioremap_resource_byname() to avoid busy +* resource region conflicts. +*/ + abb->int_base =devm_ioremap (dev, res->start, +resource_size (res)); +if (!abb->int_base) { +dev_err (dev,"Unable to map '%s'\n" , pname); +return -ENOMEM ; + }/* Map Optional resources */ pname ="efuse-address" ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 296/353 scsi: core: Move scsi_host_busy() out of host lock for waking up EH handler
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
[ Upstream commit 4373534a9850627a2695317944898eb1283a2db0 ]
Inside scsi_eh_wakeup(), scsi_host_busy() is called & checked with host lock every time for deciding if error handler kthread needs to be waken up.
This can be too heavy in case of recovery, such as:
- N hardware queues
- queue depth is M for each hardware queue
- each scsi_host_busy() iterates over (N * M) tag/requests
If recovery is triggered in case that all requests are in-flight, each scsi_eh_wakeup() is strictly serialized, when scsi_eh_wakeup() is called for the last in-flight request, scsi_host_busy() has been run for (N * M -
1) times, and request has been iterated for (N*M - 1) * (N * M) times.
If both N and M are big enough, hard lockup can be triggered on acquiring host lock, and it is observed on mpi3mr(128 hw queues, queue depth 8169).
Fix the issue by calling scsi_host_busy() outside the host lock. We don't need the host lock for getting busy count because host the lock never covers that.
[mkp: Drop unnecessary 'busy' variables pointed out by Bart]
--- drivers/scsi/scsi_error.c | 8 ++++---- drivers/scsi/scsi_lib.c | 2 +- drivers/scsi/scsi_priv.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/scsi_error.c +4 -4
@@ -61,11 +61,11 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd);static enum scsi_disposition scsi_try_to_abort_cmd (const struct scsi_host_template *,struct scsi_cmnd *); -void scsi_eh_wakeup (struct Scsi_Host *shost) +void scsi_eh_wakeup (struct Scsi_Host *shost,unsigned int busy) {lockdep_assert_held (shost->host_lock); -if (scsi_host_busy (shost) == shost->host_failed) { +if (busy == shost->host_failed) {trace_scsi_eh_wakeup (shost);wake_up_process (shost->ehandler); SCSI_LOG_ERROR_RECOVERY(5, shost_printk(KERN_INFO, shost,
@@ -88,7 +88,7 @@ void scsi_schedule_eh(struct Scsi_Host *shost)if (scsi_host_set_state (shost,SHOST_RECOVERY ) ==0 ||scsi_host_set_state (shost,SHOST_CANCEL_RECOVERY ) ==0 ) { shost->host_eh_scheduled++; -scsi_eh_wakeup (shost); +scsi_eh_wakeup (shost,scsi_host_busy (shost)); }spin_unlock_irqrestore (shost->host_lock, flags);
@@ -286,7 +286,7 @@ static void scsi_eh_inc_host_failed(struct rcu_head *head)spin_lock_irqsave (shost->host_lock, flags); shost->host_failed++; -scsi_eh_wakeup (shost); +scsi_eh_wakeup (shost,scsi_host_busy (shost));spin_unlock_irqrestore (shost->host_lock, flags); }
drivers/scsi/scsi_lib.c +1 -1
@@ -280,7 +280,7 @@ static void scsi_dec_host_busy(struct Scsi_Host *shost, struct scsi_cmnd *cmd)if (unlikely (scsi_host_in_recovery (shost))) {spin_lock_irqsave (shost->host_lock, flags);if (shost->host_failed || shost->host_eh_scheduled) -scsi_eh_wakeup (shost); +scsi_eh_wakeup (shost,scsi_host_busy (shost));spin_unlock_irqrestore (shost->host_lock, flags); }rcu_read_unlock ();
drivers/scsi/scsi_priv.h +1 -1
@@ -92,7 +92,7 @@ extern void scmd_eh_abort_handler(struct work_struct *work);extern enum blk_eh_timer_return scsi_timeout (struct request *req);extern int scsi_error_handler (void *host);extern enum scsi_disposition scsi_decide_disposition (struct scsi_cmnd *cmd); -extern void scsi_eh_wakeup (struct Scsi_Host *shost); +extern void scsi_eh_wakeup (struct Scsi_Host *shost,unsigned int busy);extern void scsi_eh_scmd_add (struct scsi_cmnd *); void scsi_eh_ready_devs(struct Scsi_Host *shost, struct list_head *work_q,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 297/353 HID: hidraw: fix a problem of memory leak in hidraw_release()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Hui <[email protected]>
[ Upstream commit a3bdcdd022c68942a774e8e63424cc11c85aab78 ]
'struct hidraw_list' is a circular queue whose head can be smaller than tail. Using 'list->tail != list->head' to release all memory that should be released.
--- drivers/hid/hidraw.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/hid/hidraw.c +5 -2
@@ -357,8 +357,11 @@ static int hidraw_release(struct inode * inode, struct file * file)down_write (&minors_rwsem);spin_lock_irqsave (&hidraw_table[minor]->list_lock, flags); -for (int i = list->tail; i < list->head; i++) -kfree (list->buffer[i].value); +while (list->tail != list->head) { +kfree (list->buffer[list->tail].value); + list->buffer[list->tail].value =NULL ; + list->tail = (list->tail +1 ) & (HIDRAW_BUFFER_SIZE -1 ); + }list_del (&list->node);spin_unlock_irqrestore (&hidraw_table[minor]->list_lock, flags);kfree (list);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 298/353 selftests: net: remove dependency on ebpf tests
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 98cb12eb52a780e682bea8372fdb2912c08132dd ]
Several net tests requires an XDP program build under the ebpf directory, and error out if such program is not available.
That makes running successful net test hard, let's duplicate into the net dir the [very small] program, re-using the existing rules to build it, and finally dropping the bogus dependency.
Stable-dep-of: 4acffb66630a ("selftests: net: explicitly wait for listener ready")
--- tools/testing/selftests/net/Makefile | 5 +++-- tools/testing/selftests/net/udpgro.sh | 4 ++-- tools/testing/selftests/net/udpgro_bench.sh | 4 ++-- tools/testing/selftests/net/udpgro_frglist.sh | 6 +++--- tools/testing/selftests/net/udpgro_fwd.sh | 2 +- tools/testing/selftests/net/veth.sh | 4 ++-- tools/testing/selftests/net/xdp_dummy.c | 13 +++++++++++++ 7 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 tools/testing/selftests/net/xdp_dummy.c
tools/testing/selftests/net/Makefile +3 -2
@@ -84,6 +84,7 @@ TEST_PROGS += sctp_vrf.sh TEST_GEN_FILES += sctp_hello TEST_GEN_FILES += csum TEST_GEN_FILES += nat6to4.o +TEST_GEN_FILES += xdp_dummy.o TEST_GEN_FILES += ip_local_port_range TEST_GEN_FILES += bind_wildcard TEST_PROGS += test_vxlan_mdb.sh
@@ -103,7 +104,7 @@ $(OUTPUT)/tcp_inq: LDLIBS += -lpthread $(OUTPUT)/bind_bhash: LDLIBS += -lpthread $(OUTPUT)/io_uring_zerocopy_tx: CFLAGS += -I../../../include/ -# Rules to generate bpf obj nat6to4.o +# Rules to generate bpf objs CLANG ?= clang SCRATCH_DIR := $(OUTPUT)/tools BUILD_DIR := $(SCRATCH_DIR)/build
@@ -138,7 +139,7 @@ endif CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH)) -$(OUTPUT)/nat6to4.o: nat6to4.c $(BPFOBJ) | $(MAKE_DIRS) +$(OUTPUT)/nat6to4.o $(OUTPUT)/xdp_dummy.o: $(OUTPUT)/%.o : %.c $(BPFOBJ) | $(MAKE_DIRS) $(CLANG) -O2 --target=bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@ $(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \
tools/testing/selftests/net/udpgro.sh +2 -2
@@ -5,7 +5,7 @@ readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" -BPF_FILE="../bpf/xdp_dummy.bpf.o" +BPF_FILE="xdp_dummy.o" # set global exit status, but never reset nonzero one. check_err()
@@ -198,7 +198,7 @@ run_all() { } if [ ! -f ${BPF_FILE} ]; then - echo "Missing ${BPF_FILE}. Build bpf selftest first" + echo "Missing ${BPF_FILE}. Run 'make' first" exit -1 fi
tools/testing/selftests/net/udpgro_bench.sh +2 -2
@@ -5,7 +5,7 @@ readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" -BPF_FILE="../bpf/xdp_dummy.bpf.o" +BPF_FILE="xdp_dummy.o" cleanup() { local -r jobs="$(jobs -p)"
@@ -83,7 +83,7 @@ run_all() { } if [ ! -f ${BPF_FILE} ]; then - echo "Missing ${BPF_FILE}. Build bpf selftest first" + echo "Missing ${BPF_FILE}. Run 'make' first" exit -1 fi
tools/testing/selftests/net/udpgro_frglist.sh +3 -3
@@ -5,7 +5,7 @@ readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" -BPF_FILE="../bpf/xdp_dummy.bpf.o" +BPF_FILE="xdp_dummy.o" cleanup() { local -r jobs="$(jobs -p)"
@@ -84,12 +84,12 @@ run_all() { } if [ ! -f ${BPF_FILE} ]; then - echo "Missing ${BPF_FILE}. Build bpf selftest first" + echo "Missing ${BPF_FILE}. Run 'make' first" exit -1 fi if [ ! -f nat6to4.o ]; then - echo "Missing nat6to4 helper. Build bpf nat6to4.o selftest first" + echo "Missing nat6to4 helper. Run 'make' first" exit -1 fi
tools/testing/selftests/net/udpgro_fwd.sh +1 -1
@@ -1,7 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 -BPF_FILE="../bpf/xdp_dummy.bpf.o" +BPF_FILE="xdp_dummy.o" readonly BASE="ns-$(mktemp -u XXXXXX)" readonly SRC=2 readonly DST=1
tools/testing/selftests/net/veth.sh +2 -2
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 -BPF_FILE="../bpf/xdp_dummy.bpf.o" +BPF_FILE="xdp_dummy.o" readonly STATS="$(mktemp -p /tmp ns-XXXXXX)" readonly BASE=`basename $STATS` readonly SRC=2
@@ -218,7 +218,7 @@ while getopts "hs:" option; do done if [ ! -f ${BPF_FILE} ]; then - echo "Missing ${BPF_FILE}. Build bpf selftest first" + echo "Missing ${BPF_FILE}. Run 'make' first" exit 1 fi
tools/testing/selftests/net/xdp_dummy.c new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +#define KBUILD_MODNAME "xdp_dummy" +#include <linux/bpf.h> +#include <bpf/bpf_helpers.h> + +SEC("xdp") +int xdp_dummy_prog (struct xdp_md *ctx) +{ +return XDP_PASS ; +} + +char _license[] SEC("license") = "GPL";
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 299/353 selftests: net: explicitly wait for listener ready
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 4acffb66630a0e4800880baa61a54ef18047ccd3 ]
The UDP GRO forwarding test still hard-code an arbitrary pause to wait for the UDP listener becoming ready in background.
That causes sporadic failures depending on the host load.
Replace the sleep with the existing helper waiting for the desired port being exposed.
--- tools/testing/selftests/net/udpgro_fwd.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/testing/selftests/net/udpgro_fwd.sh +4 -2
@@ -1,6 +1,8 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +source net_helper.sh + BPF_FILE="xdp_dummy.o" readonly BASE="ns-$(mktemp -u XXXXXX)" readonly SRC=2
@@ -119,7 +121,7 @@ run_test() { ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 8000 ip netns exec $NS_DST ./udpgso_bench_rx -C 1000 -R 10 -n 10 -l 1300 $rx_args & local spid=$! - sleep 0.1 + wait_local_port_listen "$NS_DST" 8000 udp ip netns exec $NS_SRC ./udpgso_bench_tx $family -M 1 -s 13000 -S 1300 -D $dst local retc=$? wait $spid
@@ -168,7 +170,7 @@ run_bench() { ip netns exec $NS_DST bash -c "echo 2 > /sys/class/net/veth$DST/queues/rx-0/rps_cpus" ip netns exec $NS_DST taskset 0x2 ./udpgso_bench_rx -C 1000 -R 10 & local spid=$! - sleep 0.1 + wait_local_port_listen "$NS_DST" 8000 udp ip netns exec $NS_SRC taskset 0x1 ./udpgso_bench_tx $family -l 3 -S 1300 -D $dst local retc=$? wait $spid
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 300/353 gve: Fix skb truesize underestimation
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Praveen Kaligineedi <[email protected]>
[ Upstream commit 534326711000c318fe1523c77308450522baa499 ]
For a skb frag with a newly allocated copy page, the true size is incorrectly set to packet buffer size. It should be set to PAGE_SIZE instead.
--- drivers/net/ethernet/google/gve/gve_rx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/google/gve/gve_rx.c +4 -4
@@ -362,7 +362,7 @@ static enum pkt_hash_types gve_rss_type(__be16 pkt_flags)static struct sk_buff *gve_rx_add_frags (struct napi_struct *napi,struct gve_rx_slot_page_info *page_info, -u16 packet_buffer_size,u16 len, +unsigned int truesize,u16 len,struct gve_rx_ctx *ctx) {u32 offset = page_info->page_offset + page_info->pad;
@@ -395,10 +395,10 @@ static struct sk_buff *gve_rx_add_frags(struct napi_struct *napi,if (skb != ctx->skb_head) { ctx->skb_head->len += len; ctx->skb_head->data_len += len; - ctx->skb_head->truesize += packet_buffer_size; + ctx->skb_head->truesize += truesize; }skb_add_rx_frag (skb, num_frags, page_info->page, - offset, len, packet_buffer_size); + offset, len, truesize);return ctx->skb_head; }
@@ -492,7 +492,7 @@ static struct sk_buff *gve_rx_copy_to_pool(struct gve_rx_ring *rx,memcpy (alloc_page_info.page_address, src, page_info->pad + len); skb =gve_rx_add_frags (napi, &alloc_page_info, - rx->packet_buffer_size, +PAGE_SIZE , len, ctx);u64_stats_update_begin (&rx->statss);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 301/353 net: ethernet: mtk_eth_soc: set DMA coherent mask to get PPE working
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
[ Upstream commit cae1f1c36661f28c92a1db9113961a9ebd61dbaa ]
Set DMA coherent mask to 32-bit which makes PPE offloading engine start working on BPi-R4 which got 4 GiB of RAM.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +4 -1
@@ -4758,7 +4758,10 @@ static int mtk_probe(struct platform_device *pdev) }if (MTK_HAS_CAPS (eth->soc->caps,MTK_36BIT_DMA )) { - err =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (36 )); + err =dma_set_mask (&pdev->dev,DMA_BIT_MASK (36 )); +if (!err) + err =dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 )); +if (err) {dev_err (&pdev->dev,"Wrong DMA config\n" );return -EINVAL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 302/353 net: phy: mediatek-ge-soc: sync driver with MediaTek SDK
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
[ Upstream commit ff63cc2e95065bea978d2db01f7e7356cca3d021 ]
Sync initialization and calibration routines with MediaTek's reference driver. Improves compliance and resolves link stability issues with CH340 IoT devices connected to MT798x built-in PHYs.
--- drivers/net/phy/mediatek-ge-soc.c | 147 ++++++++++++++++-------------- 1 file changed, 81 insertions(+), 66 deletions(-)
drivers/net/phy/mediatek-ge-soc.c +81 -66
@@ -489,7 +489,7 @@ static int tx_r50_fill_result(struct phy_device *phydev, u16 tx_r50_cal_val,u16 reg, val;if (phydev->drv->phy_id ==MTK_GPHY_ID_MT7988 ) - bias =-2 ; + bias =-1 ; val =clamp_val (bias + tx_r50_cal_val,0 ,63 );
@@ -705,6 +705,11 @@ static int tx_vcm_cal_sw(struct phy_device *phydev, u8 rg_txreserve_x)static void mt798x_phy_common_finetune (struct phy_device *phydev) {phy_select_page (phydev,MTK_PHY_PAGE_EXTENDED_52B5 ); +/* SlvDSPreadyTime = 24, MasDSPreadyTime = 24 */ +__phy_write (phydev,0x11 ,0xc71 ); +__phy_write (phydev,0x12 ,0xc ); +__phy_write (phydev,0x10 ,0x8fae ); +/* EnabRandUpdTrig = 1 */ __phy_write (phydev,0x11 ,0x2f00 );__phy_write (phydev,0x12 ,0xe );
@@ -715,15 +720,56 @@ static void mt798x_phy_common_finetune(struct phy_device *phydev)__phy_write (phydev,0x12 ,0x0 );__phy_write (phydev,0x10 ,0x83aa ); -/* TrFreeze = 0 */ +/* FfeUpdGainForce = 1(Enable), FfeUpdGainForceVal = 4 */ +__phy_write (phydev,0x11 ,0x240 ); +__phy_write (phydev,0x12 ,0x0 ); +__phy_write (phydev,0x10 ,0x9680 ); + +/* TrFreeze = 0 (mt7988 default) */ __phy_write (phydev,0x11 ,0x0 );__phy_write (phydev,0x12 ,0x0 );__phy_write (phydev,0x10 ,0x9686 ); +/* SSTrKp100 = 5 */ +/* SSTrKf100 = 6 */ +/* SSTrKp1000Mas = 5 */ +/* SSTrKf1000Mas = 6 */ /* SSTrKp1000Slv = 5 */ +/* SSTrKf1000Slv = 6 */ __phy_write (phydev,0x11 ,0xbaef );__phy_write (phydev,0x12 ,0x2e );__phy_write (phydev,0x10 ,0x968c ); +phy_restore_page (phydev,MTK_PHY_PAGE_STANDARD ,0 ); +} + +static void mt7981_phy_finetune (struct phy_device *phydev) +{ +u16 val[8 ] = {0x01ce ,0x01c1 , +0x020f ,0x0202 , +0x03d0 ,0x03c0 , +0x0013 ,0x0005 }; +int i, k; + +/* 100M eye finetune: +* Keep middle level of TX MLT3 shapper as default. +* Only change TX MLT3 overshoot level here. +*/ +for (k =0 , i =1 ; i <12 ; i++) { +if (i %3 ==0 ) +continue ; +phy_write_mmd (phydev,MDIO_MMD_VEND1 , i, val[k++]); + } + +phy_select_page (phydev,MTK_PHY_PAGE_EXTENDED_52B5 ); +/* ResetSyncOffset = 6 */ +__phy_write (phydev,0x11 ,0x600 ); +__phy_write (phydev,0x12 ,0x0 ); +__phy_write (phydev,0x10 ,0x8fc0 ); + +/* VgaDecRate = 1 */ +__phy_write (phydev,0x11 ,0x4c2a ); +__phy_write (phydev,0x12 ,0x3e ); +__phy_write (phydev,0x10 ,0x8fa4 );/* MrvlTrFix100Kp = 3, MrvlTrFix100Kf = 2, * MrvlTrFix1000Kp = 3, MrvlTrFix1000Kf = 2
@@ -738,7 +784,7 @@ static void mt798x_phy_common_finetune(struct phy_device *phydev)__phy_write (phydev,0x10 ,0x8ec0 );phy_restore_page (phydev,MTK_PHY_PAGE_STANDARD ,0 ); -/* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9*/ +/* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9 */ phy_modify_mmd (phydev,MDIO_MMD_VEND1 ,MTK_PHY_RG_DEV1E_REG234 ,MTK_PHY_TR_OPEN_LOOP_EN_MASK |MTK_PHY_LPF_X_AVERAGE_MASK ,BIT (0 ) |FIELD_PREP (MTK_PHY_LPF_X_AVERAGE_MASK ,0x9 ));
@@ -771,48 +817,6 @@ static void mt798x_phy_common_finetune(struct phy_device *phydev)phy_write_mmd (phydev,MDIO_MMD_VEND1 ,MTK_PHY_LDO_OUTPUT_V ,0x2222 ); } -static void mt7981_phy_finetune (struct phy_device *phydev) -{ -u16 val[8 ] = {0x01ce ,0x01c1 , -0x020f ,0x0202 , -0x03d0 ,0x03c0 , -0x0013 ,0x0005 }; -int i, k; - -/* 100M eye finetune: -* Keep middle level of TX MLT3 shapper as default. -* Only change TX MLT3 overshoot level here. -*/ -for (k =0 , i =1 ; i <12 ; i++) { -if (i %3 ==0 ) -continue ; -phy_write_mmd (phydev,MDIO_MMD_VEND1 , i, val[k++]); - } - -phy_select_page (phydev,MTK_PHY_PAGE_EXTENDED_52B5 ); -/* SlvDSPreadyTime = 24, MasDSPreadyTime = 24 */ -__phy_write (phydev,0x11 ,0xc71 ); -__phy_write (phydev,0x12 ,0xc ); -__phy_write (phydev,0x10 ,0x8fae ); - -/* ResetSyncOffset = 6 */ -__phy_write (phydev,0x11 ,0x600 ); -__phy_write (phydev,0x12 ,0x0 ); -__phy_write (phydev,0x10 ,0x8fc0 ); - -/* VgaDecRate = 1 */ -__phy_write (phydev,0x11 ,0x4c2a ); -__phy_write (phydev,0x12 ,0x3e ); -__phy_write (phydev,0x10 ,0x8fa4 ); - -/* FfeUpdGainForce = 4 */ -__phy_write (phydev,0x11 ,0x240 ); -__phy_write (phydev,0x12 ,0x0 ); -__phy_write (phydev,0x10 ,0x9680 ); - -phy_restore_page (phydev,MTK_PHY_PAGE_STANDARD ,0 ); -} -static void mt7988_phy_finetune (struct phy_device *phydev) {u16 val[12 ] = {0x0187 ,0x01cd ,0x01c8 ,0x0182 ,
@@ -827,17 +831,7 @@ static void mt7988_phy_finetune(struct phy_device *phydev)/* TCT finetune */ phy_write_mmd (phydev,MDIO_MMD_VEND1 ,MTK_PHY_RG_TX_FILTER ,0x5 ); -/* Disable TX power saving */ -phy_modify_mmd (phydev,MDIO_MMD_VEND1 ,MTK_PHY_RXADC_CTRL_RG7 , -MTK_PHY_DA_AD_BUF_BIAS_LP_MASK ,0x3 <<8 ); -phy_select_page (phydev,MTK_PHY_PAGE_EXTENDED_52B5 ); - -/* SlvDSPreadyTime = 24, MasDSPreadyTime = 12 */ -__phy_write (phydev,0x11 ,0x671 ); -__phy_write (phydev,0x12 ,0xc ); -__phy_write (phydev,0x10 ,0x8fae ); -/* ResetSyncOffset = 5 */ __phy_write (phydev,0x11 ,0x500 );__phy_write (phydev,0x12 ,0x0 );
@@ -845,13 +839,27 @@ static void mt7988_phy_finetune(struct phy_device *phydev)/* VgaDecRate is 1 at default on mt7988 */ -phy_restore_page (phydev,MTK_PHY_PAGE_STANDARD ,0 ); +/* MrvlTrFix100Kp = 6, MrvlTrFix100Kf = 7, +* MrvlTrFix1000Kp = 6, MrvlTrFix1000Kf = 7 +*/ +__phy_write (phydev,0x11 ,0xb90a ); +__phy_write (phydev,0x12 ,0x6f ); +__phy_write (phydev,0x10 ,0x8f82 ); + +/* RemAckCntLimitCtrl = 1 */ +__phy_write (phydev,0x11 ,0xfbba ); +__phy_write (phydev,0x12 ,0xc3 ); +__phy_write (phydev,0x10 ,0x87f8 ); -phy_select_page (phydev,MTK_PHY_PAGE_EXTENDED_2A30 ); -/* TxClkOffset = 2 */ -__phy_modify (phydev,MTK_PHY_ANARG_RG ,MTK_PHY_TCLKOFFSET_MASK , -FIELD_PREP (MTK_PHY_TCLKOFFSET_MASK ,0x2 ));phy_restore_page (phydev,MTK_PHY_PAGE_STANDARD ,0 ); + +/* TR_OPEN_LOOP_EN = 1, lpf_x_average = 10 */ +phy_modify_mmd (phydev,MDIO_MMD_VEND1 ,MTK_PHY_RG_DEV1E_REG234 , +MTK_PHY_TR_OPEN_LOOP_EN_MASK |MTK_PHY_LPF_X_AVERAGE_MASK , +BIT (0 ) |FIELD_PREP (MTK_PHY_LPF_X_AVERAGE_MASK ,0xa )); + +/* rg_tr_lpf_cnt_val = 1023 */ +phy_write_mmd (phydev,MDIO_MMD_VEND1 ,MTK_PHY_RG_LPF_CNT_VAL ,0x3ff ); }static void mt798x_phy_eee (struct phy_device *phydev)
@@ -884,11 +892,11 @@ static void mt798x_phy_eee(struct phy_device *phydev)MTK_PHY_LPI_SLV_SEND_TX_EN , FIELD_PREP(MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK, 0x120)); -phy_modify_mmd (phydev,MDIO_MMD_VEND1 ,MTK_PHY_RG_DEV1E_REG239 , -MTK_PHY_LPI_SEND_LOC_TIMER_MASK | -MTK_PHY_LPI_TXPCS_LOC_RCV , -FIELD_PREP (MTK_PHY_LPI_SEND_LOC_TIMER_MASK ,0x117 )); +/* Keep MTK_PHY_LPI_SEND_LOC_TIMER as 375 */ +phy_clear_bits_mmd (phydev,MDIO_MMD_VEND1 ,MTK_PHY_RG_DEV1E_REG239 , +MTK_PHY_LPI_TXPCS_LOC_RCV ); +/* This also fixes some IoT issues, such as CH340 */ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG2C7, MTK_PHY_MAX_GAIN_MASK | MTK_PHY_MIN_GAIN_MASK, FIELD_PREP(MTK_PHY_MAX_GAIN_MASK, 0x8) |
@@ -922,7 +930,7 @@ static void mt798x_phy_eee(struct phy_device *phydev)__phy_write (phydev,0x12 ,0x0 );__phy_write (phydev,0x10 ,0x9690 ); -/* REG_EEE_st2TrKf1000 = 3 */ +/* REG_EEE_st2TrKf1000 = 2 */ __phy_write (phydev,0x11 ,0x114f );__phy_write (phydev,0x12 ,0x2 );__phy_write (phydev,0x10 ,0x969a );
@@ -947,7 +955,7 @@ static void mt798x_phy_eee(struct phy_device *phydev)__phy_write (phydev,0x12 ,0x0 );__phy_write (phydev,0x10 ,0x96b8 ); -/* REGEEE_wake_slv_tr_wait_dfesigdet_en = 1 */ +/* REGEEE_wake_slv_tr_wait_dfesigdet_en = 0 */ __phy_write (phydev,0x11 ,0x1463 );__phy_write (phydev,0x12 ,0x0 );__phy_write (phydev,0x10 ,0x96ca );
@@ -1459,6 +1467,13 @@ static int mt7988_phy_probe(struct phy_device *phydev)if (err)return err; +/* Disable TX power saving at probing to: +* 1. Meet common mode compliance test criteria +* 2. Make sure that TX-VCM calibration works fine +*/ +phy_modify_mmd (phydev,MDIO_MMD_VEND1 ,MTK_PHY_RXADC_CTRL_RG7 , +MTK_PHY_DA_AD_BUF_BIAS_LP_MASK ,0x3 <<8 ); +return mt798x_phy_calibration (phydev); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 303/353 crypto: caam - fix asynchronous hash
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gaurav Jain <[email protected]>
[ Upstream commit c5a2f74db71a849f3a60bc153d684d6d28a0c665 ]
ahash_alg->setkey is updated to ahash_nosetkey in ahash.c
so checking setkey() function to determine hmac algorithm is not valid.
to fix this added is_hmac variable in structure caam_hash_alg to determine whether the algorithm is hmac or not.
--- drivers/crypto/caam/caamalg_qi2.c | 7 +++++-- drivers/crypto/caam/caamhash.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/crypto/caam/caamalg_qi2.c +5 -2
@@ -4545,6 +4545,7 @@ struct caam_hash_alg {struct list_head entry;struct device *dev;int alg_type; +bool is_hmac;struct ahash_alg ahash_alg; };
@@ -4571,7 +4572,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) ctx->dev = caam_hash->dev; -if (alg->setkey) { +if (caam_hash->is_hmac) { ctx->adata.key_dma = dma_map_single_attrs(ctx->dev, ctx->key, ARRAY_SIZE(ctx->key), DMA_TO_DEVICE,
@@ -4611,7 +4612,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm)* For keyed hash algorithms shared descriptors * will be created later in setkey() callback */ -return alg->setkey ?0 :ahash_set_sh_desc (ahash); +return caam_hash->is_hmac ?0 :ahash_set_sh_desc (ahash); }static void caam_hash_cra_exit (struct crypto_tfm *tfm)
@@ -4646,12 +4647,14 @@ static struct caam_hash_alg *caam_hash_alloc(struct device *dev, template->hmac_name);snprintf (alg->cra_driver_name,CRYPTO_MAX_ALG_NAME ,"%s" , template->hmac_driver_name); + t_alg->is_hmac = true; }else {snprintf (alg->cra_name,CRYPTO_MAX_ALG_NAME ,"%s" , template->name);snprintf (alg->cra_driver_name,CRYPTO_MAX_ALG_NAME ,"%s" , template->driver_name); t_alg->ahash_alg.setkey =NULL ; + t_alg->is_hmac = false; } alg->cra_module =THIS_MODULE ; alg->cra_init = caam_hash_cra_init;
drivers/crypto/caam/caamhash.c +5 -2
@@ -1753,6 +1753,7 @@ static struct caam_hash_template driver_hash[] = {struct caam_hash_alg {struct list_head entry;int alg_type; +bool is_hmac;struct ahash_engine_alg ahash_alg; };
@@ -1804,7 +1805,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) }else {if (priv->era >=6 ) { ctx->dir =DMA_BIDIRECTIONAL ; - ctx->key_dir = alg->setkey ?DMA_TO_DEVICE :DMA_NONE ; + ctx->key_dir = caam_hash->is_hmac ?DMA_TO_DEVICE :DMA_NONE ; }else { ctx->dir =DMA_TO_DEVICE ; ctx->key_dir =DMA_NONE ;
@@ -1862,7 +1863,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm)* For keyed hash algorithms shared descriptors * will be created later in setkey() callback */ -return alg->setkey ?0 :ahash_set_sh_desc (ahash); +return caam_hash->is_hmac ?0 :ahash_set_sh_desc (ahash); }static void caam_hash_cra_exit (struct crypto_tfm *tfm)
@@ -1915,12 +1916,14 @@ caam_hash_alloc(struct caam_hash_template *template, template->hmac_name);snprintf (alg->cra_driver_name,CRYPTO_MAX_ALG_NAME ,"%s" , template->hmac_driver_name); + t_alg->is_hmac = true; }else {snprintf (alg->cra_name,CRYPTO_MAX_ALG_NAME ,"%s" , template->name);snprintf (alg->cra_driver_name,CRYPTO_MAX_ALG_NAME ,"%s" , template->driver_name); halg->setkey =NULL ; + t_alg->is_hmac = false; } alg->cra_module =THIS_MODULE ; alg->cra_init = caam_hash_cra_init;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 304/353 selftests: net: add missing config for big tcp tests
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit fcf67d82b8b878bdd95145382be43927bce07ec6 ]
The big_tcp test-case requires a few kernel knobs currently not specified in the net selftests config, causing the following failure:
# selftests: net: big_tcp.sh
# Error: Failed to load TC action module.
# We have an error talking to the kernel
...
# Testing for BIG TCP:
# CLI GSO | GW GRO | GW GSO | SER GRO
# ./big_tcp.sh: line 107: test: !=: unary operator expected
...
# on on on on : [FAIL_on_link1]
Add the missing configs
--- tools/testing/selftests/net/config | 5 +++++ 1 file changed, 5 insertions(+)
tools/testing/selftests/net/config +5 -0
@@ -29,7 +29,9 @@ CONFIG_NF_NAT=m CONFIG_IP6_NF_IPTABLES=m CONFIG_IP_NF_IPTABLES=m CONFIG_IP6_NF_NAT=m +CONFIG_IP6_NF_RAW=m CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_RAW=m CONFIG_IPV6_GRE=m CONFIG_IPV6_SEG6_LWTUNNEL=y CONFIG_L2TP_ETH=m
@@ -45,6 +47,8 @@ CONFIG_NF_TABLES=m CONFIG_NF_TABLES_IPV6=y CONFIG_NF_TABLES_IPV4=y CONFIG_NFT_NAT=m +CONFIG_NETFILTER_XT_MATCH_LENGTH=m +CONFIG_NET_ACT_CT=m CONFIG_NET_ACT_GACT=m CONFIG_NET_CLS_BASIC=m CONFIG_NET_CLS_U32=m
@@ -55,6 +59,7 @@ CONFIG_NET_SCH_HTB=m CONFIG_NET_SCH_FQ=m CONFIG_NET_SCH_ETF=m CONFIG_NET_SCH_NETEM=y +CONFIG_NF_FLOW_TABLE=m CONFIG_PSAMPLE=m CONFIG_TCP_MD5SIG=y CONFIG_TEST_BLACKHOLE_DEV=m
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 305/353 selftests: net: add missing required classifier
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit d3cb3b0088ca92082e2bebc40cc6894a632173e2 ]
the udpgro_fraglist self-test uses the BPF classifiers, but the current net self-test configuration does not include it, causing CI failures:
# selftests: net: udpgro_frglist.sh
# ipv6 # tcp - over veth touching data # -l 4 -6 -D 2001:db8::1 -t rx -4 -t # Error: TC classifier not found. # We have an error talking to the kernel # Error: TC classifier not found. # We have an error talking to the kernel
Add the missing knob.
--- tools/testing/selftests/net/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/config +1 -0
@@ -51,6 +51,7 @@ CONFIG_NETFILTER_XT_MATCH_LENGTH=m CONFIG_NET_ACT_CT=m CONFIG_NET_ACT_GACT=m CONFIG_NET_CLS_BASIC=m +CONFIG_NET_CLS_BPF=m CONFIG_NET_CLS_U32=m CONFIG_NET_IPGRE_DEMUX=m CONFIG_NET_IPGRE=m
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 306/353 selftests: net: give more time for GRO aggregation
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 89abe628375301fedb68770644df845d49018d8b ]
The gro.sh test-case relay on the gro_flush_timeout to ensure that all the segments belonging to any given batch are properly aggregated.
The other end, the sender is a user-space program transmitting each packet with a separate write syscall. A busy host and/or stracing the sender program can make the relevant segments reach the GRO engine after the flush timeout triggers.
Give the GRO flush timeout more slack, to avoid sporadic self-tests failures.
--- tools/testing/selftests/net/setup_veth.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/setup_veth.sh +1 -1
@@ -8,7 +8,7 @@ setup_veth_ns() { local -r ns_mac="$4" [[ -e /var/run/netns/"${ns_name}" ]] || ip netns add "${ns_name}" - echo 100000 > "/sys/class/net/${ns_dev}/gro_flush_timeout" + echo 1000000 > "/sys/class/net/${ns_dev}/gro_flush_timeout" ip link set dev "${ns_dev}" netns "${ns_name}" mtu 65535 ip -netns "${ns_name}" link set dev "${ns_dev}" up
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 307/353 ip6_tunnel: make sure to pull inner header in __ip6_tnl_rcv()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 8d975c15c0cd744000ca386247432d57b21f9df0 ]
syzbot found __ip6_tnl_rcv() could access unitiliazed data [1].
Call pskb_inet_may_pull() to fix this, and initialize ipv6h variable after this call as it can change skb->head.
[1]
BUG: KMSAN: uninit-value in __INET_ECN_decapsulate include/net/inet_ecn.h:253 [inline] BUG: KMSAN: uninit-value in INET_ECN_decapsulate include/net/inet_ecn.h:275 [inline] BUG: KMSAN: uninit-value in IP6_ECN_decapsulate+0x7df/0x1e50 include/net/inet_ecn.h:321 __INET_ECN_decapsulate include/net/inet_ecn.h:253 [inline] INET_ECN_decapsulate include/net/inet_ecn.h:275 [inline] IP6_ECN_decapsulate+0x7df/0x1e50 include/net/inet_ecn.h:321 ip6ip6_dscp_ecn_decapsulate+0x178/0x1b0 net/ipv6/ip6_tunnel.c:727 __ip6_tnl_rcv+0xd4e/0x1590 net/ipv6/ip6_tunnel.c:845 ip6_tnl_rcv+0xce/0x100 net/ipv6/ip6_tunnel.c:888 gre_rcv+0x143f/0x1870 ip6_protocol_deliver_rcu+0xda6/0x2a60 net/ipv6/ip6_input.c:438 ip6_input_finish net/ipv6/ip6_input.c:483 [inline] NF_HOOK include/linux/netfilter.h:314 [inline] ip6_input+0x15d/0x430 net/ipv6/ip6_input.c:492 ip6_mc_input+0xa7e/0xc80 net/ipv6/ip6_input.c:586 dst_input include/net/dst.h:461 [inline] ip6_rcv_finish+0x5db/0x870 net/ipv6/ip6_input.c:79 NF_HOOK include/linux/netfilter.h:314 [inline] ipv6_rcv+0xda/0x390 net/ipv6/ip6_input.c:310 __netif_receive_skb_one_core net/core/dev.c:5532 [inline] __netif_receive_skb+0x1a6/0x5a0 net/core/dev.c:5646 netif_receive_skb_internal net/core/dev.c:5732 [inline] netif_receive_skb+0x58/0x660 net/core/dev.c:5791 tun_rx_batched+0x3ee/0x980 drivers/net/tun.c:1555 tun_get_user+0x53af/0x66d0 drivers/net/tun.c:2002 tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2048 call_write_iter include/linux/fs.h:2084 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0x786/0x1200 fs/read_write.c:590 ksys_write+0x20f/0x4c0 fs/read_write.c:643 __do_sys_write fs/read_write.c:655 [inline] __se_sys_write fs/read_write.c:652 [inline] __x64_sys_write+0x93/0xd0 fs/read_write.c:652 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x6d/0x140 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
Uninit was created at:
slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768 slab_alloc_node mm/slub.c:3478 [inline] kmem_cache_alloc_node+0x5e9/0xb10 mm/slub.c:3523 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:560 __alloc_skb+0x318/0x740 net/core/skbuff.c:651 alloc_skb include/linux/skbuff.h:1286 [inline] alloc_skb_with_frags+0xc8/0xbd0 net/core/skbuff.c:6334 sock_alloc_send_pskb+0xa80/0xbf0 net/core/sock.c:2787 tun_alloc_skb drivers/net/tun.c:1531 [inline] tun_get_user+0x1e8a/0x66d0 drivers/net/tun.c:1846 tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2048 call_write_iter include/linux/fs.h:2084 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0x786/0x1200 fs/read_write.c:590 ksys_write+0x20f/0x4c0 fs/read_write.c:643 __do_sys_write fs/read_write.c:655 [inline] __se_sys_write fs/read_write.c:652 [inline] __x64_sys_write+0x93/0xd0 fs/read_write.c:652 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x6d/0x140 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b CPU: 0 PID: 5034 Comm: syz-executor331 Not tainted 6.7.0-syzkaller-00562-g9f8413c4a66f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
--- net/ipv6/ip6_tunnel.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
net/ipv6/ip6_tunnel.c +18 -3
@@ -796,8 +796,8 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, struct sk_buff *skb), bool log_ecn_err) { -const struct ipv6hdr *ipv6h =ipv6_hdr (skb); -int err; +const struct ipv6hdr *ipv6h; +int nh, err; if ((!(tpi->flags & TUNNEL_CSUM) && (tunnel->parms.i_flags & TUNNEL_CSUM)) ||
@@ -829,7 +829,6 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, goto drop; } - ipv6h =ipv6_hdr (skb); skb->protocol =eth_type_trans (skb, tunnel->dev);skb_postpull_rcsum (skb,eth_hdr (skb),ETH_HLEN ); }else {
@@ -837,7 +836,23 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb,skb_reset_mac_header (skb); } +/* Save offset of outer header relative to skb->head, +* because we are going to reset the network header to the inner header +* and might change skb->head. +*/ + nh =skb_network_header (skb) - skb->head; +skb_reset_network_header (skb); + +if (!pskb_inet_may_pull (skb)) { +DEV_STATS_INC (tunnel->dev, rx_length_errors); +DEV_STATS_INC (tunnel->dev, rx_errors); + goto drop; + } + +/* Get the outer header. */ + ipv6h = (struct ipv6hdr *)(skb->head + nh); +memset (skb->cb,0 ,sizeof (struct inet6_skb_parm ));__skb_tunnel_rx (skb, tunnel->dev, tunnel->net);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 308/353 net: dsa: mt7530: fix 10M/100M speed on MT7988 switch
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
[ Upstream commit dfa988b4c7c3a48bde7c2713308920c7741fff29 ]
Setup PMCR port register for actual speed and duplex on internally connected PHYs of the MT7988 built-in switch. This fixes links with speeds other than 1000M.
--- drivers/net/dsa/mt7530.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/dsa/mt7530.c +1 -2
@@ -2838,8 +2838,7 @@ static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port,/* MT753x MAC works in 1G full duplex mode for all up-clocked * variants. */ -if (interface ==PHY_INTERFACE_MODE_INTERNAL || - interface ==PHY_INTERFACE_MODE_TRGMII || +if (interface ==PHY_INTERFACE_MODE_TRGMII || (phy_interface_mode_is_8023z (interface))) { speed =SPEED_1000 ; duplex =DUPLEX_FULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 309/353 ipmr: fix kernel panic when forwarding mcast packets
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
[ Upstream commit e622502c310f1069fd9f41cd38210553115f610a ]
The stacktrace was:
[ 86.305548] BUG: kernel NULL pointer dereference, address: 0000000000000092 [ 86.306815] #PF: supervisor read access in kernel mode [ 86.307717] #PF: error_code(0x0000) - not-present page [ 86.308624] PGD 0 P4D 0 [ 86.309091] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 86.309883] CPU: 2 PID: 3139 Comm: pimd Tainted: G U 6.8.0-6wind-knet #1 [ 86.311027] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.1-0-g0551a4be2c-prebuilt.qemu-project.org 04/01/2014 [ 86.312728] RIP: 0010:ip_mr_forward (/build/work/knet/net/ipv4/ipmr.c:1985) [ 86.313399] Code: f9 1f 0f 87 85 03 00 00 48 8d 04 5b 48 8d 04 83 49 8d 44 c5 00 48 8b 40 70 48 39 c2 0f 84 d9 00 00 00 49 8b 46 58 48 83 e0 fe <80> b8 92 00 00 00 00 0f 84 55 ff ff ff 49 83 47 38 01 45 85 e4 0f [ 86.316565] RSP: 0018:ffffad21c0583ae0 EFLAGS: 00010246 [ 86.317497] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 [ 86.318596] RDX: ffff9559cb46c000 RSI: 0000000000000000 RDI: 0000000000000000 [ 86.319627] RBP: ffffad21c0583b30 R08: 0000000000000000 R09: 0000000000000000 [ 86.320650] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000001 [ 86.321672] R13: ffff9559c093a000 R14: ffff9559cc00b800 R15: ffff9559c09c1d80 [ 86.322873] FS: 00007f85db661980(0000) GS:ffff955a79d00000(0000) knlGS:0000000000000000 [ 86.324291] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 86.325314] CR2: 0000000000000092 CR3: 000000002f13a000 CR4: 0000000000350ef0 [ 86.326589] Call Trace: [ 86.327036] <TASK> [ 86.327434] ? show_regs (/build/work/knet/arch/x86/kernel/dumpstack.c:479) [ 86.328049] ? __die (/build/work/knet/arch/x86/kernel/dumpstack.c:421 /build/work/knet/arch/x86/kernel/dumpstack.c:434) [ 86.328508] ? page_fault_oops (/build/work/knet/arch/x86/mm/fault.c:707) [ 86.329107] ? do_user_addr_fault (/build/work/knet/arch/x86/mm/fault.c:1264) [ 86.329756] ? srso_return_thunk (/build/work/knet/arch/x86/lib/retpoline.S:223) [ 86.330350] ? __irq_work_queue_local (/build/work/knet/kernel/irq_work.c:111 (discriminator 1)) [ 86.331013] ? exc_page_fault (/build/work/knet/./arch/x86/include/asm/paravirt.h:693 /build/work/knet/arch/x86/mm/fault.c:1515 /build/work/knet/arch/x86/mm/fault.c:1563) [ 86.331702] ? asm_exc_page_fault (/build/work/knet/./arch/x86/include/asm/idtentry.h:570) [ 86.332468] ? ip_mr_forward (/build/work/knet/net/ipv4/ipmr.c:1985) [ 86.333183] ? srso_return_thunk (/build/work/knet/arch/x86/lib/retpoline.S:223) [ 86.333920] ipmr_mfc_add (/build/work/knet/./include/linux/rcupdate.h:782 /build/work/knet/net/ipv4/ipmr.c:1009 /build/work/knet/net/ipv4/ipmr.c:1273) [ 86.334583] ? __pfx_ipmr_hash_cmp (/build/work/knet/net/ipv4/ipmr.c:363) [ 86.335357] ip_mroute_setsockopt (/build/work/knet/net/ipv4/ipmr.c:1470) [ 86.336135] ? srso_return_thunk (/build/work/knet/arch/x86/lib/retpoline.S:223) [ 86.336854] ? ip_mroute_setsockopt (/build/work/knet/net/ipv4/ipmr.c:1470) [ 86.337679] do_ip_setsockopt (/build/work/knet/net/ipv4/ip_sockglue.c:944) [ 86.338408] ? __pfx_unix_stream_read_actor (/build/work/knet/net/unix/af_unix.c:2862) [ 86.339232] ? srso_return_thunk (/build/work/knet/arch/x86/lib/retpoline.S:223) [ 86.339809] ? aa_sk_perm (/build/work/knet/security/apparmor/include/cred.h:153 /build/work/knet/security/apparmor/net.c:181) [ 86.340342] ip_setsockopt (/build/work/knet/net/ipv4/ip_sockglue.c:1415) [ 86.340859] raw_setsockopt (/build/work/knet/net/ipv4/raw.c:836) [ 86.341408] ? security_socket_setsockopt (/build/work/knet/security/security.c:4561 (discriminator 13)) [ 86.342116] sock_common_setsockopt (/build/work/knet/net/core/sock.c:3716) [ 86.342747] do_sock_setsockopt (/build/work/knet/net/socket.c:2313) [ 86.343363] __sys_setsockopt (/build/work/knet/./include/linux/file.h:32 /build/work/knet/net/socket.c:2336) [ 86.344020] __x64_sys_setsockopt (/build/work/knet/net/socket.c:2340) [ 86.344766] do_syscall_64 (/build/work/knet/arch/x86/entry/common.c:52 /build/work/knet/arch/x86/entry/common.c:83) [ 86.345433] ? srso_return_thunk (/build/work/knet/arch/x86/lib/retpoline.S:223) [ 86.346161] ? syscall_exit_work (/build/work/knet/./include/linux/audit.h:357 /build/work/knet/kernel/entry/common.c:160) [ 86.346938] ? srso_return_thunk (/build/work/knet/arch/x86/lib/retpoline.S:223) [ 86.347657] ? syscall_exit_to_user_mode (/build/work/knet/kernel/entry/common.c:215) [ 86.348538] ? srso_return_thunk (/build/work/knet/arch/x86/lib/retpoline.S:223) [ 86.349262] ? do_syscall_64 (/build/work/knet/./arch/x86/include/asm/cpufeature.h:171 /build/work/knet/arch/x86/entry/common.c:98) [ 86.349971] entry_SYSCALL_64_after_hwframe (/build/work/knet/arch/x86/entry/entry_64.S:129)
The original packet in ipmr_cache_report() may be queued and then forwarded with ip_mr_forward(). This last function has the assumption that the skb dst is set.
After the below commit, the skb dst is dropped by ipv4_pktinfo_prepare(), which causes the oops.
--- include/net/ip.h | 2 +- net/ipv4/ip_sockglue.c | 6 ++++-- net/ipv4/ipmr.c | 2 +- net/ipv4/raw.c | 2 +- net/ipv4/udp.c | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-)
include/net/ip.h +1 -1
@@ -761,7 +761,7 @@ int ip_options_rcv_srr(struct sk_buff *skb, struct net_device *dev);* Functions provided by ip_sockglue.c */ -void ipv4_pktinfo_prepare (const struct sock *sk,struct sk_buff *skb); +void ipv4_pktinfo_prepare (const struct sock *sk,struct sk_buff *skb,bool drop_dst);void ip_cmsg_recv_offset (struct msghdr *msg,struct sock *sk,struct sk_buff *skb,int tlen,int offset); int ip_cmsg_send(struct sock *sk, struct msghdr *msg,
net/ipv4/ip_sockglue.c +4 -2
@@ -1366,12 +1366,13 @@ int do_ip_setsockopt(struct sock *sk, int level, int optname,* ipv4_pktinfo_prepare - transfer some info from rtable to skb * @sk: socket * @skb: buffer +* @drop_dst: if true, drops skb dst * * To support IP_CMSG_PKTINFO option, we store rt_iif and specific * destination in skb->cb[] before dst drop. * This way, receiver doesn't make cache line misses to read rtable. */ -void ipv4_pktinfo_prepare (const struct sock *sk,struct sk_buff *skb) +void ipv4_pktinfo_prepare (const struct sock *sk,struct sk_buff *skb,bool drop_dst) {struct in_pktinfo *pktinfo =PKTINFO_SKB_CB (skb); bool prepare = inet_test_bit(PKTINFO, sk) ||
@@ -1400,7 +1401,8 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb) pktinfo->ipi_ifindex =0 ; pktinfo->ipi_spec_dst.s_addr =0 ; } -skb_dst_drop (skb); +if (drop_dst) +skb_dst_drop (skb); } int ip_setsockopt(struct sock *sk, int level, int optname, sockptr_t optval,
net/ipv4/ipmr.c +1 -1
@@ -1073,7 +1073,7 @@ static int ipmr_cache_report(const struct mr_table *mrt, msg = (struct igmpmsg *)skb_network_header (skb); msg->im_vif = vifi; msg->im_vif_hi = vifi >>8 ; -ipv4_pktinfo_prepare (mroute_sk, pkt); +ipv4_pktinfo_prepare (mroute_sk, pkt, false);memcpy (skb->cb, pkt->cb,sizeof (skb->cb));/* Add our header */ igmp =skb_put (skb,sizeof (struct igmphdr ));
net/ipv4/raw.c +1 -1
@@ -292,7 +292,7 @@ static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb)/* Charge it to the socket. */ -ipv4_pktinfo_prepare (sk, skb); +ipv4_pktinfo_prepare (sk, skb, true);if (sock_queue_rcv_skb_reason (sk, skb, &reason) <0 ) {kfree_skb_reason (skb, reason);return NET_RX_DROP ;
net/ipv4/udp.c +1 -1
@@ -2169,7 +2169,7 @@ static int udp_queue_rcv_one_skb(struct sock *sk, struct sk_buff *skb)udp_csum_pull_header (skb); -ipv4_pktinfo_prepare (sk, skb); +ipv4_pktinfo_prepare (sk, skb, true);return __udp_queue_rcv_skb (sk, skb); csum_error:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 310/353 net: lan966x: Fix port configuration when using SGMII interface
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horatiu Vultur <[email protected]>
[ Upstream commit 62b4248105353e7d1debd30ca5c57ec5e5f28e35 ]
In case the interface between the MAC and the PHY is SGMII, then the bit GIGA_MODE on the MAC side needs to be set regardless of the speed at which it is running.
--- drivers/net/ethernet/microchip/lan966x/lan966x_port.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/lan966x/lan966x_port.c +3 -2
@@ -168,9 +168,10 @@ static void lan966x_port_link_up(struct lan966x_port *port)lan966x_taprio_speed_set (port, config->speed);/* Also the GIGA_MODE_ENA(1) needs to be set regardless of the -* port speed for QSGMII ports. +* port speed for QSGMII or SGMII ports. */ -if (phy_interface_num_ports (config->portmode) ==4 ) +if (phy_interface_num_ports (config->portmode) ==4 || + config->portmode ==PHY_INTERFACE_MODE_SGMII ) mode =DEV_MAC_MODE_CFG_GIGA_MODE_ENA_SET (1 ); lan_wr(config->duplex | mode,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 311/353 tracefs: remove stale update_gid code
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
[ Upstream commit 29142dc92c37d3259a33aef15b03e6ee25b0d188 ]
The 'eventfs_update_gid()' function is no longer called, so remove it (and the helper function it uses).
--- fs/tracefs/event_inode.c | 38 -------------------------------------- fs/tracefs/internal.h | 1 - 2 files changed, 39 deletions(-)
fs/tracefs/event_inode.c +0 -38
@@ -273,44 +273,6 @@ static void update_inode_attr(struct dentry *dentry, struct inode *inode, inode->i_gid = attr->gid; } -static void update_gid (struct eventfs_inode *ei,kgid_t gid,int level) -{ -struct eventfs_inode *ei_child; - -/* at most we have events/system/event */ -if (WARN_ON_ONCE (level >3 )) -return ; - - ei->attr.gid = gid; - -if (ei->entry_attrs) { -for (int i =0 ; i < ei->nr_entries; i++) { - ei->entry_attrs[i].gid = gid; - } - } - -/* -* Only eventfs_inode with dentries are updated, make sure -* all eventfs_inodes are updated. If one of the children -* do not have a dentry, this function must traverse it. -*/ -list_for_each_entry_srcu (ei_child, &ei->children, list, -srcu_read_lock_held (&eventfs_srcu)) { -if (!ei_child->dentry) -update_gid (ei_child, gid, level +1 ); - } -} - -void eventfs_update_gid (struct dentry *dentry,kgid_t gid) -{ -struct eventfs_inode *ei = dentry->d_fsdata; -int idx; - - idx =srcu_read_lock (&eventfs_srcu); -update_gid (ei, gid,0 ); -srcu_read_unlock (&eventfs_srcu, idx); -} -/** * create_file - create a file in the tracefs filesystem * @name: the name of the file to create.
fs/tracefs/internal.h +0 -1
@@ -81,7 +81,6 @@ struct inode *tracefs_get_inode(struct super_block *sb);struct dentry *eventfs_start_creating (const char *name,struct dentry *parent);struct dentry *eventfs_failed_creating (struct dentry *dentry);struct dentry *eventfs_end_creating (struct dentry *dentry); -void eventfs_update_gid (struct dentry *dentry,kgid_t gid);void eventfs_set_ei_status_free (struct tracefs_inode *ti,struct dentry *dentry);#endif /* _TRACEFS_INTERNAL_H */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 312/353 tcp: add sanity checks to rx zerocopy
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 577e4432f3ac810049cb7e6b71f4d96ec7c6e894 ]
TCP rx zerocopy intent is to map pages initially allocated from NIC drivers, not pages owned by a fs.
This patch adds to can_map_frag() these additional checks:
- Page must not be a compound one.
- page->mapping must be NULL.
This fixes the panic reported by ZhangPeng.
syzbot was able to loopback packets built with sendfile(), mapping pages owned by an ext4 file to TCP rx zerocopy.
r3 = socket$inet_tcp(0x2, 0x1, 0x0) mmap(&(0x7f0000ff9000/0x4000)=nil, 0x4000, 0x0, 0x12, r3, 0x0) r4 = socket$inet_tcp(0x2, 0x1, 0x0)
bind$inet(r4, &(0x7f0000000000)={0x2, 0x4e24, @multicast1}, 0x10) connect$inet(r4, &(0x7f00000006c0)={0x2, 0x4e24, @empty}, 0x10) r5 = openat$dir(0xffffffffffffff9c, &(0x7f00000000c0)='./file0\x00',
0x181e42, 0x0)
fallocate(r5, 0x0, 0x0, 0x85b8)
sendfile(r4, r5, 0x0, 0x8ba0)
getsockopt$inet_tcp_TCP_ZEROCOPY_RECEIVE(r4, 0x6, 0x23,
&(0x7f00000001c0)={&(0x7f0000ffb000/0x3000)=nil, 0x3000, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0}, &(0x7f0000000440)=0x40)
r6 = openat$dir(0xffffffffffffff9c, &(0x7f00000000c0)='./file0\x00',
0x181e42, 0x0)--- net/ipv4/tcp.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
net/ipv4/tcp.c +11 -1
@@ -1786,7 +1786,17 @@ static skb_frag_t *skb_advance_to_frag(struct sk_buff *skb, u32 offset_skb,static bool can_map_frag (const skb_frag_t *frag) { -return skb_frag_size (frag) ==PAGE_SIZE && !skb_frag_off (frag); +struct page *page; + +if (skb_frag_size (frag) !=PAGE_SIZE ||skb_frag_off (frag)) +return false; + + page =skb_frag_page (frag); + +if (PageCompound (page) || page->mapping) +return false; + +return true; } static int find_next_mappable_frag(const skb_frag_t *frag,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 313/353 e1000e: correct maximum frequency adjustment values
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <[email protected]>
[ Upstream commit f1f6a6b1830a8f1dc92ee26fae76333f446b0663 ]
The e1000e driver supports hardware with a variety of different clock speeds, and thus a variety of different increment values used for programming its PTP hardware clock.
The values currently programmed in e1000e_ptp_init are incorrect. In particular, only two maximum adjustments are used: 24000000 - 1, and 600000000 - 1. These were originally intended to be used with the 96 MHz clock and the 25 MHz clock.
Both of these values are actually slightly too high. For the 96 MHz clock, the actual maximum value that can safely be programmed is 23,999,938. For the 25 MHz clock, the maximum value is 599,999,904.
Worse, several devices use a 24 MHz clock or a 38.4 MHz clock. These parts are incorrectly assigned one of either the 24million or 600million values. For the 24 MHz clock, this is not a significant issue: its current increment value can support an adjustment up to 7billion in the positive direction. However, the 38.4 KHz clock uses an increment value which can only support up to 230,769,157 before it starts overflowing.
To understand where these values come from, consider that frequency adjustments have the form of:
new_incval = base_incval + (base_incval * adjustment) / (unit of adjustment)
The maximum adjustment is reported in terms of parts per billion:new_incval = base_incval + (base_incval * adjustment) / 1 billion
The largest possible adjustment is thus given by the following:max_incval = base_incval + (base_incval * max_adj) / 1 billion
Re-arranging to solve for max_adj:max_adj = (max_incval - base_incval) * 1 billion / base_incval
We also need to ensure that negative adjustments cannot underflow. This can be achieved simply by ensuring max_adj is always less than 1 billion.
Introduce new macros in e1000.h codifying the maximum adjustment in PPB for each frequency given its associated increment values. Also clarify where these values come from by commenting about the above equations.
Replace the switch statement in e1000e_ptp_init with one which mirrors the increment value switch statement from e1000e_get_base_timinica. For each device, assign the appropriate maximum adjustment based on its frequency. Some parts can have one of two frequency modes as determined by E1000_TSYNCRXCTL_SYSCFI.
Since the new flow directly matches the assignments in e1000e_get_base_timinca, and uses well defined macro names, it is much easier to verify that the resulting maximum adjustments are correct. It also avoids difficult to parse construction such as the "hw->mac.type < e1000_phc_lpt", and the use of fallthrough which was especially confusing when combined with a conditional block.
Note that I believe the current increment value configuration used for 24MHz clocks is sub-par, as it leaves at least 3 extra bits available in the INCVALUE register. However, fixing that requires more careful review of the clock rate and associated values.
--- drivers/net/ethernet/intel/e1000e/e1000.h | 20 ++++++++++++++++++++ drivers/net/ethernet/intel/e1000e/ptp.c | 22 +++++++++++++++------- 2 files changed, 35 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/e1000e/e1000.h +20 -0
@@ -360,23 +360,43 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca);* As a result, a shift of INCVALUE_SHIFT_n is used to fit a value of * INCVALUE_n into the TIMINCA register allowing 32+8+(24-INCVALUE_SHIFT_n) * bits to count nanoseconds leaving the rest for fractional nonseconds. +* +* Any given INCVALUE also has an associated maximum adjustment value. This +* maximum adjustment value is the largest increase (or decrease) which can be +* safely applied without overflowing the INCVALUE. Since INCVALUE has +* a maximum range of 24 bits, its largest value is 0xFFFFFF. +* +* To understand where the maximum value comes from, consider the following +* equation: +* +* new_incval = base_incval + (base_incval * adjustment) / 1billion +* +* To avoid overflow that means: +* max_incval = base_incval + (base_incval * max_adj) / billion +* +* Re-arranging: +* max_adj = floor(((max_incval - base_incval) * 1billion) / 1billion) */ #define INCVALUE_96MHZ 125#define INCVALUE_SHIFT_96MHZ 17#define INCPERIOD_SHIFT_96MHZ 2#define INCPERIOD_96MHZ (12 >> INCPERIOD_SHIFT_96MHZ) +#define MAX_PPB_96MHZ 23999900/* 23,999,900 ppb */ #define INCVALUE_25MHZ 40#define INCVALUE_SHIFT_25MHZ 18#define INCPERIOD_25MHZ 1 +#define MAX_PPB_25MHZ 599999900/* 599,999,900 ppb */ #define INCVALUE_24MHZ 125#define INCVALUE_SHIFT_24MHZ 14#define INCPERIOD_24MHZ 3 +#define MAX_PPB_24MHZ 999999999/* 999,999,999 ppb */ #define INCVALUE_38400KHZ 26#define INCVALUE_SHIFT_38400KHZ 19#define INCPERIOD_38400KHZ 1 +#define MAX_PPB_38400KHZ 230769100/* 230,769,100 ppb */ /* Another drawback of scaling the incvalue by a large factor is the * 64-bit SYSTIM register overflows more quickly. This is dealt with
drivers/net/ethernet/intel/e1000e/ptp.c +15 -7
@@ -280,8 +280,17 @@ void e1000e_ptp_init(struct e1000_adapter *adapter)switch (hw->mac.type) {case e1000_pch2lan: + adapter->ptp_clock_info.max_adj =MAX_PPB_96MHZ ; +break ;case e1000_pch_lpt: +if (er32 (TSYNCRXCTL ) &E1000_TSYNCRXCTL_SYSCFI ) + adapter->ptp_clock_info.max_adj =MAX_PPB_96MHZ ; +else + adapter->ptp_clock_info.max_adj =MAX_PPB_25MHZ ; +break ;case e1000_pch_spt: + adapter->ptp_clock_info.max_adj =MAX_PPB_24MHZ ; +break ;case e1000_pch_cnp:case e1000_pch_tgp:case e1000_pch_adp:
@@ -289,15 +298,14 @@ void e1000e_ptp_init(struct e1000_adapter *adapter)case e1000_pch_lnp:case e1000_pch_ptp:case e1000_pch_nvp: -if ((hw->mac.type < e1000_pch_lpt) || - (er32 (TSYNCRXCTL ) &E1000_TSYNCRXCTL_SYSCFI )) { - adapter->ptp_clock_info.max_adj =24000000 -1 ; -break ; - } - fallthrough; +if (er32 (TSYNCRXCTL ) &E1000_TSYNCRXCTL_SYSCFI ) + adapter->ptp_clock_info.max_adj =MAX_PPB_24MHZ ; +else + adapter->ptp_clock_info.max_adj =MAX_PPB_38400KHZ ; +break ;case e1000_82574:case e1000_82583: - adapter->ptp_clock_info.max_adj =600000000 -1 ; + adapter->ptp_clock_info.max_adj =MAX_PPB_25MHZ ;break ;default :break ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 314/353 ixgbe: Refactor returning internal error codes
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jedrzej Jagielski <[email protected]>
[ Upstream commit 5795f533f30a80aa0473652876296ebc9129e33a ]
Change returning codes to the kernel ones instead of the internal ones for the entire ixgbe driver.
Stable-dep-of: bbc404d20d1b ("ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()")
--- .../net/ethernet/intel/ixgbe/ixgbe_82598.c | 36 ++--- .../net/ethernet/intel/ixgbe/ixgbe_82599.c | 61 ++++---- .../net/ethernet/intel/ixgbe/ixgbe_common.c | 145 ++++++++---------- .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 26 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c | 34 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h | 1 - drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 84 +++++----- .../net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 39 ----- drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 44 +++--- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 107 +++++++------ 12 files changed, 264 insertions(+), 317 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c +18 -18
@@ -123,14 +123,14 @@ static s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)if (ret_val)return ret_val;if (hw->phy.sfp_type == ixgbe_sfp_type_unknown) -return IXGBE_ERR_SFP_NOT_SUPPORTED ; +return -EOPNOTSUPP ;/* Check to see if SFP+ module is supported */ ret_val =ixgbe_get_sfp_init_sequence_offsets (hw, &list_offset, &data_offset);if (ret_val) -return IXGBE_ERR_SFP_NOT_SUPPORTED ; +return -EOPNOTSUPP ;break ;default :break ;
@@ -213,7 +213,7 @@ static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw,break ;default : -return IXGBE_ERR_LINK_SETUP ; +return -EIO ; }return 0 ;
@@ -283,7 +283,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)/* Validate the water mark configuration */ if (!hw->fc.pause_time) -return IXGBE_ERR_INVALID_LINK_SETTINGS ; +return -EINVAL ;/* Low water mark of zero causes XOFF floods */ for (i =0 ; i <MAX_TRAFFIC_CLASS ; i++) {
@@ -292,7 +292,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)if (!hw->fc.low_water[i] || hw->fc.low_water[i] >= hw->fc.high_water[i]) {hw_dbg (hw,"Invalid water mark configuration\n" ); -return IXGBE_ERR_INVALID_LINK_SETTINGS ; +return -EINVAL ; } } }
@@ -369,7 +369,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)break ;default :hw_dbg (hw,"Flow control param set incorrectly\n" ); -return IXGBE_ERR_CONFIG ; +return -EIO ; }/* Set 802.3x based flow control settings. */
@@ -438,7 +438,7 @@ static s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw,msleep (100 ); }if (!(links_reg &IXGBE_LINKS_KX_AN_COMP )) { - status =IXGBE_ERR_AUTONEG_NOT_COMPLETE ; + status = -EIO ;hw_dbg (hw,"Autonegotiation did not complete.\n" ); } }
@@ -478,7 +478,7 @@ static s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw)if (timeout ==IXGBE_VALIDATE_LINK_READY_TIMEOUT ) {hw_dbg (hw,"Link was indicated but link is down\n" ); -return IXGBE_ERR_LINK_SETUP ; +return -EIO ; }return 0 ;
@@ -594,7 +594,7 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw, speed &= link_capabilities;if (speed ==IXGBE_LINK_SPEED_UNKNOWN ) -return IXGBE_ERR_LINK_SETUP ; +return -EINVAL ;/* Set KX4/KX support according to speed requested */ else if (link_mode == IXGBE_AUTOC_LMS_KX4_AN ||
@@ -701,9 +701,9 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)/* Init PHY and function pointers, perform SFP setup */ phy_status = hw->phy.ops.init (hw); -if (phy_status ==IXGBE_ERR_SFP_NOT_SUPPORTED ) +if (phy_status == -EOPNOTSUPP )return phy_status; -if (phy_status ==IXGBE_ERR_SFP_NOT_PRESENT ) +if (phy_status == -ENOENT ) goto mac_reset_top; hw->phy.ops.reset (hw);
@@ -727,7 +727,7 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)udelay (1 ); }if (ctrl &IXGBE_CTRL_RST ) { - status =IXGBE_ERR_RESET_FAILED ; + status = -EIO ;hw_dbg (hw,"Reset polling failed to complete.\n" ); }
@@ -789,7 +789,7 @@ static s32 ixgbe_set_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)/* Make sure we are using a valid rar index range */ if (rar >= rar_entries) {hw_dbg (hw,"RAR index %d is out of range.\n" , rar); -return IXGBE_ERR_INVALID_ARGUMENT ; +return -EINVAL ; } rar_high =IXGBE_READ_REG (hw,IXGBE_RAH (rar));
@@ -814,7 +814,7 @@ static s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)/* Make sure we are using a valid rar index range */ if (rar >= rar_entries) {hw_dbg (hw,"RAR index %d is out of range.\n" , rar); -return IXGBE_ERR_INVALID_ARGUMENT ; +return -EINVAL ; } rar_high =IXGBE_READ_REG (hw,IXGBE_RAH (rar));
@@ -845,7 +845,7 @@ static s32 ixgbe_set_vfta_82598(struct ixgbe_hw *hw, u32 vlan, u32 vind,u32 vftabyte;if (vlan >4095 ) -return IXGBE_ERR_PARAM ; +return -EINVAL ;/* Determine 32-bit word position in array */ regindex = (vlan >>5 ) &0x7F ;/* upper seven bits */
@@ -964,7 +964,7 @@ static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr, gssr =IXGBE_GSSR_PHY0_SM ;if (hw->mac.ops.acquire_swfw_sync (hw, gssr) !=0 ) -return IXGBE_ERR_SWFW_SYNC ; +return -EBUSY ;if (hw->phy.type == ixgbe_phy_nl) {/*
@@ -993,7 +993,7 @@ static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr,if (sfp_stat !=IXGBE_I2C_EEPROM_STATUS_PASS ) {hw_dbg (hw,"EEPROM read did not pass.\n" ); - status =IXGBE_ERR_SFP_NOT_PRESENT ; + status = -ENOENT ; goto out; }
@@ -1003,7 +1003,7 @@ static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr, *eeprom_data = (u8)(sfp_data >>8 ); }else { - status =IXGBE_ERR_PHY ; + status = -EIO ; } out:
drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c +30 -31
233 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +67 -78
508 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +1 -1
@@ -3370,7 +3370,7 @@ static int ixgbe_get_module_eeprom(struct net_device *dev, {struct ixgbe_adapter *adapter =netdev_priv (dev);struct ixgbe_hw *hw = &adapter->hw; -s32 status =IXGBE_ERR_PHY_ADDR_INVALID ; +s32 status = -EFAULT ;u8 databyte =0xFF ;int i =0 ;
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +13 -13
@@ -5512,7 +5512,7 @@ static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw) {u32 speed;bool autoneg, link_up = false; -int ret =IXGBE_ERR_LINK_SETUP ; +int ret = -EIO ;if (hw->mac.ops.check_link) ret = hw->mac.ops.check_link (hw, &speed, &link_up, false);
@@ -5983,13 +5983,13 @@ void ixgbe_reset(struct ixgbe_adapter *adapter) err = hw->mac.ops.init_hw (hw);switch (err) {case 0 : -case IXGBE_ERR_SFP_NOT_PRESENT : -case IXGBE_ERR_SFP_NOT_SUPPORTED : +case -ENOENT : +case -EOPNOTSUPP :break ; -case IXGBE_ERR_PRIMARY_REQUESTS_PENDING : +case -EALREADY :e_dev_err ("primary disable timed out\n" );break ; -case IXGBE_ERR_EEPROM_VERSION : +case -EACCES :/* We are running on a pre-production device, log a warning */ e_dev_warn ("This device is a pre-production adapter/LOM. " "Please be aware there may be issues associated with "
@@ -7829,10 +7829,10 @@ static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter) adapter->sfp_poll_time = jiffies +IXGBE_SFP_POLL_JIFFIES -1 ; err = hw->phy.ops.identify_sfp (hw); -if (err ==IXGBE_ERR_SFP_NOT_SUPPORTED ) +if (err == -EOPNOTSUPP ) goto sfp_out; -if (err ==IXGBE_ERR_SFP_NOT_PRESENT ) { +if (err == -ENOENT ) {/* If no cable is present, then we need to reset * the next time we find a good cable. */ adapter->flags2 |=IXGBE_FLAG2_SFP_NEEDS_RESET ;
@@ -7858,7 +7858,7 @@ static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter)else err = hw->mac.ops.setup_sfp (hw); -if (err ==IXGBE_ERR_SFP_NOT_SUPPORTED ) +if (err == -EOPNOTSUPP ) goto sfp_out; adapter->flags |=IXGBE_FLAG_NEED_LINK_CONFIG ;
@@ -7867,8 +7867,8 @@ static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter) sfp_out:clear_bit (__IXGBE_IN_SFP_INIT, &adapter->state); -if ((err ==IXGBE_ERR_SFP_NOT_SUPPORTED ) && - (adapter->netdev->reg_state ==NETREG_REGISTERED )) { +if (err == -EOPNOTSUPP && + adapter->netdev->reg_state ==NETREG_REGISTERED ) {e_dev_err ("failed to initialize because an unsupported " "SFP+ module type was detected.\n" ); e_dev_err("Reload the driver after installing a "
@@ -10922,9 +10922,9 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err = hw->mac.ops.reset_hw (hw); hw->phy.reset_if_overtemp = false;ixgbe_set_eee_capable (adapter); -if (err ==IXGBE_ERR_SFP_NOT_PRESENT ) { +if (err == -ENOENT ) { err =0 ; - }else if (err ==IXGBE_ERR_SFP_NOT_SUPPORTED ) { + }else if (err == -EOPNOTSUPP ) {e_dev_err ("failed to load because an unsupported SFP+ or QSFP module type was detected.\n" );e_dev_err ("Reload the driver after installing a supported module.\n" ); goto err_sw_init;
@@ -11143,7 +11143,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* reset the hardware with the new settings */ err = hw->mac.ops.start_hw (hw); -if (err ==IXGBE_ERR_EEPROM_VERSION ) { +if (err == -EACCES ) {/* We are running on a pre-production device, log a warning */ e_dev_warn ("This device is a pre-production adapter/LOM. " "Please be aware there may be issues associated "
drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c +17 -17
@@ -24,7 +24,7 @@ s32 ixgbe_read_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id) size = mbx->size;if (!mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;return mbx->ops->read (hw, msg, size, mbx_id); }
@@ -43,10 +43,10 @@ s32 ixgbe_write_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)struct ixgbe_mbx_info *mbx = &hw->mbx;if (size > mbx->size) -return IXGBE_ERR_MBX ; +return -EINVAL ;if (!mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;return mbx->ops->write (hw, msg, size, mbx_id); }
@@ -63,7 +63,7 @@ s32 ixgbe_check_for_msg(struct ixgbe_hw *hw, u16 mbx_id)struct ixgbe_mbx_info *mbx = &hw->mbx;if (!mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;return mbx->ops->check_for_msg (hw, mbx_id); }
@@ -80,7 +80,7 @@ s32 ixgbe_check_for_ack(struct ixgbe_hw *hw, u16 mbx_id)struct ixgbe_mbx_info *mbx = &hw->mbx;if (!mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;return mbx->ops->check_for_ack (hw, mbx_id); }
@@ -97,7 +97,7 @@ s32 ixgbe_check_for_rst(struct ixgbe_hw *hw, u16 mbx_id)struct ixgbe_mbx_info *mbx = &hw->mbx;if (!mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;return mbx->ops->check_for_rst (hw, mbx_id); }
@@ -115,12 +115,12 @@ static s32 ixgbe_poll_for_msg(struct ixgbe_hw *hw, u16 mbx_id)int countdown = mbx->timeout;if (!countdown || !mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;while (mbx->ops->check_for_msg (hw, mbx_id)) { countdown--;if (!countdown) -return IXGBE_ERR_MBX ; +return -EIO ;udelay (mbx->usec_delay); }
@@ -140,12 +140,12 @@ static s32 ixgbe_poll_for_ack(struct ixgbe_hw *hw, u16 mbx_id)int countdown = mbx->timeout;if (!countdown || !mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ;while (mbx->ops->check_for_ack (hw, mbx_id)) { countdown--;if (!countdown) -return IXGBE_ERR_MBX ; +return -EIO ;udelay (mbx->usec_delay); }
@@ -169,7 +169,7 @@ static s32 ixgbe_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size,s32 ret_val;if (!mbx->ops) -return IXGBE_ERR_MBX ; +return -EIO ; ret_val =ixgbe_poll_for_msg (hw, mbx_id);if (ret_val)
@@ -197,7 +197,7 @@ static s32 ixgbe_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size,/* exit if either we can't write or there isn't a defined timeout */ if (!mbx->ops || !mbx->timeout) -return IXGBE_ERR_MBX ; +return -EIO ;/* send msg */ ret_val = mbx->ops->write (hw, msg, size, mbx_id);
@@ -217,7 +217,7 @@ static s32 ixgbe_check_for_bit_pf(struct ixgbe_hw *hw, u32 mask, s32 index)return 0 ; } -return IXGBE_ERR_MBX ; +return -EIO ; }/**
@@ -238,7 +238,7 @@ static s32 ixgbe_check_for_msg_pf(struct ixgbe_hw *hw, u16 vf_number)return 0 ; } -return IXGBE_ERR_MBX ; +return -EIO ; }/**
@@ -259,7 +259,7 @@ static s32 ixgbe_check_for_ack_pf(struct ixgbe_hw *hw, u16 vf_number)return 0 ; } -return IXGBE_ERR_MBX ; +return -EIO ; }/**
@@ -295,7 +295,7 @@ static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number)return 0 ; } -return IXGBE_ERR_MBX ; +return -EIO ; }/**
@@ -317,7 +317,7 @@ static s32 ixgbe_obtain_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_number)if (p2v_mailbox &IXGBE_PFMAILBOX_PFU )return 0 ; -return IXGBE_ERR_MBX ; +return -EIO ; }/**
drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h +0 -1
@@ -7,7 +7,6 @@#include "ixgbe_type.h" #define IXGBE_VFMAILBOX_SIZE 16/* 16 32 bit words - 64 bytes */ -#define IXGBE_ERR_MBX -100#define IXGBE_VFMAILBOX 0x002FC#define IXGBE_VFMBMEM 0x00200
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +42 -42
321 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +1 -1
@@ -1327,7 +1327,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)break ;default :e_err (drv,"Unhandled Msg %8.8x\n" , msgbuf[0 ]); - retval =IXGBE_ERR_MBX ; + retval = -EIO ;break ; }
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +0 -39
@@ -3665,45 +3665,6 @@ struct ixgbe_info {const u32 *mvals; }; - -/* Error Codes */ -#define IXGBE_ERR_EEPROM -1 -#define IXGBE_ERR_EEPROM_CHECKSUM -2 -#define IXGBE_ERR_PHY -3 -#define IXGBE_ERR_CONFIG -4 -#define IXGBE_ERR_PARAM -5 -#define IXGBE_ERR_MAC_TYPE -6 -#define IXGBE_ERR_UNKNOWN_PHY -7 -#define IXGBE_ERR_LINK_SETUP -8 -#define IXGBE_ERR_ADAPTER_STOPPED -9 -#define IXGBE_ERR_INVALID_MAC_ADDR -10 -#define IXGBE_ERR_DEVICE_NOT_SUPPORTED -11 -#define IXGBE_ERR_PRIMARY_REQUESTS_PENDING -12 -#define IXGBE_ERR_INVALID_LINK_SETTINGS -13 -#define IXGBE_ERR_AUTONEG_NOT_COMPLETE -14 -#define IXGBE_ERR_RESET_FAILED -15 -#define IXGBE_ERR_SWFW_SYNC -16 -#define IXGBE_ERR_PHY_ADDR_INVALID -17 -#define IXGBE_ERR_I2C -18 -#define IXGBE_ERR_SFP_NOT_SUPPORTED -19 -#define IXGBE_ERR_SFP_NOT_PRESENT -20 -#define IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT -21 -#define IXGBE_ERR_NO_SAN_ADDR_PTR -22 -#define IXGBE_ERR_FDIR_REINIT_FAILED -23 -#define IXGBE_ERR_EEPROM_VERSION -24 -#define IXGBE_ERR_NO_SPACE -25 -#define IXGBE_ERR_OVERTEMP -26 -#define IXGBE_ERR_FC_NOT_NEGOTIATED -27 -#define IXGBE_ERR_FC_NOT_SUPPORTED -28 -#define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE -30 -#define IXGBE_ERR_PBA_SECTION -31 -#define IXGBE_ERR_INVALID_ARGUMENT -32 -#define IXGBE_ERR_HOST_INTERFACE_COMMAND -33 -#define IXGBE_ERR_FDIR_CMD_INCOMPLETE -38 -#define IXGBE_ERR_FW_RESP_INVALID -39 -#define IXGBE_ERR_TOKEN_RETRY -40 -#define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF -#define IXGBE_FUSES0_GROUP (_i) (0x11158 + ((_i) * 4))#define IXGBE_FUSES0_300MHZ BIT(5)#define IXGBE_FUSES0_REV_MASK (3u << 6)
drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +22 -22
173 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +53 -54
409 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 315/353 ixgbe: Refactor overtemp event handling
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jedrzej Jagielski <[email protected]>
[ Upstream commit 6c1b4af8c1b20c70dde01e58381685d6a4a1d2c8 ]
Currently ixgbe driver is notified of overheating events via internal IXGBE_ERR_OVERTEMP error code.
Change the approach for handle_lasi() to use freshly introduced is_overtemp function parameter which set when such event occurs. Change check_overtemp() to bool and return true if overtemp event occurs.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 16 +++----- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 21 +++++----- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 4 +- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 41 +++++++++++-------- 5 files changed, 43 insertions(+), 41 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +6 -10
@@ -2756,7 +2756,6 @@ static void ixgbe_check_overtemp_subtask(struct ixgbe_adapter *adapter) {struct ixgbe_hw *hw = &adapter->hw;u32 eicr = adapter->interrupt_event; -s32 rc;if (test_bit (__IXGBE_DOWN, &adapter->state))return ;
@@ -2790,14 +2789,13 @@ static void ixgbe_check_overtemp_subtask(struct ixgbe_adapter *adapter) }/* Check if this is not due to overtemp */ -if (hw->phy.ops.check_overtemp (hw) !=IXGBE_ERR_OVERTEMP ) +if (!hw->phy.ops.check_overtemp (hw))return ;break ;case IXGBE_DEV_ID_X550EM_A_1G_T :case IXGBE_DEV_ID_X550EM_A_1G_T_L : - rc = hw->phy.ops.check_overtemp (hw); -if (rc !=IXGBE_ERR_OVERTEMP ) +if (!hw->phy.ops.check_overtemp (hw))return ;break ;default :
@@ -7938,7 +7936,7 @@ static void ixgbe_service_timer(struct timer_list *t)static void ixgbe_phy_interrupt_subtask (struct ixgbe_adapter *adapter) {struct ixgbe_hw *hw = &adapter->hw; -u32 status; +bool overtemp;if (!(adapter->flags2 &IXGBE_FLAG2_PHY_INTERRUPT ))return ;
@@ -7948,11 +7946,9 @@ static void ixgbe_phy_interrupt_subtask(struct ixgbe_adapter *adapter)if (!hw->phy.ops.handle_lasi)return ; - status = hw->phy.ops.handle_lasi (&adapter->hw); -if (status !=IXGBE_ERR_OVERTEMP ) -return ; - -e_crit (drv,"%s\n" , ixgbe_overheat_msg); + hw->phy.ops.handle_lasi (&adapter->hw, &overtemp); +if (overtemp) +e_crit (drv,"%s\n" , ixgbe_overheat_msg); }static void ixgbe_reset_subtask (struct ixgbe_adapter *adapter)
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +11 -10
@@ -408,8 +408,7 @@ s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw)return status;/* Don't reset PHY if it's shut down due to overtemp. */ -if (!hw->phy.reset_if_overtemp && - (IXGBE_ERR_OVERTEMP == hw->phy.ops.check_overtemp (hw))) +if (!hw->phy.reset_if_overtemp && hw->phy.ops.check_overtemp (hw))return 0 ;/* Blocked by MNG FW so bail */
@@ -2748,22 +2747,24 @@ static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw)* @hw: pointer to hardware structure * * Checks if the LASI temp alarm status was triggered due to overtemp +* +* Return true when an overtemp event detected, otherwise false. **/ -s32 ixgbe_tn_check_overtemp (struct ixgbe_hw *hw) +bool ixgbe_tn_check_overtemp (struct ixgbe_hw *hw) {u16 phy_data =0 ; +u32 status;if (hw->device_id !=IXGBE_DEV_ID_82599_T3_LOM ) -return 0 ; +return false;/* Check that the LASI temp alarm status was triggered */ - hw->phy.ops.read_reg (hw,IXGBE_TN_LASI_STATUS_REG , -MDIO_MMD_PMAPMD , &phy_data); - -if (!(phy_data &IXGBE_TN_LASI_STATUS_TEMP_ALARM )) -return 0 ; + status = hw->phy.ops.read_reg (hw,IXGBE_TN_LASI_STATUS_REG , +MDIO_MMD_PMAPMD , &phy_data); +if (status) +return false; -return IXGBE_ERR_OVERTEMP ; +return !!(phy_data &IXGBE_TN_LASI_STATUS_TEMP_ALARM ); }/** ixgbe_set_copper_phy_power - Control power for copper phy
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h +1 -1
@@ -155,7 +155,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw);s32 ixgbe_get_sfp_init_sequence_offsets (struct ixgbe_hw *hw,u16 *list_offset,u16 *data_offset); -s32 ixgbe_tn_check_overtemp (struct ixgbe_hw *hw); +bool ixgbe_tn_check_overtemp (struct ixgbe_hw *hw);s32 ixgbe_read_i2c_byte_generic (struct ixgbe_hw *hw,u8 byte_offset,u8 dev_addr,u8 *data); s32 ixgbe_read_i2c_byte_generic_unlocked(struct ixgbe_hw *hw, u8 byte_offset,
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +2 -2
@@ -3509,10 +3509,10 @@ struct ixgbe_phy_operations {s32 (*read_i2c_sff8472)(struct ixgbe_hw *,u8 ,u8 *);s32 (*read_i2c_eeprom)(struct ixgbe_hw *,u8 ,u8 *);s32 (*write_i2c_eeprom)(struct ixgbe_hw *,u8 ,u8 ); -s32 (*check_overtemp)(struct ixgbe_hw *); +bool (*check_overtemp)(struct ixgbe_hw *);s32 (*set_phy_power)(struct ixgbe_hw *,bool on);s32 (*enter_lplu)(struct ixgbe_hw *); -s32 (*handle_lasi)(struct ixgbe_hw *hw); +s32 (*handle_lasi)(struct ixgbe_hw *hw,bool *);s32 (*read_i2c_byte_unlocked)(struct ixgbe_hw *,u8 offset,u8 addr,u8 *value); s32 (*write_i2c_byte_unlocked)(struct ixgbe_hw *, u8 offset, u8 addr,
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +23 -18
117 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 316/353 ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit bbc404d20d1b46d89b461918bc44587620eda200 ]
All error handling paths, except this one, go to 'out' where release_swfw_sync() is called.
This call balances the acquire_swfw_sync() call done at the beginning of the function.
Branch to the error handling path in order to correctly release some resources in case of error.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +2 -1
@@ -717,7 +717,8 @@ static s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr, error = (command &IXGBE_SB_IOSF_CTRL_CMPL_ERR_MASK ) >>IXGBE_SB_IOSF_CTRL_CMPL_ERR_SHIFT ;hw_dbg (hw,"Failed to read, error %x\n" , error); -return -EIO ; + ret = -EIO ; + goto out; }if (!ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 317/353 net: dsa: qca8k: fix illegal usage of GPIO
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Vokáč <[email protected]>
[ Upstream commit c44fc98f0a8ffd94fa0bd291928e7e312ffc7ca4 ]
When working with GPIO, its direction must be set either when the GPIO is requested by gpiod_get*() or later on by one of the gpiod_direction_*() functions. Neither of this is done here which results in undefined behavior on some systems.
As the reset GPIO is used right after it is requested here, it makes sense to configure it as GPIOD_OUT_HIGH right away. With that, the following gpiod_set_value_cansleep(1) becomes redundant and can be safely removed.
--- drivers/net/dsa/qca/qca8k-8xxx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/dsa/qca/qca8k-8xxx.c +1 -2
@@ -2049,12 +2049,11 @@ qca8k_sw_probe(struct mdio_device *mdiodev) priv->info =of_device_get_match_data (priv->dev); priv->reset_gpio =devm_gpiod_get_optional (priv->dev,"reset" , -GPIOD_ASIS ); +GPIOD_OUT_HIGH );if (IS_ERR (priv->reset_gpio))return PTR_ERR (priv->reset_gpio);if (priv->reset_gpio) { -gpiod_set_value_cansleep (priv->reset_gpio,1 );/* The active low duration must be greater than 10 ms * and checkpatch.pl wants 20 ms. */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 318/353 ipv6: Ensure natural alignment of const ipv6 loopback and router addresses
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
[ Upstream commit 60365049ccbacd101654a66ddcb299abfabd4fc5 ]
On a parisc64 kernel I sometimes notice this kernel warning:
Kernel unaligned access to 0x40ff8814 at ndisc_send_skb+0xc0/0x4d8
The address 0x40ff8814 points to the in6addr_linklocal_allrouters variable and the warning simply means that some ipv6 function tries to read a 64-bit word directly from the not-64-bit aligned in6addr_linklocal_allrouters variable.
Unaligned accesses are non-critical as the architecture or exception handlers usually will fix it up at runtime. Nevertheless it may trigger a performance penality for some architectures. For details read the "unaligned-memory-access" kernel documentation.
The patch below ensures that the ipv6 loopback and router addresses will always be naturally aligned. This prevents the unaligned accesses for all architectures.
--- net/ipv6/addrconf_core.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
net/ipv6/addrconf_core.c +14 -7
@@ -220,19 +220,26 @@ const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {EXPORT_SYMBOL_GPL (ipv6_stub);/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */ -const struct in6_addr in6addr_loopback =IN6ADDR_LOOPBACK_INIT ; +const struct in6_addr in6addr_loopback__aligned(BITS_PER_LONG/8) + =IN6ADDR_LOOPBACK_INIT ;EXPORT_SYMBOL (in6addr_loopback); -const struct in6_addr in6addr_any =IN6ADDR_ANY_INIT ; +const struct in6_addr in6addr_any__aligned(BITS_PER_LONG/8) + =IN6ADDR_ANY_INIT ;EXPORT_SYMBOL (in6addr_any); -const struct in6_addr in6addr_linklocal_allnodes =IN6ADDR_LINKLOCAL_ALLNODES_INIT ; +const struct in6_addr in6addr_linklocal_allnodes__aligned(BITS_PER_LONG/8) + =IN6ADDR_LINKLOCAL_ALLNODES_INIT ;EXPORT_SYMBOL (in6addr_linklocal_allnodes); -const struct in6_addr in6addr_linklocal_allrouters =IN6ADDR_LINKLOCAL_ALLROUTERS_INIT ; +const struct in6_addr in6addr_linklocal_allrouters__aligned(BITS_PER_LONG/8) + =IN6ADDR_LINKLOCAL_ALLROUTERS_INIT ;EXPORT_SYMBOL (in6addr_linklocal_allrouters); -const struct in6_addr in6addr_interfacelocal_allnodes =IN6ADDR_INTERFACELOCAL_ALLNODES_INIT ; +const struct in6_addr in6addr_interfacelocal_allnodes__aligned(BITS_PER_LONG/8) + =IN6ADDR_INTERFACELOCAL_ALLNODES_INIT ;EXPORT_SYMBOL (in6addr_interfacelocal_allnodes); -const struct in6_addr in6addr_interfacelocal_allrouters =IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT ; +const struct in6_addr in6addr_interfacelocal_allrouters__aligned(BITS_PER_LONG/8) + =IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT ;EXPORT_SYMBOL (in6addr_interfacelocal_allrouters); -const struct in6_addr in6addr_sitelocal_allrouters =IN6ADDR_SITELOCAL_ALLROUTERS_INIT ; +const struct in6_addr in6addr_sitelocal_allrouters__aligned(BITS_PER_LONG/8) + =IN6ADDR_SITELOCAL_ALLROUTERS_INIT ;EXPORT_SYMBOL (in6addr_sitelocal_allrouters);static void snmp6_free_dev (struct inet6_dev *idev)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 319/353 llc: call sock_orphan() at release time
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit aa2b2eb3934859904c287bf5434647ba72e14c1c ]
syzbot reported an interesting trace [1] caused by a stale sk->sk_wq pointer in a closed llc socket.
In commit ff7b11aa481f ("net: socket: set sock->sk to NULL after calling proto_ops::release()") Eric Biggers hinted that some protocols are missing a sock_orphan(), we need to perform a full audit.
In net-next, I plan to clear sock->sk from sock_orphan() and amend Eric patch to add a warning.
[1]
BUG: KASAN: slab-use-after-free in list_empty include/linux/list.h:373 [inline] BUG: KASAN: slab-use-after-free in waitqueue_active include/linux/wait.h:127 [inline] BUG: KASAN: slab-use-after-free in sock_def_write_space_wfree net/core/sock.c:3384 [inline] BUG: KASAN: slab-use-after-free in sock_wfree+0x9a8/0x9d0 net/core/sock.c:2468 Read of size 8 at addr ffff88802f4fc880 by task ksoftirqd/1/27 CPU: 1 PID: 27 Comm: ksoftirqd/1 Not tainted 6.8.0-rc1-syzkaller-00049-g6098d87eaf31 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc4/0x620 mm/kasan/report.c:488 kasan_report+0xda/0x110 mm/kasan/report.c:601 list_empty include/linux/list.h:373 [inline] waitqueue_active include/linux/wait.h:127 [inline] sock_def_write_space_wfree net/core/sock.c:3384 [inline] sock_wfree+0x9a8/0x9d0 net/core/sock.c:2468 skb_release_head_state+0xa3/0x2b0 net/core/skbuff.c:1080 skb_release_all net/core/skbuff.c:1092 [inline] napi_consume_skb+0x119/0x2b0 net/core/skbuff.c:1404 e1000_unmap_and_free_tx_resource+0x144/0x200 drivers/net/ethernet/intel/e1000/e1000_main.c:1970 e1000_clean_tx_irq drivers/net/ethernet/intel/e1000/e1000_main.c:3860 [inline] e1000_clean+0x4a1/0x26e0 drivers/net/ethernet/intel/e1000/e1000_main.c:3801 __napi_poll.constprop.0+0xb4/0x540 net/core/dev.c:6576 napi_poll net/core/dev.c:6645 [inline] net_rx_action+0x956/0xe90 net/core/dev.c:6778 __do_softirq+0x21a/0x8de kernel/softirq.c:553 run_ksoftirqd kernel/softirq.c:921 [inline] run_ksoftirqd+0x31/0x60 kernel/softirq.c:913 smpboot_thread_fn+0x660/0xa10 kernel/smpboot.c:164 kthread+0x2c6/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 </TASK> Allocated by task 5167: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:314 [inline] __kasan_slab_alloc+0x81/0x90 mm/kasan/common.c:340 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3813 [inline] slab_alloc_node mm/slub.c:3860 [inline] kmem_cache_alloc_lru+0x142/0x6f0 mm/slub.c:3879 alloc_inode_sb include/linux/fs.h:3019 [inline] sock_alloc_inode+0x25/0x1c0 net/socket.c:308 alloc_inode+0x5d/0x220 fs/inode.c:260 new_inode_pseudo+0x16/0x80 fs/inode.c:1005 sock_alloc+0x40/0x270 net/socket.c:634 __sock_create+0xbc/0x800 net/socket.c:1535 sock_create net/socket.c:1622 [inline] __sys_socket_create net/socket.c:1659 [inline] __sys_socket+0x14c/0x260 net/socket.c:1706 __do_sys_socket net/socket.c:1720 [inline] __se_sys_socket net/socket.c:1718 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1718 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd3/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b Freed by task 0: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3f/0x60 mm/kasan/generic.c:640 poison_slab_object mm/kasan/common.c:241 [inline] __kasan_slab_free+0x121/0x1b0 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kmem_cache_free+0x129/0x350 mm/slub.c:4363 i_callback+0x43/0x70 fs/inode.c:249 rcu_do_batch kernel/rcu/tree.c:2158 [inline] rcu_core+0x819/0x1680 kernel/rcu/tree.c:2433 __do_softirq+0x21a/0x8de kernel/softirq.c:553 Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 __kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:586 __call_rcu_common.constprop.0+0x9a/0x7b0 kernel/rcu/tree.c:2683 destroy_inode+0x129/0x1b0 fs/inode.c:315 iput_final fs/inode.c:1739 [inline] iput.part.0+0x560/0x7b0 fs/inode.c:1765 iput+0x5c/0x80 fs/inode.c:1755 dentry_unlink_inode+0x292/0x430 fs/dcache.c:400 __dentry_kill+0x1ca/0x5f0 fs/dcache.c:603 dput.part.0+0x4ac/0x9a0 fs/dcache.c:845 dput+0x1f/0x30 fs/dcache.c:835 __fput+0x3b9/0xb70 fs/file_table.c:384 task_work_run+0x14d/0x240 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa8a/0x2ad0 kernel/exit.c:871 do_group_exit+0xd4/0x2a0 kernel/exit.c:1020 __do_sys_exit_group kernel/exit.c:1031 [inline] __se_sys_exit_group kernel/exit.c:1029 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1029 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd3/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b The buggy address belongs to the object at ffff88802f4fc800 which belongs to the cache sock_inode_cache of size 1408
The buggy address is located 128 bytes inside of
freed 1408-byte region [ffff88802f4fc800, ffff88802f4fcd80)
The buggy address belongs to the physical page:
page:ffffea0000bd3e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2f4f8 head:ffffea0000bd3e00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)page_type: 0xffffffff()
raw: 00fff00000000840 ffff888013b06b40 0000000000000000 0000000000000001 raw: 0000000000000000 0000000080150015 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Reclaimable, gfp_mask 0xd20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_RECLAIMABLE), pid 4956, tgid 4956 (sshd), ts 31423924727, free_ts 0 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d0/0x350 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3311 __alloc_pages+0x22f/0x2440 mm/page_alloc.c:4567 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page mm/slub.c:2190 [inline] allocate_slab mm/slub.c:2354 [inline] new_slab+0xcc/0x3a0 mm/slub.c:2407 ___slab_alloc+0x4af/0x19a0 mm/slub.c:3540 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3625 __slab_alloc_node mm/slub.c:3678 [inline] slab_alloc_node mm/slub.c:3850 [inline] kmem_cache_alloc_lru+0x379/0x6f0 mm/slub.c:3879 alloc_inode_sb include/linux/fs.h:3019 [inline] sock_alloc_inode+0x25/0x1c0 net/socket.c:308 alloc_inode+0x5d/0x220 fs/inode.c:260 new_inode_pseudo+0x16/0x80 fs/inode.c:1005 sock_alloc+0x40/0x270 net/socket.c:634 __sock_create+0xbc/0x800 net/socket.c:1535 sock_create net/socket.c:1622 [inline] __sys_socket_create net/socket.c:1659 [inline] __sys_socket+0x14c/0x260 net/socket.c:1706 __do_sys_socket net/socket.c:1720 [inline] __se_sys_socket net/socket.c:1718 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1718 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd3/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
page_owner free stack trace missing
Memory state around the buggy address:
ffff88802f4fc780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88802f4fc800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802f4fc880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88802f4fc900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88802f4fc980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb--- net/llc/af_llc.c | 2 ++ 1 file changed, 2 insertions(+)
net/llc/af_llc.c +2 -0
@@ -226,6 +226,8 @@ static int llc_ui_release(struct socket *sock) }netdev_put (llc->dev, &llc->dev_tracker);sock_put (sk); +sock_orphan (sk); + sock->sk =NULL ;llc_sk_free (sk); out:return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 320/353 selftests: net: Add missing matchall classifier
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit b40f873a7c80dbafbb6f4a7a569f2dcaf969d283 ]
One of the test cases in the test_bridge_backup_port.sh selftest relies on a matchall classifier to drop unrelated traffic so that the Tx drop counter on the VXLAN device will only be incremented as a result of traffic generated by the test.
However, the configuration option for the matchall classifier is missing from the configuration file which might explain the failures we see in the netdev CI [1].
Fix by adding CONFIG_NET_CLS_MATCHALL to the configuration file.
[1]
# Backup nexthop ID - invalid IDs
# -------------------------------
[...]
# TEST: Forwarding out of vx0 [ OK ] # TEST: No forwarding using backup nexthop ID [ OK ] # TEST: Tx drop increased [FAIL] # TEST: IPv6 address family nexthop as backup nexthop [ OK ] # TEST: No forwarding out of swp1 [ OK ] # TEST: Forwarding out of vx0 [ OK ] # TEST: No forwarding using backup nexthop ID [ OK ] # TEST: Tx drop increased [FAIL]
[...]
--- tools/testing/selftests/net/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/config +1 -0
@@ -52,6 +52,7 @@ CONFIG_NET_ACT_CT=m CONFIG_NET_ACT_GACT=m CONFIG_NET_CLS_BASIC=m CONFIG_NET_CLS_BPF=m +CONFIG_NET_CLS_MATCHALL=m CONFIG_NET_CLS_U32=m CONFIG_NET_IPGRE_DEMUX=m CONFIG_NET_IPGRE=m
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 321/353 bridge: mcast: fix disabled snooping after long uptime
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Lüssing <[email protected]>
[ Upstream commit f5c3eb4b7251baba5cd72c9e93920e710ac8194a ]
The original idea of the delay_time check was to not apply multicast snooping too early when an MLD querier appears. And to instead wait at least for MLD reports to arrive before switching from flooding to group based, MLD snooped forwarding, to avoid temporary packet loss.
However in a batman-adv mesh network it was noticed that after 248 days of uptime 32bit MIPS based devices would start to signal that they had stopped applying multicast snooping due to missing queriers - even though they were the elected querier and still sending MLD queries themselves.
While time_is_before_jiffies() generally is safe against jiffies wrap-arounds, like the code comments in jiffies.h explain, it won't be able to track a difference larger than ULONG_MAX/2. With a 32bit large jiffies and one jiffies tick every 10ms (CONFIG_HZ=100) on these MIPS devices running OpenWrt this would result in a difference larger than ULONG_MAX/2 after 248 (= 2^32/100/60/60/24/2) days and time_is_before_jiffies() would then start to return false instead of true. Leading to multicast snooping not being applied to multicast packets anymore.
Fix this issue by using a proper timer_list object which won't have this ULONG_MAX/2 difference limitation.
--- net/bridge/br_multicast.c | 20 +++++++++++++++----- net/bridge/br_private.h | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-)
net/bridge/br_multicast.c +15 -5
@@ -1762,6 +1762,10 @@ static void br_ip6_multicast_querier_expired(struct timer_list *t) }#endif +static void br_multicast_query_delay_expired (struct timer_list *t) +{ +} +static void br_multicast_select_own_querier (struct net_bridge_mcast *brmctx,struct br_ip *ip,struct sk_buff *skb)
@@ -3198,7 +3202,7 @@ br_multicast_update_query_timer(struct net_bridge_mcast *brmctx, unsigned long max_delay) {if (!timer_pending (&query->timer)) - query->delay_time = jiffies + max_delay; +mod_timer (&query->delay_timer, jiffies + max_delay);mod_timer (&query->timer, jiffies + brmctx->multicast_querier_interval); }
@@ -4041,13 +4045,11 @@ void br_multicast_ctx_init(struct net_bridge *br, brmctx->multicast_querier_interval =255 *HZ ; brmctx->multicast_membership_interval =260 *HZ ; - brmctx->ip4_other_query.delay_time =0 ; brmctx->ip4_querier.port_ifidx =0 ;seqcount_spinlock_init (&brmctx->ip4_querier.seq, &br->multicast_lock); brmctx->multicast_igmp_version =2 ;#if IS_ENABLED (CONFIG_IPV6 ) brmctx->multicast_mld_version =1 ; - brmctx->ip6_other_query.delay_time =0 ; brmctx->ip6_querier.port_ifidx =0 ;seqcount_spinlock_init (&brmctx->ip6_querier.seq, &br->multicast_lock);#endif
@@ -4056,6 +4058,8 @@ void br_multicast_ctx_init(struct net_bridge *br, br_ip4_multicast_local_router_expired, 0);timer_setup (&brmctx->ip4_other_query.timer, br_ip4_multicast_querier_expired,0 ); +timer_setup (&brmctx->ip4_other_query.delay_timer, + br_multicast_query_delay_expired,0 );timer_setup (&brmctx->ip4_own_query.timer, br_ip4_multicast_query_expired,0 );#if IS_ENABLED (CONFIG_IPV6 )
@@ -4063,6 +4067,8 @@ void br_multicast_ctx_init(struct net_bridge *br, br_ip6_multicast_local_router_expired, 0);timer_setup (&brmctx->ip6_other_query.timer, br_ip6_multicast_querier_expired,0 ); +timer_setup (&brmctx->ip6_other_query.delay_timer, + br_multicast_query_delay_expired,0 );timer_setup (&brmctx->ip6_own_query.timer, br_ip6_multicast_query_expired,0 );#endif
@@ -4197,10 +4203,12 @@ static void __br_multicast_stop(struct net_bridge_mcast *brmctx) {del_timer_sync (&brmctx->ip4_mc_router_timer);del_timer_sync (&brmctx->ip4_other_query.timer); +del_timer_sync (&brmctx->ip4_other_query.delay_timer);del_timer_sync (&brmctx->ip4_own_query.timer);#if IS_ENABLED (CONFIG_IPV6 )del_timer_sync (&brmctx->ip6_mc_router_timer);del_timer_sync (&brmctx->ip6_other_query.timer); +del_timer_sync (&brmctx->ip6_other_query.delay_timer);del_timer_sync (&brmctx->ip6_own_query.timer);#endif }
@@ -4643,13 +4651,15 @@ int br_multicast_set_querier(struct net_bridge_mcast *brmctx, unsigned long val) max_delay = brmctx->multicast_query_response_interval;if (!timer_pending (&brmctx->ip4_other_query.timer)) - brmctx->ip4_other_query.delay_time = jiffies + max_delay; +mod_timer (&brmctx->ip4_other_query.delay_timer, + jiffies + max_delay);br_multicast_start_querier (brmctx, &brmctx->ip4_own_query);#if IS_ENABLED (CONFIG_IPV6 )if (!timer_pending (&brmctx->ip6_other_query.timer)) - brmctx->ip6_other_query.delay_time = jiffies + max_delay; +mod_timer (&brmctx->ip6_other_query.delay_timer, + jiffies + max_delay);br_multicast_start_querier (brmctx, &brmctx->ip6_own_query);#endif
net/bridge/br_private.h +2 -2
@@ -78,7 +78,7 @@ struct bridge_mcast_own_query {/* other querier */ struct bridge_mcast_other_query {struct timer_list timer; -unsigned long delay_time; +struct timer_list delay_timer; };/* selected querier */
@@ -1155,7 +1155,7 @@ __br_multicast_querier_exists(struct net_bridge_mcast *brmctx, own_querier_enabled = false; } -return time_is_before_jiffies (querier->delay_time) && +return !timer_pending (&querier->delay_timer) && (own_querier_enabled ||timer_pending (&querier->timer)); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 322/353 devlink: Fix referring to hw_addr attribute during state validation
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Parav Pandit <[email protected]>
[ Upstream commit 1a89e24f8bfd3e3562d69709c9d9cd185ded869b ]
When port function state change is requested, and when the driver does not support it, it refers to the hw address attribute instead of state attribute. Seems like a copy paste error.
Fix it by referring to the port function state attribute.
--- net/devlink/port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/devlink/port.c +1 -1
@@ -672,7 +672,7 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port,return -EOPNOTSUPP ; }if (tb[DEVLINK_PORT_FN_ATTR_STATE ] && !ops->port_fn_state_set) { -NL_SET_ERR_MSG_ATTR (extack, tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR ], +NL_SET_ERR_MSG_ATTR (extack, tb[DEVLINK_PORT_FN_ATTR_STATE ],"Function does not support state setting" );return -EOPNOTSUPP ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 323/353 selftests: net: add missing config for GENEVE
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias May <[email protected]>
[ Upstream commit c9ec85153fea6873c52ed4f5055c87263f1b54f9 ]
l2_tos_ttl_inherit.sh verifies the inheritance of tos and ttl for GRETAP, VXLAN and GENEVE.
Before testing it checks if the required module is available and if not skips the tests accordingly.
Currently only GRETAP and VXLAN are tested because the GENEVE module is missing.
--- tools/testing/selftests/net/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/config +1 -0
@@ -19,6 +19,7 @@ CONFIG_BRIDGE_VLAN_FILTERING=y CONFIG_BRIDGE=y CONFIG_CRYPTO_CHACHA20POLY1305=m CONFIG_VLAN_8021Q=y +CONFIG_GENEVE=m CONFIG_IFB=y CONFIG_INET_DIAG=y CONFIG_IP_GRE=m
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 324/353 netfilter: conntrack: correct window scaling with retransmitted SYN
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryan Schaefer <[email protected]>
[ Upstream commit fb366fc7541a1de521ab3df58471746aa793b833 ]
commit c7aab4f17021 ("netfilter: nf_conntrack_tcp: re-init for syn packets only") introduces a bug where SYNs in ORIGINAL direction on reused 5-tuple result in incorrect window scale negotiation. This commit merged the SYN re-initialization and simultaneous open or SYN retransmits cases. Merging this block added the logic in tcp_init_sender() that performed window scale negotiation to the retransmitted syn case. Previously. this would only result in updating the sender's scale and flags. After the merge the additional logic results in improperly clearing the scale in ORIGINAL direction before any packets in the REPLY direction are received. This results in packets incorrectly being marked invalid for being out-of-window.
This can be reproduced with the following trace:
Packet Sequence:
Quoted 2 lines
Flags [S], seq 1687765604, win 62727, options [.. wscale 7], length 0 Flags [S], seq 1944817196, win 62727, options [.. wscale 7], length 0
In order to fix the issue, only evaluate window negotiation for packets in the REPLY direction. This was tested with simultaneous open, fast open, and the above reproduction.
--- net/netfilter/nf_conntrack_proto_tcp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +6 -4
@@ -457,7 +457,8 @@ static void tcp_init_sender(struct ip_ct_tcp_state *sender,const struct sk_buff *skb, unsigned int dataoff, const struct tcphdr *tcph, - u32 end, u32 win) + u32 end, u32 win, + enum ip_conntrack_dir dir) {/* SYN-ACK in reply to a SYN * or SYN from reply direction in simultaneous open.
@@ -471,7 +472,8 @@ static void tcp_init_sender(struct ip_ct_tcp_state *sender,* Both sides must send the Window Scale option * to enable window scaling in either direction. */ -if (!(sender->flags &IP_CT_TCP_FLAG_WINDOW_SCALE && +if (dir ==IP_CT_DIR_REPLY && + !(sender->flags &IP_CT_TCP_FLAG_WINDOW_SCALE && receiver->flags &IP_CT_TCP_FLAG_WINDOW_SCALE )) { sender->td_scale =0 ; receiver->td_scale =0 ;
@@ -542,7 +544,7 @@ tcp_in_window(struct nf_conn *ct, enum ip_conntrack_dir dir,if (tcph->syn) {tcp_init_sender (sender, receiver, skb, dataoff, tcph, - end, win); + end, win, dir);if (!tcph->ack)/* Simultaneous open */ return NFCT_TCP_ACCEPT ;
@@ -585,7 +587,7 @@ tcp_in_window(struct nf_conn *ct, enum ip_conntrack_dir dir,*/ tcp_init_sender (sender, receiver, skb, dataoff, tcph, - end, win); + end, win, dir);if (dir ==IP_CT_DIR_REPLY && !tcph->ack)return NFCT_TCP_ACCEPT ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 325/353 netfilter: nf_tables: restrict tunnel object to NFPROTO_NETDEV
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 776d451648443f9884be4a1b4e38e8faf1c621f9 ]
Bail out on using the tunnel dst template from other than netdev family. Add the infrastructure to check for the family in objects.
--- include/net/netfilter/nf_tables.h | 2 ++ net/netfilter/nf_tables_api.c | 14 +++++++++----- net/netfilter/nft_tunnel.c | 1 + 3 files changed, 12 insertions(+), 5 deletions(-)
include/net/netfilter/nf_tables.h +2 -0
@@ -1322,6 +1322,7 @@ void nft_obj_notify(struct net *net, const struct nft_table *table,* @type: stateful object numeric type * @owner: module owner * @maxattr: maximum netlink attribute +* @family: address family for AF-specific object types * @policy: netlink attribute policy */ struct nft_object_type {
@@ -1331,6 +1332,7 @@ struct nft_object_type {struct list_head list;u32 type;unsigned int maxattr; +u8 family;struct module *owner;const struct nla_policy *policy; };
net/netfilter/nf_tables_api.c +9 -5
@@ -7468,11 +7468,15 @@ static int nft_object_dump(struct sk_buff *skb, unsigned int attr,return -1 ; } -static const struct nft_object_type *__nft_obj_type_get (u32 objtype) +static const struct nft_object_type *__nft_obj_type_get (u32 objtype,u8 family) {const struct nft_object_type *type;list_for_each_entry (type, &nf_tables_objects, list) { +if (type->family !=NFPROTO_UNSPEC && + type->family != family) +continue ; +if (objtype == type->type)return type; }
@@ -7480,11 +7484,11 @@ static const struct nft_object_type *__nft_obj_type_get(u32 objtype) }static const struct nft_object_type * -nft_obj_type_get (struct net *net,u32 objtype) +nft_obj_type_get (struct net *net,u32 objtype,u8 family) {const struct nft_object_type *type; - type =__nft_obj_type_get (objtype); + type =__nft_obj_type_get (objtype, family);if (type !=NULL &&try_module_get (type->owner))return type;
@@ -7577,7 +7581,7 @@ static int nf_tables_newobj(struct sk_buff *skb, const struct nfnl_info *info,if (info->nlh->nlmsg_flags &NLM_F_REPLACE )return -EOPNOTSUPP ; - type =__nft_obj_type_get (objtype); + type =__nft_obj_type_get (objtype, family);if (WARN_ON_ONCE (!type))return -ENOENT ;
@@ -7591,7 +7595,7 @@ static int nf_tables_newobj(struct sk_buff *skb, const struct nfnl_info *info,if (!nft_use_inc (&table->use))return -EMFILE ; - type =nft_obj_type_get (net, objtype); + type =nft_obj_type_get (net, objtype, family);if (IS_ERR (type)) { err =PTR_ERR (type); goto err_type;
net/netfilter/nft_tunnel.c +1 -0
@@ -713,6 +713,7 @@ static const struct nft_object_ops nft_tunnel_obj_ops = {static struct nft_object_type nft_tunnel_obj_type__read_mostly = { .type =NFT_OBJECT_TUNNEL , + .family =NFPROTO_NETDEV , .ops = &nft_tunnel_obj_ops, .maxattr =NFTA_TUNNEL_KEY_MAX , .policy = nft_tunnel_key_policy,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 326/353 netfilter: ipset: fix performance regression in swap operation
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jozsef Kadlecsik <[email protected]>
[ Upstream commit 97f7cf1cd80eeed3b7c808b7c12463295c751001 ]
The patch "netfilter: ipset: fix race condition between swap/destroy and kernel side add/del/test", commit 28628fa9 fixes a race condition. But the synchronize_rcu() added to the swap function unnecessarily slows it down: it can safely be moved to destroy and use call_rcu() instead.
Eric Dumazet pointed out that simply calling the destroy functions as rcu callback does not work: sets with timeout use garbage collectors which need cancelling at destroy which can wait. Therefore the destroy functions are split into two: cancelling garbage collectors safely at executing the command received by netlink and moving the remaining part only into the rcu callback.
--- include/linux/netfilter/ipset/ip_set.h | 4 +++ net/netfilter/ipset/ip_set_bitmap_gen.h | 14 ++++++++-- net/netfilter/ipset/ip_set_core.c | 37 +++++++++++++++++++------ net/netfilter/ipset/ip_set_hash_gen.h | 15 ++++++++-- net/netfilter/ipset/ip_set_list_set.c | 13 +++++++-- 5 files changed, 65 insertions(+), 18 deletions(-)
include/linux/netfilter/ipset/ip_set.h +4 -0
@@ -186,6 +186,8 @@ struct ip_set_type_variant {/* Return true if "b" set is the same as "a" * according to the create set parameters */ bool (*same_set)(const struct ip_set *a,const struct ip_set *b); +/* Cancel ongoing garbage collectors before destroying the set*/ +void (*cancel_gc)(struct ip_set *set);/* Region-locking is used */ bool region_lock; };
@@ -242,6 +244,8 @@ extern void ip_set_type_unregister(struct ip_set_type *set_type);/* A generic IP set */ struct ip_set { +/* For call_cru in destroy */ +struct rcu_head rcu;/* The name of the set */ char name[IPSET_MAXNAMELEN ];/* Lock protecting the set data */
net/netfilter/ipset/ip_set_bitmap_gen.h +11 -3
@@ -28,6 +28,7 @@#define mtype_del IPSET_TOKEN(MTYPE, _del)#define mtype_list IPSET_TOKEN(MTYPE, _list)#define mtype_gc IPSET_TOKEN(MTYPE, _gc) +#define mtype_cancel_gc IPSET_TOKEN(MTYPE, _cancel_gc)#define mtype MTYPE#define get_ext (set, map, id) ((map)->extensions + ((set)->dsize * (id)))
@@ -57,9 +58,6 @@ mtype_destroy(struct ip_set *set) {struct mtype *map = set->data; -if (SET_WITH_TIMEOUT (set)) -del_timer_sync (&map->gc); -if (set->dsize && set->extensions &IPSET_EXT_DESTROY )mtype_ext_cleanup (set);ip_set_free (map->members);
@@ -288,6 +286,15 @@ mtype_gc(struct timer_list *t)add_timer (&map->gc); } +static void +mtype_cancel_gc (struct ip_set *set) +{ +struct mtype *map = set->data; + +if (SET_WITH_TIMEOUT (set)) +del_timer_sync (&map->gc); +} +static const struct ip_set_type_variant mtype = { .kadt = mtype_kadt, .uadt = mtype_uadt,
@@ -301,6 +308,7 @@ static const struct ip_set_type_variant mtype = { .head = mtype_head, .list = mtype_list, .same_set = mtype_same_set, + .cancel_gc = mtype_cancel_gc, };#endif /* __IP_SET_BITMAP_IP_GEN_H */
net/netfilter/ipset/ip_set_core.c +28 -9
@@ -1182,6 +1182,14 @@ ip_set_destroy_set(struct ip_set *set)kfree (set); } +static void +ip_set_destroy_set_rcu (struct rcu_head *head) +{ + struct ip_set *set = container_of(head, struct ip_set, rcu); + +ip_set_destroy_set (set); +} +static int ip_set_destroy (struct sk_buff *skb,const struct nfnl_info *info,const struct nlattr *const attr[]) {
@@ -1193,8 +1201,6 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info,if (unlikely (protocol_min_failed (attr)))return -IPSET_ERR_PROTOCOL ; -/* Must wait for flush to be really finished in list:set */ -rcu_barrier ();/* Commands are serialized and references are * protected by the ip_set_ref_lock.
@@ -1206,8 +1212,10 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info,* counter, so if it's already zero, we can proceed * without holding the lock. */ -read_lock_bh (&ip_set_ref_lock);if (!attr[IPSET_ATTR_SETNAME ]) { +/* Must wait for flush to be really finished in list:set */ +rcu_barrier (); +read_lock_bh (&ip_set_ref_lock);for (i =0 ; i < inst->ip_set_max; i++) { s =ip_set (inst, i);if (s && (s->ref || s->ref_netlink)) {
@@ -1221,6 +1229,8 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, s =ip_set (inst, i);if (s) {ip_set (inst, i) =NULL ; +/* Must cancel garbage collectors */ + s->variant->cancel_gc (s);ip_set_destroy_set (s); } }
@@ -1228,6 +1238,9 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, inst->is_destroyed = false; }else {u32 flags =flag_exist (info->nlh); +u16 features =0 ; + +read_lock_bh (&ip_set_ref_lock); s =find_set_and_id (inst,nla_data (attr[IPSET_ATTR_SETNAME ]), &i);if (!s) {
@@ -1238,10 +1251,16 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, ret = -IPSET_ERR_BUSY ; goto out; } + features = s->type->features;ip_set (inst, i) =NULL ;read_unlock_bh (&ip_set_ref_lock); - -ip_set_destroy_set (s); +if (features &IPSET_TYPE_NAME ) { +/* Must wait for flush to be really finished */ +rcu_barrier (); + } +/* Must cancel garbage collectors */ + s->variant->cancel_gc (s); +call_rcu (&s->rcu, ip_set_destroy_set_rcu); }return 0 ; out:
@@ -1394,9 +1413,6 @@ static int ip_set_swap(struct sk_buff *skb, const struct nfnl_info *info,ip_set (inst, to_id) = from;write_unlock_bh (&ip_set_ref_lock); -/* Make sure all readers of the old set pointers are completed. */ -synchronize_rcu (); -return 0 ; }
@@ -2409,8 +2425,11 @@ ip_set_fini(void) {nf_unregister_sockopt (&so_set);nfnetlink_subsys_unregister (&ip_set_netlink_subsys); -unregister_pernet_subsys (&ip_set_net_ops); + +/* Wait for call_rcu() in destroy */ +rcu_barrier (); +pr_debug ("these are the famous last words\n" ); }
net/netfilter/ipset/ip_set_hash_gen.h +12 -3
@@ -221,6 +221,7 @@ static const union nf_inet_addr zeromask = {};#undef mtype_gc_do#undef mtype_gc#undef mtype_gc_init +#undef mtype_cancel_gc#undef mtype_variant#undef mtype_data_match
@@ -265,6 +266,7 @@ static const union nf_inet_addr zeromask = {};#define mtype_gc_do IPSET_TOKEN(MTYPE, _gc_do)#define mtype_gc IPSET_TOKEN(MTYPE, _gc)#define mtype_gc_init IPSET_TOKEN(MTYPE, _gc_init) +#define mtype_cancel_gc IPSET_TOKEN(MTYPE, _cancel_gc)#define mtype_variant IPSET_TOKEN(MTYPE, _variant)#define mtype_data_match IPSET_TOKEN(MTYPE, _data_match)
@@ -449,9 +451,6 @@ mtype_destroy(struct ip_set *set)struct htype *h = set->data;struct list_head *l, *lt; -if (SET_WITH_TIMEOUT (set)) -cancel_delayed_work_sync (&h->gc.dwork); -mtype_ahash_destroy (set,ipset_dereference_nfnl (h->table), true);list_for_each_safe (l, lt, &h->ad) {list_del (l);
@@ -598,6 +597,15 @@ mtype_gc_init(struct htable_gc *gc)queue_delayed_work (system_power_efficient_wq, &gc->dwork,HZ ); } +static void +mtype_cancel_gc (struct ip_set *set) +{ +struct htype *h = set->data; + +if (SET_WITH_TIMEOUT (set)) +cancel_delayed_work_sync (&h->gc.dwork); +} +static int mtype_add (struct ip_set *set,void *value,const struct ip_set_ext *ext,struct ip_set_ext *mext,u32 flags);
@@ -1440,6 +1448,7 @@ static const struct ip_set_type_variant mtype_variant = { .uref = mtype_uref, .resize = mtype_resize, .same_set = mtype_same_set, + .cancel_gc = mtype_cancel_gc, .region_lock = true, };
net/netfilter/ipset/ip_set_list_set.c +10 -3
@@ -426,9 +426,6 @@ list_set_destroy(struct ip_set *set)struct list_set *map = set->data;struct set_elem *e, *n; -if (SET_WITH_TIMEOUT (set)) -timer_shutdown_sync (&map->gc); -list_for_each_entry_safe (e, n, &map->members, list) {list_del (&e->list);ip_set_put_byindex (map->net, e->id);
@@ -545,6 +542,15 @@ list_set_same_set(const struct ip_set *a, const struct ip_set *b) a->extensions == b->extensions; } +static void +list_set_cancel_gc (struct ip_set *set) +{ +struct list_set *map = set->data; + +if (SET_WITH_TIMEOUT (set)) +timer_shutdown_sync (&map->gc); +} +static const struct ip_set_type_variant set_variant = { .kadt = list_set_kadt, .uadt = list_set_uadt,
@@ -558,6 +564,7 @@ static const struct ip_set_type_variant set_variant = { .head = list_set_head, .list = list_set_list, .same_set = list_set_same_set, + .cancel_gc = list_set_cancel_gc, }; static void
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 327/353 netfilter: nf_log: replace BUG_ON by WARN_ON_ONCE when putting logger
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 259eb32971e9eb24d1777a28d82730659f50fdcb ]
Module reference is bumped for each user, this should not ever happen.
But BUG_ON check should use rcu_access_pointer() instead.
If this ever happens, do WARN_ON_ONCE() instead of BUG_ON() and consolidate pointer check under the rcu read side lock section.
--- net/netfilter/nf_log.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/netfilter/nf_log.c +4 -3
@@ -193,11 +193,12 @@ void nf_logger_put(int pf, enum nf_log_type type)return ; } -BUG_ON (loggers[pf][type] ==NULL ); -rcu_read_lock (); logger =rcu_dereference (loggers[pf][type]); -module_put (logger->me); +if (!logger) +WARN_ON_ONCE (1 ); +else +module_put (logger->me);rcu_read_unlock (); }EXPORT_SYMBOL_GPL (nf_logger_put);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 328/353 netfilter: nft_ct: sanitize layer 3 and 4 protocol number in custom expectations
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 8059918a1377f2f1fff06af4f5a4ed3d5acd6bc4 ]
- Disallow families other than NFPROTO_{IPV4,IPV6,INET}.
- Disallow layer 4 protocol with no ports, since destination port is a mandatory attribute for this object.
--- net/netfilter/nft_ct.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
net/netfilter/nft_ct.c +24 -0
@@ -1250,7 +1250,31 @@ static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,if (tb[NFTA_CT_EXPECT_L3PROTO ]) priv->l3num =ntohs (nla_get_be16 (tb[NFTA_CT_EXPECT_L3PROTO ])); +switch (priv->l3num) { +case NFPROTO_IPV4 : +case NFPROTO_IPV6 : +if (priv->l3num != ctx->family) +return -EINVAL ; + + fallthrough; +case NFPROTO_INET : +break ; +default : +return -EOPNOTSUPP ; + } + priv->l4proto =nla_get_u8 (tb[NFTA_CT_EXPECT_L4PROTO ]); +switch (priv->l4proto) { +case IPPROTO_TCP : +case IPPROTO_UDP : +case IPPROTO_UDPLITE : +case IPPROTO_DCCP : +case IPPROTO_SCTP : +break ; +default : +return -EOPNOTSUPP ; + } + priv->dport =nla_get_be16 (tb[NFTA_CT_EXPECT_DPORT ]); priv->timeout =nla_get_u32 (tb[NFTA_CT_EXPECT_TIMEOUT ]); priv->size =nla_get_u8 (tb[NFTA_CT_EXPECT_SIZE ]);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 329/353 net: ipv4: fix a memleak in ip_setup_cork
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhipeng Lu <[email protected]>
[ Upstream commit 5dee6d6923458e26966717f2a3eae7d09fc10bf6 ]
When inetdev_valid_mtu fails, cork->opt should be freed if it is allocated in ip_setup_cork. Otherwise there could be a memleak.
--- net/ipv4/ip_output.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/ipv4/ip_output.c +6 -6
@@ -1287,6 +1287,12 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork,if (unlikely (!rt))return -EFAULT ; + cork->fragsize =ip_sk_use_pmtu (sk) ? +dst_mtu (&rt->dst) :READ_ONCE (rt->dst.dev->mtu); + +if (!inetdev_valid_mtu (cork->fragsize)) +return -ENETUNREACH ; +/* * setup for corking. */
@@ -1303,12 +1309,6 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork, cork->addr = ipc->addr; } - cork->fragsize =ip_sk_use_pmtu (sk) ? -dst_mtu (&rt->dst) :READ_ONCE (rt->dst.dev->mtu); - -if (!inetdev_valid_mtu (cork->fragsize)) -return -ENETUNREACH ; - cork->gso_size = ipc->gso_size; cork->dst = &rt->dst;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 330/353 af_unix: fix lockdep positive in sk_diag_dump_icons()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 4d322dce82a1d44f8c83f0f54f95dd1b8dcf46c9 ]
syzbot reported a lockdep splat [1].
Blamed commit hinted about the possible lockdep
violation, and code used unix_state_lock_nested()
in an attempt to silence lockdep.
It is not sufficient, because unix_state_lock_nested() is already used from unix_state_double_lock().
We need to use a separate subclass.
This patch adds a distinct enumeration to make things more explicit.
Also use swap() in unix_state_double_lock() as a clean up.
v2: add a missing inline keyword to unix_state_lock_nested()
[1]
WARNING: possible circular locking dependency detected 6.8.0-rc1-syzkaller-00356-g8a696a29c690 #0 Not tainted
syz-executor.1/2542 is trying to acquire lock:
ffff88808b5df9e8 (rlock-AF_UNIX){+.+.}-{2:2}, at: skb_queue_tail+0x36/0x120 net/core/skbuff.c:3863
but task is already holding lock:
ffff88808b5dfe70 (&u->lock/1){+.+.}-{2:2}, at: unix_dgram_sendmsg+0xfc7/0x2200 net/unix/af_unix.c:2089
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&u->lock/1){+.+.}-{2:2}:
lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
_raw_spin_lock_nested+0x31/0x40 kernel/locking/spinlock.c:378
sk_diag_dump_icons net/unix/diag.c:87 [inline]
sk_diag_fill+0x6ea/0xfe0 net/unix/diag.c:157
sk_diag_dump net/unix/diag.c:196 [inline]
unix_diag_dump+0x3e9/0x630 net/unix/diag.c:220
netlink_dump+0x5c1/0xcd0 net/netlink/af_netlink.c:2264
__netlink_dump_start+0x5d7/0x780 net/netlink/af_netlink.c:2370
netlink_dump_start include/linux/netlink.h:338 [inline]
unix_diag_handler_dump+0x1c3/0x8f0 net/unix/diag.c:319
sock_diag_rcv_msg+0xe3/0x400
netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2543
sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:280
netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
netlink_unicast+0x7e6/0x980 net/netlink/af_netlink.c:1367
netlink_sendmsg+0xa37/0xd70 net/netlink/af_netlink.c:1908
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
sock_write_iter+0x39a/0x520 net/socket.c:1160
call_write_iter include/linux/fs.h:2085 [inline]
new_sync_write fs/read_write.c:497 [inline]
vfs_write+0xa74/0xca0 fs/read_write.c:590
ksys_write+0x1a0/0x2c0 fs/read_write.c:643
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf5/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b-> #0 (rlock-AF_UNIX){+.+.}-{2:2}:
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain+0x1909/0x5ab0 kernel/locking/lockdep.c:3869
__lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137
lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162
skb_queue_tail+0x36/0x120 net/core/skbuff.c:3863
unix_dgram_sendmsg+0x15d9/0x2200 net/unix/af_unix.c:2112
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
____sys_sendmsg+0x592/0x890 net/socket.c:2584
___sys_sendmsg net/socket.c:2638 [inline]
__sys_sendmmsg+0x3b2/0x730 net/socket.c:2724
__do_sys_sendmmsg net/socket.c:2753 [inline]
__se_sys_sendmmsg net/socket.c:2750 [inline]
__x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2750
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf5/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6bother info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&u->lock/1);
lock(rlock-AF_UNIX);
lock(&u->lock/1); lock(rlock-AF_UNIX);
*** DEADLOCK ***
1 lock held by syz-executor.1/2542:
#0: ffff88808b5dfe70 (&u->lock/1){+.+.}-{2:2}, at: unix_dgram_sendmsg+0xfc7/0x2200 net/unix/af_unix.c:2089
stack backtrace: CPU: 1 PID: 2542 Comm: syz-executor.1 Not tainted 6.8.0-rc1-syzkaller-00356-g8a696a29c690 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 check_noncircular+0x366/0x490 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain+0x1909/0x5ab0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162 skb_queue_tail+0x36/0x120 net/core/skbuff.c:3863 unix_dgram_sendmsg+0x15d9/0x2200 net/unix/af_unix.c:2112 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] ____sys_sendmsg+0x592/0x890 net/socket.c:2584 ___sys_sendmsg net/socket.c:2638 [inline] __sys_sendmmsg+0x3b2/0x730 net/socket.c:2724 __do_sys_sendmmsg net/socket.c:2753 [inline] __se_sys_sendmmsg net/socket.c:2750 [inline] __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2750 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7f26d887cda9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f26d95a60c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133 RAX: ffffffffffffffda RBX: 00007f26d89abf80 RCX: 00007f26d887cda9 RDX: 000000000000003e RSI: 00000000200bd000 RDI: 0000000000000004 RBP: 00007f26d88c947a R08: 0000000000000000 R09: 0000000000000000 R10: 00000000000008c0 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f26d89abf80 R15: 00007ffcfe081a68
--- include/net/af_unix.h | 20 ++++++++++++++------ net/unix/af_unix.c | 14 ++++++-------- net/unix/diag.c | 2 +- 3 files changed, 21 insertions(+), 15 deletions(-)
include/net/af_unix.h +14 -6
@@ -46,12 +46,6 @@ struct scm_stat {#define UNIXCB (skb) (*(struct unix_skb_parms *)&((skb)->cb)) -#define unix_state_lock (s) spin_lock(&unix_sk(s)->lock) -#define unix_state_unlock (s) spin_unlock(&unix_sk(s)->lock) -#define unix_state_lock_nested (s) \ - spin_lock_nested(&unix_sk(s)->lock, \ - SINGLE_DEPTH_NESTING) -/* The AF_UNIX socket */ struct unix_sock {/* WARNING: sk has to be the first member */
@@ -77,6 +71,20 @@ struct unix_sock {#define unix_sk (ptr) container_of_const(ptr, struct unix_sock, sk)#define unix_peer (sk) (unix_sk(sk)->peer) +#define unix_state_lock (s) spin_lock(&unix_sk(s)->lock) +#define unix_state_unlock (s) spin_unlock(&unix_sk(s)->lock) +enum unix_socket_lock_class { +U_LOCK_NORMAL , +U_LOCK_SECOND ,/* for double locking, see unix_state_double_lock(). */ +U_LOCK_DIAG ,/* used while dumping icons, see sk_diag_dump_icons(). */ +}; + +static inline void unix_state_lock_nested (struct sock *sk, +enum unix_socket_lock_class subclass) +{ +spin_lock_nested (&unix_sk (sk)->lock, subclass); +} +#define peer_wait peer_wq.waitlong unix_inq_len (struct sock *sk);
net/unix/af_unix.c +6 -8
@@ -1344,13 +1344,11 @@ static void unix_state_double_lock(struct sock *sk1, struct sock *sk2)unix_state_lock (sk1);return ; } -if (sk1 < sk2) { -unix_state_lock (sk1); -unix_state_lock_nested (sk2); - }else { -unix_state_lock (sk2); -unix_state_lock_nested (sk1); - } +if (sk1 > sk2) +swap (sk1, sk2); + +unix_state_lock (sk1); +unix_state_lock_nested (sk2,U_LOCK_SECOND ); }static void unix_state_double_unlock (struct sock *sk1,struct sock *sk2)
@@ -1591,7 +1589,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, goto out_unlock; } -unix_state_lock_nested (sk); +unix_state_lock_nested (sk,U_LOCK_SECOND );if (sk->sk_state != st) {unix_state_unlock (sk);
net/unix/diag.c +1 -1
@@ -84,7 +84,7 @@ static int sk_diag_dump_icons(struct sock *sk, struct sk_buff *nlskb)* queue lock. With the other's queue locked it's * OK to lock the state. */ -unix_state_lock_nested (req); +unix_state_lock_nested (req,U_LOCK_DIAG ); peer =unix_sk (req)->peer; buf[i++] = (peer ?sock_i_ino (peer) :0 );unix_state_unlock (req);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 331/353 pds_core: Prevent health thread from running during reset/remove
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brett Creeley <[email protected]>
[ Upstream commit d9407ff11809c6812bb84fe7be9c1367d758e5c8 ]
The PCIe reset handlers can run at the same time as the health thread. This can cause the health thread to stomp on the PCIe reset. Fix this by preventing the health thread from running while a PCIe reset is happening.
As part of this use timer_shutdown_sync() during reset and remove to make sure the timer doesn't ever get rearmed.
--- drivers/net/ethernet/amd/pds_core/main.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/net/ethernet/amd/pds_core/main.c +17 -2
@@ -293,7 +293,7 @@ static int pdsc_init_pf(struct pdsc *pdsc) err_out_teardown:pdsc_teardown (pdsc,PDSC_TEARDOWN_REMOVING ); err_out_unmap_bars: -del_timer_sync (&pdsc->wdtimer); +timer_shutdown_sync (&pdsc->wdtimer);if (pdsc->wq)destroy_workqueue (pdsc->wq);mutex_destroy (&pdsc->config_lock);
@@ -420,7 +420,7 @@ static void pdsc_remove(struct pci_dev *pdev)*/ pdsc_sriov_configure (pdev,0 ); -del_timer_sync (&pdsc->wdtimer); +timer_shutdown_sync (&pdsc->wdtimer);if (pdsc->wq)destroy_workqueue (pdsc->wq);
@@ -445,10 +445,24 @@ static void pdsc_remove(struct pci_dev *pdev)devlink_free (dl); } +static void pdsc_stop_health_thread (struct pdsc *pdsc) +{ +timer_shutdown_sync (&pdsc->wdtimer); +if (pdsc->health_work.func) +cancel_work_sync (&pdsc->health_work); +} + +static void pdsc_restart_health_thread (struct pdsc *pdsc) +{ +timer_setup (&pdsc->wdtimer, pdsc_wdtimer_cb,0 ); +mod_timer (&pdsc->wdtimer, jiffies +1 ); +} +void pdsc_reset_prepare (struct pci_dev *pdev) {struct pdsc *pdsc =pci_get_drvdata (pdev); +pdsc_stop_health_thread (pdsc);pdsc_fw_down (pdsc);pci_free_irq_vectors (pdev);
@@ -486,6 +500,7 @@ void pdsc_reset_done(struct pci_dev *pdev) }pdsc_fw_up (pdsc); +pdsc_restart_health_thread (pdsc); }static const struct pci_error_handlers pdsc_err_handler = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 332/353 pds_core: Cancel AQ work on teardown
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brett Creeley <[email protected]>
[ Upstream commit d321067e2cfa4d5e45401a00912ca9da8d1af631 ]
There is a small window where pdsc_work_thread() calls pdsc_process_adminq() and pdsc_process_adminq() passes the PDSC_S_STOPPING_DRIVER check and starts to process adminq/notifyq work and then the driver starts a fw_down cycle. This could cause some undefined behavior if the notifyqcq/adminqcq are free'd while pdsc_process_adminq() is running. Use cancel_work_sync() on the adminqcq's work struct to make sure any pending work items are cancelled and any in progress work items are completed.
Also, make sure to not call cancel_work_sync() if the work item has not be initialized. Without this, traces will happen in cases where a reset fails and teardown is called again or if reset fails and the driver is removed.
--- drivers/net/ethernet/amd/pds_core/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/amd/pds_core/core.c +2 -0
@@ -464,6 +464,8 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing)if (!pdsc->pdev->is_virtfn)pdsc_devcmd_reset (pdsc); +if (pdsc->adminqcq.work.func) +cancel_work_sync (&pdsc->adminqcq.work);pdsc_qcq_free (pdsc, &pdsc->notifyqcq);pdsc_qcq_free (pdsc, &pdsc->adminqcq);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 333/353 pds_core: Use struct pdsc for the pdsc_adminq_isr private data
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brett Creeley <[email protected]>
[ Upstream commit 951705151e50f9022bc96ec8b3fd5697380b1df6 ]
The initial design for the adminq interrupt was done based on client drivers having their own adminq and adminq interrupt. So, each client driver's adminq isr would use their specific adminqcq for the private data struct. For the time being the design has changed to only use a single adminq for all clients. So, instead use the struct pdsc for the private data to simplify things a bit.
This also has the benefit of not dereferencing the adminqcq to access the pdsc struct when the PDSC_S_STOPPING_DRIVER bit is set and the adminqcq has actually been cleared/freed.
--- drivers/net/ethernet/amd/pds_core/adminq.c | 5 +++-- drivers/net/ethernet/amd/pds_core/core.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/amd/pds_core/adminq.c +3 -2
@@ -135,8 +135,8 @@ void pdsc_work_thread(struct work_struct *work)irqreturn_t pdsc_adminq_isr (int irq,void *data) { -struct pdsc_qcq *qcq = data; -struct pdsc *pdsc = qcq->pdsc; +struct pdsc *pdsc = data; +struct pdsc_qcq *qcq;/* Don't process AdminQ when shutting down */ if (pdsc->state &BIT_ULL (PDSC_S_STOPPING_DRIVER )) {
@@ -145,6 +145,7 @@ irqreturn_t pdsc_adminq_isr(int irq, void *data)return IRQ_HANDLED ; } + qcq = &pdsc->adminqcq;queue_work (pdsc->wq, &qcq->work);pds_core_intr_mask (&pdsc->intr_ctrl[qcq->intx],PDS_CORE_INTR_MASK_CLEAR );
drivers/net/ethernet/amd/pds_core/core.c +1 -1
@@ -125,7 +125,7 @@ static int pdsc_qcq_intr_alloc(struct pdsc *pdsc, struct pdsc_qcq *qcq)snprintf (name,sizeof (name),"%s-%d-%s" ,PDS_CORE_DRV_NAME , pdsc->pdev->bus->number, qcq->q.name); - index =pdsc_intr_alloc (pdsc, name, pdsc_adminq_isr, qcq); + index =pdsc_intr_alloc (pdsc, name, pdsc_adminq_isr, pdsc);if (index <0 )return index; qcq->intx = index;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 334/353 pds_core: Prevent race issues involving the adminq
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brett Creeley <[email protected]>
[ Upstream commit 7e82a8745b951b1e794cc780d46f3fbee5e93447 ]
There are multiple paths that can result in using the pdsc's adminq.
[1] pdsc_adminq_isr and the resulting work from queue_work(),
i.e. pdsc_work_thread()->pdsc_process_adminq()
[2] pdsc_adminq_post()
When the device goes through reset via PCIe reset and/or a fw_down/fw_up cycle due to bad PCIe state or bad device state the adminq is destroyed and recreated.
A NULL pointer dereference can happen if [1] or [2] happens after the adminq is already destroyed.
In order to fix this, add some further state checks and implement reference counting for adminq uses. Reference counting was used because multiple threads can attempt to access the adminq at the same time via [1] or [2]. Additionally, multiple clients (i.e. pds-vfio-pci) can be using [2] at the same time.
The adminq_refcnt is initialized to 1 when the adminq has been allocated and is ready to use. Users/clients of the adminq (i.e. [1] and [2]) will increment the refcnt when they are using the adminq. When the driver goes into a fw_down cycle it will set the PDSC_S_FW_DEAD bit and then wait for the adminq_refcnt to hit 1. Setting the PDSC_S_FW_DEAD before waiting will prevent any further adminq_refcnt increments. Waiting for the adminq_refcnt to hit 1 allows for any current users of the adminq to finish before the driver frees the adminq. Once the adminq_refcnt hits 1 the driver clears the refcnt to signify that the adminq is deleted and cannot be used. On the fw_up cycle the driver will once again initialize the adminq_refcnt to 1 allowing the adminq to be used again.
--- drivers/net/ethernet/amd/pds_core/adminq.c | 31 +++++++++++++++++----- drivers/net/ethernet/amd/pds_core/core.c | 21 +++++++++++++++ drivers/net/ethernet/amd/pds_core/core.h | 1 + 3 files changed, 47 insertions(+), 6 deletions(-)
drivers/net/ethernet/amd/pds_core/adminq.c +25 -6
@@ -63,6 +63,15 @@ static int pdsc_process_notifyq(struct pdsc_qcq *qcq)return nq_work; } +static bool pdsc_adminq_inc_if_up (struct pdsc *pdsc) +{ +if (pdsc->state &BIT_ULL (PDSC_S_STOPPING_DRIVER ) || + pdsc->state &BIT_ULL (PDSC_S_FW_DEAD )) +return false; + +return refcount_inc_not_zero (&pdsc->adminq_refcnt); +} +void pdsc_process_adminq (struct pdsc_qcq *qcq) {union pds_core_adminq_comp *comp;
@@ -75,9 +84,9 @@ void pdsc_process_adminq(struct pdsc_qcq *qcq)int aq_work =0 ;int credits; -/* Don't process AdminQ when shutting down */ -if (pdsc->state &BIT_ULL (PDSC_S_STOPPING_DRIVER )) { -dev_err (pdsc->dev,"%s: called while PDSC_S_STOPPING_DRIVER\n" , +/* Don't process AdminQ when it's not up */ +if (!pdsc_adminq_inc_if_up (pdsc)) { +dev_err (pdsc->dev,"%s: called while adminq is unavailable\n" , __func__);return ; }
@@ -124,6 +133,7 @@ void pdsc_process_adminq(struct pdsc_qcq *qcq)pds_core_intr_credits (&pdsc->intr_ctrl[qcq->intx], credits,PDS_CORE_INTR_CRED_REARM ); +refcount_dec (&pdsc->adminq_refcnt); }void pdsc_work_thread (struct work_struct *work)
@@ -138,9 +148,9 @@ irqreturn_t pdsc_adminq_isr(int irq, void *data)struct pdsc *pdsc = data;struct pdsc_qcq *qcq; -/* Don't process AdminQ when shutting down */ -if (pdsc->state &BIT_ULL (PDSC_S_STOPPING_DRIVER )) { -dev_err (pdsc->dev,"%s: called while PDSC_S_STOPPING_DRIVER\n" , +/* Don't process AdminQ when it's not up */ +if (!pdsc_adminq_inc_if_up (pdsc)) { +dev_err (pdsc->dev,"%s: called while adminq is unavailable\n" , __func__);return IRQ_HANDLED ; }
@@ -148,6 +158,7 @@ irqreturn_t pdsc_adminq_isr(int irq, void *data) qcq = &pdsc->adminqcq;queue_work (pdsc->wq, &qcq->work);pds_core_intr_mask (&pdsc->intr_ctrl[qcq->intx],PDS_CORE_INTR_MASK_CLEAR ); +refcount_dec (&pdsc->adminq_refcnt);return IRQ_HANDLED ; }
@@ -231,6 +242,12 @@ int pdsc_adminq_post(struct pdsc *pdsc,int err =0 ;int index; +if (!pdsc_adminq_inc_if_up (pdsc)) { +dev_dbg (pdsc->dev,"%s: preventing adminq cmd %u\n" , + __func__, cmd->opcode); +return -ENXIO ; + } + wc.qcq = &pdsc->adminqcq; index =__pdsc_adminq_post (pdsc, &pdsc->adminqcq, cmd, comp, &wc);if (index <0 ) {
@@ -286,6 +303,8 @@ int pdsc_adminq_post(struct pdsc *pdsc,queue_work (pdsc->wq, &pdsc->health_work); } +refcount_dec (&pdsc->adminq_refcnt); +return err; }EXPORT_SYMBOL_GPL (pdsc_adminq_post);
drivers/net/ethernet/amd/pds_core/core.c +21 -0
@@ -450,6 +450,7 @@ int pdsc_setup(struct pdsc *pdsc, bool init)pdsc_debugfs_add_viftype (pdsc); } +refcount_set (&pdsc->adminq_refcnt,1 );clear_bit (PDSC_S_FW_DEAD , &pdsc->state);return 0 ;
@@ -514,6 +515,24 @@ void pdsc_stop(struct pdsc *pdsc) PDS_CORE_INTR_MASK_SET); } +static void pdsc_adminq_wait_and_dec_once_unused (struct pdsc *pdsc) +{ +/* The driver initializes the adminq_refcnt to 1 when the adminq is +* allocated and ready for use. Other users/requesters will increment +* the refcnt while in use. If the refcnt is down to 1 then the adminq +* is not in use and the refcnt can be cleared and adminq freed. Before +* calling this function the driver will set PDSC_S_FW_DEAD, which +* prevent subsequent attempts to use the adminq and increment the +* refcnt to fail. This guarantees that this function will eventually +* exit. +*/ +while (!refcount_dec_if_one (&pdsc->adminq_refcnt)) { +dev_dbg_ratelimited (pdsc->dev,"%s: adminq in use\n" , + __func__); +cpu_relax (); + } +} +void pdsc_fw_down (struct pdsc *pdsc) {union pds_core_notifyq_comp reset_event = {
@@ -529,6 +548,8 @@ void pdsc_fw_down(struct pdsc *pdsc)if (pdsc->pdev->is_virtfn)return ; +pdsc_adminq_wait_and_dec_once_unused (pdsc); +/* Notify clients of fw_down */ if (pdsc->fw_reporter)devlink_health_report (pdsc->fw_reporter,"FW down reported" , pdsc);
drivers/net/ethernet/amd/pds_core/core.h +1 -0
@@ -184,6 +184,7 @@ struct pdsc {struct mutex devcmd_lock;/* lock for dev_cmd operations */ struct mutex config_lock;/* lock for configuration operations */ spinlock_t adminq_lock;/* lock for adminq operations */ +refcount_t adminq_refcnt;struct pds_core_dev_info_regs __iomem *info_regs;struct pds_core_dev_cmd_regs __iomem *cmd_regs;struct pds_core_intr __iomem *intr_ctrl;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 335/353 pds_core: Clear BARs on reset
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brett Creeley <[email protected]>
[ Upstream commit e96094c1d11cce4deb5da3c0500d49041ab845b8 ]
During reset the BARs might be accessed when they are unmapped. This can cause unexpected issues, so fix it by clearing the cached BAR values so they are not accessed until they are re-mapped.
Also, make sure any places that can access the BARs when they are NULL are prevented.
--- drivers/net/ethernet/amd/pds_core/adminq.c | 28 +++++++++++++++------ drivers/net/ethernet/amd/pds_core/core.c | 8 +++++- drivers/net/ethernet/amd/pds_core/dev.c | 9 ++++++- drivers/net/ethernet/amd/pds_core/devlink.c | 3 ++- drivers/net/ethernet/amd/pds_core/fw.c | 3 +++ drivers/net/ethernet/amd/pds_core/main.c | 5 ++++ 6 files changed, 45 insertions(+), 11 deletions(-)
drivers/net/ethernet/amd/pds_core/adminq.c +20 -8
@@ -191,10 +191,16 @@ static int __pdsc_adminq_post(struct pdsc *pdsc,/* Check that the FW is running */ if (!pdsc_is_fw_running (pdsc)) { -u8 fw_status =ioread8 (&pdsc->info_regs->fw_status); - -dev_info (pdsc->dev,"%s: post failed - fw not running %#02x:\n" , - __func__, fw_status); +if (pdsc->info_regs) { +u8 fw_status = +ioread8 (&pdsc->info_regs->fw_status); + +dev_info (pdsc->dev,"%s: post failed - fw not running %#02x:\n" , + __func__, fw_status); + }else { +dev_info (pdsc->dev,"%s: post failed - BARs not setup\n" , + __func__); + } ret = -ENXIO ; goto err_out_unlock;
@@ -266,10 +272,16 @@ int pdsc_adminq_post(struct pdsc *pdsc,break ;if (!pdsc_is_fw_running (pdsc)) { -u8 fw_status =ioread8 (&pdsc->info_regs->fw_status); - -dev_dbg (pdsc->dev,"%s: post wait failed - fw not running %#02x:\n" , - __func__, fw_status); +if (pdsc->info_regs) { +u8 fw_status = +ioread8 (&pdsc->info_regs->fw_status); + +dev_dbg (pdsc->dev,"%s: post wait failed - fw not running %#02x:\n" , + __func__, fw_status); + }else { +dev_dbg (pdsc->dev,"%s: post wait failed - BARs not setup\n" , + __func__); + } err = -ENXIO ;break ; }
drivers/net/ethernet/amd/pds_core/core.c +7 -1
@@ -600,7 +600,13 @@ void pdsc_fw_up(struct pdsc *pdsc)static void pdsc_check_pci_health (struct pdsc *pdsc) { -u8 fw_status =ioread8 (&pdsc->info_regs->fw_status); +u8 fw_status; + +/* some sort of teardown already in progress */ +if (!pdsc->info_regs) +return ; + + fw_status =ioread8 (&pdsc->info_regs->fw_status);/* is PCI broken? */ if (fw_status !=PDS_RC_BAD_PCI )
drivers/net/ethernet/amd/pds_core/dev.c +8 -1
@@ -57,6 +57,9 @@ int pdsc_err_to_errno(enum pds_core_status_code code)bool pdsc_is_fw_running (struct pdsc *pdsc) { +if (!pdsc->info_regs) +return false; + pdsc->fw_status =ioread8 (&pdsc->info_regs->fw_status); pdsc->last_fw_time = jiffies; pdsc->last_hb =ioread32 (&pdsc->info_regs->fw_heartbeat);
@@ -182,13 +185,17 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd, {int err; +if (!pdsc->cmd_regs) +return -ENXIO ; +memcpy_toio (&pdsc->cmd_regs->cmd, cmd,sizeof (*cmd));pdsc_devcmd_dbell (pdsc); err =pdsc_devcmd_wait (pdsc, cmd->opcode, max_seconds); -memcpy_fromio (comp, &pdsc->cmd_regs->comp,sizeof (*comp));if ((err == -ENXIO || err == -ETIMEDOUT ) && pdsc->wq)queue_work (pdsc->wq, &pdsc->health_work); +else +memcpy_fromio (comp, &pdsc->cmd_regs->comp,sizeof (*comp));return err; }
drivers/net/ethernet/amd/pds_core/devlink.c +2 -1
@@ -111,7 +111,8 @@ int pdsc_dl_info_get(struct devlink *dl, struct devlink_info_req *req,mutex_lock (&pdsc->devcmd_lock); err =pdsc_devcmd_locked (pdsc, &cmd, &comp, pdsc->devcmd_timeout *2 ); -memcpy_fromio (&fw_list, pdsc->cmd_regs->data,sizeof (fw_list)); +if (!err) +memcpy_fromio (&fw_list, pdsc->cmd_regs->data,sizeof (fw_list));mutex_unlock (&pdsc->devcmd_lock);if (err && err != -EIO )return err;
drivers/net/ethernet/amd/pds_core/fw.c +3 -0
@@ -107,6 +107,9 @@ int pdsc_firmware_update(struct pdsc *pdsc, const struct firmware *fw,dev_info (pdsc->dev,"Installing firmware\n" ); +if (!pdsc->cmd_regs) +return -ENXIO ; + dl =priv_to_devlink (pdsc);devlink_flash_update_status_notify (dl,"Preparing to flash" ,NULL ,0 ,0 );
drivers/net/ethernet/amd/pds_core/main.c +5 -0
@@ -37,6 +37,11 @@ static void pdsc_unmap_bars(struct pdsc *pdsc)struct pdsc_dev_bar *bars = pdsc->bars;unsigned int i; + pdsc->info_regs =NULL ; + pdsc->cmd_regs =NULL ; + pdsc->intr_status =NULL ; + pdsc->intr_ctrl =NULL ; +for (i =0 ; i <PDS_CORE_BARS_MAX ; i++) {if (bars[i].vaddr)pci_iounmap (pdsc->pdev, bars[i].vaddr);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 336/353 pds_core: Rework teardown/setup flow to be more common
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brett Creeley <[email protected]>
[ Upstream commit bc90fbe0c3182157d2be100a2f6c2edbb1820677 ]
Currently the teardown/setup flow for driver probe/remove is quite a bit different from the reset flows in pdsc_fw_down()/pdsc_fw_up(). One key piece that's missing are the calls to pci_alloc_irq_vectors() and pci_free_irq_vectors(). The pcie reset case is calling pci_free_irq_vectors() on reset_prepare, but not calling the corresponding pci_alloc_irq_vectors() on reset_done. This is causing unexpected/unwanted interrupt behavior due to the adminq interrupt being accidentally put into legacy interrupt mode. Also, the pci_alloc_irq_vectors()/pci_free_irq_vectors() functions are being called directly in probe/remove respectively.
Fix this inconsistency by making the following changes:
1. Always call pdsc_dev_init() in pdsc_setup(), which calls pci_alloc_irq_vectors() and get rid of the now unused pds_dev_reinit().
2. Always free/clear the pdsc->intr_info in pdsc_teardown() since this structure will get re-alloced in pdsc_setup().
3. Move the calls of pci_free_irq_vectors() to pdsc_teardown() since pci_alloc_irq_vectors() will always be called in pdsc_setup()->pdsc_dev_init() for both the probe/remove and reset flows.
4. Make sure to only create the debugfs "identity" entry when it doesn't already exist, which it will in the reset case because it's already been created in the initial call to pdsc_dev_init().
--- drivers/net/ethernet/amd/pds_core/core.c | 13 +++++-------- drivers/net/ethernet/amd/pds_core/core.h | 1 - drivers/net/ethernet/amd/pds_core/debugfs.c | 4 ++++ drivers/net/ethernet/amd/pds_core/dev.c | 7 ------- drivers/net/ethernet/amd/pds_core/main.c | 2 -- 5 files changed, 9 insertions(+), 18 deletions(-)
drivers/net/ethernet/amd/pds_core/core.c +5 -8
@@ -404,10 +404,7 @@ int pdsc_setup(struct pdsc *pdsc, bool init)int numdescs;int err; -if (init) - err =pdsc_dev_init (pdsc); -else - err =pdsc_dev_reinit (pdsc); + err =pdsc_dev_init (pdsc);if (err)return err;
@@ -479,10 +476,9 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing)for (i =0 ; i < pdsc->nintrs; i++)pdsc_intr_free (pdsc, i); -if (removing) { -kfree (pdsc->intr_info); - pdsc->intr_info =NULL ; - } +kfree (pdsc->intr_info); + pdsc->intr_info =NULL ; + pdsc->nintrs =0 ; }if (pdsc->kern_dbpage) {
@@ -490,6 +486,7 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing) pdsc->kern_dbpage =NULL ; } +pci_free_irq_vectors (pdsc->pdev);set_bit (PDSC_S_FW_DEAD , &pdsc->state); }
drivers/net/ethernet/amd/pds_core/core.h +0 -1
@@ -281,7 +281,6 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd, union pds_core_dev_comp *comp, int max_seconds);int pdsc_devcmd_init (struct pdsc *pdsc);int pdsc_devcmd_reset (struct pdsc *pdsc); -int pdsc_dev_reinit (struct pdsc *pdsc);int pdsc_dev_init (struct pdsc *pdsc);void pdsc_reset_prepare (struct pci_dev *pdev);
drivers/net/ethernet/amd/pds_core/debugfs.c +4 -0
@@ -64,6 +64,10 @@ DEFINE_SHOW_ATTRIBUTE(identity);void pdsc_debugfs_add_ident (struct pdsc *pdsc) { +/* This file will already exist in the reset flow */ +if (debugfs_lookup ("identity" , pdsc->dentry)) +return ; +debugfs_create_file ("identity" ,0400 , pdsc->dentry, pdsc, &identity_fops); }
drivers/net/ethernet/amd/pds_core/dev.c +0 -7
@@ -316,13 +316,6 @@ static int pdsc_identify(struct pdsc *pdsc)return 0 ; } -int pdsc_dev_reinit (struct pdsc *pdsc) -{ -pdsc_init_devinfo (pdsc); - -return pdsc_identify (pdsc); -} -int pdsc_dev_init (struct pdsc *pdsc) {unsigned int nintrs;
drivers/net/ethernet/amd/pds_core/main.c +0 -2
@@ -438,7 +438,6 @@ static void pdsc_remove(struct pci_dev *pdev)mutex_destroy (&pdsc->config_lock);mutex_destroy (&pdsc->devcmd_lock); -pci_free_irq_vectors (pdev);pdsc_unmap_bars (pdsc);pci_release_regions (pdev); }
@@ -470,7 +469,6 @@ void pdsc_reset_prepare(struct pci_dev *pdev)pdsc_stop_health_thread (pdsc);pdsc_fw_down (pdsc); -pci_free_irq_vectors (pdev);pdsc_unmap_bars (pdsc);pci_release_regions (pdev);pci_disable_device (pdev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 337/353 selftests: net: add missing config for nftables-backed iptables
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 59c93583491ab15db109f9902524d241c4fa4c0b ]
Modern OSes use iptables implementation with nf_tables as a backend, e.g.:
$ iptables -V iptables v1.8.8 (nf_tables)
Pablo points out that we need CONFIG_NFT_COMPAT to make that work, otherwise we see a lot of:
Warning: Extension DNAT revision 0 not supported, missing kernel module?
with DNAT being just an example here, other modules we need include udp, TTL, length etc.
Stable-dep-of: f7c25d8e17dd ("selftests: net: add missing config for pmtu.sh tests")
--- tools/testing/selftests/net/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/config +1 -0
@@ -62,6 +62,7 @@ CONFIG_NET_SCH_HTB=m CONFIG_NET_SCH_FQ=m CONFIG_NET_SCH_ETF=m CONFIG_NET_SCH_NETEM=y +CONFIG_NFT_COMPAT=m CONFIG_NF_FLOW_TABLE=m CONFIG_PSAMPLE=m CONFIG_TCP_MD5SIG=y
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 338/353 selftests: net: add missing config for pmtu.sh tests
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit f7c25d8e17dd759d97ca093faf92eeb7da7b3890 ]
The mentioned test uses a few Kconfig still missing the net config, add them.
Before:
# Error: Specified qdisc kind is unknown.
# Error: Specified qdisc kind is unknown.
# Error: Qdisc not classful.
# We have an error talking to the kernel
# Error: Qdisc not classful.
# We have an error talking to the kernel
# policy_routing not supported
# TEST: ICMPv4 with DSCP and ECN: PMTU exceptions [SKIP]
After:
# TEST: ICMPv4 with DSCP and ECN: PMTU exceptions [ OK ]
--- tools/testing/selftests/net/config | 3 +++ 1 file changed, 3 insertions(+)
tools/testing/selftests/net/config +3 -0
@@ -49,8 +49,10 @@ CONFIG_NF_TABLES_IPV6=y CONFIG_NF_TABLES_IPV4=y CONFIG_NFT_NAT=m CONFIG_NETFILTER_XT_MATCH_LENGTH=m +CONFIG_NET_ACT_CSUM=m CONFIG_NET_ACT_CT=m CONFIG_NET_ACT_GACT=m +CONFIG_NET_ACT_PEDIT=m CONFIG_NET_CLS_BASIC=m CONFIG_NET_CLS_BPF=m CONFIG_NET_CLS_MATCHALL=m
@@ -62,6 +64,7 @@ CONFIG_NET_SCH_HTB=m CONFIG_NET_SCH_FQ=m CONFIG_NET_SCH_ETF=m CONFIG_NET_SCH_NETEM=y +CONFIG_NET_SCH_PRIO=m CONFIG_NFT_COMPAT=m CONFIG_NF_FLOW_TABLE=m CONFIG_PSAMPLE=m
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 339/353 selftests: net: fix available tunnels detection
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit e4e4b6d568d2549583cbda3f8ce567e586cb05da ]
The pmtu.sh test tries to detect the tunnel protocols available in the running kernel and properly skip the unsupported cases.
In a few more complex setup, such detection is unsuccessful, as the script currently ignores some intermediate error code at setup time.
Before:
# which: no nettest in (/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin)
# TEST: vti6: PMTU exceptions (ESP-in-UDP) [FAIL]
# PMTU exception wasn't created after creating tunnel exceeding link layer MTU
# ./pmtu.sh: line 931: kill: (7543) - No such process
# ./pmtu.sh: line 931: kill: (7544) - No such process
After:
# xfrm4 not supported
# TEST: vti4: PMTU exceptions [SKIP]
--- tools/testing/selftests/net/pmtu.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
tools/testing/selftests/net/pmtu.sh +8 -8
@@ -714,23 +714,23 @@ setup_xfrm6() { } setup_xfrm4udp() { - setup_xfrm 4 ${veth4_a_addr} ${veth4_b_addr} "encap espinudp 4500 4500 0.0.0.0" - setup_nettest_xfrm 4 4500 + setup_xfrm 4 ${veth4_a_addr} ${veth4_b_addr} "encap espinudp 4500 4500 0.0.0.0" && \ + setup_nettest_xfrm 4 4500 } setup_xfrm6udp() { - setup_xfrm 6 ${veth6_a_addr} ${veth6_b_addr} "encap espinudp 4500 4500 0.0.0.0" - setup_nettest_xfrm 6 4500 + setup_xfrm 6 ${veth6_a_addr} ${veth6_b_addr} "encap espinudp 4500 4500 0.0.0.0" && \ + setup_nettest_xfrm 6 4500 } setup_xfrm4udprouted() { - setup_xfrm 4 ${prefix4}.${a_r1}.1 ${prefix4}.${b_r1}.1 "encap espinudp 4500 4500 0.0.0.0" - setup_nettest_xfrm 4 4500 + setup_xfrm 4 ${prefix4}.${a_r1}.1 ${prefix4}.${b_r1}.1 "encap espinudp 4500 4500 0.0.0.0" && \ + setup_nettest_xfrm 4 4500 } setup_xfrm6udprouted() { - setup_xfrm 6 ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 "encap espinudp 4500 4500 0.0.0.0" - setup_nettest_xfrm 6 4500 + setup_xfrm 6 ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 "encap espinudp 4500 4500 0.0.0.0" && \ + setup_nettest_xfrm 6 4500 } setup_routing_old() {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 340/353 selftests: net: dont access /dev/stdout in pmtu.sh
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit bc0970d5ac1d1317e212bdf55533935ecb6ae95c ]
When running the pmtu.sh via the kselftest infra, accessing /dev/stdout gives unexpected results:
# dd: failed to open '/dev/stdout': Device or resource busy
# TEST: IPv4, bridged vxlan4: PMTU exceptions [FAIL]
Let dd use directly the standard output to fix the above:
# TEST: IPv4, bridged vxlan4: PMTU exceptions - nexthop objects [ OK ]
--- tools/testing/selftests/net/pmtu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/pmtu.sh +1 -1
@@ -1348,7 +1348,7 @@ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception() { sleep 1 - dd if=/dev/zero of=/dev/stdout status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3 + dd if=/dev/zero status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3 size=$(du -sb $tmpoutfile) size=${size%%/tmp/*}
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 341/353 octeontx2-pf: Remove xdp queues on program detach
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geetha sowjanya <[email protected]>
[ Upstream commit 04f647c8e456fcfabe9c252a4dcaee03b586fa4f ]
XDP queues are created/destroyed when a XDP program is attached/detached. In current driver xdp_queues are not getting destroyed on program exit due to incorrect xdp_queue and tot_tx_queue count values.
This patch fixes the issue by setting tot_tx_queue and xdp_queue count to correct values. It also fixes xdp.data_hard_start address.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 1 - drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 3 +-- drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 7 +++---- 3 files changed, 4 insertions(+), 7 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +0 -1
@@ -314,7 +314,6 @@ static int otx2_set_channels(struct net_device *dev, pfvf->hw.tx_queues = channel->tx_count;if (pfvf->xdp_prog) pfvf->hw.xdp_queues = channel->rx_count; - pfvf->hw.non_qos_queues = pfvf->hw.tx_queues + pfvf->hw.xdp_queues;if (if_up) err = dev->netdev_ops->ndo_open (dev);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +1 -2
@@ -1744,6 +1744,7 @@ int otx2_open(struct net_device *netdev)/* RQ and SQs are mapped to different CQs, * so find out max CQ IRQs (i.e CINTs) needed. */ + pf->hw.non_qos_queues = pf->hw.tx_queues + pf->hw.xdp_queues; pf->hw.cint_cnt =max3 (pf->hw.rx_queues, pf->hw.tx_queues, pf->hw.tc_tx_queues);
@@ -2643,8 +2644,6 @@ static int otx2_xdp_setup(struct otx2_nic *pf, struct bpf_prog *prog)xdp_features_clear_redirect_target (dev); } - pf->hw.non_qos_queues += pf->hw.xdp_queues; -if (if_up)otx2_open (pf->netdev);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +3 -4
@@ -1403,7 +1403,7 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,struct otx2_cq_queue *cq, bool *need_xdp_flush) { - unsigned char *hard_start, *data; + unsigned char *hard_start;int qidx = cq->cq_idx;struct xdp_buff xdp;struct page *page;
@@ -1417,9 +1417,8 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,xdp_init_buff (&xdp, pfvf->rbsize, &cq->xdp_rxq); - data = (unsigned char *)phys_to_virt (pa); - hard_start =page_address (page); -xdp_prepare_buff (&xdp, hard_start, data - hard_start, + hard_start = (unsigned char *)phys_to_virt (pa); +xdp_prepare_buff (&xdp, hard_start,OTX2_HEAD_ROOM , cqe->sg.seg_size, false); act =bpf_prog_run_xdp (prog, &xdp);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 342/353 net: sysfs: Fix /sys/class/net/<iface> path
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit ae3f4b44641dfff969604735a0dcbf931f383285 ]
The documentation is pointing to the wrong path for the interface. Documentation is pointing to /sys/class/<iface>, instead of /sys/class/net/<iface>.
Fix it by adding the net/ directory before the interface.
--- .../ABI/testing/sysfs-class-net-queues | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-)
Documentation/ABI/testing/sysfs-class-net-queues +11 -11
@@ -1,4 +1,4 @@ -What: /sys/class/<iface>/queues/rx-<queue>/rps_cpus +What: /sys/class/net/<iface>/queues/rx-<queue>/rps_cpus Date: March 2010 KernelVersion: 2.6.35 Contact: [email protected]
@@ -8,7 +8,7 @@ Description: network device queue. Possible values depend on the number of available CPU(s) in the system. -What: /sys/class/<iface>/queues/rx-<queue>/rps_flow_cnt +What: /sys/class/net/<iface>/queues/rx-<queue>/rps_flow_cnt Date: April 2010 KernelVersion: 2.6.35 Contact: [email protected]
@@ -16,7 +16,7 @@ Description: Number of Receive Packet Steering flows being currently processed by this particular network device receive queue. -What: /sys/class/<iface>/queues/tx-<queue>/tx_timeout +What: /sys/class/net/<iface>/queues/tx-<queue>/tx_timeout Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -24,7 +24,7 @@ Description: Indicates the number of transmit timeout events seen by this network interface transmit queue. -What: /sys/class/<iface>/queues/tx-<queue>/tx_maxrate +What: /sys/class/net/<iface>/queues/tx-<queue>/tx_maxrate Date: March 2015 KernelVersion: 4.1 Contact: [email protected]
@@ -32,7 +32,7 @@ Description: A Mbps max-rate set for the queue, a value of zero means disabled, default is disabled. -What: /sys/class/<iface>/queues/tx-<queue>/xps_cpus +What: /sys/class/net/<iface>/queues/tx-<queue>/xps_cpus Date: November 2010 KernelVersion: 2.6.38 Contact: [email protected]
@@ -42,7 +42,7 @@ Description: network device transmit queue. Possible values depend on the number of available CPU(s) in the system. -What: /sys/class/<iface>/queues/tx-<queue>/xps_rxqs +What: /sys/class/net/<iface>/queues/tx-<queue>/xps_rxqs Date: June 2018 KernelVersion: 4.18.0 Contact: [email protected]
@@ -53,7 +53,7 @@ Description: number of available receive queue(s) in the network device. Default is disabled. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/hold_time +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/hold_time Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -62,7 +62,7 @@ Description: of this particular network device transmit queue. Default value is 1000. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/inflight +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/inflight Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -70,7 +70,7 @@ Description: Indicates the number of bytes (objects) in flight on this network device transmit queue. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -79,7 +79,7 @@ Description: on this network device transmit queue. This value is clamped to be within the bounds defined by limit_max and limit_min. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit_max +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit_max Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
@@ -88,7 +88,7 @@ Description: queued on this network device transmit queue. See include/linux/dynamic_queue_limits.h for the default value. -What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit_min +What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit_min Date: November 2011 KernelVersion: 3.3 Contact: [email protected]
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 343/353 selftests: team: Add missing config options
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Poirier <[email protected]>
[ Upstream commit 7b6fb3050d8f5e2b6858eef344e47ac1f5442827 ]
Similar to commit dd2d40acdbb2 ("selftests: bonding: Add more missing config options"), add more networking-specific config options which are needed for team device tests.
For testing, I used the minimal config generated by virtme-ng and I added the options in the config file. Afterwards, the team device test passed.
--- tools/testing/selftests/drivers/net/team/config | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/drivers/net/team/config +3 -1
@@ -1,3 +1,5 @@ +CONFIG_DUMMY=y +CONFIG_IPV6=y +CONFIG_MACVLAN=y CONFIG_NET_TEAM=y CONFIG_NET_TEAM_MODE_LOADBALANCE=y -CONFIG_MACVLAN=y
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 344/353 selftests: bonding: Check initial state
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Poirier <[email protected]>
[ Upstream commit 8cc063ae1b3dbe416ce62a15d49af4c2314b45fe ]
The purpose of the test_LAG_cleanup() function is to check that some hardware addresses are removed from underlying devices after they have been unenslaved. The test function simply checks that those addresses are not present at the end. However, if the addresses were never added to begin with due to some error in device setup, the test function currently passes. This is a false positive since in that situation the test did not actually exercise the intended functionality.
Add a check that the expected addresses are indeed present after device setup. This makes the test function more robust.
I noticed this problem when running the team/dev_addr_lists.sh test on a system without support for dummy and ipv6:
tools/testing/selftests/drivers/net/team# ./dev_addr_lists.sh
Error: Unknown device type.
Error: Unknown device type.
This program is not intended to be run as root. RTNETLINK answers: Operation not supported
TEST: team cleanup mode lacp [ OK ]
--- .../testing/selftests/drivers/net/bonding/lag_lib.sh | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/testing/selftests/drivers/net/bonding/lag_lib.sh +11 -0
@@ -48,6 +48,17 @@ test_LAG_cleanup() ip link add mv0 link "$name" up address "$ucaddr" type macvlan # Used to test dev->mc handling ip address add "$addr6" dev "$name" + + # Check that addresses were added as expected + (grep_bridge_fdb "$ucaddr" bridge fdb show dev dummy1 || + grep_bridge_fdb "$ucaddr" bridge fdb show dev dummy2) >/dev/null + check_err $? "macvlan unicast address not found on a slave" + + # mcaddr is added asynchronously by addrconf_dad_work(), use busywait + (busywait 10000 grep_bridge_fdb "$mcaddr" bridge fdb show dev dummy1 || + grep_bridge_fdb "$mcaddr" bridge fdb show dev dummy2) >/dev/null + check_err $? "IPv6 solicited-node multicast mac address not found on a slave" + ip link set dev "$name" down ip link del "$name"
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 345/353 selftests: net: add missing config for NF_TARGET_TTL
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 1939f738c73dfdb8389839bdc9624c765e3326e6 ]
amt test uses the TTL iptables module:
ip netns exec "${RELAY}" iptables -t mangle -I PREROUTING \
-d 239.0.0.1 -j TTL --ttl-set 2--- tools/testing/selftests/net/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/config +1 -0
@@ -33,6 +33,7 @@ CONFIG_IP6_NF_NAT=m CONFIG_IP6_NF_RAW=m CONFIG_IP_NF_NAT=m CONFIG_IP_NF_RAW=m +CONFIG_IP_NF_TARGET_TTL=m CONFIG_IPV6_GRE=m CONFIG_IPV6_SEG6_LWTUNNEL=y CONFIG_L2TP_ETH=m
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 346/353 selftests: net: enable some more knobs
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit c15a729c9d45aa142fb01a3afee822ab1f0e62a8 ]
The rtnetlink tests require additional options currently off by default.
--- tools/testing/selftests/net/config | 3 +++ 1 file changed, 3 insertions(+)
tools/testing/selftests/net/config +3 -0
@@ -22,6 +22,8 @@ CONFIG_VLAN_8021Q=y CONFIG_GENEVE=m CONFIG_IFB=y CONFIG_INET_DIAG=y +CONFIG_INET_ESP=y +CONFIG_INET_ESP_OFFLOAD=y CONFIG_IP_GRE=m CONFIG_NETFILTER=y CONFIG_NETFILTER_ADVANCED=y
@@ -93,3 +95,4 @@ CONFIG_IP_SCTP=m CONFIG_NETFILTER_XT_MATCH_POLICY=m CONFIG_CRYPTO_ARIA=y CONFIG_XFRM_INTERFACE=m +CONFIG_XFRM_USER=m
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 347/353 idpf: avoid compiler padding in virtchnl2_ptype struct
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavan Kumar Linga <[email protected]>
[ Upstream commit f0588b157f48b9c6277a75c9f14650e86d969e03 ]
In the arm random config file, kconfig option 'CONFIG_AEABI' is disabled which results in adding the compiler flag '-mabi=apcs-gnu'. This causes the compiler to add padding in virtchnl2_ptype structure to align it to 8 bytes, resulting in the following size check failure:
include/linux/build_bug.h:78:41: error: static assertion failed: "(6) == sizeof(struct virtchnl2_ptype)"
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~~~~~~~~~~~
include/linux/build_bug.h:77:34: note: in expansion of macro '__static_assert'
77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
| ^~~~~~~~~~~~~~~
drivers/net/ethernet/intel/idpf/virtchnl2.h:26:9: note: in expansion of macro 'static_assert'
26 | static_assert((n) == sizeof(struct X))
| ^~~~~~~~~~~~~
drivers/net/ethernet/intel/idpf/virtchnl2.h:982:1: note: in expansion of macro 'VIRTCHNL2_CHECK_STRUCT_LEN'
982 | VIRTCHNL2_CHECK_STRUCT_LEN(6, virtchnl2_ptype);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~Avoid the compiler padding by using "__packed" structure attribute for the virtchnl2_ptype struct. Also align the structure by using "__aligned(2)" for better code optimization.
--- drivers/net/ethernet/intel/idpf/virtchnl2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/idpf/virtchnl2.h +1 -1
@@ -978,7 +978,7 @@ struct virtchnl2_ptype {u8 proto_id_count;__le16 pad;__le16 proto_id[]; -}; +} __packed__aligned(2) ;VIRTCHNL2_CHECK_STRUCT_LEN (6 , virtchnl2_ptype);/**
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 348/353 arm64: irq: set the correct node for shadow call stack
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huang Shijie <[email protected]>
commit 7b1a09e44dc64f4f5930659b6d14a27183c00705 upstream.
The init_irq_stacks() has been changed to use the correct node:
https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/commit/?id=75b5e0bf90bf
The init_irq_scs() has the same issue with init_irq_stacks():
cpu_to_node() is not initialized yet, it does not work.
This patch uses early_cpu_to_node() to set the init_irq_scs() with the correct node.
--- arch/arm64/kernel/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/irq.c +1 -1
@@ -48,7 +48,7 @@ static void init_irq_scs(void)for_each_possible_cpu (cpu)per_cpu (irq_shadow_call_stack_ptr, cpu) = -scs_alloc (cpu_to_node (cpu)); +scs_alloc (early_cpu_to_node (cpu)); }#ifdef CONFIG_VMAP_STACK
Greg Kroah-Hartman
maintainerPATCH 349/353 mm, kmsan: fix infinite recursion due to RCU critical section
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Elver <[email protected]>
commit f6564fce256a3944aa1bc76cb3c40e792d97c1eb upstream.
Alexander Potapenko writes in [1]: "For every memory access in the code instrumented by KMSAN we call kmsan_get_metadata() to obtain the metadata for the memory being accessed. For virtual memory the metadata pointers are stored in the corresponding struct page, therefore we need to call virt_to_page() to get them.
According to the comment in arch/x86/include/asm/page.h, virt_to_page(kaddr) returns a valid pointer iff virt_addr_valid(kaddr) is true, so KMSAN needs to call virt_addr_valid() as well.
To avoid recursion, kmsan_get_metadata() must not call instrumented code, therefore ./arch/x86/include/asm/kmsan.h forks parts of arch/x86/mm/physaddr.c to check whether a virtual address is valid or not.
But the introduction of rcu_read_lock() to pfn_valid() added instrumented RCU API calls to virt_to_page_or_null(), which is called by kmsan_get_metadata(), so there is an infinite recursion now. I do not think it is correct to stop that recursion by doing kmsan_enter_runtime()/kmsan_exit_runtime() in kmsan_get_metadata(): that would prevent instrumented functions called from within the runtime from tracking the shadow values, which might introduce false positives."
Fix the issue by switching pfn_valid() to the _sched() variant of rcu_read_lock/unlock(), which does not require calling into RCU. Given the critical section in pfn_valid() is very small, this is a reasonable trade-off (with preemptible RCU).
KMSAN further needs to be careful to suppress calls into the scheduler, which would be another source of recursion. This can be done by wrapping the call to pfn_valid() into preempt_disable/enable_no_resched(). The downside is that this sacrifices breaking scheduling guarantees; however, a kernel compiled with KMSAN has already given up any performance guarantees due to being heavily instrumented.
Note, KMSAN code already disables tracing via Makefile, and since mmzone.h is included, it is not necessary to use the notrace variant, which is generally preferred in all other cases.
--- arch/x86/include/asm/kmsan.h | 17 ++++++++++++++++- include/linux/mmzone.h | 6 +++--- 2 files changed, 19 insertions(+), 4 deletions(-)
arch/x86/include/asm/kmsan.h +16 -1
@@ -64,6 +64,7 @@ static inline bool kmsan_virt_addr_valid {unsigned long x = (unsigned long )addr;unsigned long y = x - __START_KERNEL_map; +bool ret;/* use the carry flag to determine if x was < __START_KERNEL_map */ if (unlikely (x > y)) {
@@ -79,7 +80,21 @@ static inline bool kmsan_virt_addr_valid return false; } -return pfn_valid (x >>PAGE_SHIFT ); +/* +* pfn_valid() relies on RCU, and may call into the scheduler on exiting +* the critical section. However, this would result in recursion with +* KMSAN. Therefore, disable preemption here, and re-enable preemption +* below while suppressing reschedules to avoid recursion. +* +* Note, this sacrifices occasionally breaking scheduling guarantees. +* Although, a kernel compiled with KMSAN has already given up on any +* performance guarantees due to being heavily instrumented. +*/ +preempt_disable (); + ret =pfn_valid (x >>PAGE_SHIFT ); +preempt_enable_no_resched (); + +return ret; }#endif /* !MODULE */
include/linux/mmzone.h +3 -3
@@ -2025,9 +2025,9 @@ static inline int pfn_valid(unsigned lonif (pfn_to_section_nr (pfn) >=NR_MEM_SECTIONS )return 0 ; ms =__pfn_to_section (pfn); -rcu_read_lock (); +rcu_read_lock_sched ();if (!valid_section (ms)) { -rcu_read_unlock (); +rcu_read_unlock_sched ();return 0 ; }/*
@@ -2035,7 +2035,7 @@ static inline int pfn_valid(unsigned lon* the entire section-sized span. */ ret =early_section (ms) ||pfn_section_valid (ms, pfn); -rcu_read_unlock (); +rcu_read_unlock_sched ();return ret; }
Greg Kroah-Hartman
maintainerPATCH 350/353 Revert "drm/amd/display: Disable PSR-SU on Parade 0803 TCON again"
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Gray <[email protected]>
This reverts commit f015d8b6405d950f30826b4d8d9e1084dd9ea2a4.
duplicated a change made in 6.7e7ab758741672acb21c5d841a9f0309d30e48a06
--- drivers/gpu/drm/amd/display/modules/power/power_helpers.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +0 -2
@@ -841,8 +841,6 @@ bool is_psr_su_specific_panel(struct dc_ isPSRSUSupported = false; else if (dpcd_caps->sink_dev_id_str[1] == 0x08 && dpcd_caps->sink_dev_id_str[0] == 0x03) isPSRSUSupported = false; - else if (dpcd_caps->sink_dev_id_str[1] == 0x08 && dpcd_caps->sink_dev_id_str[0] == 0x03) - isPSRSUSupported = false; else if (dpcd_caps->psr_info.force_psrsu_cap == 0x1) isPSRSUSupported = true; }
Greg Kroah-Hartman
maintainerPATCH 351/353 drm/msm/dsi: Enable runtime PM
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
commit 6ab502bc1cf3147ea1d8540d04b83a7a4cb6d1f1 upstream.
Some devices power the DSI PHY/PLL through a power rail that we model as a GENPD. Enable runtime PM to make it suspendable.
Patchwork: https://patchwork.freedesktop.org/patch/543352/
--- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +4 -0
@@ -691,6 +691,10 @@ static int dsi_phy_driver_probe(struct preturn dev_err_probe (dev,PTR_ERR (phy->ahb_clk),"Unable to get ahb clk\n" ); + ret =devm_pm_runtime_enable (&pdev->dev); +if (ret) +return ret; +/* PLL init will call into clk_register which requires * register access, so we need to enable power and ahb clock. */
Greg Kroah-Hartman
maintainerPATCH 352/353 selftests/bpf: Remove flaky test_btf_id test
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonghong Song <[email protected]>
commit 56925f389e152dcb8d093435d43b78a310539c23 upstream.
With previous patch, one of subtests in test_btf_id becomes flaky and may fail. The following is a failing example:
Error: #26 btf
Error: #26/174 btf/BTF ID
Error: #26/174 btf/BTF ID
btf_raw_create:PASS:check 0 nsec
btf_raw_create:PASS:check 0 nsec
test_btf_id:PASS:check 0 nsec
...
test_btf_id:PASS:check 0 nsec
test_btf_id:FAIL:check BTF lingersdo_test_get_info:FAIL:check failed: -1
The test tries to prove a btf_id not available after the map is closed. But btf_id is freed only after workqueue and a rcu grace period, compared to previous case just after a rcu grade period.
Depending on system workload, workqueue could take quite some time to execute function bpf_map_free_deferred() which may cause the test failure. Instead of adding arbitrary delays, let us remove the logic to check btf_id availability after map is closed.
--- tools/testing/selftests/bpf/prog_tests/btf.c | 5 ----- 1 file changed, 5 deletions(-)
tools/testing/selftests/bpf/prog_tests/btf.c +0 -5
@@ -4630,11 +4630,6 @@ static int test_btf_id(unsigned int test/* The map holds the last ref to BTF and its btf_id */ close (map_fd); map_fd =-1 ; - btf_fd[0 ] =bpf_btf_get_fd_by_id (map_info.btf_id); -if (CHECK (btf_fd[0 ] >=0 ,"BTF lingers" )) { - err =-1 ; - goto done; - }fprintf (stderr,"OK" );
Greg Kroah-Hartman
maintainerPATCH 353/353 bonding: remove print in bond_verify_device_path
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchao Shao <[email protected]>
commit 486058f42a4728053ae69ebbf78e9731d8ce6f8b upstream.
As suggested by Paolo in link[1], if the memory allocation fails, the mm layer will emit a lot warning comprising the backtrace, so remove the print.
[1] https://lore.kernel.org/all/[email protected]/
--- drivers/net/bonding/bond_main.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/bonding/bond_main.c +1 -4
@@ -2973,11 +2973,8 @@ struct bond_vlan_tag *bond_verify_deviceif (start_dev == end_dev) { tags =kcalloc (level +1 ,sizeof (*tags),GFP_ATOMIC ); -if (!tags) { -net_err_ratelimited ("%s: %s: Failed to allocate tags\n" , - __func__, start_dev->name); +if (!tags)return ERR_PTR (-ENOMEM ); - } tags[level].vlan_proto =BOND_VLAN_PROTO_NONE ;return tags; }
Hello!
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.7.4 release. There are 353 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 Mon, 05 Feb 2024 03:51: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/v6.x/stable-review/patch-6.7.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.7.y
and the diffstat can be found below.thanks,
greg k-h
Same problems as reported with 6.1, but something else happening on Arm (32-bits):
-----8<-----
Error: /builds/linux/arch/arm/boot/dts/qcom/qcom-msm8960-cdp.dts:91.1-10 Label or path pmicintc not found FATAL ERROR: Syntax error parsing input tree
make[4]: *** [/builds/linux/scripts/Makefile.lib:419: arch/arm/boot/dts/qcom/qcom-msm8960-cdp.dtb] Error 1 make[4]: Target 'arch/arm/boot/dts/qcom/' not remade because of errors.
----->8-----
This is seen with Clang (17 and nightly) and GCC-8.
Bisection here points to:
commit 4fed142bbe3ca920810eba12fe96800cfd094d0c
Author: Dmitry Baryshkov <[email protected]>
Date: Thu Sep 28 14:02:44 2023 +0300
ARM: dts: qcom: msm8960: fix PMIC node labels
[ Upstream commit a10a09f34eb80b83ca7275e23bf982dae2aa7632 ]
Reverting that commit makes that problem go away.
Reproducer:
tuxmake --runtime podman --target-arch arm --toolchain gcc-8 --kconfig defconfig
Greetings!
Daniel Díaz
[email protected]
Greg Kroah-Hartman
maintainerQuoted 34 lines · Daniel Díaz
Hello!
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.7.4 release. There are 353 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 Mon, 05 Feb 2024 03:51: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/v6.x/stable-review/patch-6.7.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.7.y
and the diffstat can be found below.thanks,
greg k-h
Same problems as reported with 6.1, but something else happening on Arm (32-bits):
-----8<-----
Error: /builds/linux/arch/arm/boot/dts/qcom/qcom-msm8960-cdp.dts:91.1-10 Label or path pmicintc not found FATAL ERROR: Syntax error parsing input tree
make[4]: *** [/builds/linux/scripts/Makefile.lib:419:arch/arm/boot/dts/qcom/qcom-msm8960-cdp.dtb] Error 1 make[4]: Target 'arch/arm/boot/dts/qcom/' not remade because of errors.
----->8-----This is seen with Clang (17 and nightly) and GCC-8.
Bisection here points to:
Quoted 8 lines
commit
4fed142bbe3ca920810eba12fe96800cfd094d0c
Author: Dmitry Baryshkov <[email protected]>
Date: Thu Sep 28 14:02:44 2023 +0300ARM: dts: qcom: msm8960: fix PMIC node labels
[ Upstream commita10a09f34eb80b83ca7275e23bf982dae2aa7632]Reverting that commit makes that problem go away.
Will drop this too, thanks.
greg k-h
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.7.4 release. There are 353 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.
On my Zen2-based Thinkpad I now get the trace below on boot; this never happened before. The boot continues and the system seems usable.
It's out-of-order because apparently there's a workqueue involved, but most of the information points to the patch called "xhci-fix-possible-null-pointer-deref-during-xhci-urb.patch".
--snip--
[ 0.762299] Hardware name: LENOVO 20U50001GE/20U50001GE, BIOS R19ET32W (1.16 ) 01/26/2021 [ 0.762568] Workqueue: usb_hub_wq hub_event [ 0.762838] RIP: 0010:xhci_urb_enqueue+0x267/0x4c0 [ 0.763108] Code: 5d 41 5c 41 5d 41 5e 41 5f c3 75 d0 bd ea ff ff ff eb c9 bd ed ff ff ff eb c2 49 8b 85 c8 03 00 00 8b 54 24 04 48 8b 7c 24 10 <48> 8b 70 10 e8 00 13 00 00 49 8b 57 40 0f b7 40 06 0f b7 52 5c 89 [ 0.763395] RSP: 0018:ffffc900009cbb28 EFLAGS: 00010246 [ 0.763679] RAX: 0000000000000000 RBX: ffff888100e32000 RCX: 0000000000000000 [ 0.763965] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff888100e32260 [ 0.764039] RBP: 0000000000000001 R08: ffff8887ef42ed50 R09: 0000000000000000 [ 0.764039] R10: ffff888100daeb00 R11: ffff888103a2a058 R12: ffff888100daeb00 [ 0.764039] R13: ffff888100e32000 R14: 0000000000000c00 R15: ffff888103f8d800 [ 0.764039] FS: 0000000000000000(0000) GS:ffff8887ef400000(0000) knlGS:0000000000000000 [ 0.764039] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.764039] CR2: 0000000000000010 CR3: 0000000004429000 CR4: 0000000000350ef0 [ 0.764039] Call Trace: [ 0.764039] <TASK> [ 0.764039] ? __die+0x1f/0x60 [ 0.764039] ? page_fault_oops+0x14d/0x410 [ 0.764039] ? prb_read_valid+0x17/0x20 [ 0.764039] ? printk_get_next_message+0x73/0x270 [ 0.764039] ? exc_page_fault+0x63/0x100 [ 0.764039] ? asm_exc_page_fault+0x22/0x30 [ 0.764039] ? xhci_urb_enqueue+0x267/0x4c0 [ 0.764039] ? xhci_urb_enqueue+0xce/0x4c0 [ 0.764039] usb_hcd_submit_urb+0xa9/0xa10 [ 0.764039] ? __schedule+0x300/0xda0 [ 0.764039] ? usleep_range_state+0x60/0x60 [ 0.764039] ? usleep_range_state+0x60/0x60 [ 0.764039] ? __cond_resched+0x16/0x40 [ 0.764039] usb_start_wait_urb+0x55/0xd0 [ 0.764039] usb_control_msg+0xcb/0x120 [ 0.764039] get_bMaxPacketSize0+0x5e/0xc0 [ 0.764039] hub_port_init+0x1fd/0xde0 [ 0.764039] hub_event+0xf89/0x1810 [ 0.764039] ? lock_timer_base+0x61/0x80 [ 0.764039] process_one_work+0x166/0x300 [ 0.764039] worker_thread+0x2e2/0x400 [ 0.764039] ? process_one_work+0x300/0x300 [ 0.764039] kthread+0xc9/0xf0 [ 0.764039] ? kthread_complete_and_exit+0x20/0x20 [ 0.764039] ret_from_fork+0x2d/0x50 [ 0.764039] ? kthread_complete_and_exit+0x20/0x20 [ 0.764039] ret_from_fork_asm+0x11/0x20 [ 0.764039] </TASK> [ 0.764039] Modules linked in: [ 0.764039] CR2: 0000000000000010 [ 0.764039] ---[ end trace 0000000000000000 ]--- [ 0.764039] RIP: 0010:xhci_urb_enqueue+0x267/0x4c0 [ 0.764039] Code: 5d 41 5c 41 5d 41 5e 41 5f c3 75 d0 bd ea ff ff ff eb c9 bd ed ff ff ff eb c2 49 8b 85 c8 03 00 00 8b 54 24 04 48 8b 7c 24 10 <48> 8b 70 10 e8 00 13 00 00 49 8b 57 40 0f b7 40 06 0f b7 52 5c 89 [ 0.764039] RSP: 0018:ffffc900009cbb28 EFLAGS: 00010246 [ 0.764039] RAX: 0000000000000000 RBX: ffff888100e32000 RCX: 0000000000000000 [ 0.764039] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff888100e32260 [ 0.764039] RBP: 0000000000000001 R08: ffff8887ef42ed50 R09: 0000000000000000 [ 0.764039] R10: ffff888100daeb00 R11: ffff888103a2a058 R12: ffff888100daeb00 [ 0.764039] R13: ffff888100e32000 R14: 0000000000000c00 R15: ffff888103f8d800 [ 0.764039] FS: 0000000000000000(0000) GS:ffff8887ef400000(0000) knlGS:0000000000000000 [ 0.764039] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.764039] CR2: 0000000000000010 CR3: 0000000004429000 CR4: 0000000000350ef0 [ 0.764039] note: kworker/0:2[136] exited with irqs disabled [ 0.778061] usb 4-3: new high-speed USB device number 2 using xhci_hcd [ 0.933575] usb 4-3: New USB device found, idVendor=13d3, idProduct=56fb, bcdDevice=60.01 [ 0.933871] usb 4-3: New USB device strings: Mfr=3, Product=1, SerialNumber=2 [ 0.934152] usb 4-3: Product: Integrated Camera [ 0.934425] usb 4-3: Manufacturer: Azurewave [ 0.934696] usb 4-3: SerialNumber: 0000 [ 1.059668] input: Power Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input3 [ 1.059714] ACPI: button: Power Button [PWRB] [ 1.059750] input: Lid Switch as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input4 [ 1.067025] usb 4-4: new full-speed USB device number 3 using xhci_hcd [ 1.067067] BUG: kernel NULL pointer dereference, address: 0000000000000010 [ 1.067285] ACPI: video: Video Device [VGA] (multi-head: yes rom: no post: no) [ 1.067413] #PF: supervisor read access in kernel mode [ 1.068338] #PF: error_code(0x0000) - not-present page [ 1.068608] PGD 0 P4D 0 [ 1.068861] Oops: 0000 [#2] SMP [ 1.069114] CPU: 0 PID: 186 Comm: kworker/0:4 Tainted: G D 6.7.4 #1 [ 1.069268] ACPI: AC: AC Adapter [AC] (on-line) [ 1.069430] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:08/LNXVIDEO:00/input/input5 [ 1.069626] Hardware name: LENOVO 20U50001GE/20U50001GE, BIOS R19ET32W (1.16 ) 01/26/2021 [ 1.070386] Workqueue: usb_hub_wq hub_event [ 1.070386] RIP: 0010:xhci_urb_enqueue+0x267/0x4c0 [ 1.070386] Code: 5d 41 5c 41 5d 41 5e 41 5f c3 75 d0 bd ea ff ff ff eb c9 bd ed ff ff ff eb c2 49 8b 85 c8 03 00 00 8b 54 24 04 48 8b 7c 24 10 <48> 8b 70 10 e8 00 13 00 00 49 8b 57 40 0f b7 40 06 0f b7 52 5c 89 [ 1.070386] RSP: 0018:ffffc90000677b28 EFLAGS: 00010246 [ 1.073106] ACPI: battery: Slot [BAT0] (battery present) [ 1.070386] RAX: 0000000000000000 RBX: ffff888100167000 RCX: 0000000000000000 [ 1.070386] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff888100167260 [ 1.070386] RBP: 0000000000000001 R08: ffff8887ef42ed50 R09: 0000000000000000 [ 1.070386] R10: ffff8881043e0000 R11: ffff888103a2c858 R12: ffff8881043e0000 [ 1.070386] R13: ffff888100167000 R14: 0000000000000c00 R15: ffff888103f8d680 [ 1.070386] FS: 0000000000000000(0000) GS:ffff8887ef400000(0000) knlGS:0000000000000000 [ 1.070386] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1.070386] CR2: 0000000000000010 CR3: 0000000108214000 CR4: 0000000000350ef0 [ 1.070386] Call Trace: [ 1.070386] <TASK> [ 1.070386] ? __die+0x1f/0x60 [ 1.070386] ? page_fault_oops+0x14d/0x410 [ 1.070386] ? prb_read_valid+0x17/0x20 [ 1.070386] ? printk_get_next_message+0x73/0x270 [ 1.070386] ? exc_page_fault+0x63/0x100 [ 1.070386] ? asm_exc_page_fault+0x22/0x30 [ 1.070386] ? xhci_urb_enqueue+0x267/0x4c0 [ 1.070386] ? xhci_urb_enqueue+0xce/0x4c0 [ 1.070386] usb_hcd_submit_urb+0xa9/0xa10 [ 1.070386] ? __schedule+0x300/0xda0 [ 1.070386] ? usleep_range_state+0x60/0x60 [ 1.070386] ? usleep_range_state+0x60/0x60 [ 1.070386] ? __cond_resched+0x16/0x40 [ 1.070386] usb_start_wait_urb+0x55/0xd0 [ 1.070386] usb_control_msg+0xcb/0x120 [ 1.070386] get_bMaxPacketSize0+0x5e/0xc0 [ 1.070386] hub_port_init+0x1fd/0xde0 [ 1.070386] hub_event+0xf89/0x1810 [ 1.070386] ? __schedule+0x300/0xda0 [ 1.070386] process_one_work+0x166/0x300 [ 1.070386] worker_thread+0x2e2/0x400 [ 1.070386] ? process_one_work+0x300/0x300 [ 1.070386] ? process_one_work+0x300/0x300 [ 1.070386] kthread+0xc9/0xf0 [ 1.070386] ? kthread_complete_and_exit+0x20/0x20 [ 1.070386] ret_from_fork+0x2d/0x50 [ 1.070386] ? kthread_complete_and_exit+0x20/0x20 [ 1.070386] ret_from_fork_asm+0x11/0x20 [ 1.070386] </TASK> [ 1.070386] Modules linked in: battery ac video wmi i2c_scmi button(+) [ 1.070386] CR2: 0000000000000010 [ 1.070386] ---[ end trace 0000000000000000 ]--- [ 1.070386] RIP: 0010:xhci_urb_enqueue+0x267/0x4c0 [ 1.070386] Code: 5d 41 5c 41 5d 41 5e 41 5f c3 75 d0 bd ea ff ff ff eb c9 bd ed ff ff ff eb c2 49 8b 85 c8 03 00 00 8b 54 24 04 48 8b 7c 24 10 <48> 8b 70 10 e8 00 13 00 00 49 8b 57 40 0f b7 40 06 0f b7 52 5c 89 [ 1.070386] RSP: 0018:ffffc900009cbb28 EFLAGS: 00010246 [ 1.070386] RAX: 0000000000000000 RBX: ffff888100e32000 RCX: 0000000000000000 [ 1.070386] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff888100e32260 [ 1.070386] RBP: 0000000000000001 R08: ffff8887ef42ed50 R09: 0000000000000000 [ 1.070386] R10: ffff888100daeb00 R11: ffff888103a2a058 R12: ffff888100daeb00 [ 1.070386] R13: ffff888100e32000 R14: 0000000000000c00 R15: ffff888103f8d800 [ 1.070386] FS: 0000000000000000(0000) GS:ffff8887ef400000(0000) knlGS:0000000000000000 [ 1.070386] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1.070386] CR2: 0000000000000010 CR3: 0000000108214000 CR4: 0000000000350ef0 [ 1.070386] note: kworker/0:4[186] exited with irqs disabled [ 1.089955] ACPI: button: Lid Switch [LID]
--snip--
I'll try reverting the patch in question.
-h
Quoted 8 lines · Holger Hoffstätte
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.7.4 release. There are 353 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.
On my Zen2-based Thinkpad I now get the trace below on boot; this never happened before. The boot continues and the system seems usable.
..except for the part where reboot hangs, but whatever. In any case reverting the patch makes the trace disappear.
-h
Greg Kroah-Hartman
maintainerQuoted 6 lines · Holger Hoffstätte
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.7.4 release. There are 353 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.
Quoted 6 lines
On my Zen2-based Thinkpad I now get the trace below on boot; this never happened before. The boot continues and the system seems usable.
It's out-of-order because apparently there's a workqueue involved, but most of the information points to the patch called "xhci-fix-possible-null-pointer-deref-during-xhci-urb.patch".
Will drop this now, thanks!
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.7.4 release. There are 353 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 Mon, 05 Feb 2024 03:51: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/v6.x/stable-review/patch-6.7.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.7.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian