net/sfc: fix null dereference in syslog
Checks
Commit Message
When ctx->sa is null, sfc_err(ctx->sa, ...) will triger a null
dereference in the macro of sfc_err. Use SFC_GENERIC_LOG(ERR, ...)
to avoid that.
Fixes: 44db08d53be3 ("net/sfc: maintain controller to EFX interface mapping")
Cc: stable@dpdk.org
Signed-off-by: Weiguo Li <liweiguo@xencore.cn>
---
drivers/net/sfc/sfc_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 11/4/2023 7:37 AM, Weiguo Li wrote:
> When ctx->sa is null, sfc_err(ctx->sa, ...) will triger a null
> dereference in the macro of sfc_err. Use SFC_GENERIC_LOG(ERR, ...)
> to avoid that.
>
> Fixes: 44db08d53be3 ("net/sfc: maintain controller to EFX interface mapping")
> Cc: stable@dpdk.org
>
> Signed-off-by: Weiguo Li <liweiguo@xencore.cn>
>
Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
Applied to dpdk-next-net/main, thanks.
@@ -2070,7 +2070,7 @@ sfc_process_mport_journal_cb(void *data, efx_mport_desc_t *mport,
struct sfc_mport_journal_ctx *ctx = data;
if (ctx == NULL || ctx->sa == NULL) {
- sfc_err(ctx->sa, "received NULL context or SFC adapter");
+ SFC_GENERIC_LOG(ERR, "received NULL context or SFC adapter");
return EINVAL;
}