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 BD1F945BD57 for ; Fri, 15 May 2026 11:45: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=1778845555; cv=none; b=CeUWi/xKU06sXPwd7Em+vBI14P8sN1bPdHyMeScynpdkH0Jd01izx+eJSWj5j3wjaT39MCltKnfyg0WYGDd2jhX9a+F9QEqnHPXydwjjM5qu0Yjp9c+yOecks/m4C+CWZgP3JJEa5WaP6kb/YJkcvuZB7H5dkFY7qwmy8S+3+k4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778845555; c=relaxed/simple; bh=Gh/ilbI+x3uiph7LpUNlglMBLXz/2YQ8vtzyW9pgPlk=; h=Subject:To:From:Date:Message-ID:MIME-Version:Content-Type; b=alufVMNRiJQAfWVAkH9HJUH9OQDL4BT6NFN2bDrrG6ZLq7YXIYtqdjGYdnwKtsdwfWBBP5MKAvNgnZNi7cI2RLFkL2S1xihJrP0w8yRSG+oxFBEcmcgFtEfmW+Sbr275aVFtePx3aDY29OsDFXfvepKnIvPLtem4jX2eMiNjFJc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rf4XMkAQ; 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="rf4XMkAQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEE2DC2BCB0; Fri, 15 May 2026 11:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778845555; bh=Gh/ilbI+x3uiph7LpUNlglMBLXz/2YQ8vtzyW9pgPlk=; h=Subject:To:From:Date:From; b=rf4XMkAQgEQ8oWoQeDINIjMVC/iZfaiuQvL9HsgxfAmnOUrl8TEyLMiu7JrBeebS/ GV45j6KtLBn+IltEIsQTp8PSLLjqxWxO5pPpn9zQbT5a96q/DKyt22Q0IFhXxE00oc aCQomW3W2JQ78HPH1961y4ngF0j6yV0/8S2OKLa0= Subject: patch "iio: light: veml6070: Fix resource leak in probe error path" added to char-misc-linus To: ustc.gu@gmail.com,Jonathan.Cameron@huawei.com,Stable@vger.kernel.org,andriy.shevchenko@intel.com From: Date: Fri, 15 May 2026 13:45:54 +0200 Message-ID: <2026051554-henchman-reference-f915@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit This is a note to let you know that I've just added the patch titled iio: light: veml6070: Fix resource leak in probe error path to my char-misc git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git in the char-misc-linus branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will hopefully also be merged in Linus's tree for the next -rc kernel release. If you have any questions about this process, please let me know. >From b66f922f6a4fa92840f662fbcfeb4f8a0f774bcc Mon Sep 17 00:00:00 2001 From: Felix Gu Date: Fri, 27 Mar 2026 20:27:54 +0800 Subject: iio: light: veml6070: Fix resource leak in probe error path The driver calls i2c_new_dummy_device() to create a dummy device, then calls i2c_smbus_write_byte(). If i2c_smbus_write_byte() fails and returns, the cleanup via devm_add_action_or_reset() was never registered, so the dummy device leaks. Switch to devm_i2c_new_dummy_device() which registers cleanup atomically with device creation, eliminating the error-path window. Fixes: 7501bff87c3e ("iio: light: veml6070: add action for i2c_unregister_device") Reviewed-by: Andy Shevchenko Signed-off-by: Felix Gu Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/light/veml6070.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c index 74d7246e5225..4bbd86d0cb46 100644 --- a/drivers/iio/light/veml6070.c +++ b/drivers/iio/light/veml6070.c @@ -245,13 +245,6 @@ static const struct iio_info veml6070_info = { .write_raw = veml6070_write_raw, }; -static void veml6070_i2c_unreg(void *p) -{ - struct veml6070_data *data = p; - - i2c_unregister_device(data->client2); -} - static int veml6070_probe(struct i2c_client *client) { struct veml6070_data *data; @@ -281,7 +274,8 @@ static int veml6070_probe(struct i2c_client *client) if (ret < 0) return ret; - data->client2 = i2c_new_dummy_device(client->adapter, VEML6070_ADDR_DATA_LSB); + data->client2 = devm_i2c_new_dummy_device(&client->dev, client->adapter, + VEML6070_ADDR_DATA_LSB); if (IS_ERR(data->client2)) return dev_err_probe(&client->dev, PTR_ERR(data->client2), "i2c device for second chip address failed\n"); @@ -292,10 +286,6 @@ static int veml6070_probe(struct i2c_client *client) if (ret < 0) return ret; - ret = devm_add_action_or_reset(&client->dev, veml6070_i2c_unreg, data); - if (ret < 0) - return ret; - return devm_iio_device_register(&client->dev, indio_dev); } -- 2.54.0