From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>,
Wolfram Sang <wsa@the-dreams.de>, Sasha Levin <sashal@kernel.org>,
linux-i2c@vger.kernel.org
Subject: [PATCH AUTOSEL 4.9 09/20] i2c: dev: fix potential memory leak in i2cdev_ioctl_rdwr
Date: Sat, 8 Jun 2019 07:47:45 -0400 [thread overview]
Message-ID: <20190608114756.9742-9-sashal@kernel.org> (raw)
In-Reply-To: <20190608114756.9742-1-sashal@kernel.org>
From: Yingjoe Chen <yingjoe.chen@mediatek.com>
[ Upstream commit a0692f0eef91354b62c2b4c94954536536be5425 ]
If I2C_M_RECV_LEN check failed, msgs[i].buf allocated by memdup_user
will not be freed. Pump index up so it will be freed.
Fixes: 838bfa6049fb ("i2c-dev: Add support for I2C_M_RECV_LEN")
Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/i2c/i2c-dev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 00e8e675cbeb..eaa312bc3a3c 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -297,6 +297,7 @@ static noinline int i2cdev_ioctl_rdwr(struct i2c_client *client,
rdwr_pa[i].buf[0] < 1 ||
rdwr_pa[i].len < rdwr_pa[i].buf[0] +
I2C_SMBUS_BLOCK_MAX) {
+ i++;
res = -EINVAL;
break;
}
--
2.20.1
next prev parent reply other threads:[~2019-06-08 11:50 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-08 11:47 [PATCH AUTOSEL 4.9 01/20] perf/x86/intel/ds: Fix EVENT vs. UEVENT PEBS constraints Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 02/20] selftests: netfilter: missing error check when setting up veth interface Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 03/20] mISDN: make sure device name is NUL terminated Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 04/20] x86/CPU/AMD: Don't force the CPB cap when running under a hypervisor Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 05/20] perf/ring_buffer: Fix exposing a temporarily decreased data_head Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 06/20] perf/ring_buffer: Add ordering to rb->nest increment Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 07/20] gpio: fix gpio-adp5588 build errors Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 08/20] net: tulip: de4x5: Drop redundant MODULE_DEVICE_TABLE() Sasha Levin
2019-06-08 11:47 ` Sasha Levin [this message]
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 10/20] configfs: Fix use-after-free when accessing sd->s_dentry Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 11/20] perf data: Fix 'strncat may truncate' build failure with recent gcc Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 12/20] perf record: Fix s390 missing module symbol and warning for non-root users Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 13/20] ia64: fix build errors by exporting paddr_to_nid() Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 14/20] KVM: PPC: Book3S: Use new mutex to synchronize access to rtas token list Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 15/20] KVM: PPC: Book3S HV: Don't take kvm->lock around kvm_for_each_vcpu Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 16/20] net: sh_eth: fix mdio access in sh_eth_close() for R-Car Gen2 and RZ/A1 SoCs Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 17/20] scsi: libcxgbi: add a check for NULL pointer in cxgbi_check_route() Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 18/20] scsi: smartpqi: properly set both the DMA mask and the coherent DMA mask Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 19/20] scsi: libsas: delete sas port if expander discover failed Sasha Levin
2019-06-08 11:47 ` [PATCH AUTOSEL 4.9 20/20] mlxsw: spectrum: Prevent force of 56G Sasha Levin
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=20190608114756.9742-9-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=wsa@the-dreams.de \
--cc=yingjoe.chen@mediatek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome