* [PATCH] USB: legousbtower: use stream_open for stream semantics
@ 2026-10-28 18:28 mdshahid03
2026-11-10 17:31 ` mdshahid03
0 siblings, 1 reply; 5+ messages in thread
From: mdshahid03 @ 2026-10-28 18:28 UTC (permalink / raw)
To: starblue, gregkh; +Cc: legousb-devel, linux-usb, linux-kernel, Mohammad Shahid
From: Mohammad Shahid <mdshahid03@gmail.com>
The LEGO USB Tower driver uses nonseekable_open() in tower_open()
However, its read and write have stream semantics.
Use stream_open instead to mark the file as a stream and disable
unnecessary file position handling.
The issue is reported by stream_open.cocci script as potential
deadlock between read and write operation.
Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
drivers/usb/misc/legousbtower.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 18dd4115befb..b849bd0e9664 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -313,7 +313,7 @@ static int tower_open(struct inode *inode, struct file *file)
struct tower_reset_reply reset_reply;
int result;
- nonseekable_open(inode, file);
+ stream_open(inode, file);
subminor = iminor(inode);
interface = usb_find_interface(&tower_driver, subminor);
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] USB: legousbtower: use stream_open for stream semantics
2026-10-28 18:28 [PATCH] USB: legousbtower: use stream_open for stream semantics mdshahid03
@ 2026-11-10 17:31 ` mdshahid03
2026-11-10 18:21 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: mdshahid03 @ 2026-11-10 17:31 UTC (permalink / raw)
To: mdshahid03; +Cc: starblue, gregkh, legousb-devel, linux-usb, linux-kernel
Hi,
Could you please review patch and give your feedback,when time permits.
Thanks
Shahid.
On 2026-10-28 23:58 +0530, mdshahid03@gmail.com wrote:
> From: Mohammad Shahid <mdshahid03@gmail.com>
>
> The LEGO USB Tower driver uses nonseekable_open() in tower_open()
> However, its read and write have stream semantics.
>
> Use stream_open instead to mark the file as a stream and disable
> unnecessary file position handling.
>
> The issue is reported by stream_open.cocci script as potential
> deadlock between read and write operation.
>
> Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
> ---
> drivers/usb/misc/legousbtower.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
> index 18dd4115befb..b849bd0e9664 100644
> --- a/drivers/usb/misc/legousbtower.c
> +++ b/drivers/usb/misc/legousbtower.c
> @@ -313,7 +313,7 @@ static int tower_open(struct inode *inode, struct file *file)
> struct tower_reset_reply reset_reply;
> int result;
>
> - nonseekable_open(inode, file);
> + stream_open(inode, file);
> subminor = iminor(inode);
>
> interface = usb_find_interface(&tower_driver, subminor);
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] USB: legousbtower: use stream_open for stream semantics
2026-11-10 17:31 ` mdshahid03
@ 2026-11-10 18:21 ` Greg KH
2026-11-11 13:00 ` mdshahid03
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2026-11-10 18:21 UTC (permalink / raw)
To: mdshahid03; +Cc: starblue, legousb-devel, linux-usb, linux-kernel
On Tue, Nov 10, 2026 at 11:01:36PM +0530, mdshahid03@gmail.com wrote:
> Hi,
>
> Could you please review patch and give your feedback,when time permits.
>
> Thanks
> Shahid.
>
> On 2026-10-28 23:58 +0530, mdshahid03@gmail.com wrote:
> > From: Mohammad Shahid <mdshahid03@gmail.com>
> >
> > The LEGO USB Tower driver uses nonseekable_open() in tower_open()
> > However, its read and write have stream semantics.
> >
> > Use stream_open instead to mark the file as a stream and disable
> > unnecessary file position handling.
> >
> > The issue is reported by stream_open.cocci script as potential
> > deadlock between read and write operation.
> >
> > Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
> > ---
> > drivers/usb/misc/legousbtower.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
How was this tested?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] USB: legousbtower: use stream_open for stream semantics
2026-11-10 18:21 ` Greg KH
@ 2026-11-11 13:00 ` mdshahid03
2026-11-11 13:13 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: mdshahid03 @ 2026-11-11 13:00 UTC (permalink / raw)
To: Greg KH; +Cc: mdshahid03, starblue, legousb-devel, linux-usb, linux-kernel
Hi Greg,
I did basic sanity ,I build driver and ran smatch after changes.
I don't have Lego USB HW to test it ,but there is similar changes
in Xyllibus ,that was sent by me and Eli(maintainer)has tested in HW.
According to Eli ,There is no regressions with stream_open().
Here is discussion:
https://lore.kernel.org/all/24af6daf-dbf3-5c47-beb7-077c4473ea7e@outbound.gmail.com/
Thanks
Shahid.
On 2026-11-10 13:21 -0500, Greg KH wrote:
> On Tue, Nov 10, 2026 at 11:01:36PM +0530, mdshahid03@gmail.com wrote:
> > Hi,
> >
> > Could you please review patch and give your feedback,when time permits.
> >
> > Thanks
> > Shahid.
> >
> > On 2026-10-28 23:58 +0530, mdshahid03@gmail.com wrote:
> > > From: Mohammad Shahid <mdshahid03@gmail.com>
> > >
> > > The LEGO USB Tower driver uses nonseekable_open() in tower_open()
> > > However, its read and write have stream semantics.
> > >
> > > Use stream_open instead to mark the file as a stream and disable
> > > unnecessary file position handling.
> > >
> > > The issue is reported by stream_open.cocci script as potential
> > > deadlock between read and write operation.
> > >
> > > Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
> > > ---
> > > drivers/usb/misc/legousbtower.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> How was this tested?
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] USB: legousbtower: use stream_open for stream semantics
2026-11-11 13:00 ` mdshahid03
@ 2026-11-11 13:13 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2026-11-11 13:13 UTC (permalink / raw)
To: mdshahid03; +Cc: starblue, legousb-devel, linux-usb, linux-kernel
On Wed, Nov 11, 2026 at 06:30:21PM +0530, mdshahid03@gmail.com wrote:
> Hi Greg,
>
> I did basic sanity ,I build driver and ran smatch after changes.
So, no testing :)
> I don't have Lego USB HW to test it ,but there is similar changes
> in Xyllibus ,that was sent by me and Eli(maintainer)has tested in HW.
> According to Eli ,There is no regressions with stream_open().
>
> Here is discussion:
> https://lore.kernel.org/all/24af6daf-dbf3-5c47-beb7-077c4473ea7e@outbound.gmail.com/
If you don't have this hardware, then there's no rush on this potential
change.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-11 13:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 18:28 [PATCH] USB: legousbtower: use stream_open for stream semantics mdshahid03
2026-11-10 17:31 ` mdshahid03
2026-11-10 18:21 ` Greg KH
2026-11-11 13:00 ` mdshahid03
2026-11-11 13:13 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®