From: Hongyu Xie <xiehongyu1(a)kylinos.cn>
The -ENODEV return value from xhci_check_args() is incorrectly changed
to -EINVAL in a couple places before propagated further.
xhci_check_args() returns 4 types of value, -ENODEV, -EINVAL, 1 and 0.
xhci_urb_enqueue and xhci_check_streams_endpoint return -EINVAL if
the return value of xhci_check_args <= 0.
This causes problems for example r8152_submit_rx, calling usb_submit_urb
in drivers/net/usb/r8152.c.
r8152_submit_rx will never get -ENODEV after submiting an urb when xHC
is halted because xhci_urb_enqueue returns -EINVAL in the very beginning.
[commit message and header edit -Mathias]
Fixes: 203a86613fb3 ("xhci: Avoid NULL pointer deref when host dies.")
Cc: stable(a)vger.kernel.org
Signed-off-by: Hongyu Xie <xiehongyu1(a)kylinos.cn>
Signed-off-by: Mathias Nyman <mathias.nyman(a)linux.intel.com>
---
drivers/usb/host/xhci.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 04ec2de158bf..2d378543bc3a 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1611,9 +1611,12 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
struct urb_priv *urb_priv;
int num_tds;
- if (!urb || xhci_check_args(hcd, urb->dev, urb->ep,
- true, true, __func__) <= 0)
+ if (!urb)
return -EINVAL;
+ ret = xhci_check_args(hcd, urb->dev, urb->ep,
+ true, true, __func__);
+ if (ret <= 0)
+ return ret ? ret : -EINVAL;
slot_id = urb->dev->slot_id;
ep_index = xhci_get_endpoint_index(&urb->ep->desc);
@@ -3330,7 +3333,7 @@ static int xhci_check_streams_endpoint(struct xhci_hcd *xhci,
return -EINVAL;
ret = xhci_check_args(xhci_to_hcd(xhci), udev, ep, 1, true, __func__);
if (ret <= 0)
- return -EINVAL;
+ return ret ? ret : -EINVAL;
if (usb_ss_max_streams(&ep->ss_ep_comp) == 0) {
xhci_warn(xhci, "WARN: SuperSpeed Endpoint Companion"
" descriptor for ep 0x%x does not support streams\n",
--
2.25.1
While examining is_ucounts_overlimit and reading the various messages
I realized that is_ucounts_overlimit fails to deal with counts that
may have wrapped.
Being wrapped should be a transitory state for counts and they should
never be wrapped for long, but it can happen so handle it.
Cc: stable(a)vger.kernel.org
Fixes: 21d1c5e386bc ("Reimplement RLIMIT_NPROC on top of ucounts")
Signed-off-by: "Eric W. Biederman" <ebiederm(a)xmission.com>
---
kernel/ucount.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/ucount.c b/kernel/ucount.c
index 65b597431c86..06ea04d44685 100644
--- a/kernel/ucount.c
+++ b/kernel/ucount.c
@@ -350,7 +350,8 @@ bool is_ucounts_overlimit(struct ucounts *ucounts, enum ucount_type type, unsign
if (rlimit > LONG_MAX)
max = LONG_MAX;
for (iter = ucounts; iter; iter = iter->ns->ucounts) {
- if (get_ucounts_value(iter, type) > max)
+ long val = get_ucounts_value(iter, type);
+ if (val < 0 || val > max)
return true;
max = READ_ONCE(iter->ns->ucount_max[type]);
}
--
2.29.2
Michal Koutný <mkoutny(a)suse.com> wrote:
> Tasks are associated to multiple users at once. Historically and as per
> setrlimit(2) RLIMIT_NPROC is enforce based on real user ID.
>
> The commit 21d1c5e386bc ("Reimplement RLIMIT_NPROC on top of ucounts")
> made the accounting structure "indexed" by euid and hence potentially
> account tasks differently.
>
> The effective user ID may be different e.g. for setuid programs but
> those are exec'd into already existing task (i.e. below limit), so
> different accounting is moot.
>
> Some special setresuid(2) users may notice the difference, justifying
> this fix.
I looked at the cred->ucount is only used for rlimit operations that
were previously stored in cred->user. Making the fact cred->ucount
can refer to a different user from cred->user a bug working will all
rlimits not just RLIMIT_NPROC.
So fix set_cred_ucounts to always use the real uid not the effective uid.
Further simplify set_cred_ucounts by noticing that set_cred_ucounts
somehow retained a draft version of the check to see if alloc_ucounts
was needed that checks the new->user and new->user_ns against the
current_real_cred(), when nothing matters for setting the ucounts
field of a struct cred except the other fields in that same struct
cred.
So delete the confusing and wrong check against the
current_real_cred(), and all of it's intermediate variables.
Cc: stable(a)vger.kernel.org
Link: https://lkml.kernel.org/r/20220207121800.5079-4-mkoutny@suse.com
Reported-by: Michal Koutný <mkoutny(a)suse.com>
Fixes: 21d1c5e386bc ("Reimplement RLIMIT_NPROC on top of ucounts")
Signed-off-by: "Eric W. Biederman" <ebiederm(a)xmission.com>
---
kernel/cred.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/kernel/cred.c b/kernel/cred.c
index 473d17c431f3..933155c96922 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -665,21 +665,16 @@ EXPORT_SYMBOL(cred_fscmp);
int set_cred_ucounts(struct cred *new)
{
- struct task_struct *task = current;
- const struct cred *old = task->real_cred;
struct ucounts *new_ucounts, *old_ucounts = new->ucounts;
- if (new->user == old->user && new->user_ns == old->user_ns)
- return 0;
-
/*
* This optimization is needed because alloc_ucounts() uses locks
* for table lookups.
*/
- if (old_ucounts->ns == new->user_ns && uid_eq(old_ucounts->uid, new->euid))
+ if (old_ucounts->ns == new->user_ns && uid_eq(old_ucounts->uid, new->uid))
return 0;
- if (!(new_ucounts = alloc_ucounts(new->user_ns, new->euid)))
+ if (!(new_ucounts = alloc_ucounts(new->user_ns, new->uid)))
return -EAGAIN;
new->ucounts = new_ucounts;
--
2.29.2
This is the start of the stable review cycle for the 4.9.302 release.
There are 34 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Wed, 16 Feb 2022 09:24:36 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.302-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.9.302-rc1
Armin Wolf <W_Armin(a)gmx.de>
hwmon: (dell-smm) Speed up setting of fan speed
Johan Hovold <johan(a)kernel.org>
USB: serial: cp210x: add CPI Bulk Coin Recycler id
Johan Hovold <johan(a)kernel.org>
USB: serial: cp210x: add NCR Retail IO box id
Stephan Brunner <s.brunner(a)stephan-brunner.net>
USB: serial: ch341: add support for GW Instek USB2.0-Serial devices
Pawel Dembicki <paweldembicki(a)gmail.com>
USB: serial: option: add ZTE MF286D modem
Cameron Williams <cang1(a)live.co.uk>
USB: serial: ftdi_sio: add support for Brainboxes US-159/235/320
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
usb: gadget: rndis: check size of RNDIS_MSG_SET command
Szymon Heidrich <szymon.heidrich(a)gmail.com>
USB: gadget: validate interface OS descriptor requests
Udipto Goswami <quic_ugoswami(a)quicinc.com>
usb: dwc3: gadget: Prevent core from processing stale TRBs
TATSUKAWA KOSUKE (立川 江介) <tatsu-ab1(a)nec.com>
n_tty: wake up poll(POLLRDNORM) on receiving data
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: Add kconfig knob for disabling unpriv bpf by default
Jakob Koschel <jakobkoschel(a)gmail.com>
vt_ioctl: add array_index_nospec to VT_ACTIVATE
Jakob Koschel <jakobkoschel(a)gmail.com>
vt_ioctl: fix array_index_nospec in vt_setactivate
Jon Maloy <jmaloy(a)redhat.com>
tipc: rate limit warning for received illegal binding update
Antoine Tenart <atenart(a)kernel.org>
net: fix a memleak when uncloning an skb dst and its metadata
Antoine Tenart <atenart(a)kernel.org>
net: do not keep the dst cache when uncloning an skb dst and its metadata
Eric Dumazet <edumazet(a)google.com>
ipmr,ip6mr: acquire RTNL before calling ip[6]mr_free_table() on failure path
Mahesh Bandewar <maheshb(a)google.com>
bonding: pair enable_port with slave_arr_updates
Fabio Estevam <festevam(a)gmail.com>
ARM: dts: imx6qdl-udoo: Properly describe the SD card detect
Uwe Kleine-König <u.kleine-koenig(a)pengutronix.de>
staging: fbtft: Fix error path in fbtft_driver_module_init()
Fabio Estevam <festevam(a)gmail.com>
ARM: dts: imx23-evk: Remove MX23_PAD_SSP1_DETECT from hog group
Amelie Delaunay <amelie.delaunay(a)foss.st.com>
usb: dwc2: gadget: don't try to disable ep0 in dwc2_hsotg_suspend
ZouMingzhe <mingzhe.zou(a)easystack.cn>
scsi: target: iscsi: Make sure the np under each tpg is unique
Olga Kornievskaia <kolga(a)netapp.com>
NFSv4 remove zero number of fs_locations entries error check
Xiaoke Wang <xkernel.wang(a)foxmail.com>
nfs: nfs4clinet: check the return value of kstrdup()
Olga Kornievskaia <kolga(a)netapp.com>
NFSv4 only print the label when its queried
Guillaume Bertholon <guillaume.bertholon(a)ens.fr>
Revert "net: axienet: Wait for PhyRstCmplt after core reset"
Guillaume Bertholon <guillaume.bertholon(a)ens.fr>
ALSA: line6: Fix misplaced backport of "Fix wrong altsetting for LINE6_PODHD500_1"
Guillaume Bertholon <guillaume.bertholon(a)ens.fr>
serial: sh-sci: Fix misplaced backport of "Fix late enablement of AUTORTS"
Guillaume Bertholon <guillaume.bertholon(a)ens.fr>
Input: i8042 - Fix misplaced backport of "add ASUS Zenbook Flip to noselftest list"
Chuck Lever <chuck.lever(a)oracle.com>
NFSD: Clamp WRITE offsets
Trond Myklebust <trond.myklebust(a)hammerspace.com>
NFS: Fix initialisation of nfs_client cl_flags field
Stefan Berger <stefanb(a)linux.ibm.com>
ima: Remove ima_policy file before directory
Xiaoke Wang <xkernel.wang(a)foxmail.com>
integrity: check the return value of audit_log_start()
-------------
Diffstat:
Documentation/sysctl/kernel.txt | 21 ++++++++++++++++
Makefile | 4 ++--
arch/arm/boot/dts/imx23-evk.dts | 1 -
arch/arm/boot/dts/imx6qdl-udoo.dtsi | 5 +++-
drivers/hwmon/dell-smm-hwmon.c | 12 ++++++----
drivers/input/serio/i8042-x86ia64io.h | 11 +++++----
drivers/net/bonding/bond_3ad.c | 3 ++-
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 10 --------
drivers/staging/fbtft/fbtft.h | 5 +++-
drivers/target/iscsi/iscsi_target_tpg.c | 3 +++
drivers/tty/n_tty.c | 4 ++--
drivers/tty/serial/sh-sci.c | 8 +++----
drivers/tty/vt/vt_ioctl.c | 5 ++--
drivers/usb/dwc2/gadget.c | 2 +-
drivers/usb/dwc3/gadget.c | 13 ++++++++++
drivers/usb/gadget/composite.c | 3 +++
drivers/usb/gadget/function/rndis.c | 9 ++++---
drivers/usb/serial/ch341.c | 1 +
drivers/usb/serial/cp210x.c | 2 ++
drivers/usb/serial/ftdi_sio.c | 3 +++
drivers/usb/serial/ftdi_sio_ids.h | 3 +++
drivers/usb/serial/option.c | 2 ++
fs/nfs/client.c | 2 +-
fs/nfs/nfs4client.c | 5 +++-
fs/nfs/nfs4state.c | 3 +++
fs/nfs/nfs4xdr.c | 9 ++++---
fs/nfsd/nfs3proc.c | 5 ++++
fs/nfsd/nfs4proc.c | 5 ++--
include/net/dst_metadata.h | 14 ++++++++++-
init/Kconfig | 10 ++++++++
kernel/bpf/syscall.c | 3 ++-
kernel/sysctl.c | 29 +++++++++++++++++++----
net/ipv4/ipmr.c | 2 ++
net/ipv6/ip6mr.c | 2 ++
net/tipc/name_distr.c | 2 +-
security/integrity/ima/ima_fs.c | 2 +-
security/integrity/integrity_audit.c | 2 ++
sound/usb/line6/podhd.c | 4 ++--
38 files changed, 173 insertions(+), 56 deletions(-)
This is the start of the stable review cycle for the 4.14.267 release.
There are 44 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Wed, 16 Feb 2022 09:24:36 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.267-r…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.14.267-rc1
Song Liu <song(a)kernel.org>
perf: Fix list corruption in perf_cgroup_switch()
Armin Wolf <W_Armin(a)gmx.de>
hwmon: (dell-smm) Speed up setting of fan speed
Kees Cook <keescook(a)chromium.org>
seccomp: Invalidate seccomp mode to catch death failures
Johan Hovold <johan(a)kernel.org>
USB: serial: cp210x: add CPI Bulk Coin Recycler id
Johan Hovold <johan(a)kernel.org>
USB: serial: cp210x: add NCR Retail IO box id
Stephan Brunner <s.brunner(a)stephan-brunner.net>
USB: serial: ch341: add support for GW Instek USB2.0-Serial devices
Pawel Dembicki <paweldembicki(a)gmail.com>
USB: serial: option: add ZTE MF286D modem
Cameron Williams <cang1(a)live.co.uk>
USB: serial: ftdi_sio: add support for Brainboxes US-159/235/320
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
usb: gadget: rndis: check size of RNDIS_MSG_SET command
Szymon Heidrich <szymon.heidrich(a)gmail.com>
USB: gadget: validate interface OS descriptor requests
Udipto Goswami <quic_ugoswami(a)quicinc.com>
usb: dwc3: gadget: Prevent core from processing stale TRBs
Sean Anderson <sean.anderson(a)seco.com>
usb: ulpi: Call of_node_put correctly
Sean Anderson <sean.anderson(a)seco.com>
usb: ulpi: Move of_node_put to ulpi_dev_release
TATSUKAWA KOSUKE (立川 江介) <tatsu-ab1(a)nec.com>
n_tty: wake up poll(POLLRDNORM) on receiving data
Jakob Koschel <jakobkoschel(a)gmail.com>
vt_ioctl: add array_index_nospec to VT_ACTIVATE
Jakob Koschel <jakobkoschel(a)gmail.com>
vt_ioctl: fix array_index_nospec in vt_setactivate
Raju Rangoju <Raju.Rangoju(a)amd.com>
net: amd-xgbe: disable interrupts during pci removal
Jon Maloy <jmaloy(a)redhat.com>
tipc: rate limit warning for received illegal binding update
Antoine Tenart <atenart(a)kernel.org>
net: fix a memleak when uncloning an skb dst and its metadata
Antoine Tenart <atenart(a)kernel.org>
net: do not keep the dst cache when uncloning an skb dst and its metadata
Eric Dumazet <edumazet(a)google.com>
ipmr,ip6mr: acquire RTNL before calling ip[6]mr_free_table() on failure path
Mahesh Bandewar <maheshb(a)google.com>
bonding: pair enable_port with slave_arr_updates
Udipto Goswami <quic_ugoswami(a)quicinc.com>
usb: f_fs: Fix use-after-free for epfile
Fabio Estevam <festevam(a)gmail.com>
ARM: dts: imx6qdl-udoo: Properly describe the SD card detect
Uwe Kleine-König <u.kleine-koenig(a)pengutronix.de>
staging: fbtft: Fix error path in fbtft_driver_module_init()
Martin Blumenstingl <martin.blumenstingl(a)googlemail.com>
ARM: dts: meson: Fix the UART compatible strings
Fabio Estevam <festevam(a)gmail.com>
ARM: dts: imx23-evk: Remove MX23_PAD_SSP1_DETECT from hog group
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: Add kconfig knob for disabling unpriv bpf by default
Sasha Levin <sashal(a)kernel.org>
Revert "net: axienet: Wait for PhyRstCmplt after core reset"
Jisheng Zhang <jszhang(a)kernel.org>
net: stmmac: dwmac-sun8i: use return val of readl_poll_timeout()
Amelie Delaunay <amelie.delaunay(a)foss.st.com>
usb: dwc2: gadget: don't try to disable ep0 in dwc2_hsotg_suspend
ZouMingzhe <mingzhe.zou(a)easystack.cn>
scsi: target: iscsi: Make sure the np under each tpg is unique
Olga Kornievskaia <kolga(a)netapp.com>
NFSv4 expose nfs_parse_server_name function
Olga Kornievskaia <kolga(a)netapp.com>
NFSv4 remove zero number of fs_locations entries error check
Trond Myklebust <trond.myklebust(a)hammerspace.com>
NFSv4.1: Fix uninitialised variable in devicenotify
Xiaoke Wang <xkernel.wang(a)foxmail.com>
nfs: nfs4clinet: check the return value of kstrdup()
Olga Kornievskaia <kolga(a)netapp.com>
NFSv4 only print the label when its queried
Chuck Lever <chuck.lever(a)oracle.com>
NFSD: Clamp WRITE offsets
Trond Myklebust <trond.myklebust(a)hammerspace.com>
NFS: Fix initialisation of nfs_client cl_flags field
Pavel Parkhomenko <Pavel.Parkhomenko(a)baikalelectronics.ru>
net: phy: marvell: Fix MDI-x polarity setting in 88e1118-compatible PHYs
Jiasheng Jiang <jiasheng(a)iscas.ac.cn>
mmc: sdhci-of-esdhc: Check for error num after setting mask
Roberto Sassu <roberto.sassu(a)huawei.com>
ima: Allow template selection with ima_template[_fmt]= after ima_hash=
Stefan Berger <stefanb(a)linux.ibm.com>
ima: Remove ima_policy file before directory
Xiaoke Wang <xkernel.wang(a)foxmail.com>
integrity: check the return value of audit_log_start()
-------------
Diffstat:
Documentation/sysctl/kernel.txt | 21 +++++++++
Makefile | 4 +-
arch/arm/boot/dts/imx23-evk.dts | 1 -
arch/arm/boot/dts/imx6qdl-udoo.dtsi | 5 +-
arch/arm/boot/dts/meson.dtsi | 8 ++--
drivers/hwmon/dell-smm-hwmon.c | 12 +++--
drivers/mmc/host/sdhci-of-esdhc.c | 8 +++-
drivers/net/bonding/bond_3ad.c | 3 +-
drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 3 ++
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +-
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 10 ----
drivers/net/phy/marvell.c | 7 ++-
drivers/staging/fbtft/fbtft.h | 5 +-
drivers/target/iscsi/iscsi_target_tpg.c | 3 ++
drivers/tty/n_tty.c | 4 +-
drivers/tty/vt/vt_ioctl.c | 5 +-
drivers/usb/common/ulpi.c | 10 ++--
drivers/usb/dwc2/gadget.c | 2 +-
drivers/usb/dwc3/gadget.c | 13 ++++++
drivers/usb/gadget/composite.c | 3 ++
drivers/usb/gadget/function/f_fs.c | 56 +++++++++++++++++------
drivers/usb/gadget/function/rndis.c | 9 ++--
drivers/usb/serial/ch341.c | 1 +
drivers/usb/serial/cp210x.c | 2 +
drivers/usb/serial/ftdi_sio.c | 3 ++
drivers/usb/serial/ftdi_sio_ids.h | 3 ++
drivers/usb/serial/option.c | 2 +
fs/nfs/callback.h | 2 +-
fs/nfs/callback_proc.c | 2 +-
fs/nfs/callback_xdr.c | 18 ++++----
fs/nfs/client.c | 2 +-
fs/nfs/nfs4_fs.h | 3 +-
fs/nfs/nfs4client.c | 5 +-
fs/nfs/nfs4namespace.c | 4 +-
fs/nfs/nfs4state.c | 3 ++
fs/nfs/nfs4xdr.c | 9 ++--
fs/nfsd/nfs3proc.c | 5 ++
fs/nfsd/nfs4proc.c | 5 +-
include/net/dst_metadata.h | 14 +++++-
init/Kconfig | 10 ++++
kernel/bpf/syscall.c | 3 +-
kernel/events/core.c | 4 +-
kernel/seccomp.c | 10 ++++
kernel/sysctl.c | 29 ++++++++++--
net/ipv4/ipmr.c | 2 +
net/ipv6/ip6mr.c | 2 +
net/tipc/name_distr.c | 2 +-
security/integrity/ima/ima_fs.c | 2 +-
security/integrity/ima/ima_template.c | 10 ++--
security/integrity/integrity_audit.c | 2 +
50 files changed, 261 insertions(+), 92 deletions(-)
We found a failure when used iperf tool for wifi performance testing,
there are some MSIs received while clearing the interrupt status,
these MSIs cannot be serviced.
The interrupt status can be cleared even the MSI status still remaining,
as an edge-triggered interrupts, its interrupt status should be cleared
before dispatching to the handler of device.
Fixes: 43e6409db64d ("PCI: mediatek: Add MSI support for MT2712 and MT7622")
Signed-off-by: qizhong cheng <qizhong.cheng(a)mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno(a)collabora.com>
Cc: stable(a)vger.kernel.org
---
v3:
- Add Fix tag.
v2:
- Update the subject line.
- Improve the commit log and code comments.
drivers/pci/controller/pcie-mediatek.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
index 2f3f974977a3..2856d74b2513 100644
--- a/drivers/pci/controller/pcie-mediatek.c
+++ b/drivers/pci/controller/pcie-mediatek.c
@@ -624,12 +624,17 @@ static void mtk_pcie_intr_handler(struct irq_desc *desc)
if (status & MSI_STATUS){
unsigned long imsi_status;
+ /*
+ * The interrupt status can be cleared even the MSI
+ * status still remaining, hence as an edge-triggered
+ * interrupts, its interrupt status should be cleared
+ * before dispatching handler.
+ */
+ writel(MSI_STATUS, port->base + PCIE_INT_STATUS);
while ((imsi_status = readl(port->base + PCIE_IMSI_STATUS))) {
for_each_set_bit(bit, &imsi_status, MTK_MSI_IRQS_NUM)
generic_handle_domain_irq(port->inner_domain, bit);
}
- /* Clear MSI interrupt status */
- writel(MSI_STATUS, port->base + PCIE_INT_STATUS);
}
}
--
2.25.1
When connected point to point, the driver does not know the FC4's
supported by the other end. In Fabrics, it can query the nameserver.
Thus the driver must send PRLI's for the FC4s it supports and enable
support based on the acc(ept) or rej(ect) of the respective FC4 PRLI.
Currently the driver supports SCSI and NVMe PRLI's.
Unfortunately, although the behavior is per standard, many devices
have come to expect only SCSI PRLI's. In this particular example, the
NVMe PRLI is properly RJT'd but the target decided that it must LOGO after
seeing the unexpected NVMe PRLI. The LOGO causes the sequence to restart
and login is now in an infinite failure loop.
Fix the problem by having the driver, on a pt2pt link, remember NVMe PRLI
accept or reject status across logout as long as the link stays "up".
When retrying login, if the prior NVMe PRLI was rejected, it will not be
sent on the next login.
Cut against 5.18/scsi-queue
Cc: <stable(a)vger.kernel.org> # v5.4+
Signed-off-by: James Smart <jsmart2021(a)gmail.com>
---
drivers/scsi/lpfc/lpfc.h | 1 +
drivers/scsi/lpfc/lpfc_attr.c | 3 +++
drivers/scsi/lpfc/lpfc_els.c | 20 +++++++++++++++++++-
drivers/scsi/lpfc/lpfc_nportdisc.c | 5 +++--
4 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index a1e0a106c132..98cabe09c040 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -592,6 +592,7 @@ struct lpfc_vport {
#define FC_VPORT_LOGO_RCVD 0x200 /* LOGO received on vport */
#define FC_RSCN_DISCOVERY 0x400 /* Auth all devices after RSCN */
#define FC_LOGO_RCVD_DID_CHNG 0x800 /* FDISC on phys port detect DID chng*/
+#define FC_PT2PT_NO_NVME 0x1000 /* Don't send NVME PRLI */
#define FC_SCSI_SCAN_TMO 0x4000 /* scsi scan timer running */
#define FC_ABORT_DISCOVERY 0x8000 /* we want to abort discovery */
#define FC_NDISC_ACTIVE 0x10000 /* NPort discovery active */
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index bac78fbce8d6..fa8415259cb8 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -1315,6 +1315,9 @@ lpfc_issue_lip(struct Scsi_Host *shost)
pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK;
pmboxq->u.mb.mbxOwner = OWN_HOST;
+ if ((vport->fc_flag & FC_PT2PT) && (vport->fc_flag & FC_PT2PT_NO_NVME))
+ vport->fc_flag &= ~FC_PT2PT_NO_NVME;
+
mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, LPFC_MBOX_TMO * 2);
if ((mbxstatus == MBX_SUCCESS) &&
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index db5ccae1b63d..f936833c9909 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -1072,7 +1072,8 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
/* FLOGI failed, so there is no fabric */
spin_lock_irq(shost->host_lock);
- vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);
+ vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP |
+ FC_PT2PT_NO_NVME);
spin_unlock_irq(shost->host_lock);
/* If private loop, then allow max outstanding els to be
@@ -4607,6 +4608,23 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
/* Added for Vendor specifc support
* Just keep retrying for these Rsn / Exp codes
*/
+ if ((vport->fc_flag & FC_PT2PT) &&
+ cmd == ELS_CMD_NVMEPRLI) {
+ switch (stat.un.b.lsRjtRsnCode) {
+ case LSRJT_UNABLE_TPC:
+ case LSRJT_INVALID_CMD:
+ case LSRJT_LOGICAL_ERR:
+ case LSRJT_CMD_UNSUPPORTED:
+ lpfc_printf_vlog(vport, KERN_WARNING, LOG_ELS,
+ "0168 NVME PRLI LS_RJT "
+ "reason %x port doesn't "
+ "support NVME, disabling NVME\n",
+ stat.un.b.lsRjtRsnCode);
+ retry = 0;
+ vport->fc_flag |= FC_PT2PT_NO_NVME;
+ goto out_retry;
+ }
+ }
switch (stat.un.b.lsRjtRsnCode) {
case LSRJT_UNABLE_TPC:
/* The driver has a VALID PLOGI but the rport has
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 7d717a4ac14d..fdf5e777bf11 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -1961,8 +1961,9 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport,
* is configured try it.
*/
ndlp->nlp_fc4_type |= NLP_FC4_FCP;
- if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
- (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
+ if ((!(vport->fc_flag & FC_PT2PT_NO_NVME)) &&
+ (vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH ||
+ vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
ndlp->nlp_fc4_type |= NLP_FC4_NVME;
/* We need to update the localport also */
lpfc_nvme_update_localport(vport);
--
2.26.2