linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sumit Saxena <sumit.saxena@avagotech.com>
To: Nicholas Krause <xerofoify@gmail.com>,
	Kashyap Desai <kashyap.desai@avagotech.com>
Cc: Uday Lingala <uday.lingala@avagotech.com>,
	JBottomley@odin.com, martin.petersen@oracle.com,
	"PDL,MEGARAIDLINUX" <megaraidlinux.pdl@avagotech.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: RE: [PATCH] megaraid:Fix possible NULL pointer deference in mraid_mm_ioctl
Date: Fri, 8 Jan 2016 16:35:33 +0530	[thread overview]
Message-ID: <a15502eb3124eb63ab54a50031e587d8@mail.gmail.com> (raw)
In-Reply-To: <1452022374-20206-1-git-send-email-xerofoify@gmail.com>

> -----Original Message-----
> From: Nicholas Krause [mailto:xerofoify@gmail.com]
> Sent: Wednesday, January 06, 2016 1:03 AM
> To: kashyap.desai@avagotech.com
> Cc: sumit.saxena@avagotech.com; uday.lingala@avagotech.com;
> JBottomley@odin.com; martin.petersen@oracle.com;
> megaraidlinux.pdl@avagotech.com; linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] megaraid:Fix possible NULL pointer deference in
> mraid_mm_ioctl
>
> This adds the needed check after the call to the function
mraid_mm_alloc_kioc
> in order to make sure that this function has not returned NULL and
therefore
> makes sure we do not deference a NULL pointer if one is returned by
> mraid_mm_alloc_kioc.
> Further more add needed comments explaining that this function call can
return
> NULL if the list head is empty for the pointer passed in order to allow
furture
> users to understand this required pointer check.
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  drivers/scsi/megaraid/megaraid_mm.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/scsi/megaraid/megaraid_mm.c
> b/drivers/scsi/megaraid/megaraid_mm.c
> index a706927..215ddbc 100644
> --- a/drivers/scsi/megaraid/megaraid_mm.c
> +++ b/drivers/scsi/megaraid/megaraid_mm.c
> @@ -179,8 +179,12 @@ mraid_mm_ioctl(struct file *filep, unsigned int
cmd,
> unsigned long arg)
>
>  	/*
>  	 * The following call will block till a kioc is available
> +	 * or return NULL if the list head is empty for the pointer
> +	 * of type mraid_mmapt passed to mraid_mm_alloc_kioc
>  	 */
>  	kioc = mraid_mm_alloc_kioc(adp);
> +	if (!kioc)
> +		return -ENXIO;
>
>  	/*
>  	 * User sent the old mimd_t ioctl packet. Convert it to uioc_t.

Acked-by: Sumit Saxena <sumit.saxena@avagotech.com>

> --
> 2.5.0

           reply	other threads:[~2016-01-08 11:05 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1452022374-20206-1-git-send-email-xerofoify@gmail.com>]

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=a15502eb3124eb63ab54a50031e587d8@mail.gmail.com \
    --to=sumit.saxena@avagotech.com \
    --cc=JBottomley@odin.com \
    --cc=kashyap.desai@avagotech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=megaraidlinux.pdl@avagotech.com \
    --cc=uday.lingala@avagotech.com \
    --cc=xerofoify@gmail.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;
as well as URLs for NNTP newsgroup(s).