From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6C4525CC57 for ; Tue, 7 Jul 2026 08:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783413941; cv=none; b=er+cBBDW66tLJ4y4iCNYW5C+x7Rr5S69a9a39sS2FAErcPTvTf2/B08b1iU0iHRYVtN8moiy5Ej5sClQhry2iGQVfzGxrUTWc4OH0LW5m+iUunPhAtg3CHa9nCwk94DQ+cKGpRg+mgFrQO/ttBBHh4Iue2F6laIMgq1mlMUI8Hw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783413941; c=relaxed/simple; bh=w24kCOhd0coL7UOZzJIQAkRBP5LzvS4+x/myXHiLLnI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nMIjQw9XVIURyXuhKaARyFVDt7CgdtFNneVCXOIg4h8Z1evxdNYHM/vcxuTAEmMRNfJYOclNc+5v9BOh9ZaE6JaJbe6Uly7nCTKDfNRrT7x3rYZKnxjyKKUb2pZBcgk9CP6FvaILkNMiXMV/JYTPBrW0wP2ALOFknDsi8wQsVl4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hO7Q16kP; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hO7Q16kP" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-37df72c9984so3814121a91.3 for ; Tue, 07 Jul 2026 01:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783413940; x=1784018740; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Sg/TjGf717Hj/OrWbBMOEQ2vxvsdop73pQNz4dt05yY=; b=hO7Q16kPZYXJMhp1Fi21gJ8kRujZhDgULCL9UI/35EXzQ6M0p7PdLEXKhPW4m/CRGG +53qwlcsRr6zZYrbnVOZJmnenOFiTpRSOFyc5OwulHH3XS420Yq8jl+5T9jeoVe4ZCVL 1FJKtjRI0Hxy+snLNURh2J+DZ1o93YOYlC3aC5T47vUhWUAmtOY6Q3Y0WV09yPZMjvzc KjIisLP26cpyRMknY9h1qKwd/sruaX82kdGJavXZWeso1dJFpsrOKgERH/3Yro7Ibwzh GwcEHSBu1tGZ5poDUQwAFITRSBzV7fNc+dZ8GNh1L+2BBc/rU7KXk/qfa/3WsrrSq0TN n36A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783413940; x=1784018740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Sg/TjGf717Hj/OrWbBMOEQ2vxvsdop73pQNz4dt05yY=; b=P7M4VFPy8KY2mQoIoGgaIwpxL7K6OsdKqS2jpPjRX6+LknaRFmA6pzEZr+Y65tldhh NQIJEs0hdUXdzRwUCoCgNORr0ch4+ntA0f+n3ok71R5NDMDn3Ix3LGVv16RqnDGNxZfs yZviMEJOqXA8BCNUHXb7v15ZXgzW0R3aNzFBwnloZnQc6Na/Umd5/IbPzocY/4OBl7Fa 5DXlytF6GUj2oZCVsjVsbNBiNOx93N2xQZyLExsztfERR8apLp6oY1swK95sR6p3gvA6 TPte+IiNfv+d5C6wpyasbtp50TBuQKbVcFSzr0+RQJuooCPSCFK2GrkQYp04V6m70INL 6vEA== X-Forwarded-Encrypted: i=1; AHgh+RqC0jf8wKRzbe2iVBNK/KWIkhMXGKVbIPJKDkLWMQBv7gCiI/WZNPTQnZep+97zEo/E/JVaicPQ62v0aYQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1eWdPocEjQrm1Ps0gVHwZDx1ocGnM+5MJePjYB1aBQfqJSr2W cWqyvMLZ7FyiInDCBevEdcoEJgeXr1+28cZHClAw74UtBiyGhKBe/uWT X-Gm-Gg: AfdE7clkh0AH2ddOATpH2DsrpvgXzvXyVbPcqZbC0KIKei71PRF+90jovY4lxjAnPOB GVdSiOWVMraQ4DCWWdWn3F55Y3H1CkRE1MRI3XuMFbpM+MDfTcFhOC4gTteTy4W+Yy87X7NTcIb v5ylfOWP290Awxw+QP6h+toz98Czdb1eqEsXPovuGBiGLCx1yn2YU7hHvADYV/MVyhxp8y1MzQx ShyK5v/nszLpnX0oPmf3JFDvkbTF1dSNZL6l5HqLkrvnKsKfP5cytr10ELCxUcsKsfzf1A3flo1 gZt0d6XIDwWk7eCLMEX9YPqll/EEPfKPOTWtW5pZkRGq6rnR5RI8t8+fwKILQqljiKEReCKcBuk Y9XO9Gnw3mw1b07s0Zu+G9q9ZeTBVsLMMWWAYj+yj2bxqvhTQ29nEj2mdRjNvNDl9RpBvz5+7gk 1IucjNTN9ldmdYkYdcA2UtPLRphG9CMrI1HPtm9Ropa/maKgY= X-Received: by 2002:a17:90b:184b:b0:387:e0cb:7f3 with SMTP id 98e67ed59e1d1-387e0cb0926mr1921441a91.39.1783413940160; Tue, 07 Jul 2026 01:45:40 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-387d13fd7bfsm717546a91.6.2026.07.07.01.45.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2026 01:45:39 -0700 (PDT) From: phucduc.bui@gmail.com To: Cezary Rojewski , Jaroslav Kysela , Takashi Iwai , cassiogabrielcontato@gmail.com Cc: Kees Cook , Dan Carpenter , Cen Zhang , Len Bao , Mehul Rao , Sebastian Andrzej Siewior , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, bui duc phuc Subject: [PATCH v2 2/6] ALSA: hwdep: Return -ENODEV instead of -EFAULT in snd_hwdep_open() Date: Tue, 7 Jul 2026 15:45:02 +0700 Message-ID: <20260707084506.718583-3-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260707084506.718583-1-phucduc.bui@gmail.com> References: <20260707084506.718583-1-phucduc.bui@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: bui duc phuc When try_module_get() fails in snd_hwdep_open(), the owning module is going away and the device is no longer usable, so -EFAULT ("bad address") is the wrong error. Return -ENODEV, matching the other unavailable-device paths in this function(the NULL hw check and the card->shutdown check). This changes the errno reported to userspace on this rare race. No other behaviour changes. Signed-off-by: bui duc phuc --- sound/core/hwdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 973d11732bfd..352047e0b33e 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -87,7 +87,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) if (!try_module_get(hw->card->module)) { snd_card_unref(hw->card); - return -EFAULT; + return -ENODEV; } init_waitqueue_entry(&wait, current); -- 2.43.0