* [PATCH AUTOSEL 4.14 1/6] scsi: target: iscsi: Prevent login threads from racing between each other
@ 2023-06-15 11:40 Sasha Levin
2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 2/6] HID: wacom: Add error check to wacom_parse_and_register() Sasha Levin
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Sasha Levin @ 2023-06-15 11:40 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Maurizio Lombardi, Mike Christie, Martin K . Petersen,
Sasha Levin, d.bogdanov, peilin.ye, yang.lee, linux-scsi,
target-devel
From: Maurizio Lombardi <mlombard@redhat.com>
[ Upstream commit 2a737d3b8c792400118d6cf94958f559de9c5e59 ]
The tpg->np_login_sem is a semaphore that is used to serialize the login
process when multiple login threads run concurrently against the same
target portal group.
The iscsi_target_locate_portal() function finds the tpg, calls
iscsit_access_np() against the np_login_sem semaphore and saves the tpg
pointer in conn->tpg;
If iscsi_target_locate_portal() fails, the caller will check for the
conn->tpg pointer and, if it's not NULL, then it will assume that
iscsi_target_locate_portal() called iscsit_access_np() on the semaphore.
Make sure that conn->tpg gets initialized only if iscsit_access_np() was
successful, otherwise iscsit_deaccess_np() may end up being called against
a semaphore we never took, allowing more than one thread to access the same
tpg.
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Link: https://lore.kernel.org/r/20230508162219.1731964-4-mlombard@redhat.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/target/iscsi/iscsi_target_nego.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index 07335357418c8..d94f711afee07 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -1067,6 +1067,7 @@ int iscsi_target_locate_portal(
iscsi_target_set_sock_callbacks(conn);
login->np = np;
+ conn->tpg = NULL;
login_req = (struct iscsi_login_req *) login->req;
payload_length = ntoh24(login_req->dlength);
@@ -1136,7 +1137,6 @@ int iscsi_target_locate_portal(
*/
sessiontype = strncmp(s_buf, DISCOVERY, 9);
if (!sessiontype) {
- conn->tpg = iscsit_global->discovery_tpg;
if (!login->leading_connection)
goto get_target;
@@ -1153,9 +1153,11 @@ int iscsi_target_locate_portal(
* Serialize access across the discovery struct iscsi_portal_group to
* process login attempt.
*/
+ conn->tpg = iscsit_global->discovery_tpg;
if (iscsit_access_np(np, conn->tpg) < 0) {
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
ISCSI_LOGIN_STATUS_SVC_UNAVAILABLE);
+ conn->tpg = NULL;
ret = -1;
goto out;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH AUTOSEL 4.14 2/6] HID: wacom: Add error check to wacom_parse_and_register() 2023-06-15 11:40 [PATCH AUTOSEL 4.14 1/6] scsi: target: iscsi: Prevent login threads from racing between each other Sasha Levin @ 2023-06-15 11:40 ` Sasha Levin 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 3/6] arm64: Add missing Set/Way CMO encodings Sasha Levin ` (3 subsequent siblings) 4 siblings, 0 replies; 9+ messages in thread From: Sasha Levin @ 2023-06-15 11:40 UTC (permalink / raw) To: linux-kernel, stable Cc: Denis Arefev, Ping Cheng, Jiri Kosina, Sasha Levin, jason.gerecke, jikos, benjamin.tissoires, linux-input From: Denis Arefev <arefev@swemel.ru> [ Upstream commit 16a9c24f24fbe4564284eb575b18cc20586b9270 ] Added a variable check and transition in case of an error Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Denis Arefev <arefev@swemel.ru> Reviewed-by: Ping Cheng <ping.cheng@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/hid/wacom_sys.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 3d521f289984a..28e7a4950b74a 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -2251,8 +2251,13 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless) goto fail_quirks; } - if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) + if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) { error = hid_hw_open(hdev); + if (error) { + hid_err(hdev, "hw open failed\n"); + goto fail_quirks; + } + } wacom_set_shared_values(wacom_wac); devres_close_group(&hdev->dev, wacom); -- 2.39.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 4.14 3/6] arm64: Add missing Set/Way CMO encodings 2023-06-15 11:40 [PATCH AUTOSEL 4.14 1/6] scsi: target: iscsi: Prevent login threads from racing between each other Sasha Levin 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 2/6] HID: wacom: Add error check to wacom_parse_and_register() Sasha Levin @ 2023-06-15 11:40 ` Sasha Levin 2023-06-16 19:34 ` Pavel Machek 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 4/6] nfcsim.c: Fix error checking for debugfs_create_dir Sasha Levin ` (2 subsequent siblings) 4 siblings, 1 reply; 9+ messages in thread From: Sasha Levin @ 2023-06-15 11:40 UTC (permalink / raw) To: linux-kernel, stable Cc: Marc Zyngier, Cornelia Huck, Steven Price, Oliver Upton, Sasha Levin, catalin.marinas, will, broonie, james.morse, kristina.martsenko, robh, jintack.lim, linux-arm-kernel From: Marc Zyngier <maz@kernel.org> [ Upstream commit 8d0f019e4c4f2ee2de81efd9bf1c27e9fb3c0460 ] Add the missing Set/Way CMOs that apply to tagged memory. Signed-off-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Steven Price <steven.price@arm.com> Reviewed-by: Oliver Upton <oliver.upton@linux.dev> Link: https://lore.kernel.org/r/20230515204601.1270428-2-maz@kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org> --- arch/arm64/include/asm/sysreg.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index 3bbf0dc5ecad0..78d6f4bf117d6 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -98,8 +98,14 @@ (!!x)<<8 | 0x1f) #define SYS_DC_ISW sys_insn(1, 0, 7, 6, 2) +#define SYS_DC_IGSW sys_insn(1, 0, 7, 6, 4) +#define SYS_DC_IGDSW sys_insn(1, 0, 7, 6, 6) #define SYS_DC_CSW sys_insn(1, 0, 7, 10, 2) +#define SYS_DC_CGSW sys_insn(1, 0, 7, 10, 4) +#define SYS_DC_CGDSW sys_insn(1, 0, 7, 10, 6) #define SYS_DC_CISW sys_insn(1, 0, 7, 14, 2) +#define SYS_DC_CIGSW sys_insn(1, 0, 7, 14, 4) +#define SYS_DC_CIGDSW sys_insn(1, 0, 7, 14, 6) #define SYS_OSDTRRX_EL1 sys_reg(2, 0, 0, 0, 2) #define SYS_MDCCINT_EL1 sys_reg(2, 0, 0, 2, 0) -- 2.39.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH AUTOSEL 4.14 3/6] arm64: Add missing Set/Way CMO encodings 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 3/6] arm64: Add missing Set/Way CMO encodings Sasha Levin @ 2023-06-16 19:34 ` Pavel Machek 0 siblings, 0 replies; 9+ messages in thread From: Pavel Machek @ 2023-06-16 19:34 UTC (permalink / raw) To: Sasha Levin Cc: linux-kernel, stable, Marc Zyngier, Cornelia Huck, Steven Price, Oliver Upton, catalin.marinas, will, broonie, james.morse, kristina.martsenko, robh, jintack.lim, linux-arm-kernel [-- Attachment #1: Type: text/plain, Size: 1131 bytes --] Hi! > From: Marc Zyngier <maz@kernel.org> > > [ Upstream commit 8d0f019e4c4f2ee2de81efd9bf1c27e9fb3c0460 ] > > Add the missing Set/Way CMOs that apply to tagged memory. We are not adding users of these in 4.14, so we don't need the defines, either... right? Best regards, Pavel > +++ b/arch/arm64/include/asm/sysreg.h > @@ -98,8 +98,14 @@ > (!!x)<<8 | 0x1f) > > #define SYS_DC_ISW sys_insn(1, 0, 7, 6, 2) > +#define SYS_DC_IGSW sys_insn(1, 0, 7, 6, 4) > +#define SYS_DC_IGDSW sys_insn(1, 0, 7, 6, 6) > #define SYS_DC_CSW sys_insn(1, 0, 7, 10, 2) > +#define SYS_DC_CGSW sys_insn(1, 0, 7, 10, 4) > +#define SYS_DC_CGDSW sys_insn(1, 0, 7, 10, 6) > #define SYS_DC_CISW sys_insn(1, 0, 7, 14, 2) > +#define SYS_DC_CIGSW sys_insn(1, 0, 7, 14, 4) > +#define SYS_DC_CIGDSW sys_insn(1, 0, 7, 14, 6) > > #define SYS_OSDTRRX_EL1 sys_reg(2, 0, 0, 0, 2) > #define SYS_MDCCINT_EL1 sys_reg(2, 0, 0, 2, 0) -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 4.14 4/6] nfcsim.c: Fix error checking for debugfs_create_dir 2023-06-15 11:40 [PATCH AUTOSEL 4.14 1/6] scsi: target: iscsi: Prevent login threads from racing between each other Sasha Levin 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 2/6] HID: wacom: Add error check to wacom_parse_and_register() Sasha Levin 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 3/6] arm64: Add missing Set/Way CMO encodings Sasha Levin @ 2023-06-15 11:40 ` Sasha Levin 2023-06-16 19:35 ` Pavel Machek 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 5/6] fbdev: imsttfb: Release framebuffer and dealloc cmap on error path Sasha Levin 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 6/6] usb: gadget: udc: fix NULL dereference in remove() Sasha Levin 4 siblings, 1 reply; 9+ messages in thread From: Sasha Levin @ 2023-06-15 11:40 UTC (permalink / raw) To: linux-kernel, stable Cc: Osama Muhammad, Simon Horman, David S . Miller, Sasha Levin, krzysztof.kozlowski, netdev From: Osama Muhammad <osmtendev@gmail.com> [ Upstream commit 9b9e46aa07273ceb96866b2e812b46f1ee0b8d2f ] This patch fixes the error checking in nfcsim.c. The DebugFS kernel API is developed in a way that the caller can safely ignore the errors that occur during the creation of DebugFS nodes. Signed-off-by: Osama Muhammad <osmtendev@gmail.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/nfc/nfcsim.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c index 533e3aa6275cd..cf07b366500e9 100644 --- a/drivers/nfc/nfcsim.c +++ b/drivers/nfc/nfcsim.c @@ -345,10 +345,6 @@ static struct dentry *nfcsim_debugfs_root; static void nfcsim_debugfs_init(void) { nfcsim_debugfs_root = debugfs_create_dir("nfcsim", NULL); - - if (!nfcsim_debugfs_root) - pr_err("Could not create debugfs entry\n"); - } static void nfcsim_debugfs_remove(void) -- 2.39.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH AUTOSEL 4.14 4/6] nfcsim.c: Fix error checking for debugfs_create_dir 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 4/6] nfcsim.c: Fix error checking for debugfs_create_dir Sasha Levin @ 2023-06-16 19:35 ` Pavel Machek 0 siblings, 0 replies; 9+ messages in thread From: Pavel Machek @ 2023-06-16 19:35 UTC (permalink / raw) To: Sasha Levin Cc: linux-kernel, stable, Osama Muhammad, Simon Horman, David S . Miller, krzysztof.kozlowski, netdev [-- Attachment #1: Type: text/plain, Size: 1245 bytes --] Hi! > [ Upstream commit 9b9e46aa07273ceb96866b2e812b46f1ee0b8d2f ] > > This patch fixes the error checking in nfcsim.c. > The DebugFS kernel API is developed in > a way that the caller can safely ignore the errors that > occur during the creation of DebugFS nodes. I don't think this is good idea; user will wonder why he can't see debugfs files, and pr_err() is quite suitable way to handle this. Anyway, this does not really fix a bug, so we should not be putting it into stable. Best regards, Pavel > drivers/nfc/nfcsim.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c > index 533e3aa6275cd..cf07b366500e9 100644 > --- a/drivers/nfc/nfcsim.c > +++ b/drivers/nfc/nfcsim.c > @@ -345,10 +345,6 @@ static struct dentry *nfcsim_debugfs_root; > static void nfcsim_debugfs_init(void) > { > nfcsim_debugfs_root = debugfs_create_dir("nfcsim", NULL); > - > - if (!nfcsim_debugfs_root) > - pr_err("Could not create debugfs entry\n"); > - > } > > static void nfcsim_debugfs_remove(void) -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 4.14 5/6] fbdev: imsttfb: Release framebuffer and dealloc cmap on error path 2023-06-15 11:40 [PATCH AUTOSEL 4.14 1/6] scsi: target: iscsi: Prevent login threads from racing between each other Sasha Levin ` (2 preceding siblings ...) 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 4/6] nfcsim.c: Fix error checking for debugfs_create_dir Sasha Levin @ 2023-06-15 11:40 ` Sasha Levin 2023-06-16 19:36 ` Pavel Machek 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 6/6] usb: gadget: udc: fix NULL dereference in remove() Sasha Levin 4 siblings, 1 reply; 9+ messages in thread From: Sasha Levin @ 2023-06-15 11:40 UTC (permalink / raw) To: linux-kernel, stable Cc: Helge Deller, Sasha Levin, javierm, tzimmermann, zyytlz.wz, linux-fbdev, dri-devel From: Helge Deller <deller@gmx.de> [ Upstream commit 5cf9a090a39c97f4506b7b53739d469b1c05a7e9 ] Add missing cleanups in error path. Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/video/fbdev/imsttfb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c index ecdcf358ad5ea..6589d5f0a5a40 100644 --- a/drivers/video/fbdev/imsttfb.c +++ b/drivers/video/fbdev/imsttfb.c @@ -1452,9 +1452,13 @@ static void init_imstt(struct fb_info *info) FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_YPAN; - fb_alloc_cmap(&info->cmap, 0, 0); + if (fb_alloc_cmap(&info->cmap, 0, 0)) { + framebuffer_release(info); + return -ENODEV; + } if (register_framebuffer(info) < 0) { + fb_dealloc_cmap(&info->cmap); framebuffer_release(info); return; } -- 2.39.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH AUTOSEL 4.14 5/6] fbdev: imsttfb: Release framebuffer and dealloc cmap on error path 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 5/6] fbdev: imsttfb: Release framebuffer and dealloc cmap on error path Sasha Levin @ 2023-06-16 19:36 ` Pavel Machek 0 siblings, 0 replies; 9+ messages in thread From: Pavel Machek @ 2023-06-16 19:36 UTC (permalink / raw) To: Sasha Levin Cc: linux-kernel, stable, Helge Deller, javierm, tzimmermann, zyytlz.wz, linux-fbdev, dri-devel [-- Attachment #1: Type: text/plain, Size: 964 bytes --] Hi! > From: Helge Deller <deller@gmx.de> > > [ Upstream commit 5cf9a090a39c97f4506b7b53739d469b1c05a7e9 ] > > Add missing cleanups in error path. If we insist this is important enough for -stable, it will need tweaking. The function returns void, so we can't return a value. Best regards, Pavel > +++ b/drivers/video/fbdev/imsttfb.c > @@ -1452,9 +1452,13 @@ static void init_imstt(struct fb_info *info) > FBINFO_HWACCEL_FILLRECT | > FBINFO_HWACCEL_YPAN; > > - fb_alloc_cmap(&info->cmap, 0, 0); > + if (fb_alloc_cmap(&info->cmap, 0, 0)) { > + framebuffer_release(info); > + return -ENODEV; > + } > > if (register_framebuffer(info) < 0) { > + fb_dealloc_cmap(&info->cmap); > framebuffer_release(info); > return; > } -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH AUTOSEL 4.14 6/6] usb: gadget: udc: fix NULL dereference in remove() 2023-06-15 11:40 [PATCH AUTOSEL 4.14 1/6] scsi: target: iscsi: Prevent login threads from racing between each other Sasha Levin ` (3 preceding siblings ...) 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 5/6] fbdev: imsttfb: Release framebuffer and dealloc cmap on error path Sasha Levin @ 2023-06-15 11:40 ` Sasha Levin 4 siblings, 0 replies; 9+ messages in thread From: Sasha Levin @ 2023-06-15 11:40 UTC (permalink / raw) To: linux-kernel, stable Cc: Dan Carpenter, Greg Kroah-Hartman, Sasha Levin, linux-usb From: Dan Carpenter <dan.carpenter@linaro.org> [ Upstream commit 016da9c65fec9f0e78c4909ed9a0f2d567af6775 ] The "udc" pointer was never set in the probe() function so it will lead to a NULL dereference in udc_pci_remove() when we do: usb_del_gadget_udc(&udc->gadget); Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/ZG+A/dNpFWAlCChk@kili Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/usb/gadget/udc/amd5536udc_pci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/gadget/udc/amd5536udc_pci.c b/drivers/usb/gadget/udc/amd5536udc_pci.c index 73413c1211cbd..8849fc3030bd2 100644 --- a/drivers/usb/gadget/udc/amd5536udc_pci.c +++ b/drivers/usb/gadget/udc/amd5536udc_pci.c @@ -175,6 +175,9 @@ static int udc_pci_probe( retval = -ENODEV; goto err_probe; } + + udc = dev; + return 0; err_probe: -- 2.39.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-06-16 19:36 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-06-15 11:40 [PATCH AUTOSEL 4.14 1/6] scsi: target: iscsi: Prevent login threads from racing between each other Sasha Levin 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 2/6] HID: wacom: Add error check to wacom_parse_and_register() Sasha Levin 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 3/6] arm64: Add missing Set/Way CMO encodings Sasha Levin 2023-06-16 19:34 ` Pavel Machek 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 4/6] nfcsim.c: Fix error checking for debugfs_create_dir Sasha Levin 2023-06-16 19:35 ` Pavel Machek 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 5/6] fbdev: imsttfb: Release framebuffer and dealloc cmap on error path Sasha Levin 2023-06-16 19:36 ` Pavel Machek 2023-06-15 11:40 ` [PATCH AUTOSEL 4.14 6/6] usb: gadget: udc: fix NULL dereference in remove() Sasha Levin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox