[PATCH] nvme: null terminate nvme_tls_attrs

Shinichiro Kawasaki shinichiro.kawasaki at wdc.com
Wed Sep 25 18:53:23 PDT 2024


On Sep 24, 2024 / 12:42, John Garry wrote:
> On 24/09/2024 10:01, Shin'ichiro Kawasaki wrote:
> > Commit 1e48b34c9bc7 ("nvme: split off TLS sysfs attributes into a
> > separate group") introduced the struct attribute array nvme_tls_attrs.
> > However, the array was not null terminated and caused BUG KASAN global-
> > out-of-bounds. To avoid the BUG, null terminate the array.
> > 
> > Reported-by: Yi Zhang<yi.zhang at redhat.com>
> > Closes:https://urldefense.com/v3/__https://lore.kernel.org/linux-nvme/
> > jhllwfxcedrcxcnbajwl4x2l2ujcqowqcd4ps574zrafrqhjna at f4icvecutekm/__;!!
> > ACWV5N9M2RV99hQ! O7ofbvpkFcN1G5ZtEfcoa89swFeTDXZf8d8VLdkl9BCbv1ofMOt5QcsWBZHT2cfK6Tzf5bWPI80AFNaRRJ6UMEA4Eiv3$
> > Fixes: 1e48b34c9bc7 ("nvme: split off TLS sysfs attributes into a
> > separate group")
> > Signed-off-by: Shin'ichiro Kawasaki<shinichiro.kawasaki at wdc.com>
> > ---
> >   drivers/nvme/host/sysfs.c | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
> > index eb345551d6fe..b68a9e5f1ea3 100644
> > --- a/drivers/nvme/host/sysfs.c
> > +++ b/drivers/nvme/host/sysfs.c
> > @@ -767,6 +767,7 @@ static struct attribute *nvme_tls_attrs[] = {
> >   	&dev_attr_tls_key.attr,
> >   	&dev_attr_tls_configured_key.attr,
> >   	&dev_attr_tls_keyring.attr,
> > +	NULL,
> 
> nit: no ',' is required for a NULL terminate

Ah, right, it is not reasonable to put ',' to NULL terminates.

I thought to send out v2, but I found that this patch is already pulled to
linux-block/for-6.12/block, so I leave it as it is.


More information about the Linux-nvme mailing list