From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23D2D337B81; Wed, 8 Apr 2026 18:49:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775674196; cv=none; b=TK6W7i7qlYUvSmjs5jL4V63WCGEP5nuOpcxLtM2z7HED2x+3dCadpjPwjbLp8qg0iptlQvtuwXqBVyWCYHIcI6udgU0DBlqQynycx81nA/drTTR9rFKFuuN7dhezVg5C188F2p4gtR8r4hmvE37YBWATz1Z/rp4J66FhyN6xA74= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775674196; c=relaxed/simple; bh=2zhafJloL/I26UAgL8tXfIMA2c/3PlLrAFQUhZB/CQo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AxnyUWKyWVjThrcEnVsZ0P3MBGQZV2qTMUQv1myqCA12wNapMoX4yimVuYkbeFG8Oj3OmxlbuDCGJgijv0Vw4XgpYKXCa16NH4ueb4DOS1C5beJWJ5TapEmlHqAcbMwGDpWXCIT/MuVdNMLorNg5cweaHMT7U9GXuciIA7ltLLE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IuzmA88q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="IuzmA88q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A75EC2BC87; Wed, 8 Apr 2026 18:49:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1775674195; bh=2zhafJloL/I26UAgL8tXfIMA2c/3PlLrAFQUhZB/CQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IuzmA88quWmsHGHmkXobcwZ3oMnA2Im+8PZ27gmR20wf0QsPlk5NjK7MzNu2l3hhH fOLEyujceuTAxeo0XJMEcyS5+1XFcrqbvoRKRnw8GShz7XSPh46cQ/kHg9w71SlLhS e9qFXGlKY0gNqCVmybBOloElPtqERlOz0rddS3SY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kuen-Han Tsai Subject: [PATCH 6.12 205/242] usb: gadget: f_rndis: Protect RNDIS options with mutex Date: Wed, 8 Apr 2026 20:04:05 +0200 Message-ID: <20260408175934.755063652@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260408175927.064985309@linuxfoundation.org> References: <20260408175927.064985309@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kuen-Han Tsai commit 8d8c68b1fc06ece60cf43e1306ff0f4ac121547e upstream. The class/subclass/protocol options are suspectible to race conditions as they can be accessed concurrently through configfs. Use existing mutex to protect these options. This issue was identified during code inspection. Fixes: 73517cf49bd4 ("usb: gadget: add RNDIS configfs options for class/subclass/protocol") Cc: stable@vger.kernel.org Signed-off-by: Kuen-Han Tsai Link: https://patch.msgid.link/20260320-usb-net-lifecycle-v1-2-4886b578161b@google.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/function/f_rndis.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c @@ -11,6 +11,7 @@ /* #define VERBOSE_DEBUG */ +#include #include #include #include @@ -678,9 +679,11 @@ rndis_bind(struct usb_configuration *c, return -ENOMEM; } - rndis_iad_descriptor.bFunctionClass = rndis_opts->class; - rndis_iad_descriptor.bFunctionSubClass = rndis_opts->subclass; - rndis_iad_descriptor.bFunctionProtocol = rndis_opts->protocol; + scoped_guard(mutex, &rndis_opts->lock) { + rndis_iad_descriptor.bFunctionClass = rndis_opts->class; + rndis_iad_descriptor.bFunctionSubClass = rndis_opts->subclass; + rndis_iad_descriptor.bFunctionProtocol = rndis_opts->protocol; + } /* * in drivers/usb/gadget/configfs.c:configfs_composite_bind()