Re: [for-6.11 PATCH 04/29] sunrpc: handle NULL req->defer in cache_defer_req

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2024-06-07 at 10:26 -0400, Mike Snitzer wrote:
> From: Weston Andros Adamson <dros@xxxxxxxxxxxxxxx>
> 
> Dont crash with a NULL pointer dereference when req->defer isn't
> set. This is needed for the localio path.
> 
> Signed-off-by: Weston Andros Adamson <dros@xxxxxxxxxxxxxxx>
> Signed-off-by: Lance Shelton <lance.shelton@xxxxxxxxxxxxxxx>
> Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
> Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx>
> ---
>  net/sunrpc/cache.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
> index 95ff74706104..b757b891382c 100644
> --- a/net/sunrpc/cache.c
> +++ b/net/sunrpc/cache.c
> @@ -714,6 +714,8 @@ static bool cache_defer_req(struct cache_req
> *req, struct cache_head *item)
>  			return false;
>  	}
>  
> +	if (!req->defer)
> +		return false;
>  	dreq = req->defer(req);
>  	if (dreq == NULL)
>  		return false;

I've gone over it many times, but I still don't quite "get" the
deferral handling code. I think the above is probably safe, but please
do Cc Neil Brown on later postings of this series since he has a better
grasp of that code.
-- 
Jeff Layton <jlayton@xxxxxxxxxx>





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux