public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Abdelrahman Fekry <abdelrahmanfekry375@gmail.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	andy@kernel.org, hdegoede@redhat.com, mchehab@kernel.org,
	sakari.ailus@linux.intel.com, gregkh@linuxfoundation.org,
	linux-kernel-mentees@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	linux-staging@lists.linux.dev, skhan@linuxfoundation.com,
	dan.carpenter@linaro.org
Subject: Re: [PATCH] staging: media: atomisp: Fix premature setting of HMM_BO_DEVICE_INITED flag
Date: Tue, 1 Jul 2025 15:45:26 +0300	[thread overview]
Message-ID: <aGPYZhK65LaD0wVO@smile.fi.intel.com> (raw)
In-Reply-To: <CAGn2d8OMRaeozOMxj1Ry8i9T3sJ5J1QqA_Jpk7wYO8KiUbpKBA@mail.gmail.com>

On Tue, Jul 01, 2025 at 02:58:43PM +0300, Abdelrahman Fekry wrote:
> Hello Andy,
> On Sat, Jun 28, 2025 at 10:52 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Sat, Jun 28, 2025 at 8:26 AM Abdelrahman Fekry
> > <abdelrahmanfekry375@gmail.com> wrote:

> > > The HMM_BO_DEVICE_INITED flag was being set in hmm_bo_device_init()
> > > before key initialization steps like kmem_cache_create(),
> > > kmem_cache_alloc(), and __bo_init().
> > >
> > > This means that if any of these steps fail, the flag remains set,
> > > misleading other parts of the driver (e.g. hmm_bo_alloc())
> > > into thinking the device is initialized. This could lead
> > > to undefined behavior or invalid memory use.
> >
> > Nice. Can you make some fault injection (temporary by modifying the
> > code to always fail, for example) and actually prove this in practice?
> > If so, the few (important) lines from the given Oops would be nice to
> > have here.

> I have been trying to test it without having any intel atomisp
> hardware and failed continuously, do you have any tips or maybe some
> resources on how i can test this driver.

So, the easiest way as I can see it is to ask people who possess the HW to
test, but you need to provide a testing patch (which can be applied on top
of this one, for example).

> > > Additionally, since __bo_init() is called from inside
> > > hmm_bo_device_init() after the flag was already set, its internal
> > > check for HMM_BO_DEVICE_INITED is redundant.
> > >
> > > - Move the flag assignment to the end after all allocations succeed.
> > > - Remove redundant check of the flag inside __bo_init()

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-07-01 12:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-28  5:25 [PATCH] staging: media: atomisp: Fix premature setting of HMM_BO_DEVICE_INITED flag Abdelrahman Fekry
2025-06-28 19:52 ` Andy Shevchenko
2025-06-29  9:51   ` Abdelrahman Fekry
2025-07-01 11:58   ` Abdelrahman Fekry
2025-07-01 12:45     ` Andy Shevchenko [this message]
2025-07-01 13:54       ` Hans de Goede
2025-07-01 15:45         ` Abdelrahman Fekry
2025-07-06 18:25           ` Hans de Goede
2025-07-07 10:57             ` Abdelrahman Fekry
2025-07-07 13:26             ` Abdelrahman Fekry
2025-07-07 13:55               ` Hans de Goede
2025-07-01 15:33       ` Abdelrahman Fekry
2025-07-01 18:00         ` Andy Shevchenko
2025-07-06 16:22 ` Hans de Goede

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=aGPYZhK65LaD0wVO@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=abdelrahmanfekry375@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=skhan@linuxfoundation.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