mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [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; 3+ 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] 3+ 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; 3+ 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] 3+ 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
  0 siblings, 0 replies; 3+ 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] 3+ messages in thread

end of thread, other threads:[~2026-11-10 18:21 UTC | newest]

Thread overview: 3+ 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

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®