USB: legousbtower: use stream_open for stream semantics
Subsystems (2)
PATCH 1/1 USB: legousbtower: use stream_open for stream semantics
From: Mohammad Shahid <[email protected]>
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.
--- drivers/usb/misc/legousbtower.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/legousbtower.c +1 -1
@@ -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);
Signature · 1 line
2.43.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 5 lines
From: Mohammad Shahid <[email protected]>
The LEGO USB Tower driver uses
nonseekable_open()intower_open()However, its read and write have stream semantics.
Quoted 7 lines
Use
stream_openinstead to mark the file as a stream and disable unnecessary file position handling.The issue is reported by
stream_open.cocciscript as potential deadlock between read and write operation.Signed-off-by Mohammad Shahid <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Hi,
Could you please review patch and give your feedback,when time permits.
Thanks
Shahid.
Quoted 33 lines · On 2026-10-28 23:58 +0530, [email protected] wrote:
From: Mohammad Shahid <[email protected]>
The LEGO USB Tower driver uses
nonseekable_open()intower_open()However, its read and write have stream semantics.Use
stream_openinstead to mark the file as a stream and disable unnecessary file position handling.The issue is reported by
stream_open.cocciscript as potential deadlock between read and write operation.Signed-off-by Mohammad Shahid <[email protected]>--- drivers/usb/misc/legousbtower.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/misc/legousbtower.c +1
-1@@ -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);Signature · 1 line
2.43.0
Greg KH
maintainerQuoted 23 lines · On Tue, Nov 10, 2026 at 11:01:36PM +0530, [email protected] wrote:
Hi,
Could you please review patch and give your feedback,when time permits.
Thanks
Shahid.Quoted 15 lines · On 2026-10-28 23:58 +0530, [email protected] wrote:
From: Mohammad Shahid <[email protected]>
The LEGO USB Tower driver uses
nonseekable_open()intower_open()However, its read and write have stream semantics.Use
stream_openinstead to mark the file as a stream and disable unnecessary file position handling.The issue is reported by
stream_open.cocciscript as potential deadlock between read and write operation.Signed-off-by Mohammad Shahid <[email protected]>--- drivers/usb/misc/legousbtower.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
How was this tested?
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/[email protected]/
Thanks
Shahid.
Quoted 28 lines · Greg KH
Quoted 23 lines · On Tue, Nov 10, 2026 at 11:01:36PM +0530, [email protected] wrote:
Hi,
Could you please review patch and give your feedback,when time permits.
Thanks
Shahid.Quoted 15 lines · On 2026-10-28 23:58 +0530, [email protected] wrote:
From: Mohammad Shahid <[email protected]>
The LEGO USB Tower driver uses
nonseekable_open()intower_open()However, its read and write have stream semantics.Use
stream_openinstead to mark the file as a stream and disable unnecessary file position handling.The issue is reported by
stream_open.cocciscript as potential deadlock between read and write operation.Signed-off-by Mohammad Shahid <[email protected]>--- drivers/usb/misc/legousbtower.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)How was this tested?
Greg KH
maintainerQuoted 3 lines · On Wed, Nov 11, 2026 at 06:30:21PM +0530, [email protected] wrote:
Hi Greg,
I did basic sanity ,I build driver and ran smatch after changes.
So, no testing :)
Quoted 6 lines
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/[email protected]/
If you don't have this hardware, then there's no rush on this potential change.
thanks,
greg k-h