mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Keith Busch <kbusch@kernel.org>
Cc: Sathya Prakash <sathya.prakash@broadcom.com>,
	Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
	Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	leit@meta.com,
	"open list:LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)"
	<MPT-FusionLinux.pdl@broadcom.com>,
	"open list:LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)"
	<linux-scsi@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mpt3sas: Avoid test/set_bit() operating in non-allocated memory
Date: Wed, 5 Jun 2024 01:33:32 -0700	[thread overview]
Message-ID: <ZmAi3DoEBuv4txOL@gmail.com> (raw)
In-Reply-To: <Zlo81SBdvflQ_38O@kbusch-mbp.dhcp.thefacebook.com>

On Fri, May 31, 2024 at 03:10:45PM -0600, Keith Busch wrote:
> On Fri, May 31, 2024 at 11:00:54AM -0700, Breno Leitao wrote:

> > @@ -8529,6 +8535,12 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
> >  	ioc->pend_os_device_add_sz = (ioc->facts.MaxDevHandle / 8);
> >  	if (ioc->facts.MaxDevHandle % 8)
> >  		ioc->pend_os_device_add_sz++;
> > +
> > +	/* pend_os_device_add_sz should have, at least, the minimal room
> > +	 * for set_bit()/test_bit(), otherwise out-of-memory may occur
> > +	 */
> > +	ioc->pend_os_device_add_sz = ALIGN(ioc->pend_os_device_add_sz,
> > +					   sizeof(unsigned long));
> >  	ioc->pend_os_device_add = kzalloc(ioc->pend_os_device_add_sz,
> >  	    GFP_KERNEL);
> >  	if (!ioc->pend_os_device_add) {

> Do we need similiar ALIGN for _base_check_ioc_facts_changes() too?

Yes, that would help as well. Since it will protect
->device_remove_in_progress and others from the same problem.

Let me send a v2.

Thanks!

      reply	other threads:[~2024-06-05  8:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-31 18:00 Breno Leitao
2024-05-31 21:10 ` Keith Busch
2024-06-05  8:33   ` Breno Leitao [this message]

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=ZmAi3DoEBuv4txOL@gmail.com \
    --to=leitao@debian.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=MPT-FusionLinux.pdl@broadcom.com \
    --cc=kbusch@kernel.org \
    --cc=leit@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sathya.prakash@broadcom.com \
    --cc=sreekanth.reddy@broadcom.com \
    --cc=suganath-prabu.subramani@broadcom.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

all inboxes | Powered by JetHome®