bna: integer overflow bug in debugfs
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 17 Mar 2017 20:52:35 +0000 (23:52 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Dec 2017 13:23:38 +0000 (14:23 +0100)
commitb4cf187a1bc533839e75278dca74dfbb31d32d82
tree7264cc2a9b2a63a1e084eecae63d3f5ab03c073b
parentb3f662ccd3677915f79861bd19854250836aea4b
bna: integer overflow bug in debugfs

[ Upstream commit 13e2d5187f6b965ba3556caedb914baf81b98ed2 ]

We could allocate less memory than intended because we do:

bnad->regdata = kzalloc(len << 2, GFP_KERNEL);

The shift can overflow leading to a crash.  This is debugfs code so the
impact is very small.

Fixes: 7afc5dbde091 ("bna: Add debugfs interface.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Rasesh Mody <rasesh.mody@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/brocade/bna/bnad_debugfs.c