Re: [PATCH 066/190] Revert "bpf: Remove unnecessary assertion on fp_old"

From: Greg Kroah-Hartman
Date: Wed Apr 28 2021 - 01:53:28 EST


On Tue, Apr 27, 2021 at 09:28:31PM +0200, Daniel Borkmann wrote:
> On 4/27/21 7:58 PM, Greg Kroah-Hartman wrote:
> > On Wed, Apr 21, 2021 at 02:59:01PM +0200, Greg Kroah-Hartman wrote:
> [...]
> > > kernel/bpf/core.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
> > > index 75244ecb2389..da29211ea5d8 100644
> > > --- a/kernel/bpf/core.c
> > > +++ b/kernel/bpf/core.c
> > > @@ -230,6 +230,8 @@ struct bpf_prog *bpf_prog_realloc(struct bpf_prog *fp_old, unsigned int size,
> > > struct bpf_prog *fp;
> > > u32 pages;
> > > + BUG_ON(fp_old == NULL);
> > > +
> > > size = round_up(size, PAGE_SIZE);
> > > pages = size / PAGE_SIZE;
> > > if (pages <= fp_old->pages)
> >
> > The original commit here is correct, I'll drop this revert.
>
> Ok, sounds good to me, thanks! (If there would ever be an incorrect fp_old with NULL, then at
> latest we crash in fp_old->pages anyway, so the BUG_ON() was not needed.)

Thanks for the re-review, much appreciated.

greg k-h