fbdev/xen-fbfront: Assign fb_info->device
Subsystems (2)
PATCH 1/1 fbdev/xen-fbfront: Assign fb_info->device
From: Jason Andryuk <[email protected]>
Probing xen-fbfront faults in video_is_primary_device(). The passed-in struct device is NULL since xen-fbfront doesn't assign it and the memory is kzalloc()-ed. Assign fb_info->device to avoid this.
This was exposed by the conversion of fb_is_primary_device() to video_is_primary_device() which dropped a NULL check for struct device.
---
The other option would be to re-instate the NULL check in video_is_primary_device()
--- drivers/video/fbdev/xen-fbfront.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/xen-fbfront.c +1 -0
@@ -407,6 +407,7 @@ static int xenfb_probe(struct xenbus_device *dev,/* complete the abuse: */ fb_info->pseudo_palette = fb_info->par; fb_info->par = info; + fb_info->device = &dev->dev; fb_info->screen_buffer = info->fb;
Signature · 1 line
2.43.0
Quoted 9 lines · Jason Andryuk
From: Jason Andryuk <[email protected]>
Probing xen-fbfront faults in
video_is_primary_device(). The passed-in struct device is NULL since xen-fbfront doesn't assign it and the memory is kzalloc()-ed. Assignfb_info->deviceto avoid this.This was exposed by the conversion of
fb_is_primary_device()tovideo_is_primary_device()which dropped a NULL check for struct device.
Quoted 6 lines
Fixes f178e96de7f0 ("arch: Remove struct fb_info from video helpers")Reported-by Arthur Borsboom <[email protected]>Closes https://lore.kernel.org/xen-devel/CALUcmUncX=LkXWeiSiTKsDY-cOe8QksWhFvcCneOKfrKd0ZajA@mail.gmail.com/ open hereTested-by Arthur Borsboom <[email protected]>Signed-off-by Jason Andryuk <[email protected]>
Quoted 3 lines
---
The other option would be to re-instate the NULL check invideo_is_primary_device()
I do think this is needed, or at least an explanation. The commit message in f178e96de7f0 doesn't mention anything about video_is_primary_device() not allowing being passed a NULL device (like it was possible with fb_is_primary_device()).
Otherwise callers of video_is_primary_device() would need to be adjusted to check for device != NULL.
Thanks, Roger.
Hi
Am 10.09.24 um 09:22 schrieb Roger Pau Monné:
Quoted 21 lines · Jason Andryuk
Quoted 9 lines
From: Jason Andryuk <[email protected]>
Probing xen-fbfront faults in
video_is_primary_device(). The passed-in struct device is NULL since xen-fbfront doesn't assign it and the memory is kzalloc()-ed. Assignfb_info->deviceto avoid this.This was exposed by the conversion of
fb_is_primary_device()tovideo_is_primary_device()which dropped a NULL check for struct device.Quoted 6 lines
Fixes f178e96de7f0 ("arch: Remove struct fb_info from video helpers")Reported-by Arthur Borsboom <[email protected]>Closes https://lore.kernel.org/xen-devel/CALUcmUncX=LkXWeiSiTKsDY-cOe8QksWhFvcCneOKfrKd0ZajA@mail.gmail.com/ open hereTested-by Arthur Borsboom <[email protected]>Signed-off-by Jason Andryuk <[email protected]>Reviewed-by Roger Pau Monné <[email protected]>Quoted 3 lines
---
The other option would be to re-instate the NULL check invideo_is_primary_device()
Quoted 7 lines
I do think this is needed, or at least an explanation. The commit message in
f178e96de7f0doesn't mention anything aboutvideo_is_primary_device()not allowing being passed a NULL device (like it was possible withfb_is_primary_device()).Otherwise callers of
video_is_primary_device()would need to be adjusted to check for device != NULL.
The helper expects a non-NULL pointer. We might want to document this.
Best regards
Thomas
Quoted 3 lines
Thanks, Roger.
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Quoted 29 lines · Thomas Zimmermann
Hi
Am 10.09.24 um 09:22 schrieb Roger Pau Monné:
Quoted 26 lines · Jason Andryuk
Quoted 9 lines
From: Jason Andryuk <[email protected]>
Probing xen-fbfront faults in
video_is_primary_device(). The passed-in struct device is NULL since xen-fbfront doesn't assign it and the memory is kzalloc()-ed. Assignfb_info->deviceto avoid this.This was exposed by the conversion of
fb_is_primary_device()tovideo_is_primary_device()which dropped a NULL check for struct device.Quoted 6 lines
Fixes f178e96de7f0 ("arch: Remove struct fb_info from video helpers")Reported-by Arthur Borsboom <[email protected]>Closes https://lore.kernel.org/xen-devel/CALUcmUncX=LkXWeiSiTKsDY-cOe8QksWhFvcCneOKfrKd0ZajA@mail.gmail.com/ open hereTested-by Arthur Borsboom <[email protected]>Signed-off-by Jason Andryuk <[email protected]>Reviewed-by Roger Pau Monné <[email protected]>Quoted 3 lines
---
The other option would be to re-instate the NULL check invideo_is_primary_device()I do think this is needed, or at least an explanation. The commit message in
f178e96de7f0doesn't mention anything aboutvideo_is_primary_device()not allowing being passed a NULL device (like it was possible withfb_is_primary_device()).
Quoted 4 lines
Quoted 2 lines
Otherwise callers of
video_is_primary_device()would need to be adjusted to check for device != NULL.The helper expects a non-NULL pointer. We might want to document this.
A BUG_ON(!dev); might be enough documentation that the function expected a non-NULL dev IMO.
Thanks, Roger.
Greg KH
maintainerQuoted 30 lines · Roger Pau Monné
Quoted 29 lines · Thomas Zimmermann
Hi
Am 10.09.24 um 09:22 schrieb Roger Pau Monné:
Quoted 26 lines · Jason Andryuk
Quoted 9 lines
From: Jason Andryuk <[email protected]>
Probing xen-fbfront faults in
video_is_primary_device(). The passed-in struct device is NULL since xen-fbfront doesn't assign it and the memory is kzalloc()-ed. Assignfb_info->deviceto avoid this.This was exposed by the conversion of
fb_is_primary_device()tovideo_is_primary_device()which dropped a NULL check for struct device.Quoted 6 lines
Fixes f178e96de7f0 ("arch: Remove struct fb_info from video helpers")Reported-by Arthur Borsboom <[email protected]>Closes https://lore.kernel.org/xen-devel/CALUcmUncX=LkXWeiSiTKsDY-cOe8QksWhFvcCneOKfrKd0ZajA@mail.gmail.com/ open hereTested-by Arthur Borsboom <[email protected]>Signed-off-by Jason Andryuk <[email protected]>Reviewed-by Roger Pau Monné <[email protected]>Quoted 3 lines
---
The other option would be to re-instate the NULL check invideo_is_primary_device()I do think this is needed, or at least an explanation. The commit message in
f178e96de7f0doesn't mention anything aboutvideo_is_primary_device()not allowing being passed a NULL device (like it was possible withfb_is_primary_device()).
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Otherwise callers of
video_is_primary_device()would need to be adjusted to check for device != NULL.The helper expects a non-NULL pointer. We might want to document this.
A
BUG_ON(!dev); might be enough documentation that the function expected a non-NULL dev IMO.
No need for that, don't check for things that will never happen.
Quoted 35 lines · Greg KH
Quoted 33 lines · Roger Pau Monné
Quoted 32 lines · Thomas Zimmermann
Hi
Am 10.09.24 um 09:22 schrieb Roger Pau Monné:
Quoted 28 lines · Jason Andryuk
Quoted 9 lines
From: Jason Andryuk <[email protected]>
Probing xen-fbfront faults in
video_is_primary_device(). The passed-in struct device is NULL since xen-fbfront doesn't assign it and the memory is kzalloc()-ed. Assignfb_info->deviceto avoid this.This was exposed by the conversion of
fb_is_primary_device()tovideo_is_primary_device()which dropped a NULL check for struct device.Quoted 6 lines
Fixes f178e96de7f0 ("arch: Remove struct fb_info from video helpers")Reported-by Arthur Borsboom <[email protected]>Closes https://lore.kernel.org/xen-devel/CALUcmUncX=LkXWeiSiTKsDY-cOe8QksWhFvcCneOKfrKd0ZajA@mail.gmail.com/ open hereTested-by Arthur Borsboom <[email protected]>Signed-off-by Jason Andryuk <[email protected]>Reviewed-by Roger Pau Monné <[email protected]>Quoted 3 lines
---
The other option would be to re-instate the NULL check invideo_is_primary_device()I do think this is needed, or at least an explanation. The commit message in
f178e96de7f0doesn't mention anything aboutvideo_is_primary_device()not allowing being passed a NULL device (like it was possible withfb_is_primary_device()).Otherwise callers of
video_is_primary_device()would need to be adjusted to check for device != NULL.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
The helper expects a non-NULL pointer. We might want to document this.
A
BUG_ON(!dev); might be enough documentation that the function expected a non-NULL dev IMO.No need for that, don't check for things that will never happen.
And yet, here we are, me reporting a kernel/VM crash due to a thing that will never happen, see 'Closes' above.
I don't want to suggest BUG_ON is the right approach; I have no idea. I just want to mention that (!dev) did happen. :-)
Greg KH
maintainerQuoted 41 lines · Arthur Borsboom
Quoted 40 lines · Greg KH
Quoted 37 lines · Roger Pau Monné
Quoted 29 lines · Thomas Zimmermann
Hi
Am 10.09.24 um 09:22 schrieb Roger Pau Monné:
Quoted 26 lines · Jason Andryuk
Quoted 9 lines
From: Jason Andryuk <[email protected]>
Probing xen-fbfront faults in
video_is_primary_device(). The passed-in struct device is NULL since xen-fbfront doesn't assign it and the memory is kzalloc()-ed. Assignfb_info->deviceto avoid this.This was exposed by the conversion of
fb_is_primary_device()tovideo_is_primary_device()which dropped a NULL check for struct device.Quoted 6 lines
Fixes f178e96de7f0 ("arch: Remove struct fb_info from video helpers")Reported-by Arthur Borsboom <[email protected]>Closes https://lore.kernel.org/xen-devel/CALUcmUncX=LkXWeiSiTKsDY-cOe8QksWhFvcCneOKfrKd0ZajA@mail.gmail.com/ open hereTested-by Arthur Borsboom <[email protected]>Signed-off-by Jason Andryuk <[email protected]>Reviewed-by Roger Pau Monné <[email protected]>Quoted 3 lines
---
The other option would be to re-instate the NULL check invideo_is_primary_device()I do think this is needed, or at least an explanation. The commit message in
f178e96de7f0doesn't mention anything aboutvideo_is_primary_device()not allowing being passed a NULL device (like it was possible withfb_is_primary_device()).Quoted 4 lines
Quoted 2 lines
Otherwise callers of
video_is_primary_device()would need to be adjusted to check for device != NULL.The helper expects a non-NULL pointer. We might want to document this.
A
BUG_ON(!dev); might be enough documentation that the function expected a non-NULL dev IMO.
Quoted 7 lines
Quoted 1 line
No need for that, don't check for things that will never happen.
And yet, here we are, me reporting a kernel/VM crash due to a thing that will never happen, see 'Closes' above.
I don't want to suggest
BUG_ONis the right approach; I have no idea. I just want to mention that (!dev) did happen. :-)
A BUG_ON() will cause the same crash, so I don't see your point, sorry.
greg k-h
Am 10.09.24 um 04:09 schrieb Jason Andryuk:
Quoted 9 lines
From: Jason Andryuk <[email protected]>
Probing xen-fbfront faults in
video_is_primary_device(). The passed-in struct device is NULL since xen-fbfront doesn't assign it and the memory is kzalloc()-ed. Assignfb_info->deviceto avoid this.This was exposed by the conversion of
fb_is_primary_device()tovideo_is_primary_device()which dropped a NULL check for struct device.
Quoted 6 lines
Fixes f178e96de7f0 ("arch: Remove struct fb_info from video helpers")Reported-by Arthur Borsboom <[email protected]>Closes https://lore.kernel.org/xen-devel/CALUcmUncX=LkXWeiSiTKsDY-cOe8QksWhFvcCneOKfrKd0ZajA@mail.gmail.com/ open hereTested-by Arthur Borsboom <[email protected]>Signed-off-by Jason Andryuk <[email protected]>
Thanks a lot.
Quoted 19 lines
---
The other option would be to re-instate the NULL check invideo_is_primary_device()--- drivers/video/fbdev/xen-fbfront.c | 1 + 1 file changed, 1 insertion(+)drivers/video/fbdev/xen-fbfront.c +1
-0@@ -407,6 +407,7 @@ static int xenfb_probe(struct xenbus_device *dev,/* complete the abuse: */ fb_info->pseudo_palette = fb_info->par; fb_info->par = info; + fb_info->device = &dev->dev; fb_info->screen_buffer = info->fb;
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Quoted 9 lines · Jason Andryuk
From: Jason Andryuk <[email protected]>
Probing xen-fbfront faults in
video_is_primary_device(). The passed-in struct device is NULL since xen-fbfront doesn't assign it and the memory is kzalloc()-ed. Assignfb_info->deviceto avoid this.This was exposed by the conversion of
fb_is_primary_device()tovideo_is_primary_device()which dropped a NULL check for struct device.
Quoted 6 lines
Fixes f178e96de7f0 ("arch: Remove struct fb_info from video helpers")Reported-by Arthur Borsboom <[email protected]>Closes https://lore.kernel.org/xen-devel/CALUcmUncX=LkXWeiSiTKsDY-cOe8QksWhFvcCneOKfrKd0ZajA@mail.gmail.com/ open hereTested-by Arthur Borsboom <[email protected]>Signed-off-by Jason Andryuk <[email protected]>
applied to fbdev git tree.
Thanks!
Helge