[PATCHv2] nvme: always initialize known command effects

Keith Busch kbusch at kernel.org
Mon Jan 23 08:33:02 PST 2023


On Mon, Jan 23, 2023 at 03:54:31PM +0530, Kanchan Joshi wrote:
> On Thu, Jan 19, 2023 at 08:41:28AM -0800, Keith Busch wrote:
> > +	if (ctrl->effects)
> > +		return 0;
> > +
> > +	if (id->lpa & NVME_CTRL_LPA_CMD_EFFECTS_LOG) {
> > +		ret = nvme_get_effects_log(ctrl, NVME_CSI_NVM, &ctrl->effects);
> > +		if (ret < 0)
> > +			return ret;
> > +	}
> > +
> > +	if (!ctrl->effects) {
> > +		ctrl->effects = kzalloc(sizeof(*ctrl->effects), GFP_KERNEL);
> 
> ctrl->effects is not getting freed if controller does not support the
> commands-supported-and-effects log page?

Or maybe you meant that it's never freed *ever* since it's not in the
"cels" structure? Oops, that is indeed a leak... 



More information about the Linux-nvme mailing list