All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Wagner <dwagner@suse.de>
To: Fedor Pchelkin <pchelkin@ispras.ru>
Cc: James Smart <james.smart@broadcom.com>,
	 "Martin K. Petersen" <martin.petersen@oracle.com>,
	Ram Vegesna <ram.vegesna@broadcom.com>,
	 "James E.J. Bottomley" <jejb@linux.ibm.com>,
	Hannes Reinecke <hare@suse.de>,
	linux-scsi@vger.kernel.org,  target-devel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	 Alexey Khoroshilov <khoroshilov@ispras.ru>,
	lvc-project@linuxtesting.org, stable@vger.kernel.org
Subject: Re: [PATCH] scsi: elx: efct: adjust error handling inside efct_hw_setup_io
Date: Fri, 9 Feb 2024 07:24:13 +0100	[thread overview]
Message-ID: <2ik7x74hq6exam5ab4v2moauy4lfvqe3r626bxxettseat2nmv@q4gykxnezkff> (raw)
In-Reply-To: <20240208093657.19617-1-pchelkin@ispras.ru>

On Thu, Feb 08, 2024 at 12:36:57PM +0300, Fedor Pchelkin wrote:
> IO and WQE buffers are allocated once per HW and can be reused later. If
> WQE buffers allocation fails then the whole allocation is marked as failed
> but already created IO array internal objects are not freed. hw->io is
> freed but not nullified in that specific case - it may become a problem
> later as efct_hw_setup_io() is supposed to be reusable for the same HW.
> 
> While at it, use kcalloc instead of kmalloc_array/memset-zero combination
> and get rid of some needless NULL assignments: nullifying hw->io[i]
> elements just before freeing hw->io is not really useful.
> 
> Found by Linux Verification Center (linuxtesting.org).
> 
> Fixes: 4df84e846624 ("scsi: elx: efct: Driver initialization routines")
> Cc: stable@vger.kernel.org
> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>

The patch looks okay. Though I think this funktion leaks all over the
place memory as soon we take the error path. Could you also prepare
a fix for these path while you are at it?

Thanks!
Daniel

  reply	other threads:[~2024-02-09  6:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-08  9:36 [PATCH] scsi: elx: efct: adjust error handling inside efct_hw_setup_io Fedor Pchelkin
2024-02-09  6:24 ` Daniel Wagner [this message]
2024-02-10 11:08   ` [PATCH v2] " Fedor Pchelkin
2024-02-12  9:55     ` Daniel Wagner

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=2ik7x74hq6exam5ab4v2moauy4lfvqe3r626bxxettseat2nmv@q4gykxnezkff \
    --to=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=james.smart@broadcom.com \
    --cc=jejb@linux.ibm.com \
    --cc=khoroshilov@ispras.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=martin.petersen@oracle.com \
    --cc=pchelkin@ispras.ru \
    --cc=ram.vegesna@broadcom.com \
    --cc=stable@vger.kernel.org \
    --cc=target-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.