aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pmcraid.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-11-24 15:09:26 -0500
committerDavid S. Miller <davem@davemloft.net>2013-11-28 18:26:30 -0500
commit5e53e689b737526308db2b5c9f56e9d0371a1676 (patch)
tree933490eed9b4751978bb9d469d6afb6013646a8d /drivers/scsi/pmcraid.c
parent0f0e2159c0c101426b705d70f43b9f423d51c869 (diff)
genetlink/pmcraid: use proper genetlink multicast API
The pmcraid driver is abusing the genetlink API and is using its family ID as the multicast group ID, which is invalid and may belong to somebody else (and likely will.) Make it use the correct API, but since this may already be used as-is by userspace, reserve a family ID for this code and also reserve that group ID to not break userspace assumptions. My previous patch broke event delivery in the driver as I missed that it wasn't using the right API and forgot to update it later in my series. While changing this, I noticed that the genetlink code could use the static group ID instead of a strcmp(), so also do that for the VFS_DQUOT family. Cc: Anil Ravindranath <anil_ravindranath@pmc-sierra.com> Cc: "James E.J. Bottomley" <JBottomley@parallels.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/scsi/pmcraid.c')
-rw-r--r--drivers/scsi/pmcraid.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index bd6f743d87a7..892ea6161376 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -1404,11 +1404,22 @@ enum {
1404}; 1404};
1405#define PMCRAID_AEN_CMD_MAX (__PMCRAID_AEN_CMD_MAX - 1) 1405#define PMCRAID_AEN_CMD_MAX (__PMCRAID_AEN_CMD_MAX - 1)
1406 1406
1407static struct genl_multicast_group pmcraid_mcgrps[] = {
1408 { .name = "events", /* not really used - see ID discussion below */ },
1409};
1410
1407static struct genl_family pmcraid_event_family = { 1411static struct genl_family pmcraid_event_family = {
1408 .id = GENL_ID_GENERATE, 1412 /*
1413 * Due to prior multicast group abuse (the code having assumed that
1414 * the family ID can be used as a multicast group ID) we need to
1415 * statically allocate a family (and thus group) ID.
1416 */
1417 .id = GENL_ID_PMCRAID,
1409 .name = "pmcraid", 1418 .name = "pmcraid",
1410 .version = 1, 1419 .version = 1,
1411 .maxattr = PMCRAID_AEN_ATTR_MAX 1420 .maxattr = PMCRAID_AEN_ATTR_MAX,
1421 .mcgrps = pmcraid_mcgrps,
1422 .n_mcgrps = ARRAY_SIZE(pmcraid_mcgrps),
1412}; 1423};
1413 1424
1414/** 1425/**
@@ -1511,9 +1522,8 @@ static int pmcraid_notify_aen(
1511 return result; 1522 return result;
1512 } 1523 }
1513 1524
1514 result = 1525 result = genlmsg_multicast(&pmcraid_event_family, skb,
1515 genlmsg_multicast(&pmcraid_event_family, skb, 0, 1526 0, 0, GFP_ATOMIC);
1516 pmcraid_event_family.id, GFP_ATOMIC);
1517 1527
1518 /* If there are no listeners, genlmsg_multicast may return non-zero 1528 /* If there are no listeners, genlmsg_multicast may return non-zero
1519 * value. 1529 * value.