drm: Fix/annotate better a few error paths
Subsystems (2)
cover drm: Fix/annotate better a few error paths
Fix a few minor issues durring error handling, all of these were pointed at by Coverity reports.
Imre Deak (3):
drm: Tune up error message during format->bpp/cpp conversion drm/mst: Fix error handling during MST sideband message reception
drm: Avoid dereferencing a NULL mstb in drm_dp_mst_handle_up_req()
drivers/gpu/drm/drm_crtc.c | 10 +++++++--- drivers/gpu/drm/drm_dp_mst_topology.c | 16 +++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-)
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/3 drm: Tune up error message during format->bpp/cpp conversion
Returning a 0 bpp/cpp value from these functions isn't ever valid. In many cases it can also lead to a div-by-zero possibly at some later point in time, so make sure we catch such errors as soon as possible via louder error reporting.
--- drivers/gpu/drm/drm_crtc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_crtc.c +7 -3
@@ -5610,8 +5610,8 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, *bpp =32 ;break ;default : -DRM_DEBUG_KMS ("unsupported pixel format %s\n" , -drm_get_format_name (format)); +WARN (1 ,"unsupported pixel format %s\n" , +drm_get_format_name (format)); *depth =0 ; *bpp =0 ;break ;
@@ -5666,8 +5666,12 @@ int drm_format_plane_cpp(uint32_t format, int plane)unsigned int depth;int bpp; -if (plane >=drm_format_num_planes (format)) +if (plane >=drm_format_num_planes (format)) { +WARN (1 ,"invalid plane %d for format %s\n" , + plane,drm_get_format_name (format)); +return 0 ; + }switch (format) {case DRM_FORMAT_YUYV :
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm: Tune up error message during format->bpp/cpp conversion
Quoted 16 lines · Imre Deak
Returning a 0 bpp/cpp value from these functions isn't ever valid. In many cases it can also lead to a div-by-zero possibly at some later point in time, so make sure we catch such errors as soon as possible via louder error reporting.
CC Dave Airlie <[email protected]>Signed-off-by Imre Deak <[email protected]>--- drivers/gpu/drm/drm_crtc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_crtc.c +0
-0
drivers/gpu/drm/drm_crtc.c void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, · line 5614
Quoted 7 lines
drivers/gpu/drm/drm_crtc.c +2
-2@@ -5610,8 +5610,8 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, *bpp =32 ;break ;default : -DRM_DEBUG_KMS ("unsupported pixel format %s\n" , -drm_get_format_name (format)); +WARN (1 ,"unsupported pixel format %s\n" , +drm_get_format_name (format));
NAK. This will happen every time drm_helper_mode_fill_fb_struct() is called with a non-RGB format.
drivers/gpu/drm/drm_crtc.c int drm_format_plane_cpp(uint32_t format, int plane) · line 5672
Quoted 12 lines
drivers/gpu/drm/drm_crtc.c +4
-1*depth =0 ; *bpp =0 ;break ;@@ -5666,8 +5666,12 @@ int drm_format_plane_cpp(uint32_t format, int plane)unsigned int depth;int bpp; -if (plane >=drm_format_num_planes (format)) +if (plane >=drm_format_num_planes (format)) { +WARN (1 ,"invalid plane %d for format %s\n" , + plane,drm_get_format_name (format)); +
We have this check in many places. Should either convert all or none.
Quoted 12 lines
drivers/gpu/drm/drm_crtc.c +1
-0return 0 ; + }switch (format) {case DRM_FORMAT_YUYV :Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm: Tune up error message during format->bpp/cpp conversion
Quoted 23 lines · Ville Syrjälä
Quoted 22 lines · Imre Deak
Returning a 0 bpp/cpp value from these functions isn't ever valid. In
many cases it can also lead to a div-by-zero possibly at some later point in time, so make sure we catch such errors as soon as possible via
louder error reporting.CC Dave Airlie <[email protected]>Signed-off-by Imre Deak <[email protected]>---
drivers/gpu/drm/drm_crtc.c | 10 +++++++---1 file changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_crtc.c +0
-0@@ -5610,8 +5610,8 @@ void drm_fb_get_bpp_depth(uint32_t format,unsigned int *depth, *bpp = 32; break;
Quoted 8 lines
drivers/gpu/drm/drm_crtc.c void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, · line 5614
Quoted 5 lines
default:
drivers/gpu/drm/drm_crtc.c +2
-2-DRM_DEBUG_KMS ("unsupported pixel format %s\n" , - drm_get_format_name(format)); +WARN (1 ,"unsupported pixel format %s\n" , + drm_get_format_name(format));NAK. This will happen every time
drm_helper_mode_fill_fb_struct()is called with a non-RGB format.
Yep, missed that. So how about handling here those formats explicitly, and emitting a warning only for truly unsupported formats?
Quoted 7 lines
Quoted 7 lines
*depth = 0;
*bpp = 0;
break;drivers/gpu/drm/drm_crtc.c +0
-0@@ -5666,8 +5666,12 @@ int drm_format_plane_cpp(uint32_t format, int plane) unsigned int depth; int bpp;
Quoted 8 lines
drivers/gpu/drm/drm_crtc.c int drm_format_plane_cpp(uint32_t format, int plane) · line 5672
Quoted 6 lines
drivers/gpu/drm/drm_crtc.c +4
-1-if (plane >=drm_format_num_planes (format)) +if (plane >=drm_format_num_planes (format)) { +WARN (1 ,"invalid plane %d for format %s\n" , + plane, drm_get_format_name(format)); +We have this check in many places. Should either convert all or none.
Ok, I can also change drm_format_plane_width()
and drm_format_plane_height(). Couldn't spot any other places.
Quoted 8 lines
Quoted 8 lines
return 0;
drivers/gpu/drm/drm_crtc.c +1
-0+ }
switch (format) {
caseDRM_FORMAT_YUYV:Signature · 1 line
2.5.0
Quoted 5 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm: Tune up error message during format->bpp/cpp conversion
Quoted 33 lines · Imre Deak
Quoted 23 lines · Ville Syrjälä
Quoted 22 lines · Imre Deak
Returning a 0 bpp/cpp value from these functions isn't ever valid. In
many cases it can also lead to a div-by-zero possibly at some later point in time, so make sure we catch such errors as soon as possible via
louder error reporting.CC Dave Airlie <[email protected]>Signed-off-by Imre Deak <[email protected]>---
drivers/gpu/drm/drm_crtc.c | 10 +++++++---1 file changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_crtc.c +0
-0@@ -5610,8 +5610,8 @@ void drm_fb_get_bpp_depth(uint32_t format,unsigned int *depth, *bpp = 32; break;Quoted 8 lines
drivers/gpu/drm/drm_crtc.c void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, · line 5614
Quoted 5 lines
default:
drivers/gpu/drm/drm_crtc.c +2
-2-DRM_DEBUG_KMS ("unsupported pixel format %s\n" , - drm_get_format_name(format)); +WARN (1 ,"unsupported pixel format %s\n" , + drm_get_format_name(format));NAK. This will happen every time
drm_helper_mode_fill_fb_struct()is called with a non-RGB format.
Quoted 2 lines
Yep, missed that. So how about handling here those formats explicitly, and emitting a warning only for truly unsupported formats?
More work to keep this list updated, and it wouldn't prevent any div-by-zero with those formats. So I don't really see a point in that.
Quoted 17 lines
Quoted 16 lines
Quoted 9 lines
*depth = 0;
*bpp = 0;
break;drivers/gpu/drm/drm_crtc.c +0
-0@@ -5666,8 +5666,12 @@ int drm_format_plane_cpp(uint32_t format, int plane) unsigned int depth; int bpp;drivers/gpu/drm/drm_crtc.c int drm_format_plane_cpp(uint32_t format, int plane) · line 5672
Quoted 5 lines
drivers/gpu/drm/drm_crtc.c +4
-1-if (plane >=drm_format_num_planes (format)) +if (plane >=drm_format_num_planes (format)) { +WARN (1 ,"invalid plane %d for format %s\n" , + plane, drm_get_format_name(format)); +We have this check in many places. Should either convert all or none.
Quoted 2 lines
Ok, I can also change
drm_format_plane_width()
and drm_format_plane_height(). Couldn't spot any other places.
I thought we might have more. I guess not.
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
return 0;
drivers/gpu/drm/drm_crtc.c +1
-0+ }
switch (format) {
caseDRM_FORMAT_YUYV:Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm: Tune up error message during format->bpp/cpp conversion
Quoted 37 lines · Ville Syrjälä
Quoted 36 lines · Imre Deak
Quoted 34 lines · Ville Syrjälä
Quoted 26 lines · Imre Deak
Returning a 0 bpp/cpp value from these functions isn't ever valid.
In
many cases it can also lead to a div-by-zero possibly at some later
point in time, so make sure we catch such errors as soon as possible via
louder error reporting.CC Dave Airlie <[email protected]>Signed-off-by Imre Deak <[email protected]>---
drivers/gpu/drm/drm_crtc.c | 10 +++++++---1 file changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_crtc.c +0
-0@@ -5610,8 +5610,8 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, *bpp = 32; break;default:
drivers/gpu/drm/drm_crtc.c void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, · line 5614
Quoted 4 lines
drivers/gpu/drm/drm_crtc.c +2
-2-DRM_DEBUG_KMS ("unsupported pixel format %s\n" , - drm_get_format_name(format)); +WARN (1 ,"unsupported pixel format %s\n" , + drm_get_format_name(format));NAK. This will happen every time
drm_helper_mode_fill_fb_struct()is called with a non-RGB format.
Quoted 7 lines
Quoted 3 lines
Yep, missed that. So how about handling here those formats explicitly,
and emitting a warning only for truly unsupported formats?More work to keep this list updated, and it wouldn't prevent any div-by-zero with those formats. So I don't really see a point in that.
It would avoid the incorrect 'unsupported pixel format' message for those.
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 10 lines
*depth = 0;
*bpp = 0;
break;drivers/gpu/drm/drm_crtc.c +0
-0@@ -5666,8 +5666,12 @@ int drm_format_plane_cpp(uint32_t format, int plane) unsigned int depth; int bpp;drivers/gpu/drm/drm_crtc.c int drm_format_plane_cpp(uint32_t format, int plane) · line 5672
Quoted 5 lines
drivers/gpu/drm/drm_crtc.c +4
-1-if (plane >=drm_format_num_planes (format)) +if (plane >=drm_format_num_planes (format)) { +WARN (1 ,"invalid plane %d for format %s\n" , + plane, drm_get_format_name(format)); +We have this check in many places. Should either convert all or none.
Quoted 20 lines
Quoted 2 lines
Ok, I can also change
drm_format_plane_width()
and drm_format_plane_height(). Couldn't spot any other places.I thought we might have more. I guess not.
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
return 0;
drivers/gpu/drm/drm_crtc.c +1
-0+ }
switch (format) {
caseDRM_FORMAT_YUYV:Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm: Tune up error message during format->bpp/cpp conversion
Quoted 42 lines · Imre Deak
Quoted 41 lines · Ville Syrjälä
Quoted 39 lines · Imre Deak
Quoted 26 lines · Ville Syrjälä
Quoted 25 lines · Imre Deak
Returning a 0 bpp/cpp value from these functions isn't ever valid.
In
many cases it can also lead to a div-by-zero possibly at some later
point in time, so make sure we catch such errors as soon as possible via
louder error reporting.CC Dave Airlie <[email protected]>Signed-off-by Imre Deak <[email protected]>---
drivers/gpu/drm/drm_crtc.c | 10 +++++++---1 file changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_crtc.c +0
-0@@ -5610,8 +5610,8 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, *bpp = 32; break;Quoted 8 lines
drivers/gpu/drm/drm_crtc.c void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, · line 5614
Quoted 5 lines
default:
drivers/gpu/drm/drm_crtc.c +2
-2-DRM_DEBUG_KMS ("unsupported pixel format %s\n" , - drm_get_format_name(format)); +WARN (1 ,"unsupported pixel format %s\n" , + drm_get_format_name(format));NAK. This will happen every time
drm_helper_mode_fill_fb_struct()is called with a non-RGB format.Yep, missed that. So how about handling here those formats explicitly,
and emitting a warning only for truly unsupported formats?
Quoted 6 lines
Quoted 3 lines
More work to keep this list updated, and it wouldn't prevent any div-by-zero with those formats. So I don't really see a point in that.
It would avoid the incorrect 'unsupported pixel format' message for those.
If that's the entire concern, delete it. New drivers shouldn't use these functions any more anyway.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/3 drm: Tune up error message for incorrect plane/format combinations
In reply to Imre DeakReturning 0 from these functions isn't ever valid. In many cases it can also lead to a div-by-zero possibly at some later point in time, so make sure we catch such errors as soon as possible via louder error reporting.
v2:
- Print the same WARN whenever we check for the same condition (Ville)
- Don't change drm_fb_get_bpp_depth(), for non-RGB formats we return bpp=0, depth=0 normally. (Ville, Daniel)
--- drivers/gpu/drm/drm_crtc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_crtc.c +10 -3
@@ -5544,6 +5544,13 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,return dev->driver->dumb_destroy (file_priv, dev, args->handle); } +static bool check_format_plane_valid (uint32_t format,int plane) +{ +return !WARN (plane >=drm_format_num_planes (format), +"invalid plane %d for format %s\n" , + plane,drm_get_format_name (format)); +} +/** * drm_fb_get_bpp_depth - get the bpp/depth values for format * @format: pixel format (DRM_FORMAT_*)
@@ -5666,7 +5673,7 @@ int drm_format_plane_cpp(uint32_t format, int plane)unsigned int depth;int bpp; -if (plane >=drm_format_num_planes (format)) +if (!check_format_plane_valid (format, plane))return 0 ;switch (format) {
@@ -5771,7 +5778,7 @@ EXPORT_SYMBOL(drm_format_vert_chroma_subsampling);*/ int drm_format_plane_width (int width,uint32_t format,int plane) { -if (plane >=drm_format_num_planes (format)) +if (!check_format_plane_valid (format, plane))return 0 ;if (plane ==0 )
@@ -5792,7 +5799,7 @@ EXPORT_SYMBOL(drm_format_plane_width);*/ int drm_format_plane_height (int height,uint32_t format,int plane) { -if (plane >=drm_format_num_planes (format)) +if (!check_format_plane_valid (format, plane))return 0 ;if (plane ==0 )
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/3 drm/mst: Fix error handling during MST sideband message reception
In reply to Imre DeakHandle any error due to partial reads, timeouts etc. to avoid parsing uninitialized data subsequently. Also bail out if the parsing itself fails.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +10 -2
@@ -2204,11 +2204,19 @@ static void drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up) ret =drm_dp_dpcd_read (mgr->aux, basereg + curreply, replyblock, len);if (ret != len) { -DRM_DEBUG_KMS ("failed to read a chunk\n" ); +DRM_DEBUG_KMS ("failed to read a chunk (len %d, ret %d)\n" , + len, ret); + +return ; } + ret =drm_dp_sideband_msg_build (msg, replyblock, len, false); -if (ret == false) +if (!ret) {DRM_DEBUG_KMS ("failed to build sideband msg\n" ); + +return ; + } + curreply += len; replylen -= len; }
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [2/3] drm/mst: Fix error handling during MST sideband message reception
Quoted 16 lines · Imre Deak
Handle any error due to partial reads, timeouts etc. to avoid parsing uninitialized data subsequently. Also bail out if the parsing itself fails.
CC Dave Airlie <[email protected]>Signed-off-by Imre Deak <[email protected]>---
drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++--1 file changed, 10 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_dp_mst_topology.c +0
-0
drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_get_one_sb_msg(struct · line 2211
Quoted 9 lines
drivers/gpu/drm/drm_dp_mst_topology.c +3
-1@@ -2204,11 +2204,19 @@ static void drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up) ret = drm_dp_dpcd_read(mgr->aux, basereg + curreply, replyblock, len); if (ret != len) { -DRM_DEBUG_KMS ("failed to read a chunk\n" ); + DRM_DEBUG_KMS("failed to read a chunk (len %d, ret %d)\n", + len, ret); +
I'd get rid of the whitespace here…
drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up) · line 2216
Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +4
-1+return ; } + ret = drm_dp_sideband_msg_build(msg, replyblock, len, false); -if (ret == false) +if (!ret) { DRM_DEBUG_KMS("failed to build sideband msg\n"); +
And here, to match the rest of the file. Otherwise looks good to me;
Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +3
-0+return ; + } + curreply += len;replylen -= len;
}
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 2/3 drm/mst: Fix error handling during MST sideband message reception
In reply to Imre DeakHandle any error due to partial reads, timeouts etc. to avoid parsing uninitialized data subsequently. Also bail out if the parsing itself fails.
v2:
- Remove blank lines before returns to match the rest of file (Lyude)
--- drivers/gpu/drm/drm_dp_mst_topology.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +8 -2
@@ -2204,11 +2204,17 @@ static void drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up) ret =drm_dp_dpcd_read (mgr->aux, basereg + curreply, replyblock, len);if (ret != len) { -DRM_DEBUG_KMS ("failed to read a chunk\n" ); +DRM_DEBUG_KMS ("failed to read a chunk (len %d, ret %d)\n" , + len, ret); +return ; } + ret =drm_dp_sideband_msg_build (msg, replyblock, len, false); -if (ret == false) +if (!ret) {DRM_DEBUG_KMS ("failed to build sideband msg\n" ); +return ; + } + curreply += len; replylen -= len; }
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 drm: Avoid dereferencing a NULL mstb in drm_dp_mst_handle_up_req()
In reply to Imre DeakIn case of an unknown broadcast message is sent mstb will remain unset, so check for this.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_mst_topology.c +3 -1
@@ -2334,7 +2334,9 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)DRM_DEBUG_KMS ("Got RSN: pn: %d avail_pbn %d\n" , msg.u.resource_stat.port_number, msg.u.resource_stat.available_pbn); } -drm_dp_put_mst_branch_device (mstb); +if (mstb) +drm_dp_put_mst_branch_device (mstb); +memset (&mgr->up_req_recv,0 ,sizeof (struct drm_dp_sideband_msg_rx )); }return ret;
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm: Avoid dereferencing a NULL mstb in drm_dp_mst_handle_up_req()
Quoted 5 lines · Imre Deak
In case of an unknown broadcast message is sent mstb will remain unset, so check for this.
CC Dave Airlie <[email protected]>Signed-off-by Imre Deak <[email protected]>
Could someone review 2/3 and 3/3 in this patchset? 1/3 was NAK'd and otherwise isn't needed anymore.
Thanks,
Imre
Quoted 26 lines
--- drivers/gpu/drm/drm_dp_mst_topology.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_dp_mst_topology.c +3
-1@@ -2334,7 +2334,9 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)DRM_DEBUG_KMS ("Got RSN: pn: %d avail_pbn %d\n" , msg.u.resource_stat.port_number, msg.u.resource_stat.available_pbn); } -drm_dp_put_mst_branch_device (mstb); +if (mstb) +drm_dp_put_mst_branch_device (mstb); +memset (&mgr->up_req_recv,0 ,sizeof (struct drm_dp_sideband_msg_rx )); }return ret;Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Lyude Paul
Reviewed-byRe: [PATCH 3/3] drm: Avoid dereferencing a NULL mstb in drm_dp_mst_handle_up_req()
Looks good to me.
Quoted 41 lines · Imre Deak
Quoted 6 lines · Imre Deak
In case of an unknown broadcast message is sent mstb will remain unset,
so check for this.CC Dave Airlie <[email protected]>Signed-off-by Imre Deak <[email protected]>Could someone review 2/3 and 3/3 in this patchset? 1/3 was NAK'd and otherwise isn't needed anymore.
Thanks,
ImreQuoted 27 lines
--- drivers/gpu/drm/drm_dp_mst_topology.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_dp_mst_topology.c +3
-1@@ -2334,7 +2334,9 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr) DRM_DEBUG_KMS("Got RSN: pn: %d avail_pbn %d\n", msg.u.resource_stat.port_number, msg.u.resource_stat.available_pbn); } -drm_dp_put_mst_branch_device (mstb); +if (mstb) +drm_dp_put_mst_branch_device (mstb); +memset(&mgr->up_req_recv, 0, sizeof(struct
drm_dp_sideband_msg_rx));drivers/gpu/drm/drm_dp_mst_topology.c +0
-0}return ret;Signature · 1 line
2.5.0
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel