Re: [PATCH 3/3] mm: fail the fault on a malformed swap entry instead of retrying it

Breno Leitao <[email protected]>
Newsgroups org.kvack.linux-mm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Tue, Aug 11, 2026 at 05:38:50PM +0200, David Hildenbrand (Arm) wrote:
> On 8/10/26 18:26, Breno Leitao wrote:

> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -4957,6 +4957,9 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
> >  	/* Prevent swapoff from happening to us. */
> >  	si = get_swap_device(entry);
> >  	if (IS_ERR_OR_NULL(si)) {
> > +		/* A malformed entry never becomes valid, so don't retry it. */
> > +		if (IS_ERR(si))
> > +			ret = VM_FAULT_SIGBUS;
> >  		si = NULL;
> >  		goto out;
> 
> Better update the comment above get_swap_device() to include "bad swap entries"
> as well. Best do that as part of patch #2.

Ack, I will update and respin.

> I didn't look too closely, but conceptually LGTM

Thanks for the review so far!
--breno
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.