public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Wenchao Hao <haowenchao2@huawei.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Douglas Gilbert <dgilbert@interlog.com>,
	linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2 1/2] scsi: scsi_debug: scsi: scsi_debug: fix some bugs in sdebug_error_write()
Date: Wed, 08 Nov 2023 21:42:44 -0500	[thread overview]
Message-ID: <yq15y2b6413.fsf@ca-mkp.ca.oracle.com> (raw)
In-Reply-To: <7733643d-e102-4581-8d29-769472011c97@moroto.mountain> (Dan Carpenter's message of "Mon, 6 Nov 2023 17:04:33 +0300")


Dan,

> There are two bug in this code:
> 1) If count is zero, then it will lead to a NULL dereference.  The
>    kmalloc() will successfully allocate zero bytes and the test for
>    "if (buf[0] == '-')" will read beyond the end of the zero size buffer
>    and Oops.
> 2) The code does not ensure that the user's string is properly NUL
>    terminated which could lead to a read overflow.

Applied 1+2 to 6.7/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

  parent reply	other threads:[~2023-11-09  2:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 14:04 [PATCH v2 1/2] scsi: scsi_debug: scsi: scsi_debug: fix some bugs in sdebug_error_write() Dan Carpenter
2023-11-06 14:05 ` [PATCH v2 2/2] scsi: scsi_debug: delete some bogus error checking Dan Carpenter
2023-11-07  4:19   ` Wenchao Hao
2023-11-07  4:17 ` [PATCH v2 1/2] scsi: scsi_debug: scsi: scsi_debug: fix some bugs in sdebug_error_write() Wenchao Hao
2023-11-09  2:42 ` Martin K. Petersen [this message]
2023-11-15 15:12 ` Martin K. Petersen

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=yq15y2b6413.fsf@ca-mkp.ca.oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=dan.carpenter@linaro.org \
    --cc=dgilbert@interlog.com \
    --cc=haowenchao2@huawei.com \
    --cc=jejb@linux.ibm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /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