All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Chenyuan Yang <chenyuan0y@gmail.com>,
	Greg KH <gregkh@linuxfoundation.org>
Cc: valentina.manea.m@gmail.com, shuah@kernel.org, i@zenithal.me,
	linux-usb@vger.kernel.org, Zijie Zhao <zzjas98@gmail.com>,
	syzkaller@googlegroups.com, linux-media@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [drivers/usb/usbip] BUG: corrupted list in vep_queue
Date: Fri, 11 Oct 2024 16:56:45 -0600	[thread overview]
Message-ID: <f7d4a151-81ff-4367-aa2e-b39c30db3d31@linuxfoundation.org> (raw)
In-Reply-To: <73247327-5bc2-4390-a60d-a73e5683f0a6@linuxfoundation.org>

On 10/11/24 11:05, Shuah Khan wrote:
> On 10/11/24 10:21, Chenyuan Yang wrote:
>> Hi Greg,
>>
>> I'm curious about the best approach to fix this issue. I'm unsure if
>> adding a spinlock or mutex around the code would be good to ensure
>> that only one thread can modify the list at a time (then fix this
>> issue).
>>
>> Alternatively, we could check if the entry is already in the list
>> within the vep_queue function:
>> ```
>> if (!list_empty(&new_entry->list)) {
>>      // Entry is already in the list, handle it (e.g., log an error or ignore)
>>      return -EEXIST; // Or another appropriate error code
>> }
>>
> 
> vep_queue() function is holding udc lock when it updates
> the status and calls list_add_tail(). vep_dequeue() does
> the same.
> 
> vep_free_request() doesn't see to hold the udc lock. I will
> tale a look at this a bit more and get back to you on the
> best approach. My guess is that the fix will be in another
> function such as vep_free_request() - at the moment - that
> routine is the one I suspect.
> 
> 

Can you try adding udc lock hold in vep_free_request() and see
if the problem persists?

thanks,
-- Shuah


      reply	other threads:[~2024-10-11 22:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11  5:13 [drivers/usb/usbip] BUG: corrupted list in vep_queue Chenyuan Yang
2024-10-11  5:21 ` Greg KH
2024-10-11 16:21   ` Chenyuan Yang
2024-10-11 17:05     ` Shuah Khan
2024-10-11 22:56       ` Shuah Khan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7d4a151-81ff-4367-aa2e-b39c30db3d31@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=chenyuan0y@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=i@zenithal.me \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=syzkaller@googlegroups.com \
    --cc=valentina.manea.m@gmail.com \
    --cc=zzjas98@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.