From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Bui Quang Minh <minhquangbui99@gmail.com>,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"Paul M Stillwell Jr" <paul.m.stillwell.jr@intel.com>,
Rasesh Mody <rmody@marvell.com>,
Sudarsana Kalluru <skalluru@marvell.com>,
<GR-Linux-NIC-Dev@marvell.com>,
Krishna Gudipati <kgudipat@brocade.com>,
"Anil Gurumurthy" <anil.gurumurthy@qlogic.com>,
Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Fabian Frederick <fabf@skynet.be>,
"Saurav Kashyap" <skashyap@marvell.com>,
Javed Hasan <jhasan@marvell.com>,
<GR-QLogic-Storage-Upstream@marvell.com>,
Nilesh Javali <nilesh.javali@cavium.com>,
Arun Easi <arun.easi@cavium.com>,
"Manish Rangankar" <manish.rangankar@cavium.com>,
Vineeth Vijayan <vneethv@linux.ibm.com>,
Peter Oberparleiter <oberpar@linux.ibm.com>,
"Heiko Carstens" <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-scsi@vger.kernel.org>,
Saurav Kashyap <saurav.kashyap@cavium.com>,
<linux-s390@vger.kernel.org>, Jens Axboe <axboe@kernel.dk>,
"Czapnik, Lukasz" <lukasz.czapnik@intel.com>
Subject: Re: [PATCH 1/5] drivers/net/ethernet/intel-ice: ensure the copied buf is NULL terminated
Date: Tue, 23 Apr 2024 11:20:02 +0200 [thread overview]
Message-ID: <0e60057f-b242-4bb5-b3df-2c6d1ff39803@intel.com> (raw)
In-Reply-To: <20240422-fix-oob-read-v1-1-e02854c30174@gmail.com>
On 4/22/24 18:41, Bui Quang Minh wrote:
> Currently, we allocate a count-sized kernel buffer and copy count bytes
> from userspace to that buffer. Later, we use sscanf on this buffer but we
> don't ensure that the string is terminated inside the buffer, this can lead
> to OOB read when using sscanf. Fix this issue by using memdup_user_nul
> instead of memdup_user.
>
> Fixes: 96a9a9341cda ("ice: configure FW logging")
> Fixes: 73671c3162c8 ("ice: enable FW logging")
> Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
> ---
> drivers/net/ethernet/intel/ice/ice_debugfs.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_debugfs.c b/drivers/net/ethernet/intel/ice/ice_debugfs.c
> index d252d98218d0..9fc0fd95a13d 100644
> --- a/drivers/net/ethernet/intel/ice/ice_debugfs.c
> +++ b/drivers/net/ethernet/intel/ice/ice_debugfs.c
> @@ -171,7 +171,7 @@ ice_debugfs_module_write(struct file *filp, const char __user *buf,
> if (*ppos != 0 || count > 8)
> return -EINVAL;
>
> - cmd_buf = memdup_user(buf, count);
> + cmd_buf = memdup_user_nul(buf, count);
> if (IS_ERR(cmd_buf))
> return PTR_ERR(cmd_buf);
>
> @@ -257,7 +257,7 @@ ice_debugfs_nr_messages_write(struct file *filp, const char __user *buf,
> if (*ppos != 0 || count > 4)
> return -EINVAL;
>
> - cmd_buf = memdup_user(buf, count);
> + cmd_buf = memdup_user_nul(buf, count);
> if (IS_ERR(cmd_buf))
> return PTR_ERR(cmd_buf);
>
> @@ -332,7 +332,7 @@ ice_debugfs_enable_write(struct file *filp, const char __user *buf,
> if (*ppos != 0 || count > 2)
> return -EINVAL;
>
> - cmd_buf = memdup_user(buf, count);
> + cmd_buf = memdup_user_nul(buf, count);
> if (IS_ERR(cmd_buf))
> return PTR_ERR(cmd_buf);
>
> @@ -428,7 +428,7 @@ ice_debugfs_log_size_write(struct file *filp, const char __user *buf,
> if (*ppos != 0 || count > 5)
> return -EINVAL;
>
> - cmd_buf = memdup_user(buf, count);
> + cmd_buf = memdup_user_nul(buf, count);
> if (IS_ERR(cmd_buf))
> return PTR_ERR(cmd_buf);
>
>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
next prev parent reply other threads:[~2024-04-23 9:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-22 16:41 [PATCH 0/5] Ensure the copied buf is NULL terminated Bui Quang Minh
2024-04-22 16:41 ` [PATCH 1/5] drivers/net/ethernet/intel-ice: ensure " Bui Quang Minh
2024-04-23 9:20 ` Przemek Kitszel [this message]
2024-04-22 16:41 ` [PATCH 2/5] drivers/net/brocade-bnad: " Bui Quang Minh
2024-04-22 16:41 ` [PATCH 3/5] drivers/scsi/bfa/bfad: " Bui Quang Minh
2024-04-22 16:41 ` [PATCH 4/5] drivers/scsi/qedf: " Bui Quang Minh
2024-04-22 16:41 ` [PATCH 5/5] drivers/s390/cio: " Bui Quang Minh
2024-04-23 6:50 ` Heiko Carstens
2024-04-23 14:46 ` Bui Quang Minh
2024-04-24 11:55 ` Heiko Carstens
2024-04-23 11:10 ` [Intel-wired-lan] [PATCH 0/5] Ensure " Marcin Szycik
2024-04-23 11:25 ` Przemek Kitszel
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=0e60057f-b242-4bb5-b3df-2c6d1ff39803@intel.com \
--to=przemyslaw.kitszel@intel.com \
--cc=GR-Linux-NIC-Dev@marvell.com \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=agordeev@linux.ibm.com \
--cc=anil.gurumurthy@qlogic.com \
--cc=anthony.l.nguyen@intel.com \
--cc=arun.easi@cavium.com \
--cc=axboe@kernel.dk \
--cc=borntraeger@linux.ibm.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fabf@skynet.be \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=jhasan@marvell.com \
--cc=kgudipat@brocade.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=lukasz.czapnik@intel.com \
--cc=manish.rangankar@cavium.com \
--cc=martin.petersen@oracle.com \
--cc=minhquangbui99@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nilesh.javali@cavium.com \
--cc=oberpar@linux.ibm.com \
--cc=pabeni@redhat.com \
--cc=paul.m.stillwell.jr@intel.com \
--cc=rmody@marvell.com \
--cc=saurav.kashyap@cavium.com \
--cc=skalluru@marvell.com \
--cc=skashyap@marvell.com \
--cc=sudarsana.kalluru@qlogic.com \
--cc=svens@linux.ibm.com \
--cc=vneethv@linux.ibm.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