From: Dan Carpenter <dan.carpenter@oracle.com>
To: Souptick Joarder <jrdr.linux@gmail.com>,
Dan Williams <dan.j.williams@intel.com>
Cc: akpm@linux-foundation.org, jgg@ziepe.ca, dsterba@suse.com,
arnd@arndb.de, ira.weiny@intel.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/virt/fsl_hypervisor: Correcting error handling path
Date: Fri, 22 May 2020 15:53:50 +0300 [thread overview]
Message-ID: <20200522125349.GF22511@kadam> (raw)
In-Reply-To: <1589401396-31210-1-git-send-email-jrdr.linux@gmail.com>
On Thu, May 14, 2020 at 01:53:16AM +0530, Souptick Joarder wrote:
> First, when memory allocation for sg_list_unaligned failed, there
> is no point of calling put_pages() as we haven't pinned any pages.
>
> Second, if get_user_pages_fast() failed we should unpinned num_pinned
> pages, no point of checking till num_pages.
>
> This will address both.
>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
If gup_flags were | FOLL_LONGTERM then this patch would fix a double
free because of the put_page() in __gup_longterm_locked().
mm/gup.c
1786 if (check_dax_vmas(vmas_tmp, rc)) {
1787 for (i = 0; i < rc; i++)
1788 put_page(pages[i]);
^^^^^^^^^^^^^^^^^^^
put_page() here and also in the caller.
1789 rc = -EOPNOTSUPP;
1790 goto out;
1791 }
But since this isn't FOLL_LONGTERM the patch is a nice cleanup which
doesn't affect run time.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
regards,
dan carpenter
next prev parent reply other threads:[~2020-05-22 12:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-13 20:23 [PATCH] drivers/virt/fsl_hypervisor: Correcting error handling path Souptick Joarder
2020-05-22 11:50 ` Souptick Joarder
2020-05-22 12:53 ` Dan Carpenter [this message]
2020-05-26 5:13 ` Souptick Joarder
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=20200522125349.GF22511@kadam \
--to=dan.carpenter@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=dan.j.williams@intel.com \
--cc=dsterba@suse.com \
--cc=ira.weiny@intel.com \
--cc=jgg@ziepe.ca \
--cc=jrdr.linux@gmail.com \
--cc=linux-kernel@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