All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Saad Varshani <varshanisaad@gmail.com>
Cc: nkapron@google.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	syzbot+300213c2b5b55c0244f4@syzkaller.appspotmail.com
Subject: Re: [PATCH v6] usb: gadget: uvc: Fix deadlocks in uvcg_configfs attribute callbacks
Date: Fri, 20 Nov 2026 09:20:58 +0100	[thread overview]
Message-ID: <2026112038-imitate-drastic-8d6c@gregkh> (raw)
In-Reply-To: <20261107051544.4381-1-varshanisaad@gmail.com>

On Fri, Nov 06, 2026 at 09:15:44PM -0800, Saad Varshani wrote:
> Removed su_mutex locking in the function uvcg_extension_bm_controls_store.
> Done this due to the deadlock caused by the mutex conflict in
> fs/configfs_write_iter. Validated commit with the C repro provided by
> syzbot. No other conficts observed.
> 
> Also removed the su_mutex in the other attribute extension functions.
> Such as uvcg_extension_b_control_size_store. This applies to all
> uvcg_configfs attribute store/show functions.
> 
> The deadlock was happening due to a circular mutex dependency between
> configfs (frag_sem) and uvcg_extension su_mutex. The reason it is safe
> to traverse item->ci_parent without su_mutex is because
> configfs_write_iter() calls flush_write_buffer() which calls the
> attribute function, holding frag_sem. Which prevents configfs_rmdir()
> from unlinking the item or its ci_parent hierarchy
> 
> Also reordered fmt->linked in uvcg_frame_b_frame_index_show() to be
> under the &opts->lock. As well as reorder refcnt in uvcg_color_matching
> store to be under &opts->lock.
> 
> Applied opts->lock mutex, to functions uvcg_format_allow_link(),
> uvcg_format_drop_link(), uvcg_uncompressed_make(), uvcg_mjpeg_make(),
> and uvcg_framebased_make() due to them also modifying
> color_match->refcnt, to avoid concurrency issues.
> 
> ---
> v6 changes:
> 	- Fix compiler errors introduced in v5, due to forgetting to
> 	  test compile, and add the required variables to the modified
> 	  functions.

That doesn't belong here, it belongs below:

> Reported-by: syzbot+300213c2b5b55c0244f4@syzkaller.appspotmail.com
> Closes: https://syzbot.org/bug?extid=300213c2b5b55c0244f4
> Signed-off-by: Saad Varshani <varshanisaad@gmail.com>
> ---

Right here.

thanks,

greg k-h

  parent reply	other threads:[~2026-11-20  8:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  5:39 [PATCH] usb: gadget: uvc: Fix deadlock in uvcg_extension_bm_controls_store Saad Varshani
2026-11-05  6:05 ` sashiko-bot
2026-11-06  2:07 ` [PATCH v2] usb: gadget: uvc: Fix deadlocks in uvcg_configfs attribute callbacks Saad Varshani
2026-11-06  2:21   ` sashiko-bot
2026-11-06  3:50   ` [PATCH v3] " Saad Varshani
2026-11-06  3:57   ` [PATCH v4] " Saad Varshani
2026-11-06  4:09     ` sashiko-bot
2026-11-07  4:45   ` [PATCH v5] " Saad Varshani
2026-11-07  4:57     ` sashiko-bot
2026-11-07  5:15   ` [PATCH v6] " Saad Varshani
2026-11-07  5:27     ` sashiko-bot
2026-11-20  8:20     ` Greg KH [this message]
2026-11-20  8:22 ` [PATCH] usb: gadget: uvc: Fix deadlock in uvcg_extension_bm_controls_store Greg KH

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=2026112038-imitate-drastic-8d6c@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nkapron@google.com \
    --cc=syzbot+300213c2b5b55c0244f4@syzkaller.appspotmail.com \
    --cc=varshanisaad@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.